Sends an OptimizeToursRequest
containing a ShipmentModel
and returns an OptimizeToursResponse
containing ShipmentRoute
s, which are a set of routes to be performed by vehicles minimizing the overall cost.
A ShipmentModel
model consists mainly of Shipment
s that need to be carried out and Vehicle
s that can be used to transport the Shipment
s. The ShipmentRoute
s assign Shipment
s to Vehicle
s. More specifically, they assign a series of Visit
s to each vehicle, where a Visit
corresponds to a VisitRequest
, which is a pickup or delivery for a Shipment
.
The goal is to provide an assignment of ShipmentRoute
s to Vehicle
s that minimizes the total cost where cost has many components defined in the ShipmentModel
.
HTTP request
POST https://cloudoptimization.googleapis.com/v1/{parent}:optimizeTours
Path parameters
Parameters | |
---|---|
parent |
Required. Target project and location to make a call. Format: If no location is specified, a region will be chosen automatically. |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "timeout": string, "model": { object ( |
Fields | |
---|---|
timeout |
If this timeout is set, the server returns a response before the timeout period has elapsed or the server deadline for synchronous requests is reached, whichever is sooner. For asynchronous requests, the server will generate a solution (if possible) before the timeout has elapsed. A duration in seconds with up to nine fractional digits, ending with ' |
model |
Shipment model to solve. |
solvingMode |
By default, the solving mode is |
searchMode |
Search mode used to solve the request. |
injectedFirstSolutionRoutes[] |
Guide the optimization algorithm in finding a first solution that is similar to a previous solution. The model is constrained when the first solution is built. Any shipments not performed on a route are implicitly skipped in the first solution, but they may be performed in successive solutions. The solution must satisfy some basic validity assumptions:
If the injected solution is not feasible, a validation error is not necessarily returned and an error indicating infeasibility may be returned instead. |
injectedSolutionConstraint |
Constrain the optimization algorithm to find a final solution that is similar to a previous solution. For example, this may be used to freeze portions of routes which have already been completed or which are to be completed but must not be modified. If the injected solution is not feasible, a validation error is not necessarily returned and an error indicating infeasibility may be returned instead. |
refreshDetailsRoutes[] |
If non-empty, the given routes will be refreshed, without modifying their underlying sequence of visits or travel times: only other details will be updated. This does not solve the model. As of 2020/11, this only populates the polylines of non-empty routes and requires that The This field must not be used together with
|
interpretInjectedSolutionsUsingLabels |
If true:
This interpretation applies to the If true, labels in the following categories must appear at most once in their category:
If a Removing route visits or entire routes from an injected solution may have an effect on the implied constraints, which may lead to change in solution, validation errors, or infeasibility. NOTE: The caller must ensure that each |
considerRoadTraffic |
Consider traffic estimation in calculating |
populatePolylines |
If true, polylines will be populated in response |
populateTransitionPolylines |
If true, polylines will be populated in response |
allowLargeDeadlineDespiteInterruptionRisk |
If this is set, then the request can have a deadline (see https://grpc.io/blog/deadlines) of up to 60 minutes. Otherwise, the maximum deadline is only 30 minutes. Note that long-lived requests have a significantly larger (but still small) risk of interruption. |
useGeodesicDistances |
If true, travel distances will be computed using geodesic distances instead of Google Maps distances, and travel times will be computed using geodesic distances with a speed defined by |
label |
Label that may be used to identify this request, reported back in the |
populateTravelStepPolylines |
Deprecated: Use |
geodesicMetersPerSecond |
When |
maxValidationErrors |
Truncates the number of validation errors returned. These errors are typically attached to an INVALID_ARGUMENT error payload as a BadRequest error detail (https://cloud.google.com/apis/design/errors#error_details), unless solvingMode=VALIDATE_ONLY: see the |
Response body
If successful, the response body contains an instance of OptimizeToursResponse
.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.