lagrangian-relaxation

lagrangian-relaxation is a skill for Claude Code from hajibabaie/combinatorial-optimization-skills. It costs 131 tokens per session (10,956 once invoked), scanned A, original, MIT.

A guide to Lagrangian relaxation, a method for simplifying a difficult integer optimization problem by temporarily relaxing selected constraints and charging for their violation. The resulting prices are adjusted to produce useful bounds and feasible solutions.

In plain words
What is it for?
Use it to choose constraints to relax, solve the resulting subproblems, update prices with subgradient methods, compare bounds with the original linear relaxation, and build feasible solutions.
Why use it?
It helps obtain strong estimates of the best possible objective value when the original problem is hard to solve directly. It also provides a structured way to recover usable solutions from the simplified problem.

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 to choose constraints to relax, solve the resulting subproblems, update prices with subgradient methods, compare bounds with the original linear relaxation, and build feasible solutions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hajibabaie/combinatorial-optimization-skills/lagrangian-relaxation
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 lagrangian-relaxation
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 lagrangian-relaxation

README.md
[![agentmods](https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/lagrangian-relaxation/github.svg)](https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/lagrangian-relaxation)
Your own site
<a href="https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/lagrangian-relaxation"><img src="https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/lagrangian-relaxation/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 lagrangian-relaxation

Your own site · 80×15
<a href="https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/lagrangian-relaxation"><img src="https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/lagrangian-relaxation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 131 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 10,956 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.00131 $0.10956
Opus 5 $0.00066 $0.05478
Sonnet 5 $0.00026 $0.02191
Haiku 4.5 $0.00013 $0.01096

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

Security

Grade A, and why

lagrangian-relaxation 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/lagrangian-relaxation/SKILL.md · 722 lines

How it starts

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

Lagrangian Relaxation

You are an expert in Lagrangian relaxation for integer programming. This skill covers selecting which constraints to dualize, evaluating the Lagrangian dual, subgradient optimization with practical step-size rules, interpreting the duality gap, Lagrangian heuristics for primal recovery, and honest bound comparison against LP relaxations. Use the framework below to derive the relaxation on paper first, then implement the oracle, the multiplier update, and the heuristic as three separable pieces.

Initial Assessment

Establish these points before writing any model or code:

  • Coupling structure. Identify which constraints make the problem hard. Ask: if I delete this constraint family, what remains? The remainder must decompose or become polynomially solvable, otherwise relaxation buys nothing.
  • Subproblem algorithm. Name the algorithm that solves the relaxed subproblem (closed form, sort, shortest path, knapsack DP, assignment) and its complexity per oracle call. If you cannot name it, reconsider the dualization.
  • Integrality property check. Determine whether the subproblem's LP relaxation has integral extreme points. If it does, the Lagrangian dual equals the LP bound (Geoffrion 1974) and the value of the exercise is speed and heuristics, not a tighter bound. Decide whether that is acceptable.
  • Number of multipliers. One multiplier per dualized row. Hundreds to a few thousand is comfortable for subgradient methods; far more suggests dualizing a different family or aggregating.
  • Constraint sense. Equality rows get free multipliers; inequality rows get sign-constrained multipliers with projection. Get this right before coding.
  • Purpose of the bound. Standalone quality certificate, bound inside a custom branch-and-bound, or guidance for a heuristic? This sets the iteration budget and the stopping tolerance.
  • Upper-bound source. The Polyak step size needs a finite upper bound. Plan the Lagrangian heuristic (or an external construction heuristic) before tuning the dual loop; see warm-starts-and-initial-solutions.
  • Data properties. Integer capacities or weights enable pseudo-polynomial DP subproblems. Cost magnitudes affect multiplier scaling; consider normalizing costs to a common range.
  • Verification baseline. Decide how you will validate: solve small instances exactly with a MIP solver, and compute the LP relaxation of the same formulation you compare against (weak vs strong formulations give different z_LP).
  • Time budget. An oracle call is usually cheap; budget iterations (200-1000 typical) and decide how often the heuristic runs (every 1-10 iterations).

Read the full file on GitHub · 722 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 · 722 lines · 131 tokens per session scan A 523383dd4449

Subscribe to this mod's changes

lagrangian-relaxation is a skill published in the GitHub repository hajibabaie/combinatorial-optimization-skills (7 stars, last pushed 3mo ago), licensed MIT. It adds 131 tokens to every session and 10,956 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

phx-deps-audit

Audit Hex deps for supply-chain security risk — bidi chars, compile-time exec, maintainer changes, typosquats, CVEs. Use after mix deps.update, when checking if a package upgrade is safe, or reviewing mix.lock PR diffs.

oliver-kriska/claude-elixir-phoenix · 58 tokens

release

CONTRIBUTOR TOOL - Cut a plugin release: bump plugin.json version, finalize CHANGELOG, update README if needed, gate on make ci, commit, tag vX.Y.Z, and create the GitHub release. Use when shipping a new plugin version. NOT distributed.

oliver-kriska/claude-elixir-phoenix · 60 tokens

session-deep-dive

Deep qualitative analysis of high-signal sessions. Spawns subagents with v2 template, synthesizes patterns, compares against known findings. Use after /session-scan.

oliver-kriska/claude-elixir-phoenix · 40 tokens

catchup

Summarize and review what changed while you were away. Use after a weekend, vacation, or flight to check missed PRs, git commits, Linear tickets, and meetings — one prioritized brief, not a firehose.

oliver-kriska/claude-elixir-phoenix · 48 tokens

brainstorm

Brainstorm Elixir/Phoenix features — explore ideas, compare approaches, gather requirements. Use when vague idea, not sure how to approach, or want to discuss before plan.

oliver-kriska/claude-elixir-phoenix · 39 tokens

learn-from-fix

Capture Elixir/Ecto/LiveView lessons and Hex API rules. Use after corrections or when asked to document learning, record a lesson, prevent a fixed mistake, or remember package guidance with --library.

oliver-kriska/claude-elixir-phoenix · 46 tokens