- (July, 2023) Update the python-julia interface with the SOTA version of JuliaCall & PythonCall
Recast Code of the Paper 'Hybrid Imitation Learning for Real-Time Service Restoration in Resilient Distribution Systems'
Please use this bibtex if you want to cite this repository in your publications:
@misc{IL_Self_Healing,
author = {Ran Zhu},
title = {Recast Code of the Paper 'Hybrid Imitation Learning for Real-Time Service Restoration in Resilient Distribution Systems'},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/RanZhu1989/IL_Self_Healing}},
}
Thanks to the authors of the original paper for their valuable research and code on Github.
This is the reproduced code for the paper titled "Hybrid Imitation Learning for Real-Time Service Restoration in Resilient Distribution Systems". Compared to the original code, this recast code has the following updates:
This repository | Original | |
---|---|---|
Optimization environment | JuMP and Gurobipy (Matrix programming) | Pymoo ('For loop' programming) |
Gymnasium standard environment | ✓ | ✗ |
Deep learning framework | Pytorch | Tensorflow |
Running speed | ~500% Faster | 100% |
The so-called behavior cloning (BC) algorithm in origin paper is actually the data augmentation (DAgger) algorithm. I have corrected this in the recast code.
In general, the recast code reproduces the results in the original paper. The following figures show the success ratio of the proposed algorithm in different scenarios.
There are some points slight larger than 1, which is due to numerical issues of the mathematic programming-based environment.
Superior performance of DAgger compared to the conventional BC method.
More complex scenarios, such as N-2 and N-5 tests.
The reproduction only plays a few epochs due to the long training time. Since the trend is consistent with the original paper, the reproduction is considered successful.
-
Install python environment,
cd
into the gym environment directory./gym_SelfHealing/
and typepip install -e .
-
Install Julia environment, add the following packages:
JuMP
,PythonCall
-
Configure your python-julia interface according to the documentation, especially add your python path into the julia environment variable
PYTHON
. -
Install solvers:
- Gurobi: Install Gurobi in your OS, and run
pip install gurobipy
in python or runPkg.add("Gurobi")
in Julia (see documentations) - CPLEX: Install CPLEX in your OS, and run
Pkg.add("CPLEX")
in Julia (see documentations) - GLPK: Just run
Pkg.add("GLPK")
in Julia
- Gurobi: Install Gurobi in your OS, and run
-
You can test your environment configuration by running the scripts in
./test/
directory. -
To run the DAgger algorithm, set hyperparameters according to
configs.py
-
You can edit the system file in
./gym_SelfHealing/selfhealing_env/envs/case_data/*.xlsx
. -
Known dependencies:
- Python: Python (3.8.19), PyTorch (2.3.0), Gymnasium (0.28.1), CUDA (12.1), Gurobipy (11.0), juliacall (0.9.20)
- Julia: Julia (1.10.3), JuMP (1.22.1), PythonCall (0.9.20)
- Solvers: Gurobi (v10 and v11), CPLEX (12.10), GLPK (5.0)