Agent skill

Ortools Routing Modeling

by benchflow-ai in benchflow-ai/skillsbench

Build OR-Tools RoutingModel vehicle-routing models with transit matrices, dimensions, capacity constraints, time windows, optional visits, invalid-arc handling, search parameters, and route…

Apache-2.0Auto-check passed

Install Ortools Routing Modeling

skills CLI
$ npx skills add benchflow-ai/skillsbench --skill ortools-routing-modeling -a claude-code

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

GitHub CLI
$ gh skill install benchflow-ai/skillsbench ortools-routing-modeling --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/benchflow-ai/skillsbench.git skills-src && mkdir -p .claude/skills && cp -r skills-src/tasks/paratransit-routing/environment/skills/ortools-routing-modeling .claude/skills/ortools-routing-modeling && 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
ortools-routing-modeling
GitHub stars
1.8k
Token cost
~2.8k tokens
SKILL.md length
1,083 words
Files
1
Skills in repo
189
Repo updated
First seen
Licence
Apache-2.0

At a glance

Build OR-Tools RoutingModel vehicle-routing models with transit matrices, dimensions, capacity constraints, time windows, optional visits, invalid-arc handling, search parameters, and route…

  • Works in 5 steps: Normalize integer data and map external… → Build transit, cost, and demand matrices… → Add time and capacity dimensions,… → …
  • SKILL.md covers Modeling Flow, Data And Indexing, Dimensions and Optional Visits And Objectives, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Ortools Routing Modeling is an agent skill from benchflow-ai/skillsbench. Build OR-Tools RoutingModel vehicle-routing models with transit matrices, dimensions, capacity constraints, time windows, optional visits, invalid-arc handling, search parameters, and route extraction.

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

The repository describes itself as: SkillsBench evaluates how well skills work and how effective agents are at using them. The licence is Apache-2.0.

Example prompts

  • “/ortools-routing-modeling”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Normalize integer data and map external nodes to routing-manager nodes.
  2. Build transit, cost, and demand matrices or vectors before registering callbacks.
  3. Add time and capacity dimensions, including vehicle start/end ranges and span limits.
  4. Add problem-specific visits, time windows, optional-node penalties, and pairing constraints.
  5. Solve with an internal time limit, extract ordered routes, then audit them independently before reporting.

What it can do on your machine

Read from SKILL.md and the folder at commit 9a1f4dd. 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

Ortools Routing Modeling loads about 2.8k tokens when it runs. Until then it costs about 57 tokens; SKILL.md has 1,083 words of instructions outside code blocks.

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

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 benchflow-ai/skillsbench at commit 9a1f4dd, republished under its Apache-2.0 licence (© benchflow-ai). 1,083 words, ~2,800 tokens.

Download SKILL.mdSave it as .claude/skills/ortools-routing-modeling/SKILL.md (or your agent's skills folder).
name
ortools-routing-modeling
description
Build OR-Tools RoutingModel vehicle-routing models with transit matrices, dimensions, capacity constraints, time windows, optional visits, invalid-arc handling, search parameters, and route extraction.

OR-Tools Routing Modeling

Use this skill for vehicle-routing models built with ortools.constraint_solver.pywrapcp.RoutingModel.

Modeling Flow

  1. Normalize integer data and map external nodes to routing-manager nodes.
  2. Build transit, cost, and demand matrices or vectors before registering callbacks.
  3. Add time and capacity dimensions, including vehicle start/end ranges and span limits.
  4. Add problem-specific visits, time windows, optional-node penalties, and pairing constraints.
  5. Solve with an internal time limit, extract ordered routes, then audit them independently before reporting.

Data And Indexing

  • Convert travel times, service times, demands, and time bounds to integers before registering callbacks or transit matrices. Avoid floats and NaN; OR-Tools can silently treat bad values as usable arcs.
  • Assert that matrix dimensions, node counts, vehicle counts, and declared record counts agree before building the model. Shape mistakes often produce plausible but meaningless routes.
  • Keep a clear distinction between external node IDs, routing manager node IDs, and internal routing indices. Convert with manager.NodeToIndex(node) and manager.IndexToNode(index).
  • When vehicles need distinct starts or ends but the input has shared depots, copy the depot into one internal start node and one internal end node per vehicle. Prefer these internal depot copies over reusing the same shared depot node for every vehicle, then map the copies back to the shared external depot IDs when reporting.
  • A common cloned-depot layout is: solver job nodes first, then one start depot per vehicle, then one end depot per vehicle. External shared depot IDs can be stripped from the job matrix and restored only when reporting.
  • Treat negative, missing, or sentinel travel times as invalid arcs. Either forbid them with explicit constraints or give them a prohibitive transit cost and reject any final route that uses them. Choose invalid-arc sentinels large enough to dominate feasible legs, but small enough to avoid integer overflow when service times and route spans are added.
  • For static integer data, prefer precomputed RegisterTransitMatrix and RegisterUnaryTransitVector calls over Python callbacks. Routing callbacks are called very often during local search and can consume solve time on large instances.

When an input matrix has one shared start depot and one shared end depot, but the routing model needs one start and end node per vehicle, build an internal matrix with cloned depots:

python
def clone_depots_matrix(external, job_nodes, num_vehicles, start_depot, end_depot, invalid_cost):
    num_jobs = len(job_nodes)
    start_nodes = list(range(num_jobs, num_jobs + num_vehicles))
    end_nodes = list(range(num_jobs + num_vehicles, num_jobs + 2 * num_vehicles))
    matrix = [[invalid_cost] * (num_jobs + 2 * num_vehicles) for _ in range(num_jobs + 2 * num_vehicles)]

    for i, ext_i in enumerate(job_nodes):
        for j, ext_j in enumerate(job_nodes):
            matrix[i][j] = external[ext_i][ext_j]
        for end in end_nodes:
            matrix[i][end] = external[ext_i][end_depot]

    for start in start_nodes:
        for j, ext_j in enumerate(job_nodes):
            matrix[start][j] = external[start_depot][ext_j]
    for vehicle in range(num_vehicles):
        matrix[start_nodes[vehicle]][end_nodes[vehicle]] = 0
    return matrix, start_nodes, end_nodes

Dimensions

  • Put travel time plus service time at the departing node in the time transit. Then Time.CumulVar(index) is the arrival or service-start time, and departure is arrival + service_time.
  • Derive the time horizon from the data, including latest time windows, service time, travel time, and slack. Avoid arbitrary horizons that are too tight for waiting/service or so large that invalid-arc penalties become usable.
  • Choose fix_start_cumul_to_zero deliberately. Use False when vehicle start times or shifts may vary; use start time windows or allowed start values instead.
  • Set each vehicle start/end cumul through routing.Start(vehicle) and routing.End(vehicle), especially when depots are cloned or shared.
  • If shifts may start from a discrete menu, apply allowed values to each vehicle start cumul after setting its broad time-window range.
  • Use span upper bounds for route-duration or shift-length limits.
  • For capacity, use a unary demand callback and no slack. With OR-Tools dimensions, the load cumul at a node often represents load before applying that node's demand, so audit route loads from the ordered node sequence when checking or exporting a solution.

Apply ordinary visit time windows directly to the node's time cumul:

python
for node, (window_low, window_high) in time_windows.items():
    index = manager.NodeToIndex(node)
    time_dim.CumulVar(index).SetRange(int(window_low), int(window_high))

For top-of-hour shift starts inside an operating window, generate the allowed start values and apply them to each vehicle start cumul:

python
def possible_shift_start_times(operating_window, shift_duration, step_minutes=60):
    start, end = operating_window
    return [
        minute
        for minute in range(0, 24 * 60 + 1, step_minutes)
        if start <= minute <= end - shift_duration
    ]

shift_starts = possible_shift_start_times(operating_window, shift_duration)
for vehicle in range(num_vehicles):
    time_dim.CumulVar(routing.Start(vehicle)).SetRange(*operating_window)
    time_dim.CumulVar(routing.End(vehicle)).SetRange(*operating_window)
    time_dim.CumulVar(routing.Start(vehicle)).SetValues(shift_starts)
    time_dim.SetSpanUpperBoundForVehicle(shift_duration, vehicle)
    routing.AddVariableMinimizedByFinalizer(time_dim.CumulVar(routing.Start(vehicle)))
    routing.AddVariableMaximizedByFinalizer(time_dim.CumulVar(routing.End(vehicle)))

Optional Visits And Objectives

  • Use AddDisjunction for optional nodes and choose penalties so the primary objective dominates secondary route costs.
  • If optional visits are part of the model, scale skip penalties so they reflect the stated priority relative to travel or duration costs.
  • When the public objective is to maximize served visits or jobs, model that as large skip penalties, then add a small positive arc cost such as travel time or travel-plus-service time as a secondary tie-breaker. A purely zero-cost served-route objective can give local search too little gradient to improve route structure.
  • Keep the skip penalty very large: one additional served job should dominate any plausible secondary travel or service-time difference.
  • You can use separate callbacks for optimization cost and time feasibility. The time dimension should enforce travel and service propagation, while the arc-cost callback can use scaled travel or travel-plus-service costs for search guidance.
Show full SKILL.md (364 more words)Show less

Compact Matrix Model Skeleton

Use this shape for large matrix-based routing models with cloned depots, time propagation, capacity, a secondary travel-cost objective, and a bounded local search. Add problem-specific visits, disjunctions, and time windows after creating the dimensions.

python
from ortools.constraint_solver import pywrapcp, routing_enums_pb2

start_nodes = list(range(job_node_count, job_node_count + num_vehicles))
end_nodes = list(range(job_node_count + num_vehicles, job_node_count + 2 * num_vehicles))
manager = pywrapcp.RoutingIndexManager(num_solver_nodes, num_vehicles, start_nodes, end_nodes)
routing = pywrapcp.RoutingModel(manager)

nodes_from_indices = [manager.IndexToNode(index) for index in range(manager.GetNumberOfIndices())]
time_matrix = [
    [int(travel_times[i][j] + service_times[i]) for j in nodes_from_indices]
    for i in nodes_from_indices
]
cost_matrix = [
    [int(arc_costs[i][j]) for j in nodes_from_indices]
    for i in nodes_from_indices
]
time_cb = routing.RegisterTransitMatrix(time_matrix)
cost_cb = routing.RegisterTransitMatrix(cost_matrix)
routing.SetArcCostEvaluatorOfAllVehicles(cost_cb)
routing.AddDimension(time_cb, waiting_slack, time_horizon, False, "Time")
time_dim = routing.GetDimensionOrDie("Time")

demand_cb = routing.RegisterUnaryTransitVector([int(demands[node]) for node in nodes_from_indices])
routing.AddDimensionWithVehicleCapacity(demand_cb, 0, vehicle_capacities, True, "Capacity")

params = pywrapcp.DefaultRoutingSearchParameters()
params.first_solution_strategy = routing_enums_pb2.FirstSolutionStrategy.AUTOMATIC
params.local_search_metaheuristic = routing_enums_pb2.LocalSearchMetaheuristic.GENERIC_TABU_SEARCH
params.time_limit.seconds = int(search_limit_seconds)
params.log_search = True
solution = routing.SolveWithParameters(params)

Search And Extraction

  • Use a constructive first-solution strategy that matches the structure of the problem, then a local-search metaheuristic for improvement.
  • For large optional pickup-delivery or dial-a-ride style models, AUTOMATIC is a strong first-solution default, and GENERIC_TABU_SEARCH is often a good local-search metaheuristic for escaping local minima. Avoid assuming that simple arc-based constructors such as PATH_CHEAPEST_ARC will work well on heavily constrained optional-service instances.
  • If the objective is mostly served-count based, give local search a secondary route-quality signal through the arc-cost evaluator, such as scaled travel time or travel-plus-service time. Keep skip penalties large enough that the secondary cost cannot outweigh serving one more job.
  • If the task states a search or solver time limit, pass that limit to the OR-Tools search parameters and reserve time for extraction, auditing, and writing outputs. Do not silently expand the limit for solution quality.
  • If no task-specific search limit is given but the benchmark has an outer wall-clock timeout, set an internal OR-Tools search limit well below that timeout and reserve time for data loading, extraction, independent auditing, and report writing. A common pattern is to spend about one third of the available agent time on search.
  • Long OR-Tools searches can look idle to command runners. If a solve may run near a per-command idle timeout, enable lightweight progress output such as search_parameters.log_search = True, run Python unbuffered, or print flushed progress before and after the solve.
  • Before starting another long solve, check that enough wall-clock time remains to finish the solve, extract the incumbent, audit the route sequence, and write the requested output. A lower-quality audited output is usually better than timing out with no final report.
  • For long searches, consider collecting incumbent NextVar, route start/end cumul vars, and CostVar; keep the best collected solution by cost if the final return value is unavailable or inconvenient to extract.
  • Extract routes by following NextVar from each vehicle start to end, then pass the ordered stops to an independent audit/reporting step.

© benchflow-ai, Apache-2.0. 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 tasks/paratransit-routing/environment/skills/ortools-routing-modeling of benchflow-ai/skillsbench.

Open the folder on GitHubat commit 9a1f4dd

Compare with similar skills

Ortools Routing Modeling 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.

Ortools Routing Modeling compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ortools Routing Modeling this skillbenchflow-ai/skillsbench1.8k—~2.8kAutomated safety check: PassApache-2.0
OmniRoute Model Catalogdiegosouzapw/OmniRoute74k—~589Automated safety check: PassMIT
Model Bank Metadatalobehub/lobehub83k—~2kAutomated safety check: PassCustom licence
Harness Threat Modelruvnet/ruflo74k—~363Automated safety check: NotesMIT
OmniRoute Model Catalog CLIdiegosouzapw/OmniRoute74k—~554Automated safety check: PassMIT
Model Usageopenclaw/openclaw392k1 repos~637Automated safety check: PassMIT

Similar skills

  • OmniRoute Model Catalog

    diegosouzapw/OmniRoute

    Looks up which AI models an OmniRoute gateway can reach, creates or updates model aliases and tests whether individual models respond.

    74k GitHub stars~589 tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Model Bank Metadata

    lobehub/lobehub

    Fills and maintains the knowledgeCutoff, family and generation fields on model cards in LobeHub's model bank, from a single new model up to repo-wide backfills.

    83k GitHub stars~2k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Enterprise-review-grade threat model from harness threat-model <path.

    74k GitHub stars~363 tokensUpdated today
    SecurityAuto-check: notes
  • OmniRoute Model Catalog CLI

    diegosouzapw/OmniRoute

    Lists and manages AI models from the OmniRoute command line: browse a provider's catalog, search it, and add, edit, remove or test-add models.

    74k GitHub stars~554 tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Model Usage

    openclaw/openclaw

    Summarize CodexBar local cost logs by model for Codex or Claude, including current or full breakdowns.

    392k GitHub starsUsed in 1 repo~637 tokens
    Auto-check passed
  • Threat Modeling

    sickn33/agentic-awesome-skills

    Conduct threat modeling using STRIDE methodology. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~4.3k tokens
    SecurityAuto-check passed

More from benchflow-ai/skillsbench

All 189 skills in this repo
  • Lean4 Memories

    benchflow-ai/skillsbench

    This skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences…

    1.8k GitHub stars~3.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Senior Data Engineer

    benchflow-ai/skillsbench

    World-class data engineering skill for building scalable data pipelines, ETL/ELT systems, real-time streaming, and data infrastructure.

    1.8k GitHub stars~5.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Ac Branch Pi Model

    benchflow-ai/skillsbench

    AC branch pi-model power flow equations (P/Q and |S|) with transformer tap ratio and phase shift, matching acopf-math-model.md and MATPOWER branch fields.

    1.8k GitHub stars~1.1k tokensUpdated 2 mo ago
    Auto-check passed
  • Civ6lib

    benchflow-ai/skillsbench

    Civilization 6 district mechanics library. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • D3 Visualization

    benchflow-ai/skillsbench

    Build deterministic, verifiable data visualizations with D3.js (v6).

    1.8k GitHub stars~1.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Dc Power Flow

    benchflow-ai/skillsbench

    DC power flow analysis for power systems. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~717 tokensUpdated 2 mo ago
    Auto-check passed

Questions about Ortools Routing Modeling

What does Ortools Routing Modeling do?

Build OR-Tools RoutingModel vehicle-routing models with transit matrices, dimensions, capacity constraints, time windows, optional visits, invalid-arc handling, search parameters, and route…. Ortools Routing Modeling is an agent skill from benchflow-ai/skillsbench. Build OR-Tools RoutingModel vehicle-routing models with transit matrices, dimensions, capacity constraints, time windows, optional visits, invalid-arc handling, search parameters, and route extraction.

How do I install Ortools Routing Modeling in Claude Code?

Run `npx skills add benchflow-ai/skillsbench --skill ortools-routing-modeling -a claude-code`. Or copy the skill folder (tasks/paratransit-routing/environment/skills/ortools-routing-modeling in benchflow-ai/skillsbench) into .claude/skills/ortools-routing-modeling in your project. Claude Code loads it when a task matches its description.

How do I install Ortools Routing Modeling in Codex?

Run `npx skills add benchflow-ai/skillsbench --skill ortools-routing-modeling -a codex`. Or copy the skill folder (tasks/paratransit-routing/environment/skills/ortools-routing-modeling in benchflow-ai/skillsbench) into .agents/skills/ortools-routing-modeling in your project. Codex loads it when a task matches its description.

Can I use Ortools Routing Modeling 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 benchflow-ai/skillsbench --skill ortools-routing-modeling -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ortools-routing-modeling, .gemini/skills/ortools-routing-modeling, .github/skills/ortools-routing-modeling and .opencode/skills/ortools-routing-modeling in your project.

What does Ortools Routing Modeling need to run?

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

Does Ortools Routing Modeling 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 Ortools Routing Modeling 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 Ortools Routing Modeling use?

Ortools Routing Modeling is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Ortools Routing Modeling use?

About 2.8k tokens (SKILL.md is roughly 11k 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 Ortools Routing Modeling?

Skills that share tags, products or a category with Ortools Routing Modeling: OmniRoute Model Catalog (diegosouzapw/OmniRoute, 74k stars), Model Bank Metadata (lobehub/lobehub, 83k stars), Harness Threat Model (ruvnet/ruflo, 74k stars) and OmniRoute Model Catalog CLI (diegosouzapw/OmniRoute, 74k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ortools Routing Modeling?

benchflow-ai (a GitHub organization) maintains it in benchflow-ai/skillsbench, which has 1,834 GitHub stars. The repository holds 189 skills in this directory. The repository was last updated on July 23, 2026.

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