Skip to content

Creating new environments

benbellheron edited this page Oct 10, 2018 · 1 revision

The environment must specify the state/action space and sizes (observation_space() and action_space()).

  • from adept.environments._base import Space provides the class needed for this.
  • For environments with multiple inputs (pixel and numeric) or outputs these can return a dict()
# Observation space
@property
def observation_space(self):
	# pixel input
	return {'Pixel': Space(shape: tuple(channel,height,width), low: min_value, high: max_value, dtype: np.uint8)}
    # or numeric 
    return {'Numeric': Space([num_variables], ...)
    # or both
    return {
    	'pixel': Space(...),
        'numeric': Space(...)
    }
# action space
@property
def action_space(self):
	# single categorical action
    return {'Action': Space([num_actions], 0, 1, int)}
    # multiple categorical actions
    return {
    	'action1': Space(...),
        'action2': ...,
        ...
    }

The main functions are step(action) -> state, reward, terminal, info(optional can be None) and reset() -> state.

Clone this wiki locally