옵션
집집 Skill API 개발 cuopt-server-api-python

cuopt-server-api-python

NVIDIA/skills NVIDIA/skills

cuOpt REST 서버를 배포하고, Python이나 curl을 사용하여 경로 최적화 문제를 해결하세요.

...모든 것을 확장하십시오
5
업데이트 된 시간 2026년 9월 25일

cuOpt 서버 — 배포 및 클라이언트 (Python/curl)

이 스킬에서는 서버 및 클라이언트 예제 (curl, Python) 를 실행하는 방법을 다룹니다. 서버에는 별도의 C API가 없습니다(클라이언트는 어떤 언어로든 구현할 수 있습니다).

서버 시작

# 개발
python -m cuopt_server.cuopt_service --ip 0.0.0.0 --port 8000

# Docker
docker run --gpus all -d -p 8000:8000 -e CUOPT_SERVER_PORT=8000 \
  nvidia/cuopt:latest-cuda12.9-py3.13

확인

curl http://localhost:8000/cuopt/health

워크플로우

  1. /cuopt/request 로 POST → reqId 가져오기
  2. 솔루션이 준비될 때까지 /cuopt/solution/{reqId} 폴링
  3. 응답 분석

Python 클라이언트 (라우팅)

import requests, time
SERVER = "http://localhost:8000"
HEADERS = {"Content-Type": "application/json", "CLIENT-VERSION": "custom"}
payload = {
    "cost_matrix_data": {"data": {"0": [[0,10,15],[10,0,12],[15,12,0]]}},
    "travel_time_matrix_data": {"data": {"0": [[0,10,15],[10,0,12],[15,12,0]]}},
    "task_data": {"task_locations": [1, 2], "demand": [[10, 20]], "task_time_windows": [[0,100],[0,100]], "service_times": [5, 5]},
    "fleet_data": {"vehicle_locations": [[0, 0]], "capacities": [[50]], "vehicle_time_windows": [[0, 200]]},
    "solver_config": {"time_limit": 5}
}
r = requests.post(f"{SERVER}/cuopt/request", json=payload, headers=HEADERS)
req_id = r.json()["reqId"]
# 결과 조회: GET /cuopt/solution/{req_id}

용어: REST 대 Python API

Python API REST
order_locations task_locations
set_order_time_windows() task_time_windows
서비스_시간 service_times

transit_time_matrix_data가 아닌 travel_time_matrix_data를 사용하십시오. 수용 능력: [[50, 50]] 이지 [[50], [50]]이 아닙니다.

디버깅 (422 / 페이로드)

유효성 검사 오류: OpenAPI(/cuopt.yaml)를 기준으로 필드 이름을 확인하십시오. 흔한 실수: transit_time_matrix_data → travel_time_matrix_data; 차원별 수용 인원 [[50, 50]] 이지, 차량별 [[50], [50]]이 아닙니다. 실패한 요청에 대한 reqId 및 응답 본문을 캡처하십시오.

실행 가능한 자산

각 자산 디렉터리에서 실행하십시오(서버가 실행 중이어야 하며, 서버에 연결할 수 없는 경우 스크립트는 0으로 종료됩니다). 모두 Python requests를 사용합니다:

  • assets/vrp_simple/ — 기본 VRP (시간 창 없음)
  • assets/vrp_basic/ — 시간 창이 있는 VRP
  • assets/pdp_basic/ — 픽업 및 배송
  • assets/lp_basic/ — REST를 통한 LP (CSR 형식)
  • assets/milp_basic/ — REST를 통한 MILP

개요는 assets/README.md를 참조하십시오.

에스컬레이션

기여 또는 소스 코드 빌드에 대해서는 개발자 스킬을 참조하십시오.

GitHub에서 보기
---
name: cuopt-server-api-python
description: Deploy a cuOpt REST server and solve routing optimization problems using Python or curl.
license: Apache-2.0
---



# cuOpt Server — Deploy and client (Python/curl)

This skill covers **starting the server** and **client examples** (curl, Python). Server has no separate C API (clients can be any language).

## Start server

```bash
# Development
python -m cuopt_server.cuopt_service --ip 0.0.0.0 --port 8000

# Docker
docker run --gpus all -d -p 8000:8000 -e CUOPT_SERVER_PORT=8000 \
  nvidia/cuopt:latest-cuda12.9-py3.13
```

## Verify

```bash
curl http://localhost:8000/cuopt/health
```

## Workflow

1. POST to `/cuopt/request` → get `reqId`
2. Poll `/cuopt/solution/{reqId}` until solution ready
3. Parse response

## Python client (routing)

```python
import requests, time
SERVER = "http://localhost:8000"
HEADERS = {"Content-Type": "application/json", "CLIENT-VERSION": "custom"}
payload = {
    "cost_matrix_data": {"data": {"0": [[0,10,15],[10,0,12],[15,12,0]]}},
    "travel_time_matrix_data": {"data": {"0": [[0,10,15],[10,0,12],[15,12,0]]}},
    "task_data": {"task_locations": [1, 2], "demand": [[10, 20]], "task_time_windows": [[0,100],[0,100]], "service_times": [5, 5]},
    "fleet_data": {"vehicle_locations": [[0, 0]], "capacities": [[50]], "vehicle_time_windows": [[0, 200]]},
    "solver_config": {"time_limit": 5}
}
r = requests.post(f"{SERVER}/cuopt/request", json=payload, headers=HEADERS)
req_id = r.json()["reqId"]
# Poll: GET /cuopt/solution/{req_id}
```

## Terminology: REST vs Python API

| Python API | REST |
|------------|------|
| order_locations | task_locations |
| set_order_time_windows() | task_time_windows |
| service_times | service_times |

Use `travel_time_matrix_data` (not transit_time_matrix_data). Capacities: `[[50, 50]]` not `[[50], [50]]`.

## Debugging (422 / payload)

**Validation errors:** Check field names against OpenAPI (`/cuopt.yaml`). Common mistakes: `transit_time_matrix_data` → `travel_time_matrix_data`; capacities per dimension `[[50, 50]]` not per vehicle `[[50], [50]]`. Capture `reqId` and response body for failed requests.

## Runnable assets

Run from each asset directory (server must be running; scripts exit 0 if server unreachable). All use Python `requests`:

- [assets/vrp_simple/](assets/vrp_simple/) — Basic VRP (no time windows)
- [assets/vrp_basic/](assets/vrp_basic/) — VRP with time windows
- [assets/pdp_basic/](assets/pdp_basic/) — Pickup and delivery
- [assets/lp_basic/](assets/lp_basic/) — LP via REST (CSR format)
- [assets/milp_basic/](assets/milp_basic/) — MILP via REST

See [assets/README.md](assets/README.md) for overview.

## Escalate

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

cuopt-server-api-python 설치

스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.

ZIP 다운로드

저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.

git clone https://github.com/NVIDIA/skills/tree/main/skills/cuopt-server-api-python # Copy SKILL.md to your .claude/skills/ directory

복사 복사
빠른 설정: 스킬 폴더를 .claude/skills/로 복사하세요. Claude가 해당 스킬을 자동으로 감지하여 사용할 것입니다.
저장소 NVIDIA/skills

관련 스킬

agentwallet
업데이트 된 시간 2026년 7월 7일
brightdata-cli
업데이트 된 시간 2026년 6월 29일
humanize
업데이트 된 시간 2026년 7월 7일
korean-stock-search
업데이트 된 시간 2026년 7월 8일
OR