basicgym.envs.simulator.function#
Mathematical Functions used in Synthetic System .
Classes
Class to define the reward function. |
|
Class to define the state transition function. |
- class basicgym.envs.simulator.function.StateTransitionFunction(state_dim, action_dim, random_state=None)[source]#
Class to define the state transition function.
Bases:
basicgym.BaseStateTransitionFunctionImported as:
basicgym.envs.simulator.StateTransitionFunctionTip
Use
BaseStateTransitionFunctionto define a custom StateTransitionFunction.- Parameters:
- Attributes:
- random_state
Methods
step(state, action)Update the state based on the presented action.
- step(state, action)[source]#
Update the state based on the presented action.
- Parameters:
state (array-like of shape (state_dim, )) – Current state.
action (array-like of shape (action_dim, )) – Indicating the action chosen by the agent.
- Returns:
state – Next state.
- Return type:
array-like of shape (state_dim, )
- class basicgym.envs.simulator.function.RewardFunction(state_dim, action_dim, reward_type='continuous', reward_std=0.0, random_state=None)[source]#
Class to define the reward function.
Bases:
basicgym.BaseRewardFunctionImported as:
basicgym.envs.simulator.RewardFunctionTip
Use
BaseRewardFunctionto define a custom RewardFunction.- Parameters:
state_dim (int) – Dimension of the state.
action_dim (int) – Dimension of the action (context).
reward_type ({"continuous", "binary"}, default="continuous") – Reward type.
reward_std (float, default=0.0 (>=0)) – Noise level of the reward. Applicable only when reward_type is “continuous”.
random_state (int, default=None (>= 0)) – Random state.
- Attributes:
- random_state
Methods
mean_reward_function(state, action)Linear expected immediate reward function.
sample_reward(state, action)Sample reward.
- mean_reward_function(state, action)[source]#
Linear expected immediate reward function.
- Parameters:
state (array-like of shape (state_dim, )) – State in the RL environment.
action (array-like of shape (action_dim, )) – Indicating the action chosen by the agent.
- Returns:
mean_reward_function – Expected immediate reward function conditioned on the state and action.
- Return type: