Registry
The environment registry: make an environment by string id, and
register_env to add your own.
Every built-in environment registers itself at import time (importing
navix is enough), so navix.make(id) is the normal way to get an
Environment. The ids follow MiniGrid's naming with a Navix- prefix
and a -v0 suffix, e.g. Navix-Empty-5x5-v0, Navix-DoorKey-8x8-v0,
Navix-MultiRoom-N4-S5-v0.
NotImplementedEnvs = []
module-attribute
MiniGrid environment ids that navix does not yet cover. Currently
empty - every MiniGrid id either has a Navix-* registration or resolves
through V1_ALIASES. Kept as a named list so a future gap has an obvious
place to be recorded.
V1_ALIASES = {'MiniGrid-ObstructedMaze-2Dlhb-v1': 'Navix-ObstructedMaze-2Dlhb-v0', 'MiniGrid-ObstructedMaze-1Q-v1': 'Navix-ObstructedMaze-1Q-v0', 'MiniGrid-ObstructedMaze-2Q-v1': 'Navix-ObstructedMaze-2Q-v0', 'MiniGrid-ObstructedMaze-Full-v1': 'Navix-ObstructedMaze-Full-v0', 'MiniGrid-MultiRoom-N4-S5-v1': 'Navix-MultiRoom-N4-S5-v0'}
module-attribute
MiniGrid -v1 ids that navix implements under a plain -v0 id rather
than as a separate -v1 registration: for these families navix ports
MiniGrid's -v1 behaviour and calls it -v0 (the per-environment
behavioural difference is documented in each target's module docstring).
make redirects a -v1 key here to its -v0 value and warns, so code
written against MiniGrid's own id still resolves.
make(name, **kwargs)
Builds a registered environment by id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
a registered id (see |
required |
**kwargs
|
forwarded verbatim to the environment's constructor.
Common ones: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Environment |
the constructed environment. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
if |
Example
import navix as nx
from navix import observations
env = nx.make(
"Navix-DoorKey-8x8-v0",
observation_fn=observations.rgb_first_person,
gamma=0.995,
)
register_env(name, ctor)
Adds an environment id to the registry (or overwrites one).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the id |
required |
ctor
|
Callable
|
builds and returns the |
required |
registry()
The full id -> constructor mapping.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
maps each registered environment id (e.g. |
dict
|
|
|
dict
|
that builds the |
|
dict
|
|