Giter VIP home page Giter VIP logo

graph_comb_opt's Introduction

**** Under Construction *****

graph_comb_opt

Implementation of "Learning Combinatorial Optimization Algorithms over Graphs" (https://arxiv.org/abs/1704.01665)

build

**** Below shows an example of MVC. For all the problems, you can follow the similar pipeline ****

Get the source code, and install all the dependencies.

git clone --recursive https://github.com/Hanjun-Dai/graph_comb_opt

build the graphnn library with the instructions here:
  https://github.com/Hanjun-Dai/graphnn

For each task, build the dynamic library. For example, to build the Minimum Vertex Cover library:

cd code/s2v_mvc/mvc_lib/
cp Makefile.example Makefile

customize your Makefile if necessary
( add CXXFLAGS += -DGPU_MODE in the Makefile if you want to run it in GPU mode)

make -j

Now you are all set with the C++ backend.

Generate synthetic data

To generate the synthetic data for Minimum Vertex Cover task, you can do the following:

cd code/data_generator/mvc
modify parameters in run_generate.sh
./run_generate.sh

The above code will generate 1000 test graphs under /path/to/the/project/data/mvc

Training with n-step Q-learning

Navigate to the MVC folder and run the training script. Modify the script to change the parameters.

cd code/s2v_mvc
./run_nstep_dqn.sh

By default it will save all the model files, the logs under currentfolder/results. Note that the code will generate the data on the fly, including the validation dataset. So the training code itself doesn't rely on the data generator.

Test the performance

Navigate to the MVC folder and run the evaluation script. Modify the script to change the parameters. Make sure the parameters are consistent with your training script.

cd code/s2v_mvc
./run_eval.sh

The above script will load the 1000 test graphs you generated before, and output the solution in a csv file, under the same results folder. Format of the csv for MVC:

cover size, cover_size a_1 a_2 a_3 ...., time in seconds

Here the second column shows a solution found by S2V-DQN, in the same order of how each node is picked. 

Reference

Please cite our work if you find our code/paper is useful to your work.

@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},
  year={2017}
}

Check list

  1. S2V-DQN on synthetic data
  • Minimum Vertex Cover (done)
  • Set Cover (coming soon)
  • Maxcut (done)
  • 2D TSP (coming soon)
  1. Synthetic data generator
  • Minimum Vertex Cover (done)
  • Set Cover (coming soon)
  • Maxcut (done)
  • 2D TSP (coming soon)
  1. S2V-DQN on real-world data
  • MemeTracker MVC (coming soon)
  • MemeTracker Set Cover (coming soon)
  • Optsicom Maxcut (coming soon)
  • TSPLIB 2D TSP (coming soon)
  1. data generator for real-world data
  • MemeTracker MVC (coming soon)
  • MemeTracker Set Cover (coming soon)

graph_comb_opt's People

Contributors

hanjun-dai avatar

Watchers

GreatwavesX avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.