louisv123 / COLGE

36 stars 11 forks source link

Implementation of Dai and al. paper (Learning combinatorial optimization algorithms over graph) in Python and torch

Source of the Dai and al. paper:

@article{dai2017learning,
  title={Learning Combinatorial Optimization Algorithms over Graphs},
  author={Dai, Hanjun and Khalil, Elias B and Zhang, Yuyu and Dilkina, Bistra and Song, Le},
  journal={arXiv preprint arXiv:1704.01665 https://arxiv.org/abs/1704.01665},
  year={2017}
}

Introduction

The goal of this study is to implement the work done by Dai and al. who developed a unified framework to solve combinatorial optimization problem over graph through learning. The model is trained on batch of graphs from a Erdös-Rényi and a Barabási–Albert degree distribution, with a fix number of node. Firstly, the algorithm learns the structure of the graph through a graph embedding algorithm. A helping function provides as an input the current state of progress of the optimisation. Then it chooses the best node to add to the optimal set through a reinforcement learning algorithm. I have worked on two combinatorial optimization problems, Minimum Vertex Cover (MVC) and Maximum Cut Set (MAXCUT).

Structure of the code

alt text

main.py

main.py allows to define arguments and launch the code.

Arguments :

graph.py

Define the graph object, espacially the kind of degree distribution and the methods.

runner.py

This script calls each step of reinforcement learning part in a loop (epochs + games):

agent.py

Define the agent object and methods needed in deep Q-learning algorithm. There are a lot of paramters quite important defined in this part. The discount factor for exploration strategy, the T iterations for structure2vec, ....

model.py

Define the Q-function and the embedding algorithm. S2V_QN_1 and GCN_QN_1 gives good results.

environment.py

Define the environment object which is either MVC (Minimum vertex cover) or MAXCUT (Maximum cut set). It contains as well the method to get the approximation solution and the optimal solution (with pulp)