A shipment model contains a set of shipments which must be performed by a set of vehicles, while minimizing the overall cost, which is the sum of:
- the cost of routing the vehicles (sum of cost per total time, cost per travel time, and fixed cost over all vehicles).
- the unperformed shipment penalties.
- the cost of the global duration of the shipments
JSON representation |
---|
{ "shipments": [ { object ( |
Fields | |
---|---|
shipments[] |
Set of shipments which must be performed in the model. |
vehicles[] |
Set of vehicles which can be used to perform visits. |
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 that quantity to try and optimize for earliest job completion, for example. This cost must be in the same unit as |
durationDistanceMatrices[] |
Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the Usage examples:
|
durationDistanceMatrixSrcTags[] |
Tags defining the sources of the duration and distance matrices; Tags correspond to |
durationDistanceMatrixDstTags[] |
Tags defining the destinations of the duration and distance matrices; Tags correspond to |
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. |
breakRules[] |
Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the |
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. |
DurationDistanceMatrix
Specifies a duration and distance matrix from visit and vehicle start locations to visit and vehicle end locations.
JSON representation |
---|
{
"rows": [
{
object ( |
Fields | |
---|---|
rows[] |
Specifies the rows of the duration and distance matrix. It must have as many elements as |
vehicleStartTag |
Tag defining to which vehicles this duration and distance matrix applies. If empty, this applies to all vehicles, and there can only be a single matrix. Each vehicle start must match exactly one matrix, i.e. exactly one of their All matrices must have a different |
Row
Specifies a row of the duration and distance matrix.
JSON representation |
---|
{ "durations": [ string ], "meters": [ number ] } |
Fields | |
---|---|
durations[] |
Duration values for a given row. It must have as many elements as A duration in seconds with up to nine fractional digits, ending with ' |
meters[] |
Distance values for a given row. If no costs or constraints refer to distances in the model, this can be left empty; otherwise it must have as many elements as |
BreakRule
Deprecated: Use top level BreakRule
instead. Rules to generate time breaks for a vehicle (e.g. lunch breaks). A break is a contiguous period of time during which the vehicle remains idle at its current position and cannot perform any visit. A break may occur:
- during the travel between two visits (which includes the time right before or right after a visit, but not in the middle of a visit), in which case it extends the corresponding transit time between the visits
- before the vehicle start (the vehicle may not start in the middle of a break), in which case it does not affect the vehicle start time.
- after the vehicle end (ditto, with the vehicle end time).
JSON representation |
---|
{ "breakRequests": [ { object ( |
Fields | |
---|---|
breakRequests[] |
Sequence of breaks. See the |
frequencyConstraints[] |
Several |
BreakRequest
The sequence of breaks (i.e. their number and order) that apply to each vehicle must be known beforehand. The repeated BreakRequest
s define that sequence, in the order in which they must occur. Their time windows (earliestStartTime
/ latestStartTime
) may overlap, but they must be compatible with the order (this is checked).
JSON representation |
---|
{ "earliestStartTime": string, "latestStartTime": string, "minDuration": string } |
Fields | |
---|---|
earliestStartTime |
Required. Lower bound (inclusive) on the start of the break. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
latestStartTime |
Required. Upper bound (inclusive) on the start of the break. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
minDuration |
Required. Minimum duration of the break. Must be positive. A duration in seconds with up to nine fractional digits, ending with ' |
FrequencyConstraint
One may further constrain the frequency and duration of the breaks specified above, by enforcing a minimum break frequency, such as "There must be a break of at least 1 hour every 12 hours". Assuming that this can be interpreted as "Within any sliding time window of 12h, there must be at least one break of at least one hour", that example would translate to the following FrequencyConstraint
:
{
minBreakDuration { seconds: 3600 } # 1 hour.
maxInterBreakDuration { seconds: 39600 } # 11 hours (12 - 1 = 11).
}
The timing and duration of the breaks in the solution will respect all such constraints, in addition to the time windows and minimum durations already specified in the BreakRequest
.
A FrequencyConstraint
may in practice apply to non-consecutive breaks. For example, the following schedule honors the "1h every 12h" example:
04:00 vehicle start
.. performing travel and visits ..
09:00 1 hour break
10:00 end of the break
.. performing travel and visits ..
12:00 20-min lunch break
12:20 end of the break
.. performing travel and visits ..
21:00 1 hour break
22:00 end of the break
.. performing travel and visits ..
23:59 vehicle end
JSON representation |
---|
{ "minBreakDuration": string, "maxInterBreakDuration": string } |
Fields | |
---|---|
minBreakDuration |
Required. Minimum break duration for this constraint. Nonnegative. See description of A duration in seconds with up to nine fractional digits, ending with ' |
maxInterBreakDuration |
Required. Maximum allowed span of any interval of time in the route that does not include at least partially a break of A duration in seconds with up to nine fractional digits, ending with ' |