milp-modeling-gurobi

milp-modeling-gurobi is a skill for Claude Code from hajibabaie/combinatorial-optimization-skills. It costs 141 tokens per session (10,077 once invoked), scanned A, original, MIT.

A guide to building and solving mixed-integer linear programs in Python with Gurobi, an optimization solver. These models use equations and some whole-number decisions to find the best feasible choice.

In plain words
What is it for?
Use it for creating decision variables, constraints, objectives, solver settings, status checks, and solution extraction in Gurobi models.
Why use it?
It helps turn a clearly defined mathematical problem into solver code and handle results safely, including cases where the solver cannot find an answer.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the combinatorial-optimization plugin — 76 skills shipped together

Good fit Use it for creating decision variables, constraints, objectives, solver settings, status checks, and solution extraction in Gurobi models.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hajibabaie/combinatorial-optimization-skills/milp-modeling-gurobi
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add hajibabaie/combinatorial-optimization-skills --skill milp-modeling-gurobi
Clone the repo
git clone --depth 1 https://github.com/hajibabaie/combinatorial-optimization-skills

Made for: Claude Code.

Or install combinatorial-optimization, the plugin that ships this one along with the rest of its 76 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for milp-modeling-gurobi

README.md
[![agentmods](https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/milp-modeling-gurobi/github.svg)](https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/milp-modeling-gurobi)
Your own site
<a href="https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/milp-modeling-gurobi"><img src="https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/milp-modeling-gurobi/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for milp-modeling-gurobi

Your own site · 80×15
<a href="https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/milp-modeling-gurobi"><img src="https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/milp-modeling-gurobi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 141 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 10,077 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00141 $0.10077
Opus 5 $0.00071 $0.05038
Sonnet 5 $0.00028 $0.02015
Haiku 4.5 $0.00014 $0.01008

Measured 11d ago against content hash a4aefb7aa19d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

milp-modeling-gurobi scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/milp-modeling-gurobi/SKILL.md · 815 lines

How it starts

The opening of the file, as written. The whole thing — 815 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 the classification with the user before coding — it changes the model skeleton.
  • License and solver availability. Gurobi requires a license (free academic licenses exist; the pip install ships a size-limited trial). If there is no license, switch to open-source-solvers before investing in gurobipy-specific code.
  • Time budget and quality target. Proven optimality, 1% gap, or "best in 60 seconds"? This sets MIPGap and TimeLimit up front and decides whether a heuristic is the better tool entirely.
  • Data format and units. Where do coefficients come from (CSV, database, generated)? Check unit consistency: mixing cents with millions of dollars creates the numerical pathologies described under Practical Challenges.
  • Re-solve pattern. One-shot solve, or repeated solves with changing data (rolling horizon, decomposition loop)? Repeated solves favor model modification over rebuild and explicit Seed/Threads control for reproducibility.
  • Deliverable. A solution table, a reusable module, or an experiment harness? This determines how much of the Output Format section applies.

Read the full file on GitHub · 815 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 815 lines · 141 tokens per session scan A a4aefb7aa19d

Subscribe to this mod's changes

milp-modeling-gurobi is a skill published in the GitHub repository hajibabaie/combinatorial-optimization-skills (7 stars, last pushed 3mo ago), licensed MIT. It adds 141 tokens to every session and 10,077 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

python-backend-expert

This skill should be used when the user is writing, reviewing, debugging, or architecting Python backend code using Litestar or FastAPI with SQLAlchemy or Advanced Alchemy. Provides expert critique covering SOLID principles, hexagonal architecture, repository/service patterns, dependency injection, async correctness…

mathisk2095/jko-claude-plugins · 183 tokens

backend-development

Use when building or structuring a Python backend on FastAPI + SQLAlchemy 2.0 (async) + Alembic + Pydantic v2. Provides the opinionated project layout, the standard kit (auth, async jobs, caching, storage, observability), and best practices.

martian56/claude-engineer · 63 tokens

odoo-python

Use when writing or reviewing any Python in an Odoo module — models, computes, overrides, controllers, wizards. Carries PSAE review-derived principles for ORM correctness, performance, style, and security, plus references for exact patterns. Invoke before writing logic in models/, controllers/, or wizard/.

omas-odoo/odoo-superpowers · 64 tokens

odoo-python

Use when writing or reviewing any Python in an Odoo module — models, computes, overrides, controllers, wizards. Carries PSAE review-derived principles for ORM correctness, performance, style, and security, plus references for exact patterns. Invoke before writing logic in models/, controllers/, or wizard/.

assoumaaa/odoo-superpowers · 64 tokens

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

K-Dense-AI/scientific-agent-skills · 56 tokens

cobrapy

Constraint-based metabolic modeling (COBRA). FBA, FVA, gene knockouts, flux sampling, SBML models, for systems biology and metabolic engineering analysis.

K-Dense-AI/scientific-agent-skills · 38 tokens