Code Monkey home page Code Monkey logo

rlgnn-jssp's Introduction

Reimplement of Paper: "Learning to schedule job-shop problems: representation and policy learning using graph neural network and reinforcement learning"

@article{park2021learning,
  title={Learning to schedule job-shop problems: representation and policy learning using graph neural network and reinforcement learning},
  author={Park, Junyoung and Chun, Jaehyeong and Kim, Sang Hun and Kim, Youngkook and Park, Jinkyoo},
  journal={International Journal of Production Research},
  volume={59},
  number={11},
  pages={3360--3377},
  year={2021},
  publisher={Taylor \& Francis}
}

Installation

python 3.9.9

CUDA 11.3

pytorch 1.10.1

pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

PyG 2.0.2

Then install dependencies:

pip install --upgrade pip
pip install torch-scatter==2.0.9 -f https://pytorch-geometric.com/whl/torch-1.10.0+cu113.html
pip install torch-sparse==0.6.12 -f https://pytorch-geometric.com/whl/torch-1.10.0+cu113.html
pip install torch-geometric==2.0.2
pip install ortools==9.0.9972
pip install plotly==5.5.0
pip install networkx==2.6.3
pip install matplotlib==3.5.1

The environment is based on their code

Progress

  • Environment rollout using random policy
  • Reimplementation of GNN in the original paper
  • Rollout the environment using GNN with sampled actions
    (You can get running time for different problem sizes now, see below.)
  • Training code

Use code

Test rollout with random policy computes the correct makespan

Adjust the parameters in verify_rollout.py. Instances is randomly generated w.r.t the given size.

if __name__ == "__main__":
    np.random.seed(1)
    verify_env(10, 10)  # adjust which size you want to verify (num_machine, num_job)

run

python3 verify_rollout.py

Rollout with GNN

Adjust the parameters in rollout.py. Instances is randomly generated w.r.t the given size.

if __name__ == "__main__":
    random.seed(0)
    numpy.random.seed(1)
    torch.manual_seed(1)

    dev = 'cuda' if torch.cuda.is_available() else 'cpu'
    s = Simulator(20, 100, verbose=False)  # adjust which size you want to rollout (num_machine, num_job)
    embed = RLGNN()
    policy = PolicyNet()
    rollout(s, dev, embed, policy)

run

python3 rollout.py

Run Time Compare with Original Paper

For fixed number of jobs = 30

For fixed number of jobs = 30

For fixed number of machines = 5

For fixed number of machines = 5

rlgnn-jssp's People

Contributors

zcaicaros avatar sunjing1102628 avatar

Stargazers

 avatar GUO Yifan avatar Frederic Menezes Ferreira avatar

Watchers

 avatar

Forkers

linvilyao

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.