policy#
Control policies.
Note
Policies can be either time-invariant or time-varying, and can be either open- or
closed-loop. Thus, the arguments to the __call__() method should allow for
time and state to be specified (if needed), and should be optional kwargs:
>>> def __call__(self, time=None, state=None):
... ...
- class gym_socks.policies.policy.BasePolicy[source]#
Base policy class.
This class is abstract, meaning it is not meant to be instantiated directly. Instead, define a new class that inherits from
BasePolicy.The
__call__()method is the main point of entry for the policy classes. All subclasses must implement a__call__()method. This makes the class callable, so that policies can be evaluated as:action = policy(state)
- abstract __call__(*args, **kwargs)[source]#
Evaluate the policy.
- Returns
An action in the action space.
- action_space = None#
- state_space = None#
- class gym_socks.policies.policy.ConstantPolicy(action_space=None, constant=0)[source]#
Constant policy.
A policy which returns a constant control action.
- Parameters
action_space (gym.Space) – The action space of the system.
constant – The constant value returned by the policy.
- action_space = None#
- state_space = None#
- class gym_socks.policies.policy.RandomizedPolicy(action_space=None)[source]#
Randomized policy.
A policy which returns a random control action.
- Parameters
action_space (gym.Space) – The action space of the system.
- action_space = None#
- state_space = None#