Coder Social home page Coder Social logo

simrit1 / combopt-zero Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xuzijian629/combopt-zero

0.0 0.0 0.0 1.58 MB

A reinforcement learning based solver for combinatorial problems

Home Page: https://arxiv.org/abs/1905.11623

License: MIT License

Shell 2.41% C++ 73.40% Python 22.43% C 1.01% CMake 0.75%

combopt-zero's Introduction

CombOpt Zero

CombOpt Zero is a general-purpose solver based on AlphaGo Zero for combinatorial problems on graphs. Paper: Solving NP-Hard Problems on Graphs with Extended AlphaGo Zero

You can try MinimumVertexCover, MaximumIndependentSet, FeedbackVertexSet, MaxCut and MaximumClique, by running the code in this repository.

Try on Docker

Install Docker and just run docker/install.sh, docker/train.sh and docker/eval.sh!

Note

  • By default, it solves MaximumClique
  • Change docker/config.sh and {problem}/config.sh for other settings
  • Hyperparameters are modified so that the training and evaluation can be executed quickly on laptops without GPUs
  • But still, it will obtain pretty good solutions for real-world graphs of thousands of nodes even if trained for only a few minutes (Try and check it by yourself!)
  • docker/train.sh may yield some errors, possibly due to the file system of Docker. Please refer to FAQs.

Build and Run

If you just want to try on docker, please ignore this section.

  1. Download LibTorch from https://pytorch.org/
    Download version 1.3.0. Newer version may cause errors. If you use Linux, download Pre-cxx11 ABI version.

  2. Build library
    Please also refer to docker/install.sh if you have some problem.

$ cd max-clique/lib
$ mkdir build
$ cd build
$ cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch ..
$ make
  1. Generate scripts
    First, modify hyperparameters and other parameters in {problem}/config.sh. Then,
$ cd max-clique
# create two scripts for training and evalution, named t_sample.sh and e_sample.sh, based on config.sh
$ echo sample | python script_generator.py
  1. Start training
    You can terminate the training anytime. If you want to restart the training, just run the same command again. Model files and temporary files are stored in {problem}/results/{configuration}/.
$ cd max-clique
$ ./t_sample.sh
  1. Start evaluation
$ cd max-clique
$ ./e_sample.sh

Dataset

All the test graphs used in our experiments are in test_graphs/. Some of them are collected from Dimacs Vertex Cover instances and http://networkrepository.com/.

Links

Cite

Please cite our paper if you use our code in your work:

@article{Xu/Abe/2020,
    title={Solving NP-Hard Problems on Graphs with Extended AlphaGo Zero},
    author={Zijian Xu and Kenshin Abe and Issei Sato and Masashi Sugiyama},
    journal={arXiv preprint arXiv:1905.11623},
    year={2020}
}

combopt-zero's People

Contributors

knshnb avatar xuzijian629 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.