Saving and Loading#

navground.learning.io

Export a NavgroundEnv to YAML

Parameters:
Raises:

TypeError – If env.unwrapped is not of a navground environment

Return type:

None

Parameters:

path (PathLike)

Return type:

MultiAgentNavgroundEnv | NavgroundEnv

Export a model using export_policy_as_behavior()

Parameters:
Return type:

None

Export a policy (using navground.learning.onnx.export()) together with the YAML representation of the behavior and sensor to use it.

The behavior and sensor refer to an agent at a given index in the environment. If they cannot be retrieved, the related files will not be saved.

Parameters:
  • path (PathLike) – The directory where to save the files

  • policy (BasePolicy | None) – The policy

  • env (BaseEnv | BaseParallelEnv | None) – The environment.

  • index (int | None) – The index of the agent in the environment. If not provided, selects one of the possible agents.

Return type:

None

Load behavior and sensor previously saved in a directory using export_policy_as_behavior().

Parameters:

path (PathLike) – The directory path

Returns:

A policy behavior and a sensor, set to None if the could not be loaded.

Return type:

tuple[PolicyBehavior | None, StateEstimation | None]