Environment Interface¶
All CSuite environments adhere to the Python interface defined in the abstract
base class csuite.Environment. This base class specifies the standard methods
to implement in a CSuite environment, which are outlined below.
- class csuite.Environment[source]¶
Base class for continuing environments.
Observations and valid actions are described by the specs module in dm_env. Environment implementations should return specs as specific as possible.
Each environment will specify its own environment State, Configuration, and internal random number generator.
Loading a CSuite Environment¶
Environments in CSuite are specified by an identifying string and can be
initialized using the load function.
import csuite
env = csuite.load('catch')
The list of available environments and their associated loading strings is
given in the csuite.EnvName class.
API Methods¶
Start¶
After initialization, start must be called to set the environment state. Since
all environments are continuing, start should only be called once, at the
beginning of the agent-environment interaction.
Step¶
After start is called, step updates the environment by one timestep
given the action taken. The resulting observation and reward are returned.
Render¶
All CSuite environments are expected to return an object serving to render the environment for visualization at the current timestep.
Get and Set State¶
The get_state and set_state methods permit environment state retrieval
and manipulation. These methods should only be used for reproducibility or
checkpointing purposes; thus, it is expected that these methods can sufficiently
manipulate the internal state to provide full reproducibility of the environment
dynamics (supplying the internal random number generator if applicable,
for example).
Observation and Action Specs¶
Environments are expected to return the specifications of the observation and
action space by calling observation_spec and action_spec respectively.
These methods should return structures of dm_env
Array specs
which adhere exactly to the format of observations and actions.