core#
- class gym_socks.envs.core.BaseDynamicalObject(*args, **kwargs)[source]#
Base dynamical object class.
Bases:
gym.Env,abc.ABCThis class is abstract, meaning it is not meant to be instantiated directly. Instead, define a new class that inherits from
BaseDynamicalObject.This class serves as the base interface for dynamical objects, represented in most cases by either a
DynamicalSystemor an obstacle.- Parameters
args (Any) –
kwargs (Any) –
- Return type
Any
- close()[source]#
Override close in your subclass to perform any necessary cleanup.
Environments will automatically
close()themselves when garbage collected or when the program exits.
- abstract render(mode='human')[source]#
Renders the environment.
This method must be overridden in subclasses in order to enable rendering. Not all environments support rendering.
- Parameters
mode – the mode to render with
- abstract reset(state=None)[source]#
Reset the object to an initial state.
Resets the object to an initial state (which may be random).
- Returns
The new initial state of the object.
- seed(seed=None)[source]#
Sets the seed of the random number generator.
- Parameters
seed – Integer value representing the random seed.
- Returns
The seed of the RNG.
- abstract step()[source]#
Advance the object forward in time.
Advances the object in the simulation. By default, an object is uncontrolled, meaning it accepts no parameters and the system evolves forward in time according to its own, internal dynamics. Controlled systems should accept an
actionparameter, which represents the user-selected control input.Additionally, time-varying systems should also accept a
timeparameter.- Returns
A tuple
(obs, cost, done, info), whereobsis the observation vector. Generally, it is the state of the system corrupted by some measurement noise. If the system is fully observable, this is the actual state of the system at the next time step.costis the cost (reward) obtained by the system for taking action u in state x and transitioning to state y. In general, this is not typically used withDynamicalSystemmodels.doneis a flag to indicate the simulation has terminated. Usually toggled by guard conditions, which terminates the simulation if the system violates certain operating constraints.infois a dictionary containing extra information.