package fehu
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=96d35ce03dfbebd2313657273e24c2e2d20f9e6c7825b8518b69bd1d6ed5870f
sha512=90c5053731d4108f37c19430e45456063e872b04b8a1bbad064c356e1b18e69222de8bfcf4ec14757e71f18164ec6e4630ba770dbcb1291665de5418827d1465
doc/fehu/Fehu/Space/index.html
Module Fehu.SpaceSource
Observation and action spaces.
Spaces define valid observations and actions for reinforcement learning environments. They specify shapes, constraints, and provide methods to validate, sample, and serialize values.
Each space type corresponds to a common RL scenario: discrete choices, continuous vectors, binary indicators, composite structures, and variable-length sequences.
Structural description
type spec = | Discrete of {}(*Integer choices in [
*)start;start + n - 1].| Box of {}(*Continuous vector bounded per dimension.
*)| Multi_binary of {}(*Binary vector of length
*)n.| Multi_discrete of {}(*Multiple discrete axes with per-axis cardinalities.
*)| Tuple of spec list(*Fixed-length heterogeneous sequence.
*)| Dict of (string * spec) list(*Named fields with different types.
*)| Sequence of {min_length : int;max_length : int option;base : spec;
}(*Variable-length homogeneous sequence.
*)| Text of {}(*Character strings from a fixed alphabet.
*)
Structural description of a space. Two spaces are compatible when their specs are equal.
equal_spec a b is true iff a and b describe structurally identical spaces.
Spaces
The type for spaces over values of type 'a. A space is self-contained: all bounds, constraints, and serialization logic are stored in the value itself.
Operations
shape s is the dimensionality of s, if defined. None for scalar or variable-length spaces.
sample s is a uniformly sampled value from s.
Random keys are drawn from the implicit RNG scope.
pack s v is v converted to the universal Value.t representation.
unpack s v is Ok x if v can be converted to a valid element of s, or Error msg otherwise.
boundary_values s is a list of representative edge-case values for s. Includes lower/upper bounds or canonical sentinels when known. The empty list when no boundary values apply.