gRPC API (Reference)#
The CuOptRemoteService gRPC API is defined in Protocol Buffers under the cuopt.remote package:
cuopt_remote_service.proto— service and job/chunk/log RPCscuopt_remote.proto— LP/MIP problem, settings, and result messagescuopt_remote_data.proto— problem and result fields, including the array field ids used by chunked transfer. Generated fromcpp/src/grpc/codegen/field_registry.yamland committed to the repository.cuopt_routing.proto— VRP request messagescuopt_routing_solution.proto— VRP result messages
Download all five as cuopt-protos.zip. They import each other by file name, so keep them in one directory.
The libcuopt-client wheel and conda package install the same five files:
pip:
<site-packages>/libcuopt_client/share/cuopt/protoconda:
$CONDA_PREFIX/share/cuopt/proto
Generate stubs for your language with that directory as the include path, for example for Python:
python -m grpc_tools.protoc -I "$PROTO_DIR" --python_out=. --grpc_python_out=. \
"$PROTO_DIR"/*.proto
The same files are in the repository under cpp/src/grpc/, cpp/src/grpc/routing/ and cpp/src/grpc/codegen/generated/. The chunked-transfer wire format is described in GRPC_INTERFACE.md.
Most users do not call these RPCs directly:
Remote execution — Python, C (
cuOptSolve),cuopt_cli, and modeling-language integrations that call those APIs forward LP, MIP, and QP solves whenCUOPT_REMOTE_HOSTandCUOPT_REMOTE_PORTare set (Quick Start, Advanced Configuration).gRPC linear programming client —
cuopt.grpc.linear_programming.Clientfor LP, MIP, and QP (gRPC Linear Programming Client).gRPC routing client —
cuopt.grpc.routing.RoutingClientfor VRP, TSP, and PDP (gRPC Routing Client).
Custom clients call CuOptRemoteService over gRPC using these definitions.
This page summarizes the service for custom integrators and debugging.
Service: CuOptRemoteService#
Asynchronous Jobs#
RPC |
Purpose |
|---|---|
|
Submit an LP, MIP, or VRP job in one message (within gRPC message size limits; VRP is unary-only today, see gRPC Routing Client). |
|
Poll job status by |
|
Fetch a completed result (unary, when the payload fits one message). |
|
Cancel the job if it is still queued or running, then remove all server-side state for that |
|
Cancel a queued or running job. |
|
Block until the job finishes (status only; use |
Chunked Upload (Large Problems)#
RPC |
Purpose |
|---|---|
|
Begin a session; send problem metadata and settings (arrays follow as chunks). |
|
Upload one slice of a numeric array field. |
|
Finalize the upload and return |
Chunked Download (Large Results)#
RPC |
Purpose |
|---|---|
|
Begin a download session; returns scalar result fields and array descriptors. |
|
Fetch one chunk of a result array. |
|
End the download session and release server state. |
Streaming and Callbacks#
RPC |
Purpose |
|---|---|
|
Server-streaming solver log lines for a job. |
|
MIP incumbent solutions since a given index (only if the job was
submitted with |
Messages and Constraints#
Problem types — Wire categories are LP/QP, MIP, or VRP. QP is submitted as
lp_request(SolveLPRequest) with quadratic fields onOptimizationProblem. VRP rides the sameSubmitJob/GetResultRPCs as LP/MIP, as avrp_requestpayload typed bycpp/src/grpc/routing/cuopt_routing.proto(problem) andcuopt_routing_solution.proto(result) – not a separate service. There is noCUOPT_REMOTE_HOST/CUOPT_REMOTE_PORTremote-execution path for routing; use the gRPC routing client (gRPC Routing Client) or REST for remote routing.Solver settings — Carried as
PDLPSolverSettingsorMIPSolverSettingsinside the request or chunked header, aligned with the NVIDIA cuOpt solver options documentation.Errors — Transport failures use gRPC status codes. Some outcomes use
Status::OKwith response fields:CheckStatusreports unknown jobs asjob_status=NOT_FOUND;GetResultuses transportNOT_FOUND/UNAVAILABLE(not ready) andstatus=ERROR_SOLVE_FAILEDfor failed solves;DeleteResult/CancelJobreport outcomes in the response. Seecuopt_remote_service.proto.
Further Reading#
gRPC Linear Programming Client / gRPC Linear Programming Client API Reference — gRPC linear programming client (
cuopt.grpc.linear_programming) built on these RPCs. gRPC Routing Client / gRPC Routing Client API Reference — gRPC routing client.gRPC Server Behavior — Server process model and job lifecycle (overview); Advanced Configuration for
cuopt_grpc_serverflags. Contributor details:cpp/docs/grpc-server-architecture.md.Advanced Configuration — TLS, Docker, client environment variables, and limitations.