Resource: Optimizer
The optimizer that will run optimizations based on all vehicles and shipments within the workspace. Each optimization is triggered by a client call. When the optimizer runs an optimization, it will construct an OptimizeToursRequest
behind the scenes with the most up-to-date entity information and other constraints, and generate a solution. The corresponding OptimizeToursRequest
for each solution can be retrieved.
JSON representation |
---|
{ "name": string, "displayName": string, "modelSpec": { object ( |
Fields | |
---|---|
name |
The resource name of the optimizer. Format: |
displayName |
The display name of the optimizer. It can be up to 63 characters long and use UTF-8 characters. |
modelSpec |
The model spec that is used to formulate all |
optimizeToursSpec |
Spec used to configure the |
filters |
Filters applied to an optimizer which are used as conditions to select a subset of entities to run the optimization. |
ModelSpec
Spec that is used for providing global and relational costs and constraints for all optimizations conducted by this optimizer. The fields match their corresponding fields in ShipmentModel
.
JSON representation |
---|
{ "globalStartTime": string, "globalEndTime": string, "globalDurationCostPerHour": number, "transitionAttributes": [ { object ( |
Fields | |
---|---|
globalStartTime |
Global start and end time of the model: no times outside of this range can be considered valid. The model's time span must be less than a year, i.e. the When using A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
globalEndTime |
If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
globalDurationCostPerHour |
The "global duration" of the overall plan is the difference between the earliest effective start time and the latest effective end time of all vehicles. Users can assign a cost per hour to be used during the global duration period to try and optimize for earliest job completion, for example. This cost must be in the same unit as |
transitionAttributes[] |
Transition attributes added to the model. |
shipmentTypeIncompatibilities[] |
Sets of incompatible shipment_types (see |
shipmentTypeRequirements[] |
Sets of |
precedenceRules[] |
Set of precedence rules which must be enforced in the model. |
maxActiveVehicles |
Constrains the maximum number of active vehicles. A vehicle is active if its route performs at least one shipment. This can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicles is heterogeneous. The optimization will then select the best subset of vehicles to use. Must be strictly positive. |
TransitionAttributes
Specifies attributes of transitions between two consecutive visits on a route. Several TransitionAttributes
may apply to the same transition: in that case, all extra costs add up and the strictest constraint or limit applies (following natural "AND" semantics).
JSON representation |
---|
{
"srcTag": string,
"excludedSrcTag": string,
"dstTag": string,
"excludedDstTag": string,
"cost": number,
"costPerKilometer": number,
"distanceLimit": {
object ( |
Fields | |
---|---|
srcTag |
Tags defining the set of (src->dst) transitions these attributes apply to. A source visit or vehicle start matches iff its |
excludedSrcTag |
See |
dstTag |
A destination visit or vehicle end matches iff its |
excludedDstTag |
See |
cost |
Specifies a cost for performing this transition. This is in the same unit as all other costs in the model and must not be negative. It is applied on top of all other existing costs. |
costPerKilometer |
Specifies a cost per kilometer applied to the distance traveled while performing this transition. It adds up to any |
distanceLimit |
Specifies a limit on the distance traveled while performing this transition. As of 2021/06, only soft limits are supported. |
delay |
Specifies a delay incurred when performing this transition. This delay always occurs after finishing the source visit and before starting the destination visit. A duration in seconds with up to nine fractional digits, ending with ' |
ShipmentTypeIncompatibility
Specifies incompatibilties between shipments depending on their shipmentType. The appearance of incompatible shipments on the same route is restricted based on the incompatibility mode.
JSON representation |
---|
{
"types": [
string
],
"incompatibilityMode": enum ( |
Fields | |
---|---|
types[] |
List of incompatible types. Two shipments having different |
incompatibilityMode |
Mode applied to the incompatibility. |
IncompatibilityMode
Modes defining how the appearance of incompatible shipments are restricted on the same route.
Enums | |
---|---|
INCOMPATIBILITY_MODE_UNSPECIFIED |
Unspecified incompatibility mode. This value should never be used. |
NOT_PERFORMED_BY_SAME_VEHICLE |
In this mode, two shipments with incompatible types can never share the same vehicle. |
NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY |
For two shipments with incompatible types with the
|
ShipmentTypeRequirement
Specifies requirements between shipments based on their shipmentType. The specifics of the requirement are defined by the requirement mode.
JSON representation |
---|
{
"requiredShipmentTypeAlternatives": [
string
],
"dependentShipmentTypes": [
string
],
"requirementMode": enum ( |
Fields | |
---|---|
requiredShipmentTypeAlternatives[] |
List of alternative shipment types required by the |
dependentShipmentTypes[] |
All shipments with a type in the NOTE: Chains of requirements such that a |
requirementMode |
Mode applied to the requirement. |
RequirementMode
Modes defining the appearance of dependent shipments on a route.
Enums | |
---|---|
REQUIREMENT_MODE_UNSPECIFIED |
Unspecified requirement mode. This value should never be used. |
PERFORMED_BY_SAME_VEHICLE |
In this mode, all "dependent" shipments must share the same vehicle as at least one of their "required" shipments. |
IN_SAME_VEHICLE_AT_PICKUP_TIME |
With the A "dependent" shipment pickup must therefore have either:
|
IN_SAME_VEHICLE_AT_DELIVERY_TIME |
Same as before, except the "dependent" shipments need to have a "required" shipment on their vehicle at the time of their delivery. |
PrecedenceRule
A precedence rule between two events (each event is the pickup or the delivery of a shipment): the "second" event has to start at least offsetDuration
after "first" has started.
Several precedences can refer to the same (or related) events, e.g., "pickup of B happens after delivery of A" and "pickup of C happens after pickup of B".
Furthermore, precedences only apply when both shipments are performed and are otherwise ignored.
JSON representation |
---|
{ "firstIsDelivery": boolean, "secondIsDelivery": boolean, "offsetDuration": string, "firstIndex": integer, "secondIndex": integer } |
Fields | |
---|---|
firstIsDelivery |
Indicates if the "first" event is a delivery. |
secondIsDelivery |
Indicates if the "second" event is a delivery. |
offsetDuration |
The offset between the "first" and "second" event. It can be negative. A duration in seconds with up to nine fractional digits, ending with ' |
firstIndex |
Shipment index of the "first" event. This field must be specified. |
secondIndex |
Shipment index of the "second" event. This field must be specified. |
OptimizeToursSpec
Spec used to configure the OptimizeToursRequest
by the optimizer every time it runs an optimization. The fields matches their corresponding fields in OptimizeToursRequest
.
JSON representation |
---|
{
"timeout": string,
"searchMode": enum ( |
Fields | |
---|---|
timeout |
If this timeout is set, 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 ' |
searchMode |
Search mode used to solve the request. |
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 |
geodesicMetersPerSecond |
When |
SearchMode
Mode defining the behavior of the search, trading off latency versus solution quality. In all modes, the global request deadline is enforced.
Enums | |
---|---|
SEARCH_MODE_UNSPECIFIED |
Unspecified search mode, equivalent to RETURN_FAST . |
RETURN_FAST |
Stop the search after finding the first good solution. |
CONSUME_ALL_AVAILABLE_TIME |
Spend all the available time to search for better solutions. |
Filters
Filter expressions that match a subset of the entities to optimize. For more information about filter syntax, see https://google.aip.dev/160.
JSON representation |
---|
{ "shipmentFilter": string, "vehicleFilter": string } |
Fields | |
---|---|
shipmentFilter |
Filter expression that matches a subset of the shipments to optimize. |
vehicleFilter |
Filter expression that matches a subset of the vehicles to optimize. |
Methods |
|
---|---|
|
Creates an optimizer . |
|
Deletes an optimizer. |
|
Gets an optimizer. |
|
Lists the optimizers within a workspace. |
|
Updates an optimizer. |
|
Run the optimizer to generate a solution based on updated entities (e.g. |