[][src]Trait coliseum::space::Space

pub trait Space<Sample> {
    fn sample(self) -> Sample;
fn contains(self, sample: Sample) -> bool; }

Required methods

fn sample(self) -> Sample

fn contains(self, sample: Sample) -> bool

Loading content...

Implementors

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<D, Shape> Space<ArrayBase<OwnedRepr<f64>, D>> for Box<D, Shape> where
    D: Dimension,
    Shape: ShapeBuilder<Dim = D>, 
[src]

fn sample(self) -> ArrayBase<OwnedRepr<f64>, D>[src]

Samples using a uniform distribution with self.low and self.high. We should be able to return a different distribution based on the bounds in Box, e.g. Gym uses:

unbounded   = ~self.bounded_below & ~self.bounded_above
upp_bounded = ~self.bounded_below &  self.bounded_above
low_bounded =  self.bounded_below & ~self.bounded_above
bounded     =  self.bounded_below &  self.bounded_above

#### Vectorized sampling by interval type

sample[unbounded] = self.np_random.normal(
    size=unbounded[unbounded].shape)

sample[low_bounded] = self.np_random.exponential(
    size=low_bounded[low_bounded].shape) + self.low[low_bounded]

....

fn contains(self, sample: Array<f64, D>) -> bool[src]

Whether the sample exists in the Box

Loading content...