# [−][src]Struct coliseum::space::Box

`pub struct Box<D: Dimension, Shape: ShapeBuilder<Dim = D>> { /* fields omitted */ }`

A (possibly unbounded) box in R^n. Specifically, a Box represents the Cartesian product of n closed intervals. Each interval has the form of one of [a, b], (-oo, b], [a, oo), or (-oo, oo). E.g. low = [-oo, -oo], high=[oo,oo] is a 2D Cartesian plane

# Examples

## Trait Implementations

### `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

## Blanket Implementations

### `impl<T, U> TryFrom<U> for T where    U: Into<T>, `[src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

### `impl<T, U> TryInto<U> for T where    U: TryFrom<T>, `[src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.