pub enum ActionSpace {
Discrete(usize),
MultiDiscrete(Vec<usize>),
Box {
low: Vec<f32>,
high: Vec<f32>,
shape: Vec<usize>,
},
}Expand description
The actions of an environment (gymnax’s action_space).
Variants§
Discrete(usize)
Integers 0..n (I32).
MultiDiscrete(Vec<usize>)
Arrays of i32 of shape [nvec.len()], component k in
0..nvec[k] (Jumanji’s MultiDiscreteArray).
Box
Arrays of f32 of shape, each element between low and high
(one bound per element, in row-major order).
Implementations§
Source§impl ActionSpace
impl ActionSpace
Sourcepub fn uniform_box(low: f32, high: f32, shape: &[usize]) -> Self
pub fn uniform_box(low: f32, high: f32, shape: &[usize]) -> Self
A box with the same bounds for every element.
Sourcepub fn num_actions(&self) -> usize
pub fn num_actions(&self) -> usize
The number of discrete actions (0 for a box).
Sourcepub fn num_joint_actions(&self) -> usize
pub fn num_joint_actions(&self) -> usize
The number of joint discrete actions (the size of a legal action
mask): n, or the product of nvec; 0 for a box.
Sourcepub fn mask_len(&self) -> usize
pub fn mask_len(&self) -> usize
The size of a legal action mask: the number of joint actions, or 0
when there are more than MAX_MASK_ACTIONS (an environment with
that many joint actions, such as Jumanji’s JobShop with 21^10, has no
mask: crate::Environment::legal_action_mask gives None).
§Examples
use ruxla_env::ActionSpace;
assert_eq!(ActionSpace::MultiDiscrete(vec![40, 20]).mask_len(), 800);
assert_eq!(ActionSpace::MultiDiscrete(vec![21; 10]).mask_len(), 0);Trait Implementations§
Source§impl Clone for ActionSpace
impl Clone for ActionSpace
Source§impl Debug for ActionSpace
impl Debug for ActionSpace
Source§impl PartialEq for ActionSpace
impl PartialEq for ActionSpace
impl StructuralPartialEq for ActionSpace
Auto Trait Implementations§
impl Freeze for ActionSpace
impl RefUnwindSafe for ActionSpace
impl Send for ActionSpace
impl Sync for ActionSpace
impl Unpin for ActionSpace
impl UnsafeUnpin for ActionSpace
impl UnwindSafe for ActionSpace
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