branch-and-bound

branch-and-bound is a skill for Claude Code from hajibabaie/combinatorial-optimization-skills. It costs 124 tokens per session (10,609 once invoked), scanned A, original, MIT.

An exact search method that explores a decision tree while discarding branches that cannot beat the best solution found so far. It uses estimates called bounds to decide which unfinished branches are worth checking.

In plain words
What is it for?
Use it to build exact solvers for discrete optimization problems, with pruning, dominance checks, and tracking of the current best solution.
Why use it?
Trying every combination can take too long, but an unchecked estimate may remove the best answer. This add-on helps design the branching, bounds, search order, and validation needed for a reliable custom solver.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

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

Good fit Use it to build exact solvers for discrete optimization problems, with pruning, dominance checks, and tracking of the current best solution.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/branch-and-bound"><img src="https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/branch-and-bound.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 124 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 10,609 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.00124 $0.10609
Opus 5 $0.00062 $0.05305
Sonnet 5 $0.00025 $0.02122
Haiku 4.5 $0.00012 $0.01061

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

Security

Grade A, and why

branch-and-bound 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 10d 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/branch-and-bound/SKILL.md · 783 lines

How it starts

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

Branch-and-Bound

You are an expert in exact combinatorial optimization, specifically in designing and implementing custom branch-and-bound (B&B) algorithms. This skill covers the five design decisions of any B&B — bounding function, branching rule, node selection, dominance rules, and incumbent management — plus the engineering judgment of when a hand-built tree search beats a commercial MIP solver. Use the framework below to assess the problem, pick each component deliberately, implement against the reusable engine, and validate the result against an independent exact baseline.

Initial Assessment

Before writing any code, establish the following. Each answer changes a design decision downstream.

  • Optimization sense. Minimization or maximization? Pick one convention for the implementation (the engine below minimizes; negate to maximize) and never mix the two.
  • Objective integrality. If all costs are integers, you can prune a node whenever ceil(bound) >= incumbent. This is free pruning power; confirm it before discarding it.
  • Instance size, now and at target scale. Estimate depth × branching factor. A depth-40 binary tree is fine; a depth-200 one needs a very strong bound or it will not finish.
  • Available relaxations. What can you solve fast that bounds the problem? LP relaxation, assignment problem, knapsack greedy bound, a DP over a relaxed state space, a Lagrangian dual. Measure the root gap (relaxation value vs best known solution) before committing — it is the single best predictor of tree size.
  • Bound cost vs bound strength. A bound evaluated a million times must be O(n) or amortized O(n); an O(n^3) bound must close the gap enough to pay for itself in pruned nodes.
  • MIP solver availability and license. If gurobipy (or HiGHS/SCIP) handles the formulation, build that model first as the correctness baseline and the performance bar to beat.
  • Proof requirement. Does the user need proven optimality, a certified gap (e.g., within 1%), or just the best solution found within a time budget? This sets the termination criterion and how you report results.
  • Memory budget. Best-first search can hold an exponential open list. Tight memory pushes you toward DFS or a hybrid.
  • Incumbent source. Is there a fast construction heuristic for an initial upper bound? Without an early incumbent, no bound-based pruning happens until the first leaf.
  • Dominance structure. Can two partial solutions over the same remaining decisions be compared componentwise (one weakly better in every respect)? If yes, dominance rules can prune more than bounds do.
  • Determinism and logging needs. Research use demands reproducible node counts: fix tie-breaking explicitly (insertion counters), fix seeds in instance generation, and log nodes explored/pruned and incumbent updates.
  • Future extensions. If the tree will later host column generation (branch-and-price) or custom cuts, branching decisions must be expressible inside the pricing/separation subproblem — design the node state accordingly.

Read the full file on GitHub · 783 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. 10d ago First seen · 783 lines · 124 tokens per session scan A 7b50b8556f90

Subscribe to this mod's changes

branch-and-bound is a skill published in the GitHub repository hajibabaie/combinatorial-optimization-skills (7 stars, last pushed 2mo ago), licensed MIT. It adds 124 tokens to every session and 10,609 once invoked, about $0.0006 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

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

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

promote

Generate X/Twitter release promotion posts with ASCII tables and CodeSnap rendering. Use when writing release posts, promotion tweets, plugin announcements, or preparing social media content for new versions.

oliver-kriska/claude-elixir-phoenix · 39 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