- Home
- Skills
- Business & Operations
- Integer linear programming (ILP) formulation
Integer linear programming (ILP) formulation
Design, assemble, and rigorously audit modular ILP models, with exact proofs of which constraints are truly ideal.
$20
Works with the AI tools you already use
Integer linear programming (ILP) formulation
Example session with this skill installed
Formulate minimum graph colouring as an ILP in MathProg, and colour this graph: vertices 1–4, edges 1–2, 2–3, 3–4, 4–1, 1–3.
- Read your context and instructions
- Compiled the integer linear programming
1 — structured problem summary (the skill's Phase 1):
SETS: V (vertices), E ⊆ V×V (edges), C = 1..|V| (colour slots)
ESSENTIAL VARS: x[v,c] ∈ {0,1} — vertex v takes colour c
AUXILIARY VARS: w[c] ∈ {0,1} — colour c is used
CONSTRAINTS (essential): each vertex exactly one colour; edge endpoints can't
share a colour (and that colour then counts as used)
CONSTRAINTS (symmetry): use colours in index order — kills colour-permutation symmetry
OBJECTIVE: minimize Σ_c w[c] (number of colours used)
2 — the MathProg model (min_colouring.mod):
set V; # vertices
set E within V cross V; # edges
param K := card(V); # upper bound on colours
set C := 1..K; # colour slots
var x{V, C} binary; # x[v,c] = 1 iff vertex v gets colour c
var w{C} binary; # w[c] = 1 iff colour c is used
minimize Colours: sum{c in C} w[c];
s.t. OneColour{v in V}: sum{c in C} x[v,c] = 1;
s.t. Proper{(u,v) in E, c in C}: x[u,c] + x[v,c] <= w[c];
s.t. SymBreak{c in C: c < K}: w[c] >= w[c+1]; # use colours in order
solve;
printf "colours used = %d\n", sum{c in C} w[c];
for {v in V} printf "vertex %d -> colour %d\n", v, sum{c in C} c * x[v,c];
data;
set V := 1 2 3 4;
set E := (1,2) (2,3) (3,4) (4,1) (1,3);
end;
3 — solve it (glpsol --math min_colouring.mod):
colours used = 3
vertex 1 -> colour 1
vertex 2 -> colour 2
vertex 3 -> colour 3
vertex 4 -> colour 2
(The triangle 1–2–3 forces 3 colours; vertex 4 reuses colour 2. χ = 3. ✓)
4 — the value-add the skill flags: colouring is the textbook symmetry trap — any colour relabelling is an equivalent solution, which balloons the search. The SymBreak line (w[c] ≥ w[c+1]) is the skill earning its keep: it spots the symmetry and breaks it, rather than just transcribing the obvious model.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
Most ILP/MILP modeling goes wrong in one of two ways: the model grows into one unmaintainable file, and people claim their constraints are tight or "ideal" without ever proving it. This skill fixes both.
Developed by a MILP practitioner with over 20 years of experience in industry and academia, this skill guides you through a disciplined five-phase workflow: problem definition → modular formulation → assembly → tightness audit → refinement. Your modular optimization model in GLPK/MathProg is then compiled into the universal LP format. Jump in at any phase: start from scratch, add a constraint module, assemble modules into one runnable file, or audit an existing formulation.
What sets it apart: a real tightness audit. Phase 4 doesn't eyeball your constraints; it proves whether a constraint family is ideal using exact-rational convex-hull / vertex enumeration (the cddlib engine, which ports to Python via pycddlib or to R via rcdd). A seven-check method covers total unimodularity, McCormick envelopes, big-M vs disaggregation, and modern-solver cut recovery, so you stop shipping "valid inequalities" that do nothing and learn which ones actually matter.
Modular by construction. Bundled helpers (assembleModel, parseModule, checkDependencies, findDuplicateNames) merge ordered .mod modules into one runnable model, catch duplicate declarations, and verify dependencies, so large models stay readable across sessions.
Battle-tested, not theoretical. Stress-tested on classic Erwin Kalvelagen's examples and used to audit ILPs from multiple published papers (validated against Gurobi, CPLEX, and CBC). Encodes hard-won heuristics, such as: for modern solvers prioritize model-size reductions over LP-relaxation tightening, since a good cut engine recovers bound tightenings for free but can't shrink a bloated model.
Who it is for: operations researchers, MILP practitioners, and anyone formulating combinatorial problems (job or staff scheduling, vehicle routing, network design) who wants provably correct, tight, maintainable models.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 3 months ago
- Passed all security checks, Safe to install