nip.scenario_base.environment.Environment

nip.scenario_base.environment.Environment#

class nip.scenario_base.environment.Environment(hyper_params: HyperParameters, settings: ExperimentSettings, dataset: Dataset, protocol_handler: ProtocolHandler, *, train: bool = True)[source]#

The base class for all Prover-Verifier RL environments.

Parameters:
  • hyper_params (HyperParameters) – The parameters of the experiment.

  • settings (ExperimentSettings) – The settings of the experiment.

  • dataset (Dataset) – The dataset for the environment.

  • protocol_handler (ProtocolHandler) – The protocol handler for the environment.

  • train (bool, optional) – Whether the environment is used for training or evaluation.

Methods Summary

__init__(hyper_params, settings, dataset, ...)

reset([env_state])

Reset the environment.

step(env_state)

Perform a step in the environment.

Attributes

action_spec

The specification for the action keys.

batch_size

The batch size of the environment.

done_spec

The specification for the done keys (done and terminated).

frames_per_batch

The number of frames to sample per training iteration.

num_envs

The number of batched environments.

observation_spec

The specification for the observation keys.

reward_spec

The specification for the agent reward keys.

state_spec

The specification for the state keys.

steps_per_env_per_iteration

The number of steps per batched environment in each iteration.

Methods

__init__(hyper_params: HyperParameters, settings: ExperimentSettings, dataset: Dataset, protocol_handler: ProtocolHandler, *, train: bool = True)[source]#
abstract reset(env_state: Any | None = None, **kwargs) Any[source]#

Reset the environment.

Parameters:

env_state (Optional[Any]) – The current environment state.

Returns:

next_env_state (Any) – The reset environment state.

abstract step(env_state: Any) Any[source]#

Perform a step in the environment.

Parameters:

env_state (Any) – The current environment state.

Returns:

next_env_state (Any) – The next environment state.