# ExpertAgent: A example implementation of using ExpertOpForGrid for empirical overflow solving

## Description

This Agent uses a greedy algorithm to try to solve an overflow by trying many different topological actions.

To use this agent, please follow the install steps in ExpertAgent/READ_ME.md : https://github.com/rte-france/l2rpn-baselines/tree/master/l2rpn_baselines/ExpertAgent/READ_ME.md

You can find the documentation on the algorithm and it’s usage on : https://github.com/marota/ExpertOp4Grid

The readthedocs documentation can be found here : https://expertop4grid.readthedocs.io/en/latest/

## Agent class

This agent does not train, it is only a closed system analysis to help decision making to solve an overload. You can use this class with:

```
from l2rpn_baselines.ExpertAgent import ExpertAgent
from l2rpn_baselines.ExpertAgent import eval_expertagent
```

This is an Expert System Agent which tries to solve an overload when it happens and which does not require any training. For any new overloaded situations, it computes an influence graph around the overload of interest, and rank the substations and topologies to explore to find a solution. It simulates the top ranked topologies to eventually give a score of success:

#4 - it solves all overloads, #3 - it solves only the overload of interest #2 - it partially solves the overload of interest #1 - it solves the overload of interest but worsen other overloads #0 - it fails

You can tune:

the number of simulations it is allowed to run each for each overload

the number of overload you “study” at each given time if there are multiple overloads

if you decide to take an action now with a score of 1 (which is not necessarily good or bad, there is a tradeoff) or delay it