Module Fehu.Vec_env
Vectorized environments.
Runs multiple environment instances and batches their outputs. All environments must have compatible observation and action spaces. Terminated or truncated episodes are automatically reset.
Types
type ('obs, 'act, 'render) tThe type for vectorized environments.
type 'obs step = {- #
observations : 'obs array;(*One observation per environment.
*) - #
rewards : float array;(*One reward per environment.
*) - #
terminated : bool array;(*Per-environment termination flags.
*) - #
truncated : bool array;(*Per-environment truncation flags.
*) - #
infos : Info.t array;(*Per-environment info dictionaries.
*)
}The type for batched step results. All arrays have length num_envs.
Constructors
create envs creates a vectorized environment.
All environments must have structurally identical spaces (checked via Space.spec and Space.equal_spec). Raises Invalid_argument if envs is empty or spaces differ.
Accessors
observation_space t is the shared observation space.
action_space t is the shared action space.
Lifecycle
reset t () resets all environments.
step t actions steps all environments with the given actions.
actions must have length num_envs t. Terminated or truncated environments are automatically reset. The terminal observation is stored in the step's info under the key "final_observation" as a packed Value.t. The terminal info is stored under "final_info".
Raises Invalid_argument if Array.length actions <> num_envs t.