pub struct Acrobot;Expand description
gymnax’s Acrobot (Acrobot-v1): swing up a two-link pendulum by applying
a torque of -1 (action 0), 0 (1), or +1 (2) at the joint between the links.
It reproduces gymnax 1.0 with the same operations (one step of the
Runge-Kutta method, the same wrap, and the same noise draw), so the same
keys and actions give the same trajectories. gymnax integrates the state
augmented with the torque as an array of 5 elements; here each element is
a scalar, with the same operations on each.
Trait Implementations§
impl Copy for Acrobot
Source§impl Environment for Acrobot
impl Environment for Acrobot
Source§type State<B: Backend> = AcrobotState<B>
type State<B: Backend> = AcrobotState<B>
The state of an episode.
Source§type Params<B: Backend> = AcrobotParams<B>
type Params<B: Backend> = AcrobotParams<B>
The parameters of the environment.
Source§type Action<B: Backend> = Scalar<B, i32>
type Action<B: Backend> = Scalar<B, i32>
An action:
I32<B> for discrete actions, Array<B, f32> for
continuous ones.Source§fn action_space(&self) -> ActionSpace
fn action_space(&self) -> ActionSpace
The actions (gymnax’s
action_space).Source§fn default_params<B: Backend>(&self) -> AcrobotParams<B>
fn default_params<B: Backend>(&self) -> AcrobotParams<B>
The default parameters.
Source§fn reset<B: Backend>(
&self,
key: Key<B>,
_params: &AcrobotParams<B>,
) -> (Array<B, f32>, AcrobotState<B>)
fn reset<B: Backend>( &self, key: Key<B>, _params: &AcrobotParams<B>, ) -> (Array<B, f32>, AcrobotState<B>)
Starts an episode (gymnax’s
reset_env).Source§fn step_env<B: Backend>(
&self,
key: Key<B>,
s: &AcrobotState<B>,
action: I32<B>,
p: &AcrobotParams<B>,
) -> Transition<B, AcrobotState<B>, Array<B, f32>>
fn step_env<B: Backend>( &self, key: Key<B>, s: &AcrobotState<B>, action: I32<B>, p: &AcrobotParams<B>, ) -> Transition<B, AcrobotState<B>, Array<B, f32>>
Advances an episode by one step, without resetting.
Source§fn is_truncated<B: Backend>(
&self,
s: &AcrobotState<B>,
p: &AcrobotParams<B>,
) -> Bool<B>
fn is_truncated<B: Backend>( &self, s: &AcrobotState<B>, p: &AcrobotParams<B>, ) -> Bool<B>
Whether the episode reached its time limit.
Source§fn num_actions(&self) -> usize
fn num_actions(&self) -> usize
The number of discrete actions (0 for continuous actions).
Source§fn step_env_uses_key(&self) -> bool
fn step_env_uses_key(&self) -> bool
Whether
step_env uses its key (the default). An environment whose
steps are deterministic returns false, so that step natively
splits the key only when the episode ends and the reset needs it;
the results are the same (testing::check_backends compares the
native results with the traced ones, which always split).Source§fn legal_action_mask<B: Backend>(
&self,
state: &Self::State<B>,
) -> Option<Array<B, bool>>
fn legal_action_mask<B: Backend>( &self, state: &Self::State<B>, ) -> Option<Array<B, bool>>
The legal actions in
state, for environments that have them (board
games, Jumanji): a mask over the joint actions (shape [n], or
nvec for multi-discrete actions); None (the default) if every
action is legal. Tests and benchmarks take legal actions with
choose_legal. Environments with more joint actions than
MAX_MASK_ACTIONS have no mask (ActionSpace::mask_len is 0).Source§fn step<B: Backend>(
&self,
key: Key<B>,
state: &Self::State<B>,
action: Self::Action<B>,
params: &Self::Params<B>,
) -> Step<B, Self::State<B>, Self::Obs<B>>
fn step<B: Backend>( &self, key: Key<B>, state: &Self::State<B>, action: Self::Action<B>, params: &Self::Params<B>, ) -> Step<B, Self::State<B>, Self::Obs<B>>
Advances an episode by one step and starts a new one if it ended, as
gymnax’s
Environment.step does: the key is split in two, both
step_env and reset are computed, and the reset state and
observation are selected where the episode ended. Natively, the reset
is computed only when the episode ends (lax::select_with), with
the same results.Auto Trait Implementations§
impl Freeze for Acrobot
impl RefUnwindSafe for Acrobot
impl Send for Acrobot
impl Sync for Acrobot
impl Unpin for Acrobot
impl UnsafeUnpin for Acrobot
impl UnwindSafe for Acrobot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more