Code Monkey home page Code Monkey logo

deepsteiner's Introduction

Deep-Steiner: Learning to Solve the Euclidean Steiner Tree Problem.

A deep reinforcment learning model to solve the Euclidean Steiner Tree (EST) problem. Training with REINFORCE with greedy rollout baseline.

paper

Implementation of our paper: Deep-Steiner: Learning to Solve the Euclidean Steiner Tree Problem, which is accepted by EAI WiCON 2022.

Dependencies

Usage

Generating data

Training data is generated on the fly. To generate validation and test data for all problems with seed number:

python generate_data.py --problem all --name validation --seed 4321
python generate_data.py --problem all --name test --seed 1234

Training

For training EST problem instances with 10 nodes and using rollout as REINFORCE baseline and using the generated validation set:

python run.py --graph_size 10 --batch_size 32 --epoch_size 10240 --val_size 10000 --eval_batch_size 10 --baseline rollout --run_name 'est10' --n_epochs 100 --lr_model 0.00000001 --seed 1111 --embedding_dim 128 --hidden_dim 128 --n_encode_layers 5

Warm start

You can initialize a run using a pretrained model by using the --load_path option:

python run.py --graph_size 10 --batch_size 32 --epoch_size 10240 --val_size 10000 --eval_batch_size 10 --baseline rollout --run_name 'est10' --n_epochs 100 --lr_model 0.00000001 --seed 1111 --embedding_dim 128 --hidden_dim 128 --n_encode_layers 5 --load_path /content/drive/MyDrive/attention_completeV3.0.1/outputs/tsp_10/arc9/epoch-80.pt

Evaluation

To evaluate a model, you can use the eval.py to output the results. All the generated Steiner tree will be saved in the file "select_a.txt":

python eval.py --graph_size 10 --batch_size 32 --epoch_size 10240 --val_size 10000 --eval_batch_size 10 --baseline rollout --run_name 'est10' --n_epochs 100 --lr_model 0.00000001 --seed 1111 --embedding_dim 128 --hidden_dim 128 --n_encode_layers 5 --load_path /content/drive/MyDrive/attention_completeV3.0.1/outputs/tsp_10/arc9/epoch-80.pt

Other options and help

python run.py -h
python eval.py -h

Acknowledgements

Thanks to wouterkool / attention-learn-to-route for getting us started with the code for the graph attention model.

deepsteiner's People

Contributors

deepsteiner 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.