Abstract
Mixed-Integer Linear Programming (MILP) is a cornerstone of modern logistics and planning, yet the development of machine learning solvers is hindered by the scarcity of high-quality, interpretable training data. Traditional generation methods are either labor-intensive or produce "black-box" instances that lack clear mathematical formulations. This paper presents MILP-Retrieval, a novel framework that reframes instance generation as a code retrieval task. By aligning structural bipartite graph representations of MILP problems with natural language descriptions through contrastive learning, the system identifies and executes Python code to generate high-quality instances. Our approach achieves 100% code validity and significantly outperforms state-of-the-art generative models in instance similarity and computational efficiency.
Introduction
Generating diverse and high-quality MILP data is a significant challenge. Heuristic methods require deep domain expertise to craft templates, while deep learning approaches like Variational Autoencoders (VAEs) or Diffusion models are computationally expensive and typically require retraining for every new problem class. Furthermore, these generative models often produce instances that are difficult to interpret or mathematically infeasible.
MILP-Retrieval introduces a paradigm shift: instead of generating raw mathematical matrices, the system retrieves the underlying code used to generate them. This ensures that the output is not only mathematically sound but also human-readable and easily adjustable.
The MILP-Retrieval Framework
The framework operates on the hypothesis that the space of MILP problem types is relatively small compared to natural language, making a library-based retrieval approach highly feasible. The pipeline consists of three main components:
- MILP Library: A curated collection of MILP instances, their natural language descriptions, and the
pyscipoptPython code used to generate them. - MILP-EmbedSim: A dual-encoder model trained via contrastive learning (similar to CLIP) to map structural and semantic modalities into a shared embedding space. It utilizes a Bipartite Graph Neural Network (GNN) for problem structure and a frozen LLM (NV-Embed-V2) for textual descriptions.
- Retrieval & Execution: At inference time, the system computes the embedding of a target instance, retrieves the most similar code from the library, and executes it to produce new instances.
Experimental Results
The system was evaluated using the Evolve/Train & Test datasets, containing thousands of MILP classes, and the real-world MIPLIB benchmark.
Code Validity and Quality
In head-to-head comparisons with leading LLMs, MILP-Retrieval demonstrated superior reliability. While GPT-4o achieved only a 4% success rate on the first attempt (Pass@1) for generating valid code, MILP-Retrieval achieved 100% code validity across all test cases.
Instance Similarity and Efficiency
MILP-Retrieval significantly outperformed the state-of-the-art learning-based baseline, ACM-MILP. On MIPLIB benchmarks, the retrieval system achieved similarity scores between 0.82 and 0.96, whereas baselines often produced infeasible instances or failed to converge during training. Furthermore, the retrieval process is nearly instantaneous, offering a massive speedup over iterative generative models.
Conclusion and Future Work
MILP-Retrieval provides a training-free, interpretable, and highly efficient solution for MILP data generation. By treating code as an intermediate representation, it bridges the gap between raw mathematical structures and human-readable logic. Future research will focus on expanding the diversity of the MILP library and implementing automated code tuning, where LLMs can refine retrieved code to match the specific scale and difficulty of target instances even more precisely.
Summary updated