Codes for AAAI22 paper "Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum"

Overview

Paper

For more details, please see our paper Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum which has been accepted at AAAI 2022. If this code is useful for your work, please cite our paper:

@inproceedings{zhang2022learning,
  title={Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum},
  author={Zeyang Zhang and Ziwei Zhang and Xin Wang and Wenwu Zhu},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  year={2022}
}

Dependencies

Require python>=3.8

Install other packages

pip install torch matplotlib scipy tqdm tensorboard sklearn jupyter jupyterlab pandas gurobipy seaborn tensorboardX

And follow https://github.com/wouterkool/attention-learn-to-route to install Gurobi Solver. In short, it can be installed by conda:

conda config --add channels http://conda.anaconda.org/gurobi
conda install gurobi

Or manually: Find and download the package in https://anaconda.org/Gurobi/gurobi/files?page=0, then use conda install.

Usage

  1. generate data This step generates necessary TSP Instances for experiments.
python src/generate_data.py --problem tsp --graph_sizes 50 --name val_mg --seed 2222 --dataset_size 10000 --generate_type mg
python src/generate_data.py --problem tsp --graph_sizes 50 --name train --seed 1111 --dataset_size 10000 --generate_type random -f 
python preprocess.py
  1. preliminary study This step shows the optimality gaps of TSP instances generated from gaussian mixture generator as $c_{\text{dist}}$ increases
python preliminary.py
  1. Hardness-adaptive generator This step shows the optimality gaps of TSP instances generated from hardness-adaptive generator as $\eta$ increases
python hag.py
  1. Hardness-adaptive Curriculum This step shows the optimality gaps with or without hardness-adaptive curriculum. In this case, training data and testing data is from uniform and gaussian mixture respectively. Replace 'X' with GPU device id.
CUDA_VISIBLE_DEVICES=X python main.py --train_type uniform --iters 15
CUDA_VISIBLE_DEVICES=X python main.py --train_type hardness-adaptive --iters 15
  1. showcase This step shows some cases of instances generated by hardness-adaptive generator.
python showcase.py

Acknowledgements

This repo is modified mainly based on the code https://github.com/wouterkool/attention-learn-to-route.

You might also like...
Implementation of CVPR 2021 paper
Implementation of CVPR 2021 paper "Spatially-invariant Style-codes Controlled Makeup Transfer"

SCGAN Implementation of CVPR 2021 paper "Spatially-invariant Style-codes Controlled Makeup Transfer" Prepare The pre-trained model is avaiable at http

Codes accompanying the paper "Learning Nearly Decomposable Value Functions with Communication Minimization" (ICLR 2020)

NDQ: Learning Nearly Decomposable Value Functions with Communication Minimization Note This codebase accompanies paper Learning Nearly Decomposable Va

Codes for CIKM'21 paper 'Self-Supervised Graph Co-Training for Session-based Recommendation'.

COTREC Codes for CIKM'21 paper 'Self-Supervised Graph Co-Training for Session-based Recommendation'. Requirements: Python 3.7, Pytorch 1.6.0 Best Hype

codes for
codes for "Scheduled Sampling Based on Decoding Steps for Neural Machine Translation" (long paper of EMNLP-2022)

Scheduled Sampling Based on Decoding Steps for Neural Machine Translation (EMNLP-2021 main conference) Contents Overview Background Quick to Use Furth

This repository contains codes of ICCV2021 paper: SO-Pose: Exploiting Self-Occlusion for Direct 6D Pose Estimation

SO-Pose This repository contains codes of ICCV2021 paper: SO-Pose: Exploiting Self-Occlusion for Direct 6D Pose Estimation This paper is basically an

Multiple paper open-source codes of the Microsoft Research Asia DKI group
Multiple paper open-source codes of the Microsoft Research Asia DKI group

📫 Paper Code Collection (MSRA DKI Group) This repo hosts multiple open-source codes of the Microsoft Research Asia DKI Group. You could find the corr

Codes of paper
Codes of paper "Unseen Object Amodal Instance Segmentation via Hierarchical Occlusion Modeling"

Unseen Object Amodal Instance Segmentation (UOAIS) Seunghyeok Back, Joosoon Lee, Taewon Kim, Sangjun Noh, Raeyoung Kang, Seongho Bak, Kyoobin Lee This

A pytorch-version implementation codes of paper:
A pytorch-version implementation codes of paper: "BSN++: Complementary Boundary Regressor with Scale-Balanced Relation Modeling for Temporal Action Proposal Generation"

BSN++: Complementary Boundary Regressor with Scale-Balanced Relation Modeling for Temporal Action Proposal Generation A pytorch-version implementation

The codes reproduce the figures and statistics in the paper, "Controlling for multiple covariates," by Mark Tygert.

The accompanying codes reproduce all figures and statistics presented in "Controlling for multiple covariates" by Mark Tygert. This repository also pr

Comments
  • The Dependencies installation command need to be corrected

    The Dependencies installation command need to be corrected

    pip install torch matplotlib scipy tqdm tensorboard sklearn jupyter jupyterlab pandas gurobipy seaborn tensorboardX

    The correct version should be pip install torch matplotlib scipy tqdm tensorboard scikit-learn jupyter jupyterlab pandas gurobipy seaborn tensorboardX

    pip install sklearn will install a wrong package and report errors when run the code.

    opened by jiang-yuan 0
  • Derivation of Equation 11

    Derivation of Equation 11

    Hi, would you mind explain a little bit more about equation 11 in the paper? I have

    $$ \begin{aligned} \nabla_\mathbf{X} \mathcal{H}(\mathbf{X}, M) &= \nabla_{\mathbf{X}}\frac{\mathcal{C}M(\mathbf{X})-\mathcal{C}{M^{\prime}}(\mathbf{X})}{\mathcal{C}{M^{\prime}}(\mathbf{X})}\ &=\frac{1}{\mathcal{C}{M^\prime}(\mathbf{X})}\left[-\mathcal{C}M(\mathbf{X})\nabla{\mathbf{X}}\log C_{M^\prime}(\mathbf{X})+\nabla_{\mathbf{X}}\mathcal{C}_M (\mathbf{X})\right] \end{aligned} $$

    but equation 11 is

    $$ \nabla_\mathbf{X} \mathcal{H}(\mathbf{X}, M) =\mathbb{E}\left[\frac{\mathcal{C}M(\mathbf{X})}{\mathcal{C}{M^{\prime}}(\mathbf{X})} \nabla_\mathbf{X} \log p_M(\boldsymbol{\pi} \mid \mathbf{X})+\frac{\nabla_{\mathbf{X}} \mathcal{C}M(\mathbf{X})}{\mathcal{C}{M^{\prime}}(\mathbf{X})}\right] $$

    opened by CarlossShi 0
Owner
null
A novel method to tune language models. Codes and datasets for paper ``GPT understands, too''.

P-tuning A novel method to tune language models. Codes and datasets for paper ``GPT understands, too''. How to use our code We have released the code

THUDM 562 Dec 27, 2022
Codes for NAACL 2021 Paper "Unsupervised Multi-hop Question Answering by Question Generation"

Unsupervised-Multi-hop-QA This repository contains code and models for the paper: Unsupervised Multi-hop Question Answering by Question Generation (NA

Liangming Pan 70 Nov 27, 2022
Codes for our paper "SentiLARE: Sentiment-Aware Language Representation Learning with Linguistic Knowledge" (EMNLP 2020)

SentiLARE: Sentiment-Aware Language Representation Learning with Linguistic Knowledge Introduction SentiLARE is a sentiment-aware pre-trained language

null 74 Dec 30, 2022
Source codes for the paper "Local Additivity Based Data Augmentation for Semi-supervised NER"

LADA This repo contains codes for the following paper: Jiaao Chen*, Zhenghui Wang*, Ran Tian, Zichao Yang, Diyi Yang: Local Additivity Based Data Augm

GT-SALT 36 Dec 2, 2022
Codes for our IJCAI21 paper: Dialogue Discourse-Aware Graph Model and Data Augmentation for Meeting Summarization

DDAMS This is the pytorch code for our IJCAI 2021 paper Dialogue Discourse-Aware Graph Model and Data Augmentation for Meeting Summarization [Arxiv Pr

xcfeng 55 Dec 27, 2022
Official codes for the paper "Learning Hierarchical Discrete Linguistic Units from Visually-Grounded Speech"

ResDAVEnet-VQ Official PyTorch implementation of Learning Hierarchical Discrete Linguistic Units from Visually-Grounded Speech What is in this repo? M

Wei-Ning Hsu 21 Aug 23, 2022
Codes for ACL-IJCNLP 2021 Paper "Zero-shot Fact Verification by Claim Generation"

Zero-shot-Fact-Verification-by-Claim-Generation This repository contains code and models for the paper: Zero-shot Fact Verification by Claim Generatio

Liangming Pan 47 Jan 1, 2023
codes for paper Combining Dynamic Local Context Focus and Dependency Cluster Attention for Aspect-level sentiment classification

DLCF-DCA codes for paper Combining Dynamic Local Context Focus and Dependency Cluster Attention for Aspect-level sentiment classification. submitted t

null 15 Aug 30, 2022
The source codes for ACL 2021 paper 'BoB: BERT Over BERT for Training Persona-based Dialogue Models from Limited Personalized Data'

BoB: BERT Over BERT for Training Persona-based Dialogue Models from Limited Personalized Data This repository provides the implementation details for

null 124 Dec 27, 2022
Codes for paper "Towards Diverse Paragraph Captioning for Untrimmed Videos". CVPR 2021

Towards Diverse Paragraph Captioning for Untrimmed Videos This repository contains PyTorch implementation of our paper Towards Diverse Paragraph Capti

Yuqing Song 61 Oct 11, 2022