[−][src]Struct coliseum::space::Discrete
The Discrete space allows a fixed range of non-negative numbers, so in this case valid actions are either 0 or 1.
Examples
Discrete contains actions 0..Discrete(N-1)
use coliseum::space::{Discrete, Space}; let N = 10; let discrete = Discrete(N); // what's the idiomatic way to avoid cloning here? assert!(discrete.clone().sample() < 10); assert!(!discrete.clone().contains(10));
We can represent N*2 states for Discrete{N}
use coliseum::space::{Discrete, Space}; let discrete = Discrete(3); let sample: (u32, u32, u32) = match discrete.sample() { 0 => (1, 0, 0), 1 => (0, 1, 0), 2 => (0, 0, 1), _ => panic!("This is out of bounds!") }; assert_eq!(sample.0 + sample.1 + sample.2, 1)
Trait Implementations
impl Environment<Discrete, u32, Discrete, u32> for RockPaperScissors
[src]
Examples
use coliseum::env; use env::{Environment, State}; use env::rock_paper_scissors::RockPaperScissors; let mut game = RockPaperScissors::default(); game.reset(); // our player loves rock let agent = || 1; loop { let State { reward, done, .. } = game.step(agent()); if done { break; } }
impl Space<u32> for Discrete
[src]
fn sample(self) -> u32
[src]
Draws a random item from [0, u32]
fn contains(self, sample: u32) -> bool
[src]
Checks if the sample is part of the set
impl Clone for Discrete
[src]
impl Copy for Discrete
[src]
Auto Trait Implementations
impl Send for Discrete
impl Sync for Discrete
impl Unpin for Discrete
impl UnwindSafe for Discrete
impl RefUnwindSafe for Discrete
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,