This repository contains the code for the NeurIPS 2024 paper: SymILO: A Symmetry-Aware Learning Framework for Integer Linear Optimization.
To run this code, you need the following dependencies:
- Python 3.9.19
- CPLEX 22.1.1
- gurobipy 11.0.3
- pyg 2.5.3
- pytorch 2.4.0
Follow instructions here to prepare the data.
To train the model, you can use the following bash commands:
# symmetry-agnostic
python train.py --expName IP-r --dataset IP --opt none --epoch 50
python train.py --expName SMSP-r --dataset SMSP --opt none --epoch 50
# symmetry-aware
python train.py --expName IP-rs --dataset IP --opt opt --epoch 50
python train.py --expName SMSP-rs --dataset SMSP --opt opt --epoch 50By running the following scripts, the Top-m% error of different experiments will be calculated and presented in ./$expName/prediction_error.txt, respectively.
# symmetry-agnostic
python get_logits.py --expName IP-r --dataset IP --mod valid
python accuracy.py --expName IP-r --dataset IP
python get_logits.py --expName SMSP-r --dataset SMSP --mod valid
python accuracy.py --expName SMSP-r --dataset SMSP
# symmetry-aware
python get_logits.py --expName IP-rs --dataset IP --mod valid
python accuracy.py --expName IP-rs --dataset IP
python get_logits.py --expName SMSP-rs --dataset SMSP --mod valid
python accuracy.py --expName SMSP-rs --dataset SMSP
Before evaluation, the prediction of the test instances should be generated by running
# symmetry-agnostic
python get_logits.py --dataset IP --expName IP-r --mod test
python get_logits.py --dataset SMSP --expName SMSP-r --mod test
# symmetry-aware
python get_logits.py --dataset IP --expName IP-rs --mod test
python get_logits.py --dataset SMSP --expName SMSP-rs --mod test
To evaluate the model, you can use the following commands:
(Note: Due to device difference, the hyperparameter --perc should be adaptively tuned.)
#-----IP-----
python eval.py --expName IP-r --dataset IP --method fixTop --perc 0.0 --maxtime 3600 --nWorker 5 # CPLEX -- this step may take several days
# symmetry-agnostic
python eval.py --expName IP-r --dataset IP --method fixTop --perc 0.1 --maxtime 1000 --nWorker 5
python eval.py --expName IP-r --dataset IP --method PS --perc 0.1 --maxtime 1000 --nWorker 5
# symmetry-aware
python eval.py --expName IP-rs --dataset IP --method fixTop --maxtime 1000 --perc 0.1 --nWorker 5
python eval.py --expName IP-rs --dataset IP --method PS --maxtime 1000 --perc 0.1 --nWorker 5
#-----SMSP-----
python eval.py --expName SMSP-r --dataset SMSP --method fixTop --perc 0.0 --maxtime 3600 --nWorker 5 # CPLEX -- this step may take several days
# symmetry-agnostic
python eval.py --expName SMSP-r --dataset SMSP --method fixTop --perc 0.5 --maxtime 1000 --nWorker 5
python eval.py --expName SMSP-r --dataset SMSP --method PS --perc 0.5 --maxtime 1000 --nWorker 5
# symmetry-aware
python eval.py --expName SMSP-rs --dataset SMSP --method fixTop --perc 0.5 --maxtime 1000 --nWorker 5
python eval.py --expName SMSP-rs --dataset SMSP --method PS --perc 0.5 --maxtime 1000 --nWorker 5
After evaluation, we plot the figure with primal gap vs. solving time. First, convert the solving history data into matlab format by running
python get_primals.pynext, use matlab to draw the result figure by running sciprt draw_prim_curves.m. The corresponding values of relative primal gaps will be displayed in the console.
If you find this code helpful in your research, please consider citing our paper:
@article{chen2024symilo,
title={SymILO: A Symmetry-Aware Learning Framework for Integer Linear Optimization},
author={Chen, Qian and Zhang, Tianjian and Yang, Linxin and Han, Qingyu and Wang, Akang and Sun, Ruoyu and Luo, Xiaodong and Chang, Tsung-Hui},
journal={NeurIPS},
year={2024}
}