Agent skill

Routing Subtour Elimination

by Raidriar7170 in Raidriar7170/hermes-skilleval

Subtour-elimination methods for TSP, VRP, pickup/dropoff routing, and routing MIPs with binary arc variables.

MITAuto-check passedData & Analytics

Install Routing Subtour Elimination

skills CLI
$ npx skills add Raidriar7170/hermes-skilleval --skill routing-subtour-elimination -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Raidriar7170/hermes-skilleval routing-subtour-elimination --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Raidriar7170/hermes-skilleval.git skills-src && mkdir -p .claude/skills && cp -r skills-src/artifacts/v0.3/skillsbench-pilot/v0.3-stage2-input-package-candidate-20260701T010000Z/candidate-data/skill-sources/skillsbench__routing-subtour-elimination .claude/skills/routing-subtour-elimination && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
routing-subtour-elimination
GitHub stars
125
Used in
1 other repo
Token cost
~2.2k tokens
SKILL.md length
605 words
Files
1
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

Subtour-elimination methods for TSP, VRP, pickup/dropoff routing, and routing MIPs with binary arc variables.

  • Works in 4 steps: MTZ Order Constraints → Single-Commodity Flow Connectivity → DFJ Subset Cuts → …
  • Route-continuity constraints may permit disconnected cycles and the model needs MTZ constraints
  • SKILL.md covers Required Base Route Constraints, 1. MTZ Order Constraints, 2. Single-Commodity Flow… and 3. DFJ Subset Cuts, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Routing Subtour Elimination is an agent skill from Raidriar7170/hermes-skilleval. Subtour-elimination methods for TSP, VRP, pickup/dropoff routing, and routing MIPs with binary arc variables. Use when route-continuity constraints may permit disconnected cycles and the model needs MTZ constraints, flow-based connectivity constraints, DFJ subset cuts, or lazy/iterative subtour cuts.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Data & Analytics. It works with Python. The repository describes itself as: Verification-gated skill routing and self-improvement harness for Hermes-style agent skills. The licence is MIT.

When your agent uses it

  • Route-continuity constraints may permit disconnected cycles and the model needs MTZ constraints
  • Flow-based connectivity constraints
  • DFJ subset cuts
  • Lazy/iterative subtour cuts

Example prompts

  • “/routing-subtour-elimination”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. MTZ Order Constraints
  2. Single-Commodity Flow Connectivity
  3. DFJ Subset Cuts
  4. Lazy or Iterative Cut Separation

What it can do on your machine

Read from SKILL.md and the folder at commit 8f6a21e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Routing Subtour Elimination loads about 2.2k tokens when it runs. Until then it costs about 82 tokens; SKILL.md has 605 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~82
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Raidriar7170/hermes-skilleval at commit 8f6a21e, republished under its MIT licence (© Raidriar7170). 605 words, ~2,176 tokens.

Download SKILL.mdSave it as .claude/skills/routing-subtour-elimination/SKILL.md (or your agent's skills folder).
name
routing-subtour-elimination
description
Subtour-elimination methods for TSP, VRP, pickup/dropoff routing, and routing MIPs with binary arc variables. Use when route-continuity constraints may permit disconnected cycles and the model needs MTZ constraints, flow-based connectivity constraints, DFJ subset cuts, or lazy/iterative subtour cuts.

Routing Subtour Elimination

In routing MIPs, degree and continuity constraints are not enough. A vehicle can have one depot-to-depot path and a separate closed cycle among stations. Add subtour-elimination constraints whenever binary arc variables decide routes.

Use this base notation:

python
START = "depot_start"
END = "depot_end"
vehicles = range(K)
stations = range(n)
from_nodes = [START, *stations]
to_nodes = [*stations, END]
arcs = [(i, j) for i in from_nodes for j in to_nodes if i != j and not (i == START and j == END)]

x = {(v, i, j): model.addVar(vtype="B", name=f"x_{v}_{i}_{j}") for v in vehicles for i, j in arcs}

Required Base Route Constraints

Subtour elimination assumes each selected station has matching inbound and outbound route arcs.

python
for v in vehicles:
    model.addCons(quicksum(x[v, START, j] for j in stations) == 1)
    model.addCons(quicksum(x[v, i, END] for i in stations) == 1)

    for i in stations:
        incoming = quicksum(x[v, j, i] for j in from_nodes if j != i)
        outgoing = quicksum(x[v, i, j] for j in to_nodes if j != i)
        model.addCons(incoming == outgoing)
        model.addCons(outgoing <= 1)

The subtour methods below prevent station-only cycles that are disconnected from START.

1. MTZ Order Constraints

MTZ adds an order variable for each vehicle-station pair. If vehicle v travels from station i to station j, then order[v, j] must be greater than order[v, i].

python
order = {
    (v, i): model.addVar(vtype="C", lb=1, ub=max(1, n), name=f"order_{v}_{i}")
    for v in vehicles
    for i in stations
}

for v in vehicles:
    for i in stations:
        for j in stations:
            if i != j:
                model.addCons(order[v, i] - order[v, j] + n * x[v, i, j] <= n - 1)

Pros:

  • Compact: O(K n^2) constraints and O(K n) extra variables.
  • Easy to implement in common Python optimization APIs.
  • Good default for small and medium benchmark instances.

Cons:

  • LP relaxation is weak compared with cutset or flow formulations.
  • Can be slow for larger VRPs.
  • Order variables are artificial; do not interpret them as service times unless you also model time.

Use MTZ first when correctness and implementation speed matter more than best possible MIP strength.

2. Single-Commodity Flow Connectivity

Add an artificial connectivity flow that starts at the depot and sends one unit to every visited station. This flow is not physical vehicle load.

python
visit = {
    (v, i): quicksum(x[v, i, j] for j in to_nodes if j != i)
    for v in vehicles
    for i in stations
}

flow_arcs = [(i, j) for i in [START, *stations] for j in stations if i != j]
f = {
    (v, i, j): model.addVar(vtype="C", lb=0, ub=n, name=f"conn_flow_{v}_{i}_{j}")
    for v in vehicles
    for i, j in flow_arcs
}

for v in vehicles:
    total_visits = quicksum(visit[v, i] for i in stations)
    model.addCons(quicksum(f[v, START, j] for j in stations) == total_visits)

    for i, j in flow_arcs:
        model.addCons(f[v, i, j] <= n * x[v, i, j])

    for i in stations:
        incoming_flow = quicksum(f[v, h, i] for h in [START, *stations] if h != i)
        outgoing_flow = quicksum(f[v, i, j] for j in stations if j != i)
        model.addCons(incoming_flow - outgoing_flow == visit[v, i])

Pros:

  • Stronger connectivity logic than MTZ in many models.
  • Static constraints, no callback needed.
  • Works with optional station visits.

Cons:

  • Adds O(K n^2) continuous variables.
  • Do not reuse truck load as the connectivity flow when the vehicle can both pick up and drop off. Physical load can increase and decrease; connectivity flow should monotonically distribute artificial units.
  • More memory than MTZ.

Use this when MTZ gives weak incumbents or slow progress and the instance is still modest in size.

3. DFJ Subset Cuts

For every nonempty proper subset S of stations, selected station-to-station arcs inside S cannot form a closed cycle:

text
sum_{i in S, j in S, i != j} x[v,i,j] <= |S| - 1

For very small n, static enumeration is possible:

python
from itertools import combinations

for v in vehicles:
    for r in range(2, n):
        for S_tuple in combinations(stations, r):
            S = set(S_tuple)
            model.addCons(
                quicksum(x[v, i, j] for i in S for j in S if i != j) <= len(S) - 1
            )

Pros:

  • Strong, direct subtour elimination.
  • No artificial order or flow variables.

Cons:

  • Exponential number of constraints.
  • Static enumeration is only acceptable for small station counts.

Use static DFJ only for tiny instances or as a debugging baseline.

Show full SKILL.md (255 more words)Show less

4. Lazy or Iterative Cut Separation

The strongest practical pattern is to solve with base route constraints, detect subtours in incumbents, add only the violated DFJ cuts, and continue.

In solvers with convenient lazy callbacks, add cuts during branch-and-bound. Some Python solver APIs require callback or constraint-handler plumbing for true lazy enforcement, so iterative cut separation is often simpler for portable benchmark code:

python
def selected_arcs(model, x, v, arcs):
    return [(i, j) for i, j in arcs if model.getVal(x[v, i, j]) > 0.5]


def station_cycles_without_start(selected, stations):
    succ = {i: j for i, j in selected}
    cycles = []
    seen = set()

    for start in stations:
        if start in seen or start not in succ:
            continue
        path = []
        cur = start
        pos = {}
        while cur in succ and cur not in pos and cur not in seen:
            pos[cur] = len(path)
            path.append(cur)
            cur = succ[cur]
        seen.update(path)
        if cur in pos:
            cycle = path[pos[cur]:]
            if START not in cycle and END not in cycle:
                cycles.append(cycle)
    return cycles


while True:
    model.optimize()
    if model.getNSols() == 0:
        raise RuntimeError(f"no feasible solution; status={model.getStatus()}")

    cuts_added = 0
    for v in vehicles:
        selected = selected_arcs(model, x, v, arcs)
        for cycle in station_cycles_without_start(selected, stations):
            if len(cycle) >= 2:
                S = set(cycle)
                model.freeTransform()
                model.addCons(
                    quicksum(x[v, i, j] for i in S for j in S if i != j) <= len(S) - 1
                )
                cuts_added += 1

    if cuts_added == 0:
        break

Pros:

  • Adds only cuts that are needed.
  • Often stronger than MTZ.
  • Avoids exponential static SEC generation.

Cons:

  • Iterative resolve can be slower than a true callback.
  • Requires reliable subtour detection.
  • More moving parts than MTZ.

Use this when static MTZ is too weak and the solver environment does not make lazy callbacks convenient.

Method Choice

MethodBest ForAvoid When
MTZQuick, compact, small/medium MIPsLarge hard VRPs where relaxation strength matters
Single-commodity flowStronger static connectivity, optional visitsMemory is tight, or n is large
Multi-commodity flowVery strong small routing modelsMost practical benchmark tasks; too many variables
Static DFJTiny instances, debuggingMore than roughly 15-18 stations without careful filtering
Lazy/iterative DFJ cutsStrong routing models with many possible SECsSolver API/callback complexity is too risky

For pickup/dropoff rebalancing, start with MTZ or artificial connectivity flow. Do not use physical truck load as the only subtour-elimination mechanism because pickup/dropoff load can increase and decrease and may not prove route connectivity.

Validation

After solving, reconstruct each route by following selected arcs:

python
def extract_route(selected):
    outgoing = dict(selected)
    route = [START]
    cur = START
    seen = {START}
    while cur != END:
        if cur not in outgoing:
            raise RuntimeError(f"route disconnected at {cur!r}")
        cur = outgoing[cur]
        if cur in seen and cur != END:
            raise RuntimeError(f"cycle detected at {cur!r}")
        route.append(cur)
        seen.add(cur)
    return route

Fail fast if a selected solution has a disconnected cycle, repeated station, missing depot start, or missing depot end.

© Raidriar7170, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in artifacts/v0.3/skillsbench-pilot/v0.3-stage2-input-package-candidate-20260701T010000Z/candidate-data/skill-sources/skillsbench__routing-subtour-elimination of Raidriar7170/hermes-skilleval.

Open the folder on GitHubat commit 8f6a21e

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in Raidriar7170/hermes-skilleval, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Routing Subtour Elimination next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Routing Subtour Elimination compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Routing Subtour Elimination this skillRaidriar7170/hermes-skilleval1251 repos~2.2kAutomated safety check: PassMIT
Scikit LearnzLanqing/codex-claude-academic-skills4.7k16 repos~3.9kAutomated safety check: PassBSD-3-Clause
TimesFM Forecastinggoogle-research/timesfm34k—~4.7kAutomated safety check: PassApache-2.0
Excel and CSV Data Analysisbytedance/deer-flow84k4 repos~2.2kAutomated safety check: PassMIT
StatsmodelszLanqing/codex-claude-academic-skills4.7k15 repos~4.9kAutomated safety check: PassBSD-3-Clause
Scientific Figure MakingChenLiu-1996/figures4papers8.3k—~557Automated safety check: PassCustom licence

Similar skills

  • Scikit Learn

    zLanqing/codex-claude-academic-skills

    Machine learning in Python with scikit-learn. An agent skill from zLanqing/codex-claude-academic-skills.

    4.7k GitHub starsUsed in 16 repos~3.9k tokens
    Data & AnalyticsAuto-check passed
  • TimesFM Forecasting

    google-research/timesfm

    Forecasts any univariate time series zero-shot with Google's TimesFM model, returning point forecasts and calibrated prediction intervals without training.

    34k GitHub stars~4.7k tokensUpdated 11 days ago
    Data & AnalyticsAuto-check passed
  • Excel and CSV Data Analysis

    bytedance/deer-flow

    Analyzes uploaded Excel and CSV files with SQL through DuckDB, producing schema inspections, statistical summaries and exports to CSV, JSON or Markdown.

    84k GitHub starsUsed in 4 repos~2.2k tokens
    Data & AnalyticsAuto-check passed
  • Statsmodels

    zLanqing/codex-claude-academic-skills

    Statistical models library for Python. An agent skill from zLanqing/codex-claude-academic-skills.

    4.7k GitHub starsUsed in 15 repos~4.9k tokens
    Data & AnalyticsAuto-check passed
  • Scientific Figure Making

    ChenLiu-1996/figures4papers

    Covers publication-ready matplotlib figures for academic papers, slides, and reports—bars, trends, scatter, heatmaps, and multi-panel layouts—with this…

    8.3k GitHub stars~557 tokensUpdated yesterday
    Data & AnalyticsAuto-check passed
  • Diagnose and fix ModuleNotFoundError in Nuitka standalone binaries caused by missing implicit imports.

    15k GitHub stars~519 tokensUpdated today
    Data & AnalyticsAuto-check passed

More from Raidriar7170/hermes-skilleval

All 8 skills in this repo
  • Senior Data Scientist

    Raidriar7170/hermes-skilleval

    World-class data science skill for statistical modeling, experimentation, causal inference, and advanced analytics.

    125 GitHub starsUsed in 5 repos~1.4k tokens
    Auto-check passed
  • Dialogue Graph

    Raidriar7170/hermes-skilleval

    A library for building, validating, visualizing, and serializing dialogue graphs.

    125 GitHub starsUsed in 1 repo~597 tokens
    Auto-check passed
  • Geospatial Routing Data

    Raidriar7170/hermes-skilleval

    Geospatial routing data handling for depot and station coordinates, route node IDs, internal index mappings, great-circle distance matrices, and route-distance reconstruction.

    125 GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed
  • Logistics Rules To Optimization

    Raidriar7170/hermes-skilleval

    Translate logistics and operations rules into optimization variables and constraints.

    125 GitHub starsUsed in 1 repo~2.8k tokens
    Auto-check passed
  • Scip Opt

    Raidriar7170/hermes-skilleval

    SCIP optimization with PySCIPOpt. An agent skill from Raidriar7170/hermes-skilleval.

    125 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • DOCX

    Raidriar7170/hermes-skilleval

    Word document manipulation with python-docx - handling split placeholders, headers/footers, nested tables

    125 GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed

Works with

Questions about Routing Subtour Elimination

What does Routing Subtour Elimination do?

Subtour-elimination methods for TSP, VRP, pickup/dropoff routing, and routing MIPs with binary arc variables. Routing Subtour Elimination is an agent skill from Raidriar7170/hermes-skilleval. Subtour-elimination methods for TSP, VRP, pickup/dropoff routing, and routing MIPs with binary arc variables.

When should I use Routing Subtour Elimination?

Routing Subtour Elimination fits situations like: route-continuity constraints may permit disconnected cycles and the model needs MTZ constraints; flow-based connectivity constraints; DFJ subset cuts; lazy/iterative subtour cuts.

How do I install Routing Subtour Elimination in Claude Code?

Run `npx skills add Raidriar7170/hermes-skilleval --skill routing-subtour-elimination -a claude-code`. Or copy the skill folder (artifacts/v0.3/skillsbench-pilot/v0.3-stage2-input-package-candidate-20260701T010000Z/candidate-data/skill-sources/skillsbench__routing-subtour-elimination in Raidriar7170/hermes-skilleval) into .claude/skills/routing-subtour-elimination in your project. Claude Code loads it when a task matches its description.

How do I install Routing Subtour Elimination in Codex?

Run `npx skills add Raidriar7170/hermes-skilleval --skill routing-subtour-elimination -a codex`. Or copy the skill folder (artifacts/v0.3/skillsbench-pilot/v0.3-stage2-input-package-candidate-20260701T010000Z/candidate-data/skill-sources/skillsbench__routing-subtour-elimination in Raidriar7170/hermes-skilleval) into .agents/skills/routing-subtour-elimination in your project. Codex loads it when a task matches its description.

Can I use Routing Subtour Elimination in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Raidriar7170/hermes-skilleval --skill routing-subtour-elimination -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/routing-subtour-elimination, .gemini/skills/routing-subtour-elimination, .github/skills/routing-subtour-elimination and .opencode/skills/routing-subtour-elimination in your project.

What does Routing Subtour Elimination need to run?

SKILL.md names no scripts, command-line tools or credentials: Routing Subtour Elimination is instructions for the agent only. Our summary lists: Python 3.

Does Routing Subtour Elimination access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Routing Subtour Elimination safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Routing Subtour Elimination use?

Routing Subtour Elimination is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Routing Subtour Elimination use?

About 2.2k tokens (SKILL.md is roughly 8.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Routing Subtour Elimination?

Skills that share tags, products or a category with Routing Subtour Elimination: Scikit Learn (zLanqing/codex-claude-academic-skills, 4.7k stars), TimesFM Forecasting (google-research/timesfm, 34k stars), Excel and CSV Data Analysis (bytedance/deer-flow, 84k stars) and Statsmodels (zLanqing/codex-claude-academic-skills, 4.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Routing Subtour Elimination?

Raidriar7170 (a GitHub user) maintains it in Raidriar7170/hermes-skilleval, which has 125 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on September 26, 2026.

Source: Raidriar7170/hermes-skilleval on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.