factoriax.engine.envs.registry#
The scenario registry, which stands behind factoriax.make("<id>").
A scenario is a factory of the form () -> (env, params). The registry maps
a gymnax-style version id to a ScenarioSpec. That spec holds the
display name and description of the scenario, and the factory itself.
make() resolves an id and applies the observation settings and the
auto-reset wrapper that the caller asked for. list_scenarios() returns
the list that the playground walks.
- class factoriax.engine.envs.registry.ScenarioSpec(name: str, description: str, build: Callable[[], tuple[Any, EnvParams]], resample: bool = False)#
A registered scenario: its display name, its description, and its factory.
- factoriax.engine.envs.registry.list_scenarios() tuple[tuple[str, ScenarioSpec], ...]#
Return every registered scenario id, with its spec.
- factoriax.engine.envs.registry.make(env_id: str, *, obs: str | None = None, obs_radius: int | None = None, auto_reset: bool = True, resample: bool | None = None) tuple[Any, EnvParams]#
Resolve a scenario id to an
(env, params)pair.- Parameters:
env_id – Registered scenario id, for example
"EasyRocket-v1".obs – Name of an observation variant, which must be a key in
OBSERVATIONS.Nonetakes the default of the scenario.obs_radius – Half-width of a local window.
Nonetakes the default of the scenario. A_globalobservation variant ignores this argument.resample – Auto-reset mode.
None, the default, takes theresamplesetting of the scenario. PassTrueorFalseto override it. PassFalsefor the cheap cached restore, even on a keyed scenario.auto_reset – Whether to wrap the environment in
AutoResetWrapper. The default isTrue, because most callers train inside alax.scanrollout of fixed length and need an episode to restart ondone. PassFalseto control the episodes yourself, as a scripted rollout, interactive play, or a training loop with its own reset-on-done code does.
- Returns:
The pair
(env, params).- Return type:
- Raises:
KeyError – If no scenario carries the id
env_id.