tensorforce.environments package

Submodules

tensorforce.environments.environment module

class tensorforce.environments.environment.Environment

Bases: object

Base environment class.

__init__

x.init(…) initializes x; see help(type(x)) for signature

actions

Return the action space. Might include subdicts if multiple actions are available simultaneously.

Returns: dict of action properties (continuous, number of actions)

close()

Close environment. No other method calls possible afterwards.

execute(actions)

Executes action, observes next state(s) and reward.

Parameters:actions – Actions to execute.
Returns:(Dict of) next state(s), boolean indicating terminal, and reward signal.
static from_spec(spec, kwargs)

Creates an environment from a specification dict.

reset()

Reset environment and setup for new episode.

Returns:initial state of reset environment.
seed(seed)

Sets the random seed of the environment to the given value (current time, if seed=None). Naturally deterministic Environments (e.g. ALE or some gym Envs) don’t have to implement this method.

Parameters:seed (int) – The seed to use for initializing the pseudo-random number generator (default=epoch time in sec).

Returns: The actual seed (int) used OR None if Environment did not override this method (no seeding supported).

states

Return the state space. Might include subdicts if multiple states are available simultaneously.

Returns: dict of state properties (shape and type).

tensorforce.environments.minimal_test module

Module contents

class tensorforce.environments.Environment

Bases: object

Base environment class.

__init__

x.init(…) initializes x; see help(type(x)) for signature

actions

Return the action space. Might include subdicts if multiple actions are available simultaneously.

Returns: dict of action properties (continuous, number of actions)

close()

Close environment. No other method calls possible afterwards.

execute(actions)

Executes action, observes next state(s) and reward.

Parameters:actions – Actions to execute.
Returns:(Dict of) next state(s), boolean indicating terminal, and reward signal.
static from_spec(spec, kwargs)

Creates an environment from a specification dict.

reset()

Reset environment and setup for new episode.

Returns:initial state of reset environment.
seed(seed)

Sets the random seed of the environment to the given value (current time, if seed=None). Naturally deterministic Environments (e.g. ALE or some gym Envs) don’t have to implement this method.

Parameters:seed (int) – The seed to use for initializing the pseudo-random number generator (default=epoch time in sec).

Returns: The actual seed (int) used OR None if Environment did not override this method (no seeding supported).

states

Return the state space. Might include subdicts if multiple states are available simultaneously.

Returns: dict of state properties (shape and type).

class tensorforce.environments.MinimalTest(specification)

Bases: tensorforce.environments.environment.Environment

__init__(specification)

Initializes a minimal test environment, which is used for the unit tests. Given a specification of actions types and shapes, the environment states consist of the same number of pairs (x, y). The (mean of) an action a gives the next state via (1-a, a), and the ‘correct’ state is always (0, 1).

Parameters:specification – Takes a dict type (keys)-> shape (values specifying the action structure of the environment. Use shape () for single scalar actions.
actions
close()
execute(actions)
from_spec(spec, kwargs)

Creates an environment from a specification dict.

reset()
seed(seed)

Sets the random seed of the environment to the given value (current time, if seed=None). Naturally deterministic Environments (e.g. ALE or some gym Envs) don’t have to implement this method.

Parameters:seed (int) – The seed to use for initializing the pseudo-random number generator (default=epoch time in sec).

Returns: The actual seed (int) used OR None if Environment did not override this method (no seeding supported).

states