rlmesh::spaces
Spaces and their samplers.
Preview
use rlmesh::spaces;A SpaceSpec is immutable data describing a space. A Space is a
spec plus its sampler, a shared handle whose clones drive one RNG.
Box, Discrete and Dict are typed views of a Space (they
deref to it) that add their kind’s accessors.
use rlmesh::spaces::{Box, BoxOptions, Dict, Discrete, DiscreteOptions, SpaceSpec};
let pos = Box::new(-1.0, 1.0, [3], BoxOptions::default())?;
let id = Discrete::new(4, DiscreteOptions { start: 1, ..Default::default() })?;
let obs = Dict::new([("pos", SpaceSpec::from(&pos)), ("id", SpaceSpec::from(&id))])?;
obs.seed(Some(7));
let x = obs.sample()?;
assert!(obs.contains(&x));This module is not in the prelude: spaces::Box shadows std’s
Box.
Values are Values: a Box samples a Tensor, a Discrete an Int, a
Dict a dict in its declaration order, a Text a Text.
Structs
- BoxPreviewA box of numbers in
[low, high]. - BoxOptionsPreview
Box's keyword arguments. - DictPreviewNamed child spaces.
- DictItemsPreviewA Dict's
(key, space)pairs, in declaration order. - DictKeysPreviewA Dict's keys, in declaration order.
- DictSpacesPreviewA Dict's children: an ordered, read-only map.
- DictValuesPreviewA Dict's child spaces, in declaration order.
- DiscretePreviewThe integers
start .. start + n. - DiscreteOptionsPreview
Discrete's keyword arguments. - SpacePreviewA space: a spec plus its sampler.
- SpaceSpecPreviewImmutable data describing a space.
Enums
- BoundPreviewOne Box bound: a float, an integer, or infinity (
f64::INFINITY). - BoundsKindPreviewHow a Box stores its bounds.
- BoxBoundPreviewA Box's
loworhigh: one bound for every element, or one per element (row-major). - SpaceKindPreviewA space's kind, with its wire spelling.