Searching Large Neighborhoods for Integer Linear Programs with Contrastive Learning

Taoan Huang, Aaron M Ferber, Yuandong Tian, Bistra Dilkina, Benoit Steiner

Solving Integer Linear Programs (ILPs) is notoriously difficult, but Large Neighborhood Search (LNS) offers a fast heuristic alternative—if you can figure out exactly which variables to reoptimize. This paper introduces CL-LNS, a novel approach that uses contrastive learning and Graph Attention Networks (GATs) to train a fast machine learning policy that mimics a slow, expert heuristic. The resulting model achieves state-of-the-art performance and generalizes remarkably well to problems twice the size of its training data.

The Challenge of Integer Linear Programs

Integer Linear Programs (ILPs) are the mathematical backbone for solving a massive variety of real-world Combinatorial Optimization Problems (COPs), from vehicle routing to resource allocation. The standard way to solve ILPs is using Branch and Bound (BnB), an exact tree-search algorithm. However, BnB scales poorly as problems get larger.

Large Neighborhood Search (LNS) is a heuristic algorithm that starts with a mediocre solution and iteratively improves it by "destroying" (unassigning) a subset of variables and reoptimizing them while keeping the rest fixed. The critical question in LNS is: which subset of variables should we destroy?

Hand-crafted heuristics are often inefficient. While there is a highly effective expert heuristic called Local Branching (LB), it requires solving another complex ILP just to pick the variables, making it too slow for practical use. Previous machine learning approaches have tried to imitate LB using standard classification or reinforcement learning, but they still leave significant room for improvement in both speed and solution quality.

Introducing CL-LNS: Contrastive Learning for LNS

To overcome these limitations, the authors propose CL-LNS, which trains a neural network to act as the "destroy heuristic." It imitates the slow LB expert but introduces several major innovations:

CL-LNS Pipeline
  1. Contrastive Learning: Instead of using standard imitation learning—where the model is merely penalized for not picking the exact optimal variables—CL-LNS uses a supervised contrastive loss (InfoNCE).
  2. Clever Data Collection: To fuel the contrastive learning, the authors collect positive samples (intermediate solutions found by the expert that are close to optimal) and negative samples (created by randomly perturbing the optimal subset to generate bad variable selections). The model learns to push its predictions toward the positive samples and away from the negative ones.
  3. Graph Attention Networks (GATs): An ILP can be represented as a bipartite graph (variables on one side, constraints on the other). Previous works used Graph Convolutional Networks (GCNs). CL-LNS upgrades this to a GAT, allowing the network to weigh the importance of different neighboring nodes dynamically.
  4. Richer Features: The authors incorporate a richer set of node features, including data extracted from the root node of the BnB search tree, giving the model a better mathematical context of the problem.

Datasets and Key Results

The authors evaluated their approach on four classic NP-hard problem benchmarks: Minimum Vertex Cover (MVC), Maximum Independent Set (MIS), Combinatorial Auction (CA), and Set Covering (SC). They generated datasets of small instances (e.g., 1,000 to 6,000 variables) for training and testing, as well as large instances (twice the number of variables) strictly to test zero-shot generalization.

CL-LNS was compared against standard BnB, random selection, and state-of-the-art ML baselines (IL-LNS and RL-LNS).

Performance Comparison on Benchmark Datasets
  • Small Instances: At a 60-minute runtime cutoff, CL-LNS achieved 32%–42% lower average primal gaps (the distance to the best-known solution) and 26%–59% lower primal integrals (a metric combining solution quality and speed) compared to the second-best approach.
  • Generalization (Large Instances): When tested on problems twice the size of its training data, CL-LNS demonstrated massive zero-shot generalization. It reduced the second-best average primal gap by up to 94.4% and the primal integral by up to 57.1%.
  • Survival Rate: CL-LNS consistently achieved the highest "survival rate" (the fraction of instances reaching a strict 1.00% primal gap threshold) in the shortest amount of time across almost all benchmarks.

Key Insights

  • Contrastive learning fits combinatorial search beautifully: By explicitly showing the model what a "bad" neighborhood looks like via perturbed negative samples, the policy learns a much sharper decision boundary than it would through standard imitation learning.
  • The student surpasses the master: The expert heuristic (LB) gets bogged down if the neighborhood size it has to search is too large. Because the trained CL-LNS model is incredibly fast at inference, it can afford to evaluate much larger neighborhoods at test time. Consequently, the ML model actually outperforms the slow expert it originally learned from.
  • Architecture matters: Upgrading from GCNs to GATs and adding richer node features significantly boosted the model's ability to capture the complex relationships between variables and constraints.

Limitations and Future Work

Because LNS is a heuristic algorithm, CL-LNS does not guarantee finding the mathematically optimal solution, unlike exact solvers like BnB. Furthermore, a separate model must currently be trained for each specific problem domain. Learning policies capable of generalizing across different problem domains remains a key area for future work. Finally, integrating this learned heuristic directly into a traditional BnB solver could be a highly promising way to combine the speed of ML with the exactness of traditional solvers.

Summary updated

BibTeX
@inproceedings{huang2023searching,
  author = {Taoan Huang and Aaron M Ferber and Yuandong Tian and Bistra Dilkina and Benoit Steiner},
  title = {{Searching Large Neighborhoods for Integer Linear Programs with Contrastive Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=JLqPTrwqVD},
}
Figure