56 results available
Sign in
Skills directory

cuopt-routing-api-python

nvidia

·

Last changed
Hardened

This skill has been hardened by Chainguard

Last changed

This version passed the hardening gate. Hardening updated the skill content and independently checked the resulting changes. Classified findings before hardening: 2. Classified findings closed: 0. Classified findings remaining: 2. Unclassified scanner findings remaining: 0. Review findings closed: 8. Review findings remaining: 1.


Open before hardening

2

Medium
Open after hardening

2

Medium

Expand
File
Group
Subtype
Severity
Status
BENCHMARK.md

Sensitive Data & Secret Exposure

Agent snooping

Medium
Open
references/server_examples.md

Sensitive Data & Secret Exposure

Data exfiltration

Medium
Open

2 findings


SKILL.md

cuOpt Routing — Python API

This skill is Python only. Routing has no C API in cuOpt.

Required questions

Ask these if not already clear:

  1. Problem type — TSP, VRP, or PDP?
  2. Locations — How many? Depot(s)? Cost or distance between pairs (matrix or derived)?
  3. Orders / tasks — Which locations must be visited? Demand or service per stop?
  4. Fleet — Number of vehicles, capacity per vehicle (and per dimension if multiple), start/end locations?
  5. Constraints — Time windows (earliest/latest arrival), service times, precedence (order A before B)?

Minimal VRP Example

import cudf
from cuopt import routing

cost_matrix = cudf.DataFrame([...], dtype="float32")
dm = routing.DataModel(n_locations=4, n_fleet=2, n_orders=3)
dm.add_cost_matrix(cost_matrix)
dm.set_order_locations(cudf.Series([1, 2, 3], dtype="int32"))
ss = routing.SolverSettings()
ss.set_time_limit(30)
solution = routing.Solve(dm, ss)

if solution.get_status() == 0:
    solution.display_routes()

Adding Constraints

The precedence call at the end of this block uses the np array helper, so import it before running the block.

# Time windows
dm.add_transit_time_matrix(transit_time_matrix)
dm.set_order_time_windows(earliest_series, latest_series)

# Capacities
dm.add_capacity_dimension("weight", demand_series, capacity_series)

# Service times
dm.set_order_service_times(service_times)

# Vehicle start and end locations and time windows
dm.set_vehicle_locations(start_locations, end_locations)
dm.set_vehicle_time_windows(earliest_start, latest_return)

# Pickup-delivery pairs
dm.set_pickup_delivery_pairs(pickup_indices, delivery_indices)

# Precedence
dm.add_order_precedence(node_id=2, preceding_nodes=np.array([0, 1]))

Solution Checking

status = solution.get_status()  # 0=SUCCESS, 1=FAIL, 2=TIMEOUT, 3=EMPTY
if status == 0:
    route_df = solution.get_route()
    total_cost = solution.get_total_objective()
else:
    print(solution.get_error_message())
    print(solution.get_infeasible_orders().to_list())

Data Types (use explicit dtypes)

cost_matrix = cost_matrix.astype("float32")
order_locations = cudf.Series([...], dtype="int32")
demand = cudf.Series([...], dtype="int32")

Solver Settings

ss = routing.SolverSettings()
ss.set_time_limit(30)
ss.set_verbose_mode(True)
ss.set_error_logging_mode(True)

Verbose and error logging are for debugging. Turn them off when the inputs hold real customer locations or schedules, and keep infeasible order details for such data out of shared logs and transcripts.

Common Issues

ProblemFix

Empty solution

Widen time windows or check travel times

Infeasible orders

Increase fleet or capacity

Status != 0 with time windows

Add add_transit_time_matrix()

Wrong cost

Check that cost_matrix rows and columns map to the correct location indices and use consistent units; asymmetric matrices are allowed

compute_waypoint_sequence alters route_df

It replaces the location column with waypoint ids in place — pass route_df.copy() if you still need cost-matrix indices (e.g. when iterating per truck)

Debugging

When status != 0: print(solution.get_error_message()) and print(solution.get_infeasible_orders().to_list()) to see which orders are infeasible.

Data types: Use explicit dtypes (float32, int32) for matrices and series to avoid silent errors.

Before solving, check the inputs:

  • The cost matrix is square, with one row and one column per location.
  • Every order location index is zero or greater and smaller than the number of locations.
  • The fleet size and order count are positive and within the sizes you expect.
  • The demand series has one entry per order, and the capacity series has one entry per vehicle.

Examples

  • examples.md — VRP, PDP, multi-depot
  • server_examples.md — REST client (curl, Python). These examples assume a cuOpt server on the local machine; confirm with the user before sending real routing data to any server that is not local.
  • Reference models: This skill's assets/ — vrp_basic, pdp_basic. See assets/README.md.

Escalate

For contribution or build-from-source, see the developer skill.

Install

Install with chainctl
chainctl skill install public/nvidia/cuopt-routing-api-python:latest
Get started with chainctl
View source

Harden your own skills

Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.

Provenance

Upstream sourcehttps://github.com/nvidia/skills
Upstream commitc62f4daeceaedf2caa65654b2091a5bb283dcda7
OCI reference

skills.chainreg.biz/public/github.com/nvidia/skills/cuopt-routing-api-python:latest

License

Apache-2.0

Files

BENCHMARK.md

HARDENING.md

SKILL.md

assets/README.md

assets/pdp_basic/README.md

assets/pdp_basic/model.py

assets/vrp_basic/README.md

assets/vrp_basic/model.py

evals/evals.json

references/examples.md

references/server_examples.md

skill-card.md

skill.oms.sig


The trusted source for open source

Talk to an expert
PrivacyTerms

Product

Chainguard ContainersChainguard LibrariesChainguard VMsChainguard OS PackagesChainguard ActionsChainguard Agent SkillsIntegrationsPricing
© 2026 Chainguard, Inc. All Rights Reserved.
Chainguard® and the Chainguard logo are registered trademarks of Chainguard, Inc. in the United States and/or other countries.
The other respective trademarks mentioned on this page are owned by the respective companies and use of them does not imply any affiliation or endorsement.