Coder Social home page Coder Social logo

matnet's Introduction

MatNet

This repository provides a reference implementation of MatNet and saved trained models as described in the paper:

Matrix Encoding Networks for Neural Combinatorial Optimization
(NeurIPS 2021, accepted)
https://arxiv.org/abs/2106.11113

The code is written using Pytorch.

Getting Started

We provide codes for two CO (combinatorial optimization) problems:

  • Asymmetric Traveling Salesman Problem (ATSP)
  • Flexible Flow Shop Problem (FFSP)

Basic Usage

For both ATSP_MatNet and FFSP_MatNet,

i. To train a model,

python3 train.py

train.py contains parameters you can modify.
At the moment, it is set to train N=20 problems.

ii. To test a model,

python3  test.py

You can specify the model as a parameter contained in test.py.
At the moment, it is set to use the saved model (N=20) we have provided (in "result" folder), but you can easily use the one you have trained from running train.py.

To test for the N=50 model, make sure that saved problem files exist in the path (see below for Datasets). Also, modify test.py so that

  • all "20"'s are changed to "50"
  • "path" and "epoch" in the "tester_params" are correctly pointing to the saved model
  • test batch size is decreased (by a factor of something like 4)

Saved Trained Models

Trained models for ATSP are provided with the codes.
However, the sizes of the trained model files for FFSP-MatNet are too large to upload here. So we provide them as links below.

Datatsets

Test datasets for larger N (N=50, N=100) problems are given as links below.
Download the dataset and add them to the "data" directories under ATSP and FFSP folders.

Used Libraries

python v3.7.6
torch==1.7.0

matnet's People

Contributors

minahpark avatar yd-kwon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

matnet's Issues

Ask some questions

Have you ever tried to solve the dynamic vehicle scheduling problem with this model?

The model file is not exist

image

Hi, it seems that the trained model saved in results/saved_atsp_model is not available now. I tried to get the model from git lfs, but it shows the model does not exist on the server. Could you please solve this problem? Thanks very much.

I have a question

May I ask if the number of machines in each stage of the FFSP problem needs to be consistent? If it can be a heterogeneous quantity, how should pomo_size be set?

I want ask a question?

Sorry because i dont understand the code and I need your help ! I have two question

  • The first question: I understand that the score and aug_score is the tour length. But went i test it with my own dataset, i change the scale so the ans is different. So i want to ask that the train scale and test scale must be the same ?
  • The second question: I know that max_pomo_reward.max(dim=0) is the best tour and I dont know how to get it, and I know self.env.slected_node_list is the tour but how i can get it from the best tour ?
    TKS!!

multi-GPU implementation

In your paper, you mentioned that for n=50/100 large scale data, you adopted a multi-GPU implementation, I wonder if it is possible to provide a multi-GPU version of the code

Hope you can help me

If I met the Multiple data matrices, what should I do, May I do like this : scores = torch.stack((dot_product_score, cost_mat1, cost_mat2, cost_mat3 ), dim=4).
There may also be papers that I didn't fully understand, forgive me for being a newbie

I have a question?

max_aug_pomo_reward, _ = max_pomo_reward.max(dim=0) # get best results from augmentation
# shape: (batch,)
aug_score = -max_aug_pomo_reward.float().mean() # negative sign to make positive value

I want to ask why you use .mean() but we want to get the best result

I have a question!

I have a question about job scheduling problem. My my problem is very complicated not like job shop so what if i change the problems define as meta heuristic algorithms as sample for model ?

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.