MazeSeeding

class maze.core.utils.seeding.MazeSeeding(env_seed: int, agent_seed: int, cudnn_determinism_flag: bool, explicit_env_seeds: Sequence[Any] | None | Mapping[str, Any] | Any, explicit_env_eval_seeds: Sequence[Any] | None | Mapping[str, Any] | Any, explicit_agent_seeds: Sequence[Any] | None | Mapping[str, Any] | Any, shuffle_seeds: bool)

Manages the random seeding for maze. This class holds random state used for sampling random seed for the envs and agents.

Parameters:
  • env_seed – The base_seed to be used for the envs random number generator.

  • agent_seed – The base_seed to be used for the agents random number generator.

  • cudnn_determinism_flag – Specify whether to set the cudnn determinism flag, this will ensure guaranty when working on the gpu, however some torch modules will raise runtime errors, and the processing speed will be decreased. For more information on this topic please refer to: https://pytorch.org/docs/1.7.1/notes/randomness.html?highlight=reproducability

  • explicit_env_seeds – Explicit sequence of seeds used for seeding the environment (w.r.t. each episode).

  • explicit_env_eval_seeds – Explicit sequence of seeds used for seeding the evaluation environment (w.r.t. each episode).

  • explicit_agent_seeds – Explicit sequence of seeds used for seeding the agent (w.r.t. each episode).

  • shuffle_seeds – Whether the explicit sequence of seeds should be shuffled (based on the env/agent _base_seed).

generate_agent_instance_seed() int

Generate agent instance seed for seeding a particular instance of the agent.

Returns:

A random seed for creating the agent.

generate_env_instance_seed() int

Generate env instance seed for seeding a particular instance of the env.

Returns:

A random seed for creating the env.

static generate_seed_from_random_state(rng: numpy.random.RandomState) int

Method for generating a random seed from the given random number generator.

Returns:

Random seed.

get_agent_base_seed() int

Return the agent base seed.

Returns:

The agent base seed.

get_env_base_seed() int

Return the env base seed.

Returns:

The env base seed.

get_explicit_agent_seeds(n_seeds: int) List[Any]

Return a list of explicit agent seeds to be used for each episode.

Parameters:

n_seeds – The number of seeds to be returned.

Returns:

A list of seeds.

get_explicit_env_eval_seeds(n_seeds: int) List[Any]

Return a list of explicit env seeds to be used in the evaluation env.

Parameters:

n_seeds – The number of seeds to be returned.

Returns:

A list of seeds.

get_explicit_env_seeds(n_seeds: int) List[Any]

Return a list of explicit env seeds to be used for each episode.

Parameters:

n_seeds – The number of seeds to be returned.

Returns:

A list of seeds.