Local-MIP is a C++20 local-search solver for mixed integer programming. It ships with a lightweight CLI plus a focused C++/Python API and callback hooks to customize starts, restarts, weights, scoring functions, and neighborhood behavior.
Find out more about Local-MIP at https://local-mip.github.io/.
Although Local-MIP is freely available under the MIT license, we would be pleased to learn about users’ experiences and offer advice via email at peng.lin.csor@gmail.com.
Note: Local-MIP 1.0 has been archived and is available in Releases v1.0.1. The experimental results reported in the referenced papers (CP 2024 and Artificial Intelligence 2025) were obtained using Local-MIP 1.0.
src/– solver entry (src/local_mip/Local_MIP.cpp), CLI wrapper (src/utils/main.cpp), search logic (src/local_search/), parsing (src/reader/), and model utilities (src/model_data/).src/model_api/– Model API for programmatic model building (add variables/constraints from code).tests/– unit, integration, and instance-driven tests (CMake/CTest).example/– standalone API examples; buildable independently after preparing headers/static lib.test-set/– sample.mps/.lpinstances.build/– generated build artifacts (created by./build.sh).python-bindings/– optional pybind11 bindings and Python packaging files.default.set– parameter configuration template.
- CMake ≥ 3.15
- A C++20 compiler (GCC/Clang)
- bash, make, and standard POSIX utilities
For Linux x86_64, install the published Python bindings directly:
python3 -m pip install localmipImport the module in Python:
import localmip_py as lmFor repository-based development builds and Python demos, see python-bindings/README.md.
From the repository root:
# Release build (recommended)
./build.sh release
# Debug build with assertions/logging
./build.sh debug
# Build everything (core + examples + python bindings)
./build.sh all
# Clean build artifacts
./build.sh cleanThe solver binary and static library are written to build/ (e.g., build/Local-MIP, build/libLocalMIP.a). ./build.sh all additionally prepares/builds the example/ demos and the pybind11 module under python-bindings/build/.
Run from build/ so relative paths resolve:
cd build
./Local-MIP -i ../test-set/2club200v15p5scn.mps -t 300 -b 1 -l 1Note: CLI flags support both short (e.g., -i) and long (e.g., --model_file) forms. Run ./Local-MIP --help to see the exact mapping for your version.
Run ./Local-MIP --help (from build/) to see available CLI flags. The default.set template lists every parameter with its default value and brief notes; it can be used as-is or customized.
The reader now handles RANGES sections (SOS data is still rejected with an error).
You can use a configuration file to set parameters instead of (or in addition to) command line arguments. The repository includes default.set as a template with all available parameters and their default values.
Example:
cd build
./Local-MIP --param_set_file ../default.set --model_file ../test-set/2club200v15p5scn.mpsFormat rules:
- One parameter per line:
parameter_name = value - Lines starting with
#or;are comments - Command line arguments override values from the configuration file
- See
default.setfor descriptions and valid ranges
CTest targets are defined in tests/CMakeLists.txt.
./build.sh debug # or release
cd build
# Run unit test subset
ctest --output-on-failure -R "^(api|callbacks|constraint_recognition|scoring|model_manager|reader|move_operations|neighbor_config)$"
# Run integration tests
ctest --output-on-failure -R "^integration$"
# Run all tests (including per-instance sweeps)
ctest --output-on-failureThe public C++ and Python interfaces expose the core solver configuration used in normal runs, including parameter-file loading, along with result queries, in-memory modeling, and callback registration.
- The core build produces
build/libLocalMIP.a; headers live undersrc/. - Link against the static library directly or follow the example projects under
example/.
If you want to build a MIP model from code (instead of reading .mps/.lp), use the Model API:
- C++ demo:
example/model-api/model_api_demo.cpp(seeexample/model-api/README.md) - Python demo:
python-bindings/model_api_demo.py(requires the pybind11 module)
Important: Model API usage is single-run. Build the model once, call run once, and do not add variables/constraints after run. To solve again, create a new model instance.
Build & run (one-time):
# Build core + all examples + python bindings
./build.sh all
# Run the C++ Model API demo
cd example/model-api
./model_api_demo
# Run the Python Model API demo
cd ../../
python3 python-bindings/model_api_demo.pyLocal-MIP exposes multiple callback hooks (start, restart, weight, neighbor generation, neighbor scoring, lift scoring). Predefined demos live under example/ (e.g., start-callback/, restart-callback/, weight-callback/, neighbor-config/, neighbor-userdata/, scoring-neighbor/, scoring-lift/). The C++ API exposes typed callback signatures with optional void* user_data; the Python bindings now expose structured callback context objects plus optional user_data objects so the same customization pattern is available from Python. Refer to the example READMEs and callback type declarations in src/local_search/ for details.
Examples are decoupled from the main tree. Prepare once, then build (or run ./build.sh all to do this automatically):
cd example
./prepare.sh # copies libLocalMIP.a, headers, and sample test-set files into example/
./build.sh # builds all demosNotable demo directories:
simple-api/– minimal solver usagemodel-api/– build models programmatically via the Model APIstart-callback/,restart-callback/,weight-callback/– callback hooksscoring-lift/,scoring-neighbor/– custom scoring in feasible/infeasible phasesneighbor-config/,neighbor-userdata/– neighbor configuration and custom operators
Each demo binary is emitted inside its directory. The canonical flow is to run it from example/ after ./build.sh:
cd example
./simple-api/simple_api_demoFile-backed demos now also resolve the bundled sample instance when launched from their own subdirectory, so cd example/simple-api && ./simple_api_demo works too. Pass a custom instance path as argv[1] when needed.
Located in python-bindings/ (separate from the core).
Install from PyPI on Linux x86_64:
python3 -m pip install localmip
python3 -c "import localmip_py as lm; print(lm.LocalMIP)"Quick start from the repository:
python3 -m pip install ./python-bindings
python3 python-bindings/sample.py
# Model API demo (build models programmatically)
python3 python-bindings/model_api_demo.py
# Smoke test for parameter files + callback contexts
python3 python-bindings/test_python_api.pyFor iterative local development, python-bindings/build.sh still builds the extension into python-bindings/build/, and the repository demos prefer that local build when it exists. The sample loads test-set/2club200v15p5scn.mps, runs the solver, and writes py_example.sol. Python callbacks receive structured context objects, expose writable solver state where appropriate, and optionally accept a Python user_data object. If your python3 is not the same interpreter used during build, rebuild with PYTHON_EXECUTABLE=/path/to/python3 python-bindings/build.sh and use that same interpreter to run the scripts.
- Code style: C++20, two-space indentation, local headers before system headers, prefer
printf-family. - Keep CLI parameters in sync with
src/utils/paras.hand help text.
If you use Local-MIP in an academic context, please cite the following articles:
Important: The experimental results reported in the papers below were obtained using Local-MIP 1.0 (GitHub release v1.0.1).
-
Journal Version (Artificial Intelligence, 2025)
Peng Lin, Shaowei Cai, Mengchuan Zou, Jinkun Lin,
Local-MIP: Efficient local search for mixed integer programming,
Artificial Intelligence, Volume 348, 2025, 104405.
doi.org/10.1016/j.artint.2025.104405 -
Conference Version (CP 2024, Best Paper Award)
Peng Lin, Mengchuan Zou, and Shaowei Cai.
An Efficient Local Search Solver for Mixed Integer Programming. In Proceedings of the 30th International Conference on Principles and Practice of Constraint Programming (CP 2024).
doi.org/10.4230/LIPIcs.CP.2024.19.
@article{LIN2025104405,
title = {Local-MIP: Efficient local search for mixed integer programming},
journal = {Artificial Intelligence},
volume = {348},
pages = {104405},
year = {2025},
issn = {0004-3702},
doi = {https://doi.org/10.1016/j.artint.2025.104405},
url = {https://www.sciencedirect.com/science/article/pii/S0004370225001249},
author = {Peng Lin and Shaowei Cai and Mengchuan Zou and Jinkun Lin},
}
@InProceedings{lin_et_al:LIPIcs.CP.2024.19,
author = {Lin, Peng and Zou, Mengchuan and Cai, Shaowei},
title = {{An Efficient Local Search Solver for Mixed Integer Programming}},
booktitle = {30th International Conference on Principles and Practice of Constraint Programming (CP 2024)},
pages = {19:1--19:19},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-336-2},
ISSN = {1868-8969},
year = {2024},
volume = {307},
URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.CP.2024.19},
doi = {10.4230/LIPIcs.CP.2024.19},
}Local-MIP has set new records for several benchmark instances in the MIPLIB dataset, including: