sinergym.utils.wrappers.VariabilityContextWrapperï
- class sinergym.utils.wrappers.VariabilityContextWrapper(env: Env, context_space: Box, delta_value: float = 1.0, step_frequency_range: Tuple[int, int] = (96, 672))ï
- __init__(env: Env, context_space: Box, delta_value: float = 1.0, step_frequency_range: Tuple[int, int] = (96, 672))ï
Wrapper that modifies the environmentâs context variables at random intervals.
- Parameters:
env (gym.Env) â The environment to wrap.
context_space (gym.spaces.Box) â The space defining valid context variable values.
delta_value (float) â Maximum absolute change applied to context variables at each update.
step_frequency_range (Tuple[int, int]) â Range for the number of steps before each update.
Methods
__init__(env, context_space[, delta_value, ...])Wrapper that modifies the environment's context variables at random intervals.
class_name()Returns the class name of the wrapper.
close()Closes the wrapper and
env.get_wrapper_attr(name)Gets an attribute from the wrapper and lower environments if name doesn't exist in this object.
has_wrapper_attr(name)Checks if the given attribute is within the wrapper or its environment.
render()Uses the
render()of theenvthat can be overwritten to change the returned data.reset(*[, seed, options])Uses the
reset()of theenvthat can be overwritten to change the returned data.set_wrapper_attr(name, value, *[, force])Sets an attribute on this wrapper or lower environment if name is already defined.
step(action)Executes an action and updates the environment's context if needed.
wrapper_spec(**kwargs)Generates a WrapperSpec for the wrappers.
Attributes
action_spaceReturn the
Envaction_spaceunless overwritten then the wrapperaction_spaceis used.metadataReturns the
Envmetadata.np_randomReturns the
Envnp_randomattribute.np_random_seedReturns the base environment's
np_random_seed.observation_spaceReturn the
Envobservation_spaceunless overwritten then the wrapperobservation_spaceis used.render_modeReturns the
Envrender_mode.specReturns the
Envspecattribute with the WrapperSpec if the wrapper inherits from EzPickle.unwrappedReturns the base environment of the wrapper.
- logger = <Logger WRAPPER VariabilityContextWrapper (INFO)>ï
- step(action: ndarray) Tuple[ndarray, float, bool, bool, Dict[str, Any]]ï
Executes an action and updates the environmentâs context if needed.
- Parameters:
action (np.ndarray) â Action selected by the agent.
- Returns:
Observation for next timestep, reward obtained, Whether the episode has ended or not, Whether episode has been truncated or not, and a dictionary with extra information
- Return type:
Tuple[np.ndarray, float, bool, Dict[str, Any]]