Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EnCore: Learning to Refine Early-Stage Solutions for MILP Acceleration

Mixed-Integer Linear Programming (MILP) is a fundamental problem class in operations research and combinatorial optimization, with broad applications to industrial decision-making. Owing to their NP-hardness, however, modern solvers may struggle to find high-quality solutions for challenging MILP instances within practical time limits. Recent learning-based approaches seek to accelerate MILP solving by directly predicting high-quality solutions from static instance-level features, such as variable-constraint bipartite graphs. Yet accurate solution prediction from instance features alone is difficult, and these methods largely overlook the information revealed during the solver's search process. In this paper, we find that solutions produced at the early search stage of MILP solvers, which are computationally cheap to obtain, are often structurally close to the solutions found after full-budget search. Motivated by this observation, we propose a new solver-informed paradigm that shifts the learning target from variable assignment to \textit{early-to-final consistency}: for each variable, we predict whether its early-stage assignment should persist in full-budget solutions. The predicted consistency naturally guides downstream search, for instance by fixing the assignments deemed consistent. At inference time, we further ensemble consistency predictions across multiple early-stage solutions to improve robustness. Experiments across four MILP benchmarks show our method improves prediction-guided search across diverse downstream pipelines. With Gurobi, our proposed method reduces the primal gap by 56.9% on average and closes it completely on combinatorial auction instances. Besides, we transferred the Gurobi-trained model zero-shot to SCIP without adaptation, achieving a 36.4% average gap reduction across benchmarks.

Layout

The package lives under src/encore/ (src layout), with three top-level entry modules — collect.py, train.py, and test.py — and the supporting code grouped into subpackages:

  • encore/data/ — instance formats and bipartite-graph extraction
  • encore/model/ — the agreement GCN
  • encore/solver_utils/ — solver callbacks, SCIP solving, fixing strategies

Install it with uv sync (or pip install -e .), which also provides the encore-collect, encore-train, and encore-test commands. Ready-to-run wrappers for the common workflows live in scripts/:

  • scripts/collect.sh — collect early-solution data (SOLVER, PROBLEM, SPLITS, ENSEMBLE select the solver, problem, splits, and ensemble mode)
  • scripts/train.sh — train the agreement GCN
  • scripts/test.sh — run prediction-guided inference (requires CHECKPOINT)

Each script forwards extra arguments to the underlying Python entry point.

Quick Start

Collect training data

Training data requires single (non-ensemble) early solutions, so pass --no-ensemble (ensemble collection is on by default):

# Gurobi
uv run python -m encore.collect --root . --problem IP --train --no-ensemble

# SCIP
uv run python -m encore.collect --root . --problem IP --solver scip --train --no-ensemble

Equivalently: ENSEMBLE=0 scripts/collect.sh and ENSEMBLE=0 SOLVER=scip scripts/collect.sh.

Collect an early-solution ensemble

Ensemble collection is the default (--ensemble-k defaults to 3):

uv run python -m encore.collect \
  --root . \
  --problem IP \
  --test

Add --solver scip to collect the ensemble with SCIP, or run SPLITS=test scripts/collect.sh.

Train

uv run python -m encore.train \
  --problem IP \
  --data-dir ./dataset \
  --train-split train \
  --valid-split valid \
  --output-dir ./logs/early_solution

Equivalently: scripts/train.sh.

Run inference with Gurobi

uv run python -m encore.test \
  --problem IP \
  --strategy ps \
  --checkpoint MODEL.ckpt \
  --test-dir ./instances/IP/IP_test \
  --early-solution-ensemble-dir ./dataset/IP_test/early_solution_ensemble \
  --output-dir ./logs/test

Add --solver scip to solve with SCIP, or run CHECKPOINT=MODEL.ckpt scripts/test.sh (SOLVER=scip for SCIP).

Select a fixing strategy with --strategy:

# Predict-and-Search (default): add one trust region around the predictions
uv run python -m encore.test ... --strategy ps

# Neural Diving: directly fix all selected variables
uv run python -m encore.test ... --strategy nd

# Apollo: predict, solve, verify, and permanently fix variables over four rounds
uv run python -m encore.test ... --strategy apollo

Apollo uses the problem-specific four-round fixing schedule from Apollo-MILP. Its default per-round time limits are 100, 100, 200, and 600 seconds. They can be overridden for short experiments:

uv run python -m encore.test ... \
  --strategy apollo \
  --apollo-time-limits 100 100 200 600

The fixing hyperparameters are centralized in src/encore/solver_utils/strategies.py and match downstream_new/hyperparams.py. Supported aliases include setcover, cauctions, combinatorial_auctions, item_placement, warehouse_allocation, load_balancing, and independent_set. ND supports IP/IS/WA/CA/SC; Apollo has four-round schedules for IP/WA/CA/SC.

Ensemble inference is enabled by default, averaging consistency predictions over the last --early-solution-ensemble-k (default 3) ensemble members. To fall back to a single early solution, disable it explicitly:

--no-early-solution-ensemble \
--early-solution-dir ./dataset/IP_test/early_solution

In ensemble mode, --early-solution-dir is not required and is not read. In single-solution mode, --early-solution-dir remains required.

Requirements

The main dependencies are PyTorch, PyTorch Geometric, Gurobi, and PySCIPOpt. A valid Gurobi license is required for the Gurobi collection and solving entry points.

Acknowledgements

This project is built upon the following projects:

About

EnCore: Learning to Refine Early-Stage Solutions for MILP Acceleration

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages