Server API Reference

Server

Note

This reference documents the internal API for the cuOpt server that is part of the cuOpt Managed Service. It is intended to support development and to provide insight into the format for cuOpt problem data sumbitted to the cuOpt Managed Service. Users of the cuOpt Managed Service will not call this API directly. Additional information on the endpoints and spec can be found here

GET /cuopt/health

Health

To ping if server is running

Example request:

GET /cuopt/health HTTP/1.1
Host: example.com
Status Codes:
  • 200 OK

    Successful Response

    Example response:

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {}
    

POST /cuopt/get_optimized_routes_sync

Get Optimized Routes Sync

NOTE: This endpoint is deprecated and will be removed in the next release, please start using get_routesTakes all the data and options at once, solves the routing problem and returns result.

Example request:

POST /cuopt/get_optimized_routes_sync HTTP/1.1
Host: example.com
Content-Type: application/json

{
    "cost_waypoint_graph_data": {
        "waypoint_graph": {}
    },
    "travel_time_waypoint_graph_data": {
        "waypoint_graph": {}
    },
    "cost_matrix_data": {
        "cost_matrix": {}
    },
    "travel_time_matrix_data": {
        "cost_matrix": {}
    },
    "fleet_data": {
        "vehicle_locations": [
            [
                1
            ]
        ],
        "vehicle_ids": [
            "string"
        ],
        "capacities": [
            [
                1
            ]
        ],
        "priorities": [
            1
        ],
        "vehicle_time_windows": [
            [
                1.0
            ]
        ],
        "vehicle_break_time_windows": [
            [
                [
                    1
                ]
            ]
        ],
        "vehicle_break_durations": [
            [
                1
            ]
        ],
        "vehicle_break_locations": [
            1
        ],
        "vehicle_types": [
            1
        ],
        "vehicle_order_match": [
            {
                "vehicle_id": 1,
                "order_ids": [
                    1
                ]
            }
        ],
        "skip_first_trips": [
            true
        ],
        "drop_return_trips": [
            true
        ],
        "min_vehicles": 1,
        "vehicle_max_costs": [
            1.0
        ],
        "vehicle_max_times": [
            1.0
        ]
    },
    "task_data": {
        "task_locations": [
            1
        ],
        "task_ids": [
            "string"
        ],
        "demand": [
            [
                1
            ]
        ],
        "pickup_and_delivery_pairs": [
            [
                1
            ]
        ],
        "task_time_windows": [
            [
                1.0
            ]
        ],
        "service_times": [
            1.0
        ],
        "priorities": [
            1
        ],
        "prizes": [
            1.0
        ],
        "order_vehicle_match": [
            {
                "order_id": 1,
                "vehicle_ids": [
                    1
                ]
            }
        ],
        "mandatory_task_ids": [
            1
        ]
    },
    "solver_config": {
        "time_limit": 1.0,
        "objectives": {
            "cost": 1,
            "travel_time": 1,
            "variance_route_size": 1,
            "variance_route_service_time": 1,
            "prize": 1.0
        },
        "config_file": "string",
        "verbose_mode": true,
        "error_logging": true,
        "drop_infeasible_tasks": true
    }
}
Status Codes:
  • 200 OK

    Successful Response

    Example response:

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {}
    

  • 422 Unprocessable Entity

    Validation Error

    Example response:

    HTTP/1.1 422 Unprocessable Entity
    Content-Type: application/json
    
    {
        "detail": [
            {
                "loc": [
                    "string",
                    1
                ],
                "msg": "string",
                "type": "string"
            }
        ]
    }
    

Request Headers:
  • CUOPT-DATA-FILE – Name of data file to process in the server’s CUOPT_DATA_DIR when using the local file feature

  • CUOPT-RESULT-FILE – Result file name if output dir is enabled and size >= maxresult

  • CLIENT-VERSION – cuOpt client version. Set to ‘custom’ to skip version check

POST /cuopt/get_routes

Get Routes

Takes all the data and options at once, solves the routing problem and returns result.

Example request:

POST /cuopt/get_routes HTTP/1.1
Host: example.com
Content-Type: application/json

{
    "cost_waypoint_graph_data": {
        "waypoint_graph": {}
    },
    "travel_time_waypoint_graph_data": {
        "waypoint_graph": {}
    },
    "cost_matrix_data": {
        "cost_matrix": {}
    },
    "travel_time_matrix_data": {
        "cost_matrix": {}
    },
    "fleet_data": {
        "vehicle_locations": [
            [
                1
            ]
        ],
        "vehicle_ids": [
            "string"
        ],
        "capacities": [
            [
                1
            ]
        ],
        "priorities": [
            1
        ],
        "vehicle_time_windows": [
            [
                1.0
            ]
        ],
        "vehicle_break_time_windows": [
            [
                [
                    1
                ]
            ]
        ],
        "vehicle_break_durations": [
            [
                1
            ]
        ],
        "vehicle_break_locations": [
            1
        ],
        "vehicle_types": [
            1
        ],
        "vehicle_order_match": [
            {
                "vehicle_id": 1,
                "order_ids": [
                    1
                ]
            }
        ],
        "skip_first_trips": [
            true
        ],
        "drop_return_trips": [
            true
        ],
        "min_vehicles": 1,
        "vehicle_max_costs": [
            1.0
        ],
        "vehicle_max_times": [
            1.0
        ]
    },
    "task_data": {
        "task_locations": [
            1
        ],
        "task_ids": [
            "string"
        ],
        "demand": [
            [
                1
            ]
        ],
        "pickup_and_delivery_pairs": [
            [
                1
            ]
        ],
        "task_time_windows": [
            [
                1.0
            ]
        ],
        "service_times": [
            1.0
        ],
        "priorities": [
            1
        ],
        "prizes": [
            1.0
        ],
        "order_vehicle_match": [
            {
                "order_id": 1,
                "vehicle_ids": [
                    1
                ]
            }
        ],
        "mandatory_task_ids": [
            1
        ]
    },
    "solver_config": {
        "time_limit": 1.0,
        "objectives": {
            "cost": 1,
            "travel_time": 1,
            "variance_route_size": 1,
            "variance_route_service_time": 1,
            "prize": 1.0
        },
        "config_file": "string",
        "verbose_mode": true,
        "error_logging": true,
        "drop_infeasible_tasks": true
    }
}
Status Codes:
  • 200 OK

    Successful Response

    Example response:

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {}
    

  • 422 Unprocessable Entity

    Validation Error

    Example response:

    HTTP/1.1 422 Unprocessable Entity
    Content-Type: application/json
    
    {
        "detail": [
            {
                "loc": [
                    "string",
                    1
                ],
                "msg": "string",
                "type": "string"
            }
        ]
    }
    

Request Headers:
  • CUOPT-DATA-FILE – Name of data file to process in the server’s CUOPT_DATA_DIR when using the local file feature

  • CUOPT-RESULT-FILE – Result file name if output dir is enabled and size >= maxresult

  • CLIENT-VERSION – cuOpt client version. Set to ‘custom’ to skip version check