minimal_mjx.eval¶
Rolling out policies and recording what happens. See Rolling out a policy for a walkthrough.
minimal_mjx.eval.rollout
¶
Functions:
| Name | Description |
|---|---|
make_dummy_inference_fn |
Makes a 'fake' inference function for simulating the environment without |
rollout_policy |
|
make_dummy_inference_fn
¶
make_dummy_inference_fn(env: SwappableBase, mode='zero')
Makes a 'fake' inference function for simulating the environment without a policy. Modes are 'zero' (which sends all zeros as the action) and 'random' (which sends random actions in [-1, 1])
Source code in src/minimal_mjx/eval/rollout.py
rollout_policy
¶
rollout_policy(
inference_fn,
env: MjxEnv,
n_steps=100,
info_init_fn=lambda state: info,
info_step_fn=lambda state: info,
info_plot_key=None,
width=None,
height=None,
gen_vid=True,
show_progress=True,
camera=None,
) -> tuple[
list, list, RewardPlotter, MujocoPlotter, InfoPlotter
]
Source code in src/minimal_mjx/eval/rollout.py
minimal_mjx.eval.policy
¶
Create default, single or parallel instance 'default policies.
Functions:
| Name | Description |
|---|---|
make_zero_policy |
Open-loop policy that always emits zero actions. |
make_const_policy |
Open-loop policy that always emits a constant action. |
make_random_policy |
Open-loop policy that emits uniform random actions in |
make_sinusoidal_policy |
Open-loop sinusoid |
from_inference_fn |
Adapt a normal brax |
make_open_loop_policy |
Build an open-loop policy by name ( |
Attributes:
| Name | Type | Description |
|---|---|---|
OPEN_LOOP |
|
OPEN_LOOP
module-attribute
¶
OPEN_LOOP = {
"zero": make_zero_policy,
"const": make_const_policy,
"random": make_random_policy,
"sinusoid": make_sinusoidal_policy,
}
make_zero_policy
¶
Open-loop policy that always emits zero actions.
make_const_policy
¶
Open-loop policy that always emits a constant action.
Source code in src/minimal_mjx/eval/policy.py
make_random_policy
¶
Open-loop policy that emits uniform random actions in [-1, 1].
Source code in src/minimal_mjx/eval/policy.py
make_sinusoidal_policy
¶
make_sinusoidal_policy(
action_size: int,
amp: float = 0.8,
freq: float = 1.5,
phases=None,
**kwargs,
)
Open-loop sinusoid amp * sin(2*pi*freq*t + phases), identical across envs.
Source code in src/minimal_mjx/eval/policy.py
from_inference_fn
¶
Adapt a normal brax policy(obs, key) to a time-based policy
(obs, key, t) protocol.
make_open_loop_policy
¶
Build an open-loop policy by name ('zero', 'random', 'sinusoid').
Extra kwargs are forwarded to the underlying factory.