sciencegym.simulations.EnvironmentInterface module¶
- class sciencegym.simulations.EnvironmentInterface.EnvironmentInterface(*args: Any, **kwargs: Any)¶
Bases:
SimulationInterface
,ABC
- alter_state(state)¶
- close()¶
Close the pygame window and terminate the program.
- abstract getReward()¶
- Returns:
- internal_step(action=None)¶
- abstract performAction(action)¶
perform the actual action from the step function
- Parameters:
action – ActType
- Returns:
- printSuccess()¶
return message, if we have a match or a successful outcome
- Returns:
- Return type:
str
- render(mode='human')¶
Render function, which runs the simulation and render it (if wished)
- Parameters:
mode (str) – “human” for rendering, “state_pixels” for returning the pixel array
- Returns:
nothing if mode is human, if mode is “state_pixels”, we return the array of the screen
- Return type:
np.array
- abstract rescaleState(state=None)¶
Normalize the state
- Parameters:
state – State that should be normalized
- Returns:
nromalized state
- Return type:
??
- abstract reset()¶
Resets the simulation to the initial conditions and returns the initial conditions of the new environment, alongside additional information.
- seed(seed=None)¶
- step(action=None)¶
- step_injection(action)¶
- abstract success()¶
Has the experiment succeeded?
- Returns:
True if success, else False
- Return type:
bool
- testFailed()¶
Only overwrite, if there is an opportunity that the experiment might be at a point where it cannot succeed anymore.
- Returns:
True, if the test fails, else False
- Return type:
bool
- abstract updateState()¶
Reset the state
- Returns:
updated state
- Return type:
??
- sciencegym.simulations.EnvironmentInterface.rescale_movement(original_interval, value, to_interval=(-1, 1))¶
Help function to do and to undo the normalization of the action and observation space
- Parameters:
original_interval (list[float, float]) – Original interval, in which we observe the value.
value (float) – Number that should be rescaled.
to_interval (list[float, float]) – New interval, in which we want to rescale the value.
- Returns:
Rescaled value
- Return type:
float