Part VI · making it real · spine

27

Modelling for a real solver

What presolve does and what defeats it, symmetry, big-M against indicators, starts, reading the log, and the discovery that most single-run speed-ups are noise.

needs 26, 08~1½ h slides + 2½ h lablab: uv run co lab 27

27 · overview

The route

1 · what the solver does before branching

Presolve, bound and coefficient tightening; the habits that defeat them; indicators.

2 · symmetry

Why interchangeable objects cost exponentially, and three ways to stop paying.

3 · starts, bounds, reformulation

MIP starts, solution pools, bounds from heuristics, and changing the model entirely.

4 · logs and variability

Reading a statistics report; seeds; MIPLIB 2017 as shared reality.

getting around

Words with a dotted underline are glossary terms: click one for its definition. G lists every term in the unit, N shows the notes. Optional extra: interactive figures, linked from the slides they support by a small ▸ chip; skip them freely.

section 1

Before branching

The model the solver actually solves isn't the one you wrote.

27 · presolve · example

The running example: five items, bins of 5

Sizes $3, 3, 2, 2, 2$ (total 12), capacity 5. Any bin holds a 3 and a 2, or two 2s, or one item.

whatbins
first-fit decreasing: $\{3,2\}\{3,2\}\{2\}$3
area bound $\lceil 12/5 \rceil$3
Martello–Toth L23
optimum3

Here the heuristic and the bounds already agree: 3 is proved without any search.

three models, three LP bounds
modelLP
A: capacity constraints, separate $x \le y$1.0
B: capacity linked, $\text{load} \le 5\,y$2.4
F: arc flow2.5

A's LP spreads every item as ⅕ over five bins, each bin open only ⅕. B's LP is the area bound $12/5$. Arc flow's 2.5 rounds up to the optimum: the round-up property.

27 · presolve

What presolve does, and what defeats it

reductionexample
bound tightening$x + 10y \le 12$, $y \in \{0,1\}$ ⇒ $x \le 12$
coefficient tightening$x \le 1000y$ with $x \le 50$ ⇒ $x \le 50y$
dual fixinga variable that only hurts the objective and only helps constraints → its bound
aggregation$x = y + z$ substituted away
probingfix a binary both ways and learn implications
clique detectionpairwise conflicts merged into one constraint

Achterberg et al., "Presolve reductions in mixed integer programming", INFORMS JoC 32 (2020).

modelling habits that defeat it
  • Big-M larger than it needs to be. Presolve can tighten some; it can't know your data's true range.
  • Unbounded continuous variables feeding big-M constraints: nothing to tighten from.
  • Redundant formulations that hide structure, like one aggregated constraint in place of many disaggregated ones (unit 05).
  • Numerically wide coefficients (1e-6 next to 1e6): tolerances start to bite, and cuts get rejected.
indicator constraints instead of big-M

$y = 1 \Rightarrow a^\top x \le b$, stated as such. The solver chooses between big-M reformulation (with the tightest M it can derive), branching on the implication, or SOS1. It's often better, sometimes worse. Measure.

27 · presolve · example

Two reductions, on a two-constraint model

$$\begin{aligned} & x + 10\,y \le 12 \\ & x \le 1000\,y \\ & 0 \le x \le 50,\quad y \in \{0, 1\} \end{aligned}$$
step 1: bound tightening

Constraint 1 with $y \ge 0$ gives $x \le 12 - 10y \le 12$. The bound $x \le 50$ becomes $x \le 12$.

step 2: coefficient tightening

Constraint 2 only matters when $y = 0$, where it says $x \le 0$. When $y = 1$ it allows 1000, but $x$ can't exceed 12 anyway. So 1000 can shrink to 12: $x \le 12\,y$, the same integer solutions.

what it changes for the LP

The point $x = 11$, $y = 0.011$ satisfies the original constraints: $11 + 0.11 \le 12$ and $11 \le 11$. After step 2 it needs $11 \le 0.132$: cut off.

Same integer points, a much tighter relaxation. That is the whole value of presolve, and why the tightening in step 2 needed step 1's bound first.

If $x$ had no upper bound (the "unbounded continuous variable" habit), constraint 1 still supplies $x \le 12$. Without it as well, nothing bounds $x$, and the 1000 has to stay.

section 2

Symmetry

The single biggest lever on many models.

27 · symmetry

Interchangeable objects cost $k!$

In the assignment model (symmetry), any permutation of the bins maps a packing to another packing of the same cost. With 17 bins, every solution has up to 17! ≈ 3.6 × 10¹⁴ copies, and branch and bound can prove infeasibility of a subtree only by visiting its copies too.

three ways to stop paying
  • Symmetry-breaking constraints (lex-leader, Crawford et al. 1996): keep one representative per orbit. Lab: $y_b \ge y_{b+1}$, item $i$ only in bins $0..i$.
  • Orbitopes (Kaibel & Pfetsch 2008): the convex hull of lexicographically sorted 0/1 matrices, with a propagation algorithm.
  • Orbital branching and fixing (Ostrowski et al. 2011): detect the symmetry group, branch on orbits, fix variables in the same orbit.
the interaction

Modern solvers detect symmetry themselves (SCIP: misc/usesymmetry). Explicit constraints can duplicate that work, or conflict with the solver's choice of representative.

Lab then, same linked model:

variantsolvedSGM s
B SCIP symmetry handling on8/105.32
B′ off8/104.00
C on + your constraints9/103.80

Within noise: four seeds on one instance gave B 20, 15.3, 20, 1.7 s and B′ 1.6, 11.3, 2.8, 11.4 s.

27 · symmetry · example

Symmetry, counted on the example

Pack the five items into 3 labelled bins, 0, 1, 2. Count the assignments that use all three bins:

whatcount
different packings (bins unlabelled)12
labellings of each packing$3! = 6$
optimal assignments the model sees72
… with "item $i$ only in bins $0..i$"12

The constraint keeps exactly one labelling per packing: 72 copies become 12 solutions.

one packing, all its copies

Packing $\{3_a, 2_a\}\ \{3_b, 2_b\}\ \{2_c\}$ as "bin of each item" (items in order $3_a, 3_b, 2_a, 2_b, 2_c$):

01012, 02021, 10102, 12120, 20201, 21210

Only 01012 has every item $i$ in a bin numbered at most $i$. A branch-and-bound tree proving "no 2-bin packing" would otherwise meet this packing six times.

section 3

Starts, bounds, reformulation

Tell the solver what you know.

27 · what you know

Bounds, starts, and a different model

  • Upper bound → smaller model (the bounded model). First-fit decreasing packs into at most $\frac{11}{9}\mathrm{OPT} + \frac69$ bins, so no more bins than that are needed.
  • Lower bound → fixings. Martello–Toth L2 ≥ ⌈Σ/C⌉. With symmetry broken, bins $0..L_2-1$ must be used.
  • MIP start. A feasible solution before the first node: an incumbent for pruning, a seed for improvement heuristics. Solution pools keep several.
  • Reformulation. Arc flow (Valério de Carvalho 1999): one path per bin through capacities 0..C, pseudo-polynomial size. Its LP equals Gilmore–Gomory's pattern LP (unit 10).
configurationsolvedSGM smedian nodes
A x ≤ y linking6/109.97942
B capacity linked8/105.32870
C + symmetry breaking9/103.80598
D + FFD bins, L2 fixing10/103.431 380
E + FFD as a start9/103.021 576
F arc flow10/101.401

10 instances, SCIP 10, 20 s limit, shift 1 s.

Arc flow's LP proves optimality at the root on these instances. On the triplet instances (C = 1000) its graph is ten times bigger and it's slower than C–E.

27 · what you know · example

The arc-flow graph of the example

012 345 size-3 arcs size-2 arcs ×2 ×3

A bin is a path from 0 to 5: its item arcs are its contents, loss arcs (along the line) are empty space. Thick: two bins "3 then 2". Dashed: one bin "waste 1, then 2, then 2".

reading the optimal flow

2 units along $0 \xrightarrow{3} 3 \xrightarrow{2} 5$ and 1 unit along $0 \to 1 \xrightarrow{2} 3 \xrightarrow{2} 5$. Flow out of node 0 is 3: three bins.

Size-3 arcs carry 2 (two items of size 3), size-2 arcs carry $1 + 3 = 4 \ge 3$: the extra unit is a 2-slot left empty.

The graph has 3 + 4 item arcs and 5 loss arcs for capacity 5. At capacity 1000 it has thousands: the pseudo-polynomial size of the previous slide.

No bin labels appear anywhere, so there is no symmetry to break.

section 4

Logs and variability

Where did the time go, and would it go there again?

27 · the log

Reading a SCIP statistics report

sectionread it for
Presolverswhich reductions fired: fixed vars, deleted constraints, changed coefficients
Constraintswhich constraint handlers did the propagating and separating
Separatorscuts found and applied per family; > rows split a separator by cut class
Primal Heuristicswhich heuristic found solutions, and which found the best
Branching Ruleshow many children, cutoffs and domain reductions
B&B Treenodes (total), depth, nodes left
Root Nodefirst LP value against the final dual bound: what cuts bought
Solutionprimal and dual bounds, gap, found by <heuristic>
diagnosis by pattern
  • Dual bound stuck at the first LP value, many nodes: a weak relaxation. Reformulate or add structure.
  • Incumbent late or never, bound fine: give a start, or check heuristics.
  • Huge node count, gap closing slowly: symmetry, or branching on the wrong variables.
  • Time in presolve or root LP: model size or numerics, before any search.

Lab step 6 parses the statistics report into a dict and checks it against SCIP's API. Its traps: "nodes" appears twice, and "cut pool" isn't a separator.

27 · variability

Performance variability: the same model, different seeds

Four SCIP random seeds on instances where consecutive configurations disagreed (seconds, 20 = limit):

instance, stepbeforeafter
triplets #1, A → B20 13.8 12.5 206.4 1.9 3.1 2.0
triplets #3, B → B′20 15.3 20 1.71.6 11.3 2.8 11.4
uniform #3, B′ → C20 2.9 7.1 8.62.9 3.2 9.6 10.7
uniform #2, D → E15.9 19.3 1.9 2020 1.7 10.0 4.9
uniform #2, E → F20 1.7 10.1 4.90.4 0.4 0.3 0.3
what survives

Linking (A → B) and reformulation (→ F). The rest are within noise on ten instances. Two runs of the whole script also disagreed on solved counts (A: 5 then 6; B: 9 then 8), because runs near the time limit flip.

MIP solvers are chaotic in the technical sense (performance variability): a tiny change (a seed, constraint order, a different but equivalent model) changes branching decisions early, and the tree grows differently from there. Lodi & Tramontani (2013) document this across solvers.

MIPLIB 2017 (Gleixner et al. 2021): 1 065 instances, a 240-instance benchmark set, and many still open. The shared reality check. then section 2 runs any MIPLIB files you download.

27 · lab

Lab 27 — what you build

about 2½ hours · uv run co lab 27
  1. The assignment model, weak and linked, integer and LP.
  2. Symmetry-breaking constraints.
  3. Bounds: first-fit decreasing, Martello–Toth L2, and the bounded model.
  4. A MIP start, checked before it's offered.
  5. The arc-flow reformulation.
  6. A parser for SCIP's statistics report.
uv run co test 27
uv run co then 27     # seven configurations × ten instances · per-instance times · seed re-runs (≈ 30 min)

27 · checkpoint

Done when

checkpoint
  • All six lab steps are ✓.
  • A before/after table of your own model with one row per intervention and the time each bought, and no row you can't explain, including "within noise" with the evidence.
  • You can read a statistics report and say where the time went.

Reading

Achterberg et al., INFORMS JoC 32 (2020).
Lodi & Tramontani, TutORials in OR (2013).
Margot, in 50 Years of Integer Programming (2010).
Delorme, Iori & Martello, EJOR 255 (2016).

Next

28 experimental method: the harness, the plots, and an audit of earlier conclusions.