Opponent Modeling¶
-
class
grid2op.Opponent.
OpponentSpace
(compute_budget, init_budget, opponent, budget_per_timestep=0.0, action_space=None)[source]¶ -
action_space
¶ The action space defining which action the Opponent are allowed to take
-
init_budget
¶ The initial budget of the opponent
- Type
float
-
compute_budget
¶ The tool used to compute the budget
- Type
grid2op.Opponent.ActionBudget
-
opponent
¶ The agent that will take malicious actions.
- Type
grid2op.Opponent.BaseOpponent
-
previous_fails
¶ Whether the last attack of the opponent failed or not
- Type
bool
-
budget_per_timestep
¶ The increase of the opponent budget per time step (if any)
- Type
float
-
attack
(observation, agent_action, env_action)[source]¶ This function calls the attack from the opponent.
It check whether the budget is consistent with the attack (budget should be more that the cosst associated with the attack). If the attack cost too much, then it is replaced by a “do nothing” action. Otherwise, the attack will be implemented by the environment.
Note that if the attack is “ambiguous” it will fails (the environment will replace it by a “do nothing” action), but the budget will still be consumed.
- Parameters
observation (
grid2op.Observation.Observation
) – The last observation (at time t)agent_action (
grid2op.Action.Action
) – The action that the agent tookenv_action (
grid2op.Action.Action
) – The modification that the environment will take.
- Returns
res – The attack the opponent wants to perform (or “do nothing” if the attack was too costly)
- Return type
-
has_failed
()[source]¶ This signal is sent by the environment and indicated the opponent attack could not be implmented on the powergrid, most likely due to the attack to be ambiguous.
-
-
class
grid2op.Opponent.
UnlimitedBudget
(action_space)[source]¶ This class define an unlimited budget for the opponent.
It SHOULD NOT be used if the opponent is allow to take any actions!
If you still can’t find what you’re looking for, try in one of the following pages: