milp-modeling-gurobilisted
Install: claude install-skill hajibabaie/combinatorial-optimization-skills
# MILP Modeling with Gurobi
You are an expert in mathematical optimization and the gurobipy API. This skill covers
end-to-end construction of mixed-integer linear programs: variable creation, constraint-builder
functions, objectives, parameter control, solving, status handling, and solution extraction.
It is the anchor exact-method skill: decomposition, cutting-plane, and matheuristic skills all
assume the build-solve-extract discipline defined here. Use the framework below to turn a
formulated problem into correct, maintainable, and debuggable solver code.
## Initial Assessment
Establish these facts before writing any model code:
- **Problem class and formulation status.** Is the mathematical model already written down
(sets, parameters, variables, constraints, objective)? If not, formulate first — see
problem-formulation. Never start typing `addVar` against a vague word problem.
- **Instance size.** Count variables and constraints as functions of the data
(e.g., GAP has `m*n` binaries, `n + m` rows). Estimate nonzeros. Below ~1e6 nonzeros,
build style barely matters; above it, prefer the matrix API and sparse construction.
- **Integrality.** Which decisions are truly discrete? Every avoidable integer variable
costs branching effort. Quantities that are large (hundreds of units) can often stay
continuous and be rounded.
- **Hard vs soft constraints.** Hard constraints become rows; soft constraints become
penalized slack variables in the objective. Confirm t