garage.np.policies.fixed_policy module

Policy that performs a fixed sequence of actions.

class FixedPolicy(env_spec, scripted_actions, agent_infos=None)[source]

Bases: garage.np.policies.policy.Policy

Policy that performs a fixed sequence of actions.

Parameters:
  • env_spec (garage.envs.env_spec.EnvSpec) – Environment specification.
  • scripted_actions (list[np.ndarray] or np.ndarray) – Sequence of actions to perform.
  • agent_infos (list[dict[str, np.ndarray]] or None) – Sequence of agent_infos to produce.
get_action(observation)[source]

Get next action.

Parameters:observation (np.ndarray) – Ignored.
Raises:ValueError – If policy is currently vectorized (reset was called with more than one done value).
Returns:
The action and agent_info
for this time step.
Return type:tuple[np.ndarray, dict[str, np.ndarray]]
get_actions(observations)[source]

Get next action.

Parameters:observations (np.ndarray) – Ignored.
Raises:ValueError – If observations has length greater than 1.
Returns:
The action and agent_info
for this time step.
Return type:tuple[np.ndarray, dict[str, np.ndarray]]
get_param_values()[source]

Return policy params (there are none).

Returns:Empty tuple.
Return type:tuple
reset(dones=None)[source]

Reset policy.

Parameters:dones (None or list[bool]) – Vectorized policy states to reset.
Raises:ValueError – If dones has length greater than 1.
set_param_values(params)[source]

Set param values of policy.

Parameters:params (object) – Ignored.