milp-solver-workflow
Use for formulating, solving, debugging, and validating mixed-integer linear optimization models with open-source solvers, including variable indexing, sparse constraints, linearized costs, solver limits, MIP gaps, incumbent extraction, numerical tolerances, and deterministic output reporting.
Install / Use
npx skills add benchflow-ai/skillsbench --skill milp-solver-workflowInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AutomationSupported Platforms
Tags
Our assessment of milp-solver-workflow
milp-solver-workflow scores 92/100 on our quality scale, 794th of 3,055 Automation skills we index (top 26%).
Its SKILL.md is 6.4 KB long, well organised into 14 sections with 5 code examples: a thorough specification that gives an agent plenty to work with.
With 1,813 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so milp-solver-workflow is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.
Automated pattern scan on 2026-10-02. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
milp-solver-workflow compared with similar skills
All 4 of these similar skills score higher than milp-solver-workflow; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| milp-solver-workflow (this skill)by benchflow-ai | 92 | 1.8k | 2mo ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 87.6k | 16d ago | CLAUDE.md |
| rufloby ruvnet | 100 | 73.7k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 85.1k | 1d ago | MCP Server |
| algorithmic-artby anthropics | 100 | 177.9k | 9d ago | SKILL.md |
Frequently asked questions
- How do I install milp-solver-workflow?
- Run
npx skills add benchflow-ai/skillsbench --skill milp-solver-workflow. The install tabs above show the steps for each supported agent. - Which AI agents does milp-solver-workflow work with?
- It is written for Zed, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is milp-solver-workflow safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is milp-solver-workflow still maintained?
- The repository was last updated about 2 months ago, so milp-solver-workflow is actively maintained.
Skill content
View source on GitHubname: milp-solver-workflow description: Use for formulating, solving, debugging, and validating mixed-integer linear optimization models with open-source solvers, including variable indexing, sparse constraints, linearized costs, solver limits, MIP gaps, incumbent extraction, numerical tolerances, and deterministic output reporting.
MILP Solver Workflow
Use this skill for binary/integer decisions, linear constraints, and linear or piecewise-linear objectives. It is useful for time-expanded scheduling models with many repeated resource-period constraints.
This is a workflow and implementation guide, not a complete formulation for any one task.
Workflow
- Parse and normalize data into ordered arrays.
- Define decision states before coding: status, transitions, continuous quantities, slacks, segments, tiers.
- Build a deterministic variable map.
- Add constraints family by family: bounds, linking, balance, time coupling, capacity/ramp limits, cost logic.
- Solve with an available open-source MILP solver.
- Extract a candidate solution, rounding binaries only if near integral.
- Convert internal variables into the report convention.
- Independently validate extracted arrays.
- Recompute objective and summaries from extracted arrays.
- Write final output only after validation passes.
Variable Map Pattern
Use helper functions or dictionaries, not scattered index arithmetic.
offset = {}
n = 0
def alloc(name, shape, lb=0.0, ub=float("inf"), integer=False):
global n
size = int(np.prod(shape))
idx = np.arange(n, n + size).reshape(shape)
offset[name] = idx
n += size
return idx
u = alloc("commitment", (G, T), lb=0, ub=1, integer=True)
start = alloc("startup", (G, T), lb=0, ub=1, integer=True)
dispatch = alloc("dispatch", (G, T), lb=0)
reserve = alloc("reserve", (G, T), lb=0)
Keep variable ownership obvious: type, resource, period, and optional segment/tier.
Sparse Constraint Pattern
Use sparse rows for large time-expanded models:
rows, cols, vals = [], [], []
lb, ub = [], []
row = 0
def add_row(terms, lo, hi):
global row
for j, a in terms:
if abs(a) > 0:
rows.append(row)
cols.append(j)
vals.append(float(a))
lb.append(float(lo))
ub.append(float(hi))
row += 1
Use equality rows for conservation/linking and upper/lower bound rows for capacity, reserve, ramping, timing, and logic.
Sign-Safe Encoding
Write the intended inequality first, then move variable terms to the left-hand side.
# Intended: x + y <= cap * u - reduction * start
# Row form: x + y - cap*u + reduction*start <= 0
add_row(
[(x, 1.0), (y, 1.0), (u, -cap), (start, reduction)],
lo=-INF,
hi=0.0,
)
For non-obvious rows, test a tiny hand case. Example: set u=1, start=1 and check the remaining capacity equals the intended startup capability; set u=1, start=0 and check normal capacity returns.
Match Model Rows To Validation
Keep a checklist linking each model constraint family to a validation check:
transition linking -> startup/shutdown match status
online capacity -> offline zeroes and min/max output
joint reserve capacity -> production plus reserve fits capability
ramp deliverability -> reserve can be deployed within ramp-up
minimum durations -> starts/stops imply required status windows
balance equations -> demand/load/inventory conservation
cost-curve logic -> recomputed objective matches report
If validation checks something not in the model, the solver may produce an invalid report. If the model has a constraint not validated after extraction, conversion bugs can slip through.
Piecewise-Linear Costs
Identify the curve convention before modeling:
- total cost at output breakpoints;
- marginal or incremental segment cost;
- heat-rate curve;
- first point as minimum-output or no-load-like cost.
For segment variables, constrain segment quantities to their widths and sum them to the modeled production quantity. Use slopes only when the data represents total-cost breakpoints or incremental segment costs consistently.
Open-Source Solver Use
HiGHS through SciPy is a common default when available:
from scipy.optimize import milp, LinearConstraint, Bounds
result = milp(
c=c,
integrality=integrality,
bounds=Bounds(lb, ub),
constraints=constraints,
options={"time_limit": 600.0, "mip_rel_gap": 0.01, "disp": False},
)
if result.x is None:
raise RuntimeError(f"No incumbent: status={result.status}, message={result.message}")
Capture status, objective, incumbent values, and any reliable gap/bound. A time-limit status can be useful if a feasible incumbent exists; a failure with no incumbent is not a solution.
Extraction And Validation
After solving:
- check binary variables are close to 0/1 before rounding;
- convert internal units/conventions to report units;
- recompute summaries from arrays;
- recompute objective from input data and extracted decisions;
- run validation that reads only input data plus extracted/report arrays;
- write
"pass"self-checks only after validation passes.
Debugging Infeasibility
First suspect the model encoding. Common causes:
- mixing total output with output above minimum;
- applying startup/shutdown limits to the wrong quantity;
- using the wrong
tort-1index; - over-constraining initial minimum up/down obligations;
- enforcing post-horizon obligations when the prompt excludes them;
- treating cost curves as feasibility constraints;
- choosing bad Big-M values;
- requiring segment/tier variables when the trigger did not occur.
Debug in stages: check shapes, relax one family at a time, add diagnostic slack variables, print largest violations, and compare local validation with final requirements.
Repair LPs And Heuristics
A fixed-commitment repair LP is useful only if it includes every feasibility family judged in the final report. Do not repair only balance and capacity while omitting transition-dependent ramp, reserve, startup, shutdown, or minimum-duration limits.
Always rerun independent validation after repair.
Reporting Discipline
- Use deterministic ordering and plain numeric values.
- Do not include placeholder values.
- Keep feasibility separate from proof quality/MIP gap.
- Use
null/empty gap when no reliable bound exists, if the schema allows it. - Do not trust solver status or self-reported
"pass"strings without validation.
Related Skills
Agent-Reach
87.6kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
ruflo
73.7k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Scrapling
85.1k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
