@googlemaps/routeoptimization 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2537 @@
1
+ // Copyright 2024 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package google.maps.routeoptimization.v1;
18
+
19
+ import "google/api/annotations.proto";
20
+ import "google/api/client.proto";
21
+ import "google/api/field_behavior.proto";
22
+ import "google/longrunning/operations.proto";
23
+ import "google/protobuf/duration.proto";
24
+ import "google/protobuf/timestamp.proto";
25
+ import "google/type/latlng.proto";
26
+
27
+ option csharp_namespace = "Google.Maps.RouteOptimization.V1";
28
+ option go_package = "cloud.google.com/go/maps/routeoptimization/apiv1/routeoptimizationpb;routeoptimizationpb";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "RouteOptimizationServiceProto";
31
+ option java_package = "com.google.maps.routeoptimization.v1";
32
+ option php_namespace = "Google\\Maps\\RouteOptimization\\V1";
33
+ option ruby_package = "Google::Maps::RouteOptimization::V1";
34
+
35
+ // A service for optimizing vehicle tours.
36
+ //
37
+ // Validity of certain types of fields:
38
+ //
39
+ // * `google.protobuf.Timestamp`
40
+ // * Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00.
41
+ // * seconds must be in [0, 253402300799],
42
+ // i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
43
+ // * nanos must be unset or set to 0.
44
+ // * `google.protobuf.Duration`
45
+ // * seconds must be in [0, 253402300799],
46
+ // i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
47
+ // * nanos must be unset or set to 0.
48
+ // * `google.type.LatLng`
49
+ // * latitude must be in [-90.0, 90.0].
50
+ // * longitude must be in [-180.0, 180.0].
51
+ // * at least one of latitude and longitude must be non-zero.
52
+ //
53
+ service RouteOptimization {
54
+ option (google.api.default_host) = "routeoptimization.googleapis.com";
55
+ option (google.api.oauth_scopes) =
56
+ "https://www.googleapis.com/auth/cloud-platform";
57
+
58
+ // Sends an `OptimizeToursRequest` containing a `ShipmentModel` and returns an
59
+ // `OptimizeToursResponse` containing `ShipmentRoute`s, which are a set of
60
+ // routes to be performed by vehicles minimizing the overall cost.
61
+ //
62
+ // A `ShipmentModel` model consists mainly of `Shipment`s that need to be
63
+ // carried out and `Vehicle`s that can be used to transport the `Shipment`s.
64
+ // The `ShipmentRoute`s assign `Shipment`s to `Vehicle`s. More specifically,
65
+ // they assign a series of `Visit`s to each vehicle, where a `Visit`
66
+ // corresponds to a `VisitRequest`, which is a pickup or delivery for a
67
+ // `Shipment`.
68
+ //
69
+ // The goal is to provide an assignment of `ShipmentRoute`s to `Vehicle`s that
70
+ // minimizes the total cost where cost has many components defined in the
71
+ // `ShipmentModel`.
72
+ rpc OptimizeTours(OptimizeToursRequest) returns (OptimizeToursResponse) {
73
+ option (google.api.http) = {
74
+ post: "/v1/{parent=projects/*/locations/*}:optimizeTours"
75
+ body: "*"
76
+ additional_bindings {
77
+ post: "/v1/{parent=projects/*}:optimizeTours"
78
+ body: "*"
79
+ }
80
+ };
81
+ }
82
+
83
+ // Optimizes vehicle tours for one or more `OptimizeToursRequest`
84
+ // messages as a batch.
85
+ //
86
+ // This method is a Long Running Operation (LRO). The inputs for optimization
87
+ // (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse`
88
+ // messages) are read/written from/to Cloud Storage in user-specified
89
+ // format. Like the `OptimizeTours` method, each `OptimizeToursRequest`
90
+ // contains a `ShipmentModel` and returns an `OptimizeToursResponse`
91
+ // containing `ShipmentRoute`s, which are a set of routes to be performed by
92
+ // vehicles minimizing the overall cost.
93
+ rpc BatchOptimizeTours(BatchOptimizeToursRequest)
94
+ returns (google.longrunning.Operation) {
95
+ option (google.api.http) = {
96
+ post: "/v1/{parent=projects/*/locations/*}:batchOptimizeTours"
97
+ body: "*"
98
+ additional_bindings {
99
+ post: "/v1/{parent=projects/*}:batchOptimizeTours"
100
+ body: "*"
101
+ }
102
+ };
103
+ option (google.longrunning.operation_info) = {
104
+ response_type: "BatchOptimizeToursResponse"
105
+ metadata_type: "BatchOptimizeToursMetadata"
106
+ };
107
+ }
108
+ }
109
+
110
+ // Request to batch optimize tours as an asynchronous operation.
111
+ // Each input file should contain one `OptimizeToursRequest`, and each output
112
+ // file will contain one `OptimizeToursResponse`. The request contains
113
+ // information to read/write and parse the files. All the input and output files
114
+ // should be under the same project.
115
+ message BatchOptimizeToursRequest {
116
+ // Information for solving one optimization model asynchronously.
117
+ message AsyncModelConfig {
118
+ // Optional. User defined model name, can be used as alias by users to keep
119
+ // track of models.
120
+ string display_name = 1 [(google.api.field_behavior) = OPTIONAL];
121
+
122
+ // Required. Information about the input model.
123
+ InputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED];
124
+
125
+ // Required. The desired output location information.
126
+ OutputConfig output_config = 3 [(google.api.field_behavior) = REQUIRED];
127
+ }
128
+
129
+ // Required. Target project and location to make a call.
130
+ //
131
+ // Format:
132
+ // * `projects/{project-id}`
133
+ // * `projects/{project-id}/locations/{location-id}`
134
+ //
135
+ // If no location is specified, a region will be chosen automatically.
136
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
137
+
138
+ // Required. Input/Output information each purchase model, such as file paths
139
+ // and data formats.
140
+ repeated AsyncModelConfig model_configs = 2
141
+ [(google.api.field_behavior) = REQUIRED];
142
+ }
143
+
144
+ // Response to a `BatchOptimizeToursRequest`. This is returned in
145
+ // the Long Running Operation after the operation is complete.
146
+ message BatchOptimizeToursResponse {}
147
+
148
+ // Operation metadata for `BatchOptimizeToursRequest` calls.
149
+ message BatchOptimizeToursMetadata {}
150
+
151
+ // Request to be given to a tour optimization solver which defines the
152
+ // shipment model to solve as well as optimization parameters.
153
+ message OptimizeToursRequest {
154
+ // Defines how the solver should handle the request. In all modes but
155
+ // `VALIDATE_ONLY`, if the request is invalid, you will receive an
156
+ // `INVALID_REQUEST` error. See
157
+ // [max_validation_errors][google.maps.routeoptimization.v1.OptimizeToursRequest.max_validation_errors]
158
+ // to cap the number of errors returned.
159
+ enum SolvingMode {
160
+ // Solve the model.
161
+ DEFAULT_SOLVE = 0;
162
+
163
+ // Only validates the model without solving it: populates as many
164
+ // [OptimizeToursResponse.validation_errors][google.maps.routeoptimization.v1.OptimizeToursResponse.validation_errors]
165
+ // as possible.
166
+ VALIDATE_ONLY = 1;
167
+
168
+ // Only populates
169
+ // [OptimizeToursResponse.validation_errors][google.maps.routeoptimization.v1.OptimizeToursResponse.validation_errors]
170
+ // or
171
+ // [OptimizeToursResponse.skipped_shipments][google.maps.routeoptimization.v1.OptimizeToursResponse.skipped_shipments],
172
+ // and doesn't actually solve the rest of the request (`status` and `routes`
173
+ // are unset in the response).
174
+ // If infeasibilities in `injected_solution_constraint` routes are detected
175
+ // they are populated in the
176
+ // [OptimizeToursResponse.validation_errors][google.maps.routeoptimization.v1.OptimizeToursResponse.validation_errors]
177
+ // field and
178
+ // [OptimizeToursResponse.skipped_shipments][google.maps.routeoptimization.v1.OptimizeToursResponse.skipped_shipments]
179
+ // is left empty.
180
+ //
181
+ // *IMPORTANT*: not all infeasible shipments are returned here, but only the
182
+ // ones that are detected as infeasible during preprocessing.
183
+ DETECT_SOME_INFEASIBLE_SHIPMENTS = 2;
184
+ }
185
+
186
+ // Mode defining the behavior of the search, trading off latency versus
187
+ // solution quality. In all modes, the global request deadline is enforced.
188
+ enum SearchMode {
189
+ // Unspecified search mode, equivalent to `RETURN_FAST`.
190
+ SEARCH_MODE_UNSPECIFIED = 0;
191
+
192
+ // Stop the search after finding the first good solution.
193
+ RETURN_FAST = 1;
194
+
195
+ // Spend all the available time to search for better solutions.
196
+ CONSUME_ALL_AVAILABLE_TIME = 2;
197
+ }
198
+
199
+ // Required. Target project or location to make a call.
200
+ //
201
+ // Format:
202
+ // * `projects/{project-id}`
203
+ // * `projects/{project-id}/locations/{location-id}`
204
+ //
205
+ // If no location is specified, a region will be chosen automatically.
206
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
207
+
208
+ // If this timeout is set, the server returns a response before the timeout
209
+ // period has elapsed or the server deadline for synchronous requests is
210
+ // reached, whichever is sooner.
211
+ //
212
+ // For asynchronous requests, the server will generate a solution (if
213
+ // possible) before the timeout has elapsed.
214
+ google.protobuf.Duration timeout = 2;
215
+
216
+ // Shipment model to solve.
217
+ ShipmentModel model = 3;
218
+
219
+ // By default, the solving mode is `DEFAULT_SOLVE` (0).
220
+ SolvingMode solving_mode = 4;
221
+
222
+ // Search mode used to solve the request.
223
+ SearchMode search_mode = 6;
224
+
225
+ // Guide the optimization algorithm in finding a first solution that is
226
+ // similar to a previous solution.
227
+ //
228
+ // The model is constrained when the first solution is built.
229
+ // Any shipments not performed on a route are implicitly skipped in the first
230
+ // solution, but they may be performed in successive solutions.
231
+ //
232
+ // The solution must satisfy some basic validity assumptions:
233
+ //
234
+ // * for all routes, `vehicle_index` must be in range and not be duplicated.
235
+ // * for all visits, `shipment_index` and `visit_request_index` must be
236
+ // in range.
237
+ // * a shipment may only be referenced on one route.
238
+ // * the pickup of a pickup-delivery shipment must be performed before
239
+ // the delivery.
240
+ // * no more than one pickup alternative or delivery alternative of
241
+ // a shipment may be performed.
242
+ // * for all routes, times are increasing (i.e., `vehicle_start_time
243
+ // <= visits[0].start_time <= visits[1].start_time ...
244
+ // <= vehicle_end_time`).
245
+ // * a shipment may only be performed on a vehicle that is allowed. A
246
+ // vehicle is allowed if
247
+ // [Shipment.allowed_vehicle_indices][google.maps.routeoptimization.v1.Shipment.allowed_vehicle_indices]
248
+ // is empty or its `vehicle_index` is included in
249
+ // [Shipment.allowed_vehicle_indices][google.maps.routeoptimization.v1.Shipment.allowed_vehicle_indices].
250
+ //
251
+ // If the injected solution is not feasible, a validation error is not
252
+ // necessarily returned and an error indicating infeasibility may be returned
253
+ // instead.
254
+ repeated ShipmentRoute injected_first_solution_routes = 7;
255
+
256
+ // Constrain the optimization algorithm to find a final solution that is
257
+ // similar to a previous solution. For example, this may be used to freeze
258
+ // portions of routes which have already been completed or which are to be
259
+ // completed but must not be modified.
260
+ //
261
+ // If the injected solution is not feasible, a validation error is not
262
+ // necessarily returned and an error indicating infeasibility may be returned
263
+ // instead.
264
+ InjectedSolutionConstraint injected_solution_constraint = 8;
265
+
266
+ // If non-empty, the given routes will be refreshed, without modifying their
267
+ // underlying sequence of visits or travel times: only other details will be
268
+ // updated. This does not solve the model.
269
+ //
270
+ // As of 2020/11, this only populates the polylines of non-empty routes and
271
+ // requires that `populate_polylines` is true.
272
+ //
273
+ // The `route_polyline` fields of the passed-in routes may be inconsistent
274
+ // with route `transitions`.
275
+ //
276
+ // This field must not be used together with `injected_first_solution_routes`
277
+ // or `injected_solution_constraint`.
278
+ //
279
+ // `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior.
280
+ // Polylines are still populated between all visits in all non-empty routes
281
+ // regardless of whether the related shipments or vehicles are ignored.
282
+ repeated ShipmentRoute refresh_details_routes = 9;
283
+
284
+ // If true:
285
+ //
286
+ // * uses
287
+ // [ShipmentRoute.vehicle_label][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_label]
288
+ // instead of `vehicle_index` to
289
+ // match routes in an injected solution with vehicles in the request;
290
+ // reuses the mapping of original
291
+ // [ShipmentRoute.vehicle_index][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_index]
292
+ // to new
293
+ // [ShipmentRoute.vehicle_index][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_index]
294
+ // to update
295
+ // [ConstraintRelaxation.vehicle_indices][google.maps.routeoptimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices]
296
+ // if non-empty, but the mapping must be unambiguous (i.e., multiple
297
+ // `ShipmentRoute`s must not share the same original `vehicle_index`).
298
+ // * uses
299
+ // [ShipmentRoute.Visit.shipment_label][google.maps.routeoptimization.v1.ShipmentRoute.Visit.shipment_label]
300
+ // instead of `shipment_index`
301
+ // to match visits in an injected solution with shipments in the request;
302
+ // * uses
303
+ // [SkippedShipment.label][google.maps.routeoptimization.v1.SkippedShipment.label]
304
+ // instead of
305
+ // [SkippedShipment.index][google.maps.routeoptimization.v1.SkippedShipment.index]
306
+ // to
307
+ // match skipped shipments in the injected solution with request
308
+ // shipments.
309
+ //
310
+ // This interpretation applies to the `injected_first_solution_routes`,
311
+ // `injected_solution_constraint`, and `refresh_details_routes` fields.
312
+ // It can be used when shipment or vehicle indices in the request have
313
+ // changed since the solution was created, perhaps because shipments or
314
+ // vehicles have been removed from or added to the request.
315
+ //
316
+ // If true, labels in the following categories must appear at most once in
317
+ // their category:
318
+ //
319
+ // * [Vehicle.label][google.maps.routeoptimization.v1.Vehicle.label] in the
320
+ // request;
321
+ // * [Shipment.label][google.maps.routeoptimization.v1.Shipment.label] in
322
+ // the request;
323
+ // * [ShipmentRoute.vehicle_label][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_label] in the injected solution;
324
+ // * [SkippedShipment.label][google.maps.routeoptimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.maps.routeoptimization.v1.ShipmentRoute.Visit.shipment_label] in
325
+ // the injected solution (except pickup/delivery visit pairs, whose
326
+ // `shipment_label` must appear twice).
327
+ //
328
+ // If a `vehicle_label` in the injected solution does not correspond to a
329
+ // request vehicle, the corresponding route is removed from the solution
330
+ // along with its visits. If a `shipment_label` in the injected solution does
331
+ // not correspond to a request shipment, the corresponding visit is removed
332
+ // from the solution. If a
333
+ // [SkippedShipment.label][google.maps.routeoptimization.v1.SkippedShipment.label]
334
+ // in the injected solution does not correspond to a request shipment, the
335
+ // `SkippedShipment` is removed from the solution.
336
+ //
337
+ // Removing route visits or entire routes from an injected solution may
338
+ // have an effect on the implied constraints, which may lead to change in
339
+ // solution, validation errors, or infeasibility.
340
+ //
341
+ // NOTE: The caller must ensure that each
342
+ // [Vehicle.label][google.maps.routeoptimization.v1.Vehicle.label] (resp.
343
+ // [Shipment.label][google.maps.routeoptimization.v1.Shipment.label]) uniquely
344
+ // identifies a vehicle (resp. shipment) entity used across the two relevant
345
+ // requests: the past request that produced the `OptimizeToursResponse` used
346
+ // in the injected solution and the current request that includes the injected
347
+ // solution. The uniqueness checks described above are not enough to guarantee
348
+ // this requirement.
349
+ bool interpret_injected_solutions_using_labels = 10;
350
+
351
+ // Consider traffic estimation in calculating `ShipmentRoute` fields
352
+ // [Transition.travel_duration][google.maps.routeoptimization.v1.ShipmentRoute.Transition.travel_duration],
353
+ // [Visit.start_time][google.maps.routeoptimization.v1.ShipmentRoute.Visit.start_time],
354
+ // and `vehicle_end_time`; in setting the
355
+ // [ShipmentRoute.has_traffic_infeasibilities][google.maps.routeoptimization.v1.ShipmentRoute.has_traffic_infeasibilities]
356
+ // field, and in calculating the
357
+ // [OptimizeToursResponse.total_cost][google.maps.routeoptimization.v1.OptimizeToursResponse.total_cost]
358
+ // field.
359
+ bool consider_road_traffic = 11;
360
+
361
+ // If true, polylines will be populated in response `ShipmentRoute`s.
362
+ bool populate_polylines = 12;
363
+
364
+ // If true, polylines will be populated in response
365
+ // [ShipmentRoute.transitions][google.maps.routeoptimization.v1.ShipmentRoute.transitions].
366
+ bool populate_transition_polylines = 13;
367
+
368
+ // If this is set, then the request can have a deadline
369
+ // (see https://grpc.io/blog/deadlines) of up to 60 minutes.
370
+ // Otherwise, the maximum deadline is only 30 minutes.
371
+ // Note that long-lived requests have a significantly larger (but still small)
372
+ // risk of interruption.
373
+ bool allow_large_deadline_despite_interruption_risk = 14;
374
+
375
+ // If true, travel distances will be computed using geodesic distances instead
376
+ // of Google Maps distances, and travel times will be computed using geodesic
377
+ // distances with a speed defined by `geodesic_meters_per_second`.
378
+ bool use_geodesic_distances = 15;
379
+
380
+ // When `use_geodesic_distances` is true, this field must be set and defines
381
+ // the speed applied to compute travel times. Its value must be at least 1.0
382
+ // meters/seconds.
383
+ optional double geodesic_meters_per_second = 16;
384
+
385
+ // Truncates the number of validation errors returned. These errors are
386
+ // typically attached to an INVALID_ARGUMENT error payload as a BadRequest
387
+ // error detail (https://cloud.google.com/apis/design/errors#error_details),
388
+ // unless solving_mode=VALIDATE_ONLY: see the
389
+ // [OptimizeToursResponse.validation_errors][google.maps.routeoptimization.v1.OptimizeToursResponse.validation_errors]
390
+ // field.
391
+ // This defaults to 100 and is capped at 10,000.
392
+ optional int32 max_validation_errors = 5;
393
+
394
+ // Label that may be used to identify this request, reported back in the
395
+ // [OptimizeToursResponse.request_label][google.maps.routeoptimization.v1.OptimizeToursResponse.request_label].
396
+ string label = 17;
397
+ }
398
+
399
+ // Response after solving a tour optimization problem containing the routes
400
+ // followed by each vehicle, the shipments which have been skipped and the
401
+ // overall cost of the solution.
402
+ message OptimizeToursResponse {
403
+ // Overall metrics, aggregated over all routes.
404
+ message Metrics {
405
+ // Aggregated over the routes. Each metric is the sum (or max, for loads)
406
+ // over all
407
+ // [ShipmentRoute.metrics][google.maps.routeoptimization.v1.ShipmentRoute.metrics]
408
+ // fields of the same name.
409
+ AggregatedMetrics aggregated_route_metrics = 1;
410
+
411
+ // Number of mandatory shipments skipped.
412
+ int32 skipped_mandatory_shipment_count = 2;
413
+
414
+ // Number of vehicles used. Note: if a vehicle route is empty and
415
+ // [Vehicle.used_if_route_is_empty][google.maps.routeoptimization.v1.Vehicle.used_if_route_is_empty]
416
+ // is true, the vehicle is considered used.
417
+ int32 used_vehicle_count = 3;
418
+
419
+ // The earliest start time for a used vehicle, computed as the minimum over
420
+ // all used vehicles of
421
+ // [ShipmentRoute.vehicle_start_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_start_time].
422
+ google.protobuf.Timestamp earliest_vehicle_start_time = 4;
423
+
424
+ // The latest end time for a used vehicle, computed as the maximum over all
425
+ // used vehicles of
426
+ // [ShipmentRoute.vehicle_end_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_end_time].
427
+ google.protobuf.Timestamp latest_vehicle_end_time = 5;
428
+
429
+ // Cost of the solution, broken down by cost-related request fields.
430
+ // The keys are proto paths, relative to the input OptimizeToursRequest,
431
+ // e.g. "model.shipments.pickups.cost", and the values are the total cost
432
+ // generated by the corresponding cost field, aggregated over the whole
433
+ // solution. In other words, costs["model.shipments.pickups.cost"] is the
434
+ // sum of all pickup costs over the solution. All costs defined in the model
435
+ // are reported in detail here with the exception of costs related to
436
+ // TransitionAttributes that are only reported in an aggregated way as of
437
+ // 2022/01.
438
+ map<string, double> costs = 10;
439
+
440
+ // Total cost of the solution. The sum of all values in the costs map.
441
+ double total_cost = 6;
442
+ }
443
+
444
+ // Routes computed for each vehicle; the i-th route corresponds to the i-th
445
+ // vehicle in the model.
446
+ repeated ShipmentRoute routes = 1;
447
+
448
+ // Copy of the
449
+ // [OptimizeToursRequest.label][google.maps.routeoptimization.v1.OptimizeToursRequest.label],
450
+ // if a label was specified in the request.
451
+ string request_label = 3;
452
+
453
+ // The list of all shipments skipped.
454
+ repeated SkippedShipment skipped_shipments = 4;
455
+
456
+ // List of all the validation errors that we were able to detect
457
+ // independently. See the "MULTIPLE ERRORS" explanation for the
458
+ // [OptimizeToursValidationError][google.maps.routeoptimization.v1.OptimizeToursValidationError]
459
+ // message.
460
+ repeated OptimizeToursValidationError validation_errors = 5;
461
+
462
+ // Duration, distance and usage metrics for this solution.
463
+ Metrics metrics = 6;
464
+ }
465
+
466
+ // A shipment model contains a set of shipments which must be performed by a
467
+ // set of vehicles, while minimizing the overall cost, which is the sum of:
468
+ //
469
+ // * the cost of routing the vehicles (sum of cost per total time, cost per
470
+ // travel time, and fixed cost over all vehicles).
471
+ // * the unperformed shipment penalties.
472
+ // * the cost of the global duration of the shipments
473
+ message ShipmentModel {
474
+ // Specifies a duration and distance matrix from visit and vehicle start
475
+ // locations to visit and vehicle end locations.
476
+ message DurationDistanceMatrix {
477
+ // Specifies a row of the duration and distance matrix.
478
+ message Row {
479
+ // Duration values for a given row. It must have as many elements as
480
+ // [ShipmentModel.duration_distance_matrix_dst_tags][google.maps.routeoptimization.v1.ShipmentModel.duration_distance_matrix_dst_tags].
481
+ repeated google.protobuf.Duration durations = 1;
482
+
483
+ // Distance values for a given row. If no costs or constraints refer to
484
+ // distances in the model, this can be left empty; otherwise it must have
485
+ // as many elements as `durations`.
486
+ repeated double meters = 2;
487
+ }
488
+
489
+ // Specifies the rows of the duration and distance matrix. It must have as
490
+ // many elements as
491
+ // [ShipmentModel.duration_distance_matrix_src_tags][google.maps.routeoptimization.v1.ShipmentModel.duration_distance_matrix_src_tags].
492
+ repeated Row rows = 1;
493
+
494
+ // Tag defining to which vehicles this duration and distance matrix applies.
495
+ // If empty, this applies to all vehicles, and there can only be a single
496
+ // matrix.
497
+ //
498
+ // Each vehicle start must match exactly one matrix, i.e. exactly one of
499
+ // their `start_tags` field must match the `vehicle_start_tag` of a matrix
500
+ // (and of that matrix only).
501
+ //
502
+ // All matrices must have a different `vehicle_start_tag`.
503
+ string vehicle_start_tag = 2;
504
+ }
505
+
506
+ // A precedence rule between two events (each event is the pickup or the
507
+ // delivery of a shipment): the "second" event has to start at least
508
+ // `offset_duration` after "first" has started.
509
+ //
510
+ // Several precedences can refer to the same (or related) events, e.g.,
511
+ // "pickup of B happens after delivery of A" and "pickup of C happens after
512
+ // pickup of B".
513
+ //
514
+ // Furthermore, precedences only apply when both shipments are performed and
515
+ // are otherwise ignored.
516
+ message PrecedenceRule {
517
+ // Shipment index of the "first" event. This field must be specified.
518
+ optional int32 first_index = 1;
519
+
520
+ // Indicates if the "first" event is a delivery.
521
+ bool first_is_delivery = 3;
522
+
523
+ // Shipment index of the "second" event. This field must be specified.
524
+ optional int32 second_index = 2;
525
+
526
+ // Indicates if the "second" event is a delivery.
527
+ bool second_is_delivery = 4;
528
+
529
+ // The offset between the "first" and "second" event. It can be negative.
530
+ google.protobuf.Duration offset_duration = 5;
531
+ }
532
+
533
+ // Set of shipments which must be performed in the model.
534
+ repeated Shipment shipments = 1;
535
+
536
+ // Set of vehicles which can be used to perform visits.
537
+ repeated Vehicle vehicles = 2;
538
+
539
+ // Constrains the maximum number of active vehicles. A vehicle is active if
540
+ // its route performs at least one shipment. This can be used to limit the
541
+ // number of routes in the case where there are fewer drivers than
542
+ // vehicles and that the fleet of vehicles is heterogeneous. The optimization
543
+ // will then select the best subset of vehicles to use.
544
+ // Must be strictly positive.
545
+ optional int32 max_active_vehicles = 4;
546
+
547
+ // Global start and end time of the model: no times outside of this range
548
+ // can be considered valid.
549
+ //
550
+ // The model's time span must be less than a year, i.e. the `global_end_time`
551
+ // and the `global_start_time` must be within 31536000 seconds of each other.
552
+ //
553
+ // When using `cost_per_*hour` fields, you might want to set this window to a
554
+ // smaller interval to increase performance (eg. if you model a single day,
555
+ // you should set the global time limits to that day).
556
+ // If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used
557
+ // as default.
558
+ google.protobuf.Timestamp global_start_time = 5;
559
+
560
+ // If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0)
561
+ // is used as default.
562
+ google.protobuf.Timestamp global_end_time = 6;
563
+
564
+ // The "global duration" of the overall plan is the difference between the
565
+ // earliest effective start time and the latest effective end time of
566
+ // all vehicles. Users can assign a cost per hour to that quantity to try
567
+ // and optimize for earliest job completion, for example. This cost must be in
568
+ // the same unit as
569
+ // [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost].
570
+ double global_duration_cost_per_hour = 7;
571
+
572
+ // Specifies duration and distance matrices used in the model. If this field
573
+ // is empty, Google Maps or geodesic distances will be used instead, depending
574
+ // on the value of the `use_geodesic_distances` field. If it is not empty,
575
+ // `use_geodesic_distances` cannot be true and neither
576
+ // `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags`
577
+ // can be empty.
578
+ //
579
+ // Usage examples:
580
+ //
581
+ // * There are two locations: locA and locB.
582
+ // * 1 vehicle starting its route at locA and ending it at locA.
583
+ // * 1 pickup visit request at locB.
584
+ //
585
+ // ```
586
+ // model {
587
+ // vehicles { start_tags: "locA" end_tags: "locA" }
588
+ // shipments { pickups { tags: "locB" } }
589
+ // duration_distance_matrix_src_tags: "locA"
590
+ // duration_distance_matrix_src_tags: "locB"
591
+ // duration_distance_matrix_dst_tags: "locA"
592
+ // duration_distance_matrix_dst_tags: "locB"
593
+ // duration_distance_matrices {
594
+ // rows { # from: locA
595
+ // durations { seconds: 0 } meters: 0 # to: locA
596
+ // durations { seconds: 100 } meters: 1000 # to: locB
597
+ // }
598
+ // rows { # from: locB
599
+ // durations { seconds: 102 } meters: 990 # to: locA
600
+ // durations { seconds: 0 } meters: 0 # to: locB
601
+ // }
602
+ // }
603
+ // }
604
+ // ```
605
+ //
606
+ //
607
+ // * There are three locations: locA, locB and locC.
608
+ // * 1 vehicle starting its route at locA and ending it at locB, using
609
+ // matrix "fast".
610
+ // * 1 vehicle starting its route at locB and ending it at locB, using
611
+ // matrix "slow".
612
+ // * 1 vehicle starting its route at locB and ending it at locB, using
613
+ // matrix "fast".
614
+ // * 1 pickup visit request at locC.
615
+ //
616
+ // ```
617
+ // model {
618
+ // vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" }
619
+ // vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" }
620
+ // vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" }
621
+ // shipments { pickups { tags: "locC" } }
622
+ // duration_distance_matrix_src_tags: "locA"
623
+ // duration_distance_matrix_src_tags: "locB"
624
+ // duration_distance_matrix_src_tags: "locC"
625
+ // duration_distance_matrix_dst_tags: "locB"
626
+ // duration_distance_matrix_dst_tags: "locC"
627
+ // duration_distance_matrices {
628
+ // vehicle_start_tag: "fast"
629
+ // rows { # from: locA
630
+ // durations { seconds: 1000 } meters: 2000 # to: locB
631
+ // durations { seconds: 600 } meters: 1000 # to: locC
632
+ // }
633
+ // rows { # from: locB
634
+ // durations { seconds: 0 } meters: 0 # to: locB
635
+ // durations { seconds: 700 } meters: 1200 # to: locC
636
+ // }
637
+ // rows { # from: locC
638
+ // durations { seconds: 702 } meters: 1190 # to: locB
639
+ // durations { seconds: 0 } meters: 0 # to: locC
640
+ // }
641
+ // }
642
+ // duration_distance_matrices {
643
+ // vehicle_start_tag: "slow"
644
+ // rows { # from: locA
645
+ // durations { seconds: 1800 } meters: 2001 # to: locB
646
+ // durations { seconds: 900 } meters: 1002 # to: locC
647
+ // }
648
+ // rows { # from: locB
649
+ // durations { seconds: 0 } meters: 0 # to: locB
650
+ // durations { seconds: 1000 } meters: 1202 # to: locC
651
+ // }
652
+ // rows { # from: locC
653
+ // durations { seconds: 1001 } meters: 1195 # to: locB
654
+ // durations { seconds: 0 } meters: 0 # to: locC
655
+ // }
656
+ // }
657
+ // }
658
+ // ```
659
+ repeated DurationDistanceMatrix duration_distance_matrices = 8;
660
+
661
+ // Tags defining the sources of the duration and distance matrices;
662
+ // `duration_distance_matrices(i).rows(j)` defines durations and distances
663
+ // from visits with tag `duration_distance_matrix_src_tags(j)` to other visits
664
+ // in matrix i.
665
+ //
666
+ // Tags correspond to
667
+ // [VisitRequest.tags][google.maps.routeoptimization.v1.Shipment.VisitRequest.tags]
668
+ // or
669
+ // [Vehicle.start_tags][google.maps.routeoptimization.v1.Vehicle.start_tags].
670
+ // A given `VisitRequest` or `Vehicle` must match exactly one tag in this
671
+ // field. Note that a `Vehicle`'s source, destination and matrix tags may be
672
+ // the same; similarly a `VisitRequest`'s source and destination tags may be
673
+ // the same. All tags must be different and cannot be empty strings. If this
674
+ // field is not empty, then `duration_distance_matrices` must not be empty.
675
+ repeated string duration_distance_matrix_src_tags = 9;
676
+
677
+ // Tags defining the destinations of the duration and distance matrices;
678
+ // `duration_distance_matrices(i).rows(j).durations(k)` (resp.
679
+ // `duration_distance_matrices(i).rows(j).meters(k))` defines the duration
680
+ // (resp. the distance) of the travel from visits with tag
681
+ // `duration_distance_matrix_src_tags(j)` to visits with tag
682
+ // `duration_distance_matrix_dst_tags(k)` in matrix i.
683
+ //
684
+ // Tags correspond to
685
+ // [VisitRequest.tags][google.maps.routeoptimization.v1.Shipment.VisitRequest.tags]
686
+ // or
687
+ // [Vehicle.start_tags][google.maps.routeoptimization.v1.Vehicle.start_tags].
688
+ // A given `VisitRequest` or `Vehicle` must match exactly one tag in this
689
+ // field. Note that a `Vehicle`'s source, destination and matrix tags may be
690
+ // the same; similarly a `VisitRequest`'s source and destination tags may be
691
+ // the same. All tags must be different and cannot be empty strings. If this
692
+ // field is not empty, then `duration_distance_matrices` must not be empty.
693
+ repeated string duration_distance_matrix_dst_tags = 10;
694
+
695
+ // Transition attributes added to the model.
696
+ repeated TransitionAttributes transition_attributes = 11;
697
+
698
+ // Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`).
699
+ repeated ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;
700
+
701
+ // Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`).
702
+ repeated ShipmentTypeRequirement shipment_type_requirements = 13;
703
+
704
+ // Set of precedence rules which must be enforced in the model.
705
+ repeated PrecedenceRule precedence_rules = 14;
706
+ }
707
+
708
+ // The shipment of a single item, from one of its pickups to one of its
709
+ // deliveries. For the shipment to be considered as performed, a unique vehicle
710
+ // must visit one of its pickup locations (and decrease its spare capacities
711
+ // accordingly), then visit one of its delivery locations later on (and
712
+ // therefore re-increase its spare capacities accordingly).
713
+ message Shipment {
714
+ // Request for a visit which can be done by a vehicle: it has a geo-location
715
+ // (or two, see below), opening and closing times represented by time windows,
716
+ // and a service duration time (time spent by the vehicle once it has arrived
717
+ // to pickup or drop off goods).
718
+ message VisitRequest {
719
+ // The geo-location where the vehicle arrives when performing this
720
+ // `VisitRequest`. If the shipment model has duration distance matrices,
721
+ // `arrival_location` must not be specified.
722
+ google.type.LatLng arrival_location = 1;
723
+
724
+ // The waypoint where the vehicle arrives when performing this
725
+ // `VisitRequest`. If the shipment model has duration distance matrices,
726
+ // `arrival_waypoint` must not be specified.
727
+ Waypoint arrival_waypoint = 2;
728
+
729
+ // The geo-location where the vehicle departs after completing this
730
+ // `VisitRequest`. Can be omitted if it is the same as `arrival_location`.
731
+ // If the shipment model has duration distance matrices,
732
+ // `departure_location` must not be specified.
733
+ google.type.LatLng departure_location = 3;
734
+
735
+ // The waypoint where the vehicle departs after completing this
736
+ // `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`.
737
+ // If the shipment model has duration distance matrices,
738
+ // `departure_waypoint` must not be specified.
739
+ Waypoint departure_waypoint = 4;
740
+
741
+ // Specifies tags attached to the visit request.
742
+ // Empty or duplicate strings are not allowed.
743
+ repeated string tags = 5;
744
+
745
+ // Time windows which constrain the arrival time at a visit.
746
+ // Note that a vehicle may depart outside of the arrival time window, i.e.
747
+ // arrival time + duration do not need to be inside a time window. This can
748
+ // result in waiting time if the vehicle arrives before
749
+ // [TimeWindow.start_time][google.maps.routeoptimization.v1.TimeWindow.start_time].
750
+ //
751
+ // The absence of `TimeWindow` means that the vehicle can perform this visit
752
+ // at any time.
753
+ //
754
+ // Time windows must be disjoint, i.e. no time window must overlap with or
755
+ // be adjacent to another, and they must be in increasing order.
756
+ //
757
+ // `cost_per_hour_after_soft_end_time` and `soft_end_time` can only
758
+ // be set if there is a single time window.
759
+ repeated TimeWindow time_windows = 6;
760
+
761
+ // Duration of the visit, i.e. time spent by the vehicle between arrival
762
+ // and departure (to be added to the possible waiting time; see
763
+ // `time_windows`).
764
+ google.protobuf.Duration duration = 7;
765
+
766
+ // Cost to service this visit request on a vehicle route. This can be used
767
+ // to pay different costs for each alternative pickup or delivery of a
768
+ // shipment. This cost must be in the same unit as `Shipment.penalty_cost`
769
+ // and must not be negative.
770
+ double cost = 8;
771
+
772
+ // Load demands of this visit request. This is just like
773
+ // [Shipment.load_demands][google.maps.routeoptimization.v1.Shipment.load_demands]
774
+ // field, except that it only applies to this
775
+ // [VisitRequest][google.maps.routeoptimization.v1.Shipment.VisitRequest]
776
+ // instead of the whole
777
+ // [Shipment][google.maps.routeoptimization.v1.Shipment]. The demands listed
778
+ // here are added to the demands listed in
779
+ // [Shipment.load_demands][google.maps.routeoptimization.v1.Shipment.load_demands].
780
+ map<string, Load> load_demands = 12;
781
+
782
+ // Specifies the types of the visit. This may be used to allocate additional
783
+ // time required for a vehicle to complete this visit (see
784
+ // [Vehicle.extra_visit_duration_for_visit_type][google.maps.routeoptimization.v1.Vehicle.extra_visit_duration_for_visit_type]).
785
+ //
786
+ // A type can only appear once.
787
+ repeated string visit_types = 10;
788
+
789
+ // Specifies a label for this `VisitRequest`. This label is reported in the
790
+ // response as `visit_label` in the corresponding
791
+ // [ShipmentRoute.Visit][google.maps.routeoptimization.v1.ShipmentRoute.Visit].
792
+ string label = 11;
793
+ }
794
+
795
+ // When performing a visit, a predefined amount may be added to the vehicle
796
+ // load if it's a pickup, or subtracted if it's a delivery. This message
797
+ // defines such amount. See
798
+ // [load_demands][google.maps.routeoptimization.v1.Shipment.load_demands].
799
+ message Load {
800
+ // The amount by which the load of the vehicle performing the corresponding
801
+ // visit will vary. Since it is an integer, users are advised to choose an
802
+ // appropriate unit to avoid loss of precision. Must be ≥ 0.
803
+ int64 amount = 2;
804
+ }
805
+
806
+ // The user-defined display name of the shipment.
807
+ // It can be up to 63 characters long and may use UTF-8 characters.
808
+ string display_name = 16;
809
+
810
+ // Set of pickup alternatives associated to the shipment. If not specified,
811
+ // the vehicle only needs to visit a location corresponding to the deliveries.
812
+ repeated VisitRequest pickups = 1;
813
+
814
+ // Set of delivery alternatives associated to the shipment. If not specified,
815
+ // the vehicle only needs to visit a location corresponding to the pickups.
816
+ repeated VisitRequest deliveries = 2;
817
+
818
+ // Load demands of the shipment (for example weight, volume, number of
819
+ // pallets etc). The keys in the map should be identifiers describing the type
820
+ // of the corresponding load, ideally also including the units.
821
+ // For example: "weight_kg", "volume_gallons", "pallet_count", etc.
822
+ // If a given key does not appear in the map, the corresponding load is
823
+ // considered as null.
824
+ map<string, Load> load_demands = 14;
825
+
826
+ // If the shipment is not completed, this penalty is added to the overall
827
+ // cost of the routes. A shipment is considered completed if one of its pickup
828
+ // and delivery alternatives is visited. The cost may be expressed in the
829
+ // same unit used for all other cost-related fields in the model and must be
830
+ // positive.
831
+ //
832
+ // *IMPORTANT*: If this penalty is not specified, it is considered infinite,
833
+ // i.e. the shipment must be completed.
834
+ optional double penalty_cost = 4;
835
+
836
+ // The set of vehicles that may perform this shipment. If empty, all vehicles
837
+ // may perform it. Vehicles are given by their index in the `ShipmentModel`'s
838
+ // `vehicles` list.
839
+ repeated int32 allowed_vehicle_indices = 5;
840
+
841
+ // Specifies the cost that is incurred when this shipment is delivered by each
842
+ // vehicle. If specified, it must have EITHER:
843
+ //
844
+ // * the same number of elements as `costs_per_vehicle_indices`.
845
+ // `costs_per_vehicle[i]` corresponds to vehicle
846
+ // `costs_per_vehicle_indices[i]` of the model.
847
+ // * the same number of elements as there are vehicles in the model. The
848
+ // i-th element corresponds to vehicle #i of the model.
849
+ //
850
+ // These costs must be in the same unit as `penalty_cost` and must not be
851
+ // negative. Leave this field empty, if there are no such costs.
852
+ repeated double costs_per_vehicle = 6;
853
+
854
+ // Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty,
855
+ // it must have the same number of elements as `costs_per_vehicle`. A vehicle
856
+ // index may not be specified more than once. If a vehicle is excluded from
857
+ // `costs_per_vehicle_indices`, its cost is zero.
858
+ repeated int32 costs_per_vehicle_indices = 7;
859
+
860
+ // Specifies the maximum relative detour time compared to the shortest path
861
+ // from pickup to delivery. If specified, it must be nonnegative, and the
862
+ // shipment must contain at least a pickup and a delivery.
863
+ //
864
+ // For example, let t be the shortest time taken to go from the selected
865
+ // pickup alternative directly to the selected delivery alternative. Then
866
+ // setting `pickup_to_delivery_relative_detour_limit` enforces:
867
+ //
868
+ // ```
869
+ // start_time(delivery) - start_time(pickup) <=
870
+ // std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit))
871
+ // ```
872
+ //
873
+ // If both relative and absolute limits are specified on the same shipment,
874
+ // the more constraining limit is used for each possible pickup/delivery pair.
875
+ // As of 2017/10, detours are only supported when travel durations do not
876
+ // depend on vehicles.
877
+ optional double pickup_to_delivery_relative_detour_limit = 8;
878
+
879
+ // Specifies the maximum absolute detour time compared to the shortest path
880
+ // from pickup to delivery. If specified, it must be nonnegative, and the
881
+ // shipment must contain at least a pickup and a delivery.
882
+ //
883
+ // For example, let t be the shortest time taken to go from the selected
884
+ // pickup alternative directly to the selected delivery alternative. Then
885
+ // setting `pickup_to_delivery_absolute_detour_limit` enforces:
886
+ //
887
+ // ```
888
+ // start_time(delivery) - start_time(pickup) <=
889
+ // t + pickup_to_delivery_absolute_detour_limit
890
+ // ```
891
+ //
892
+ // If both relative and absolute limits are specified on the same shipment,
893
+ // the more constraining limit is used for each possible pickup/delivery pair.
894
+ // As of 2017/10, detours are only supported when travel durations do not
895
+ // depend on vehicles.
896
+ google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9;
897
+
898
+ // Specifies the maximum duration from start of pickup to start of delivery of
899
+ // a shipment. If specified, it must be nonnegative, and the shipment must
900
+ // contain at least a pickup and a delivery. This does not depend on which
901
+ // alternatives are selected for pickup and delivery, nor on vehicle speed.
902
+ // This can be specified alongside maximum detour constraints: the solution
903
+ // will respect both specifications.
904
+ google.protobuf.Duration pickup_to_delivery_time_limit = 10;
905
+
906
+ // Non-empty string specifying a "type" for this shipment.
907
+ // This feature can be used to define incompatibilities or requirements
908
+ // between `shipment_types` (see `shipment_type_incompatibilities` and
909
+ // `shipment_type_requirements` in `ShipmentModel`).
910
+ //
911
+ // Differs from `visit_types` which is specified for a single visit: All
912
+ // pickup/deliveries belonging to the same shipment share the same
913
+ // `shipment_type`.
914
+ string shipment_type = 11;
915
+
916
+ // Specifies a label for this shipment. This label is reported in the response
917
+ // in the `shipment_label` of the corresponding
918
+ // [ShipmentRoute.Visit][google.maps.routeoptimization.v1.ShipmentRoute.Visit].
919
+ string label = 12;
920
+
921
+ // If true, skip this shipment, but don't apply a `penalty_cost`.
922
+ //
923
+ // Ignoring a shipment results in a validation error when there are any
924
+ // `shipment_type_requirements` in the model.
925
+ //
926
+ // Ignoring a shipment that is performed in `injected_first_solution_routes`
927
+ // or `injected_solution_constraint` is permitted; the solver removes the
928
+ // related pickup/delivery visits from the performing route.
929
+ // `precedence_rules` that reference ignored shipments will also be ignored.
930
+ bool ignore = 13;
931
+ }
932
+
933
+ // Specifies incompatibilties between shipments depending on their
934
+ // shipment_type. The appearance of incompatible shipments on the same route is
935
+ // restricted based on the incompatibility mode.
936
+ message ShipmentTypeIncompatibility {
937
+ // Modes defining how the appearance of incompatible shipments are restricted
938
+ // on the same route.
939
+ enum IncompatibilityMode {
940
+ // Unspecified incompatibility mode. This value should never be used.
941
+ INCOMPATIBILITY_MODE_UNSPECIFIED = 0;
942
+
943
+ // In this mode, two shipments with incompatible types can never share the
944
+ // same vehicle.
945
+ NOT_PERFORMED_BY_SAME_VEHICLE = 1;
946
+
947
+ // For two shipments with incompatible types with the
948
+ // `NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY` incompatibility mode:
949
+ //
950
+ // * If both are pickups only (no deliveries) or deliveries only (no
951
+ // pickups), they cannot share the same vehicle at all.
952
+ // * If one of the shipments has a delivery and the other a pickup, the two
953
+ // shipments can share the same vehicle iff the former shipment is
954
+ // delivered before the latter is picked up.
955
+ NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY = 2;
956
+ }
957
+
958
+ // List of incompatible types. Two shipments having different `shipment_types`
959
+ // among those listed are "incompatible".
960
+ repeated string types = 1;
961
+
962
+ // Mode applied to the incompatibility.
963
+ IncompatibilityMode incompatibility_mode = 2;
964
+ }
965
+
966
+ // Specifies requirements between shipments based on their shipment_type.
967
+ // The specifics of the requirement are defined by the requirement mode.
968
+ message ShipmentTypeRequirement {
969
+ // Modes defining the appearance of dependent shipments on a route.
970
+ enum RequirementMode {
971
+ // Unspecified requirement mode. This value should never be used.
972
+ REQUIREMENT_MODE_UNSPECIFIED = 0;
973
+
974
+ // In this mode, all "dependent" shipments must share the same vehicle as at
975
+ // least one of their "required" shipments.
976
+ PERFORMED_BY_SAME_VEHICLE = 1;
977
+
978
+ // With the `IN_SAME_VEHICLE_AT_PICKUP_TIME` mode, all "dependent"
979
+ // shipments need to have at least one "required" shipment on their vehicle
980
+ // at the time of their pickup.
981
+ //
982
+ // A "dependent" shipment pickup must therefore have either:
983
+ //
984
+ // * A delivery-only "required" shipment delivered on the route after, or
985
+ // * A "required" shipment picked up on the route before it, and if the
986
+ // "required" shipment has a delivery, this delivery must be performed
987
+ // after the "dependent" shipment's pickup.
988
+ IN_SAME_VEHICLE_AT_PICKUP_TIME = 2;
989
+
990
+ // Same as before, except the "dependent" shipments need to have a
991
+ // "required" shipment on their vehicle at the time of their *delivery*.
992
+ IN_SAME_VEHICLE_AT_DELIVERY_TIME = 3;
993
+ }
994
+
995
+ // List of alternative shipment types required by the
996
+ // `dependent_shipment_types`.
997
+ repeated string required_shipment_type_alternatives = 1;
998
+
999
+ // All shipments with a type in the `dependent_shipment_types` field require
1000
+ // at least one shipment of type `required_shipment_type_alternatives` to be
1001
+ // visited on the same route.
1002
+ //
1003
+ // NOTE: Chains of requirements such that a `shipment_type` depends on itself
1004
+ // are not allowed.
1005
+ repeated string dependent_shipment_types = 2;
1006
+
1007
+ // Mode applied to the requirement.
1008
+ RequirementMode requirement_mode = 3;
1009
+ }
1010
+
1011
+ // Models a vehicle in a shipment problem. Solving a shipment problem will
1012
+ // build a route starting from `start_location` and ending at `end_location`
1013
+ // for this vehicle. A route is a sequence of visits (see `ShipmentRoute`).
1014
+ message Vehicle {
1015
+ // Travel modes which can be used by vehicles.
1016
+ //
1017
+ // These should be a subset of the Google Maps Platform Routes Preferred API
1018
+ // travel modes, see:
1019
+ // https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode.
1020
+ enum TravelMode {
1021
+ // Unspecified travel mode, equivalent to `DRIVING`.
1022
+ TRAVEL_MODE_UNSPECIFIED = 0;
1023
+
1024
+ // Travel mode corresponding to driving directions (car, ...).
1025
+ DRIVING = 1;
1026
+
1027
+ // Travel mode corresponding to walking directions.
1028
+ WALKING = 2;
1029
+ }
1030
+
1031
+ // Policy on how a vehicle can be unloaded. Applies only to shipments having
1032
+ // both a pickup and a delivery.
1033
+ //
1034
+ // Other shipments are free to occur anywhere on the route independent of
1035
+ // `unloading_policy`.
1036
+ enum UnloadingPolicy {
1037
+ // Unspecified unloading policy; deliveries must just occur after their
1038
+ // corresponding pickups.
1039
+ UNLOADING_POLICY_UNSPECIFIED = 0;
1040
+
1041
+ // Deliveries must occur in reverse order of pickups
1042
+ LAST_IN_FIRST_OUT = 1;
1043
+
1044
+ // Deliveries must occur in the same order as pickups
1045
+ FIRST_IN_FIRST_OUT = 2;
1046
+ }
1047
+
1048
+ // Defines a load limit applying to a vehicle, e.g. "this truck may only
1049
+ // carry up to 3500 kg". See
1050
+ // [load_limits][google.maps.routeoptimization.v1.Vehicle.load_limits].
1051
+ message LoadLimit {
1052
+ // Interval of acceptable load amounts.
1053
+ message Interval {
1054
+ // A minimum acceptable load. Must be ≥ 0.
1055
+ // If they're both specified,
1056
+ // [min][google.maps.routeoptimization.v1.Vehicle.LoadLimit.Interval.min]
1057
+ // must be ≤
1058
+ // [max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.Interval.max].
1059
+ int64 min = 1;
1060
+
1061
+ // A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum
1062
+ // load is unrestricted by this message.
1063
+ // If they're both specified,
1064
+ // [min][google.maps.routeoptimization.v1.Vehicle.LoadLimit.Interval.min]
1065
+ // must be ≤
1066
+ // [max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.Interval.max].
1067
+ optional int64 max = 2;
1068
+ }
1069
+
1070
+ // The maximum acceptable amount of load.
1071
+ optional int64 max_load = 1;
1072
+
1073
+ // A soft limit of the load. See
1074
+ // [cost_per_unit_above_soft_max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max].
1075
+ int64 soft_max_load = 2;
1076
+
1077
+ // If the load ever exceeds
1078
+ // [soft_max_load][google.maps.routeoptimization.v1.Vehicle.LoadLimit.soft_max_load]
1079
+ // along this vehicle's route, the following cost penalty applies (only once
1080
+ // per vehicle): (load -
1081
+ // [soft_max_load][google.maps.routeoptimization.v1.Vehicle.LoadLimit.soft_max_load])
1082
+ // * [cost_per_unit_above_soft_max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs
1083
+ // add up and must be in the same unit as
1084
+ // [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost].
1085
+ double cost_per_unit_above_soft_max = 3;
1086
+
1087
+ // The acceptable load interval of the vehicle at the start of the route.
1088
+ Interval start_load_interval = 4;
1089
+
1090
+ // The acceptable load interval of the vehicle at the end of the route.
1091
+ Interval end_load_interval = 5;
1092
+ }
1093
+
1094
+ // A limit defining a maximum duration of the route of a vehicle. It can be
1095
+ // either hard or soft.
1096
+ //
1097
+ // When a soft limit field is defined, both the soft max threshold and its
1098
+ // associated cost must be defined together.
1099
+ message DurationLimit {
1100
+ // A hard limit constraining the duration to be at most max_duration.
1101
+ google.protobuf.Duration max_duration = 1;
1102
+
1103
+ // A soft limit not enforcing a maximum duration limit, but when violated
1104
+ // makes the route incur a cost. This cost adds up to other costs defined in
1105
+ // the model, with the same unit.
1106
+ //
1107
+ // If defined, `soft_max_duration` must be nonnegative. If max_duration is
1108
+ // also defined, `soft_max_duration` must be less than max_duration.
1109
+ google.protobuf.Duration soft_max_duration = 2;
1110
+
1111
+ // Cost per hour incurred if the `soft_max_duration` threshold is violated.
1112
+ // The additional cost is 0 if the duration is under the threshold,
1113
+ // otherwise the cost depends on the duration as follows:
1114
+ // ```
1115
+ // cost_per_hour_after_soft_max * (duration - soft_max_duration)
1116
+ // ```
1117
+ // The cost must be nonnegative.
1118
+ optional double cost_per_hour_after_soft_max = 3;
1119
+
1120
+ // A soft limit not enforcing a maximum duration limit, but when violated
1121
+ // makes the route incur a cost, quadratic in the duration. This cost adds
1122
+ // up to other costs defined in the model, with the same unit.
1123
+ //
1124
+ // If defined, `quadratic_soft_max_duration` must be nonnegative. If
1125
+ // `max_duration` is also defined, `quadratic_soft_max_duration` must be
1126
+ // less than `max_duration`, and the difference must be no larger than one
1127
+ // day:
1128
+ //
1129
+ // `max_duration - quadratic_soft_max_duration <= 86400 seconds`
1130
+ google.protobuf.Duration quadratic_soft_max_duration = 4;
1131
+
1132
+ // Cost per square hour incurred if the
1133
+ // `quadratic_soft_max_duration` threshold is violated.
1134
+ //
1135
+ // The additional cost is 0 if the duration is under the threshold,
1136
+ // otherwise the cost depends on the duration as follows:
1137
+ //
1138
+ // ```
1139
+ // cost_per_square_hour_after_quadratic_soft_max *
1140
+ // (duration - quadratic_soft_max_duration)^2
1141
+ // ```
1142
+ //
1143
+ // The cost must be nonnegative.
1144
+ optional double cost_per_square_hour_after_quadratic_soft_max = 5;
1145
+ }
1146
+
1147
+ // The user-defined display name of the vehicle.
1148
+ // It can be up to 63 characters long and may use UTF-8 characters.
1149
+ string display_name = 32;
1150
+
1151
+ // The travel mode which affects the roads usable by the vehicle and its
1152
+ // speed. See also `travel_duration_multiple`.
1153
+ TravelMode travel_mode = 1;
1154
+
1155
+ // Geographic location where the vehicle starts before picking up any
1156
+ // shipments. If not specified, the vehicle starts at its first pickup.
1157
+ // If the shipment model has duration and distance matrices, `start_location`
1158
+ // must not be specified.
1159
+ google.type.LatLng start_location = 3;
1160
+
1161
+ // Waypoint representing a geographic location where the vehicle starts before
1162
+ // picking up any shipments. If neither `start_waypoint` nor `start_location`
1163
+ // is specified, the vehicle starts at its first pickup.
1164
+ // If the shipment model has duration and distance matrices, `start_waypoint`
1165
+ // must not be specified.
1166
+ Waypoint start_waypoint = 4;
1167
+
1168
+ // Geographic location where the vehicle ends after it has completed its last
1169
+ // `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends
1170
+ // immediately when it completes its last `VisitRequest`.
1171
+ // If the shipment model has duration and distance matrices, `end_location`
1172
+ // must not be specified.
1173
+ google.type.LatLng end_location = 5;
1174
+
1175
+ // Waypoint representing a geographic location where the vehicle ends after
1176
+ // it has completed its last `VisitRequest`. If neither `end_waypoint` nor
1177
+ // `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately
1178
+ // when it completes its last `VisitRequest`.
1179
+ // If the shipment model has duration and distance matrices, `end_waypoint`
1180
+ // must not be specified.
1181
+ Waypoint end_waypoint = 6;
1182
+
1183
+ // Specifies tags attached to the start of the vehicle's route.
1184
+ //
1185
+ // Empty or duplicate strings are not allowed.
1186
+ repeated string start_tags = 7;
1187
+
1188
+ // Specifies tags attached to the end of the vehicle's route.
1189
+ //
1190
+ // Empty or duplicate strings are not allowed.
1191
+ repeated string end_tags = 8;
1192
+
1193
+ // Time windows during which the vehicle may depart its start location.
1194
+ // They must be within the global time limits (see
1195
+ // [ShipmentModel.global_*][google.maps.routeoptimization.v1.ShipmentModel.global_start_time]
1196
+ // fields). If unspecified, there is no limitation besides those global time
1197
+ // limits.
1198
+ //
1199
+ // Time windows belonging to the same repeated field must be disjoint, i.e. no
1200
+ // time window can overlap with or be adjacent to another, and they must be in
1201
+ // chronological order.
1202
+ //
1203
+ // `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if
1204
+ // there is a single time window.
1205
+ repeated TimeWindow start_time_windows = 9;
1206
+
1207
+ // Time windows during which the vehicle may arrive at its end location.
1208
+ // They must be within the global time limits (see
1209
+ // [ShipmentModel.global_*][google.maps.routeoptimization.v1.ShipmentModel.global_start_time]
1210
+ // fields). If unspecified, there is no limitation besides those global time
1211
+ // limits.
1212
+ //
1213
+ // Time windows belonging to the same repeated field must be disjoint, i.e. no
1214
+ // time window can overlap with or be adjacent to another, and they must be in
1215
+ // chronological order.
1216
+ //
1217
+ // `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if
1218
+ // there is a single time window.
1219
+ repeated TimeWindow end_time_windows = 10;
1220
+
1221
+ // Specifies a multiplicative factor that can be used to increase or decrease
1222
+ // travel times of this vehicle. For example, setting this to 2.0 means
1223
+ // that this vehicle is slower and has travel times that are twice what they
1224
+ // are for standard vehicles. This multiple does not affect visit durations.
1225
+ // It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are
1226
+ // specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle
1227
+ // is standard, and this multiple is considered 1.0.
1228
+ //
1229
+ // WARNING: Travel times will be rounded to the nearest second after this
1230
+ // multiple is applied but before performing any numerical operations, thus,
1231
+ // a small multiple may result in a loss of precision.
1232
+ //
1233
+ // See also `extra_visit_duration_for_visit_type` below.
1234
+ optional double travel_duration_multiple = 11;
1235
+
1236
+ // Unloading policy enforced on the vehicle.
1237
+ UnloadingPolicy unloading_policy = 12;
1238
+
1239
+ // Capacities of the vehicle (weight, volume, # of pallets for example).
1240
+ // The keys in the map are the identifiers of the type of load, consistent
1241
+ // with the keys of the
1242
+ // [Shipment.load_demands][google.maps.routeoptimization.v1.Shipment.load_demands]
1243
+ // field. If a given key is absent from this map, the corresponding capacity
1244
+ // is considered to be limitless.
1245
+ map<string, LoadLimit> load_limits = 30;
1246
+
1247
+ // Vehicle costs: all costs add up and must be in the same unit as
1248
+ // [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost].
1249
+ //
1250
+ // Cost per hour of the vehicle route. This cost is applied to the total time
1251
+ // taken by the route, and includes travel time, waiting time, and visit time.
1252
+ // Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result
1253
+ // in additional latency.
1254
+ double cost_per_hour = 16;
1255
+
1256
+ // Cost per traveled hour of the vehicle route. This cost is applied only to
1257
+ // travel time taken by the route (i.e., that reported in
1258
+ // [ShipmentRoute.transitions][google.maps.routeoptimization.v1.ShipmentRoute.transitions]),
1259
+ // and excludes waiting time and visit time.
1260
+ double cost_per_traveled_hour = 17;
1261
+
1262
+ // Cost per kilometer of the vehicle route. This cost is applied to the
1263
+ // distance reported in the
1264
+ // [ShipmentRoute.transitions][google.maps.routeoptimization.v1.ShipmentRoute.transitions]
1265
+ // and does not apply to any distance implicitly traveled from the
1266
+ // `arrival_location` to the `departure_location` of a single `VisitRequest`.
1267
+ double cost_per_kilometer = 18;
1268
+
1269
+ // Fixed cost applied if this vehicle is used to handle a shipment.
1270
+ double fixed_cost = 19;
1271
+
1272
+ // This field only applies to vehicles when their route does not serve any
1273
+ // shipments. It indicates if the vehicle should be considered as used or not
1274
+ // in this case.
1275
+ //
1276
+ // If true, the vehicle goes from its start to its end location even if it
1277
+ // doesn't serve any shipments, and time and distance costs resulting from its
1278
+ // start --> end travel are taken into account.
1279
+ //
1280
+ // Otherwise, it doesn't travel from its start to its end location, and no
1281
+ // `break_rule` or delay (from `TransitionAttributes`) are scheduled for this
1282
+ // vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any
1283
+ // information except for the vehicle index and label.
1284
+ bool used_if_route_is_empty = 20;
1285
+
1286
+ // Limit applied to the total duration of the vehicle's route. In a given
1287
+ // `OptimizeToursResponse`, the route duration of a vehicle is the
1288
+ // difference between its `vehicle_end_time` and `vehicle_start_time`.
1289
+ DurationLimit route_duration_limit = 21;
1290
+
1291
+ // Limit applied to the travel duration of the vehicle's route. In a given
1292
+ // `OptimizeToursResponse`, the route travel duration is the sum of all its
1293
+ // [transitions.travel_duration][google.maps.routeoptimization.v1.ShipmentRoute.Transition.travel_duration].
1294
+ DurationLimit travel_duration_limit = 22;
1295
+
1296
+ // Limit applied to the total distance of the vehicle's route. In a given
1297
+ // `OptimizeToursResponse`, the route distance is the sum of all its
1298
+ // [transitions.travel_distance_meters][google.maps.routeoptimization.v1.ShipmentRoute.Transition.travel_distance_meters].
1299
+ DistanceLimit route_distance_limit = 23;
1300
+
1301
+ // Specifies a map from visit_types strings to durations. The duration is time
1302
+ // in addition to
1303
+ // [VisitRequest.duration][google.maps.routeoptimization.v1.Shipment.VisitRequest.duration]
1304
+ // to be taken at visits with the specified `visit_types`. This extra visit
1305
+ // duration adds cost if `cost_per_hour` is specified. Keys (i.e.
1306
+ // `visit_types`) cannot be empty strings.
1307
+ //
1308
+ // If a visit request has multiple types, a duration will be added for each
1309
+ // type in the map.
1310
+ map<string, google.protobuf.Duration> extra_visit_duration_for_visit_type =
1311
+ 24;
1312
+
1313
+ // Describes the break schedule to be enforced on this vehicle.
1314
+ // If empty, no breaks will be scheduled for this vehicle.
1315
+ BreakRule break_rule = 25;
1316
+
1317
+ // Specifies a label for this vehicle. This label is reported in the response
1318
+ // as the `vehicle_label` of the corresponding
1319
+ // [ShipmentRoute][google.maps.routeoptimization.v1.ShipmentRoute].
1320
+ string label = 27;
1321
+
1322
+ // If true, `used_if_route_is_empty` must be false, and this vehicle will
1323
+ // remain unused.
1324
+ //
1325
+ // If a shipment is performed by an ignored vehicle in
1326
+ // `injected_first_solution_routes`, it is skipped in the first solution but
1327
+ // is free to be performed in the response.
1328
+ //
1329
+ // If a shipment is performed by an ignored vehicle in
1330
+ // `injected_solution_constraint` and any related pickup/delivery is
1331
+ // constrained to remain on the vehicle (i.e., not relaxed to level
1332
+ // `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response.
1333
+ // If a shipment has a non-empty `allowed_vehicle_indices` field and all of
1334
+ // the allowed vehicles are ignored, it is skipped in the response.
1335
+ bool ignore = 28;
1336
+ }
1337
+
1338
+ // Time windows constrain the time of an event, such as the arrival time at a
1339
+ // visit, or the start and end time of a vehicle.
1340
+ //
1341
+ // Hard time window bounds, `start_time` and `end_time`, enforce the earliest
1342
+ // and latest time of the event, such that `start_time <= event_time <=
1343
+ // end_time`. The soft time window lower bound, `soft_start_time`, expresses a
1344
+ // preference for the event to happen at or after `soft_start_time` by incurring
1345
+ // a cost proportional to how long before soft_start_time the event occurs. The
1346
+ // soft time window upper bound, `soft_end_time`, expresses a preference for the
1347
+ // event to happen at or before `soft_end_time` by incurring a cost proportional
1348
+ // to how long after `soft_end_time` the event occurs. `start_time`, `end_time`,
1349
+ // `soft_start_time` and `soft_end_time` should be within the global time limits
1350
+ // (see
1351
+ // [ShipmentModel.global_start_time][google.maps.routeoptimization.v1.ShipmentModel.global_start_time]
1352
+ // and
1353
+ // [ShipmentModel.global_end_time][google.maps.routeoptimization.v1.ShipmentModel.global_end_time])
1354
+ // and should respect:
1355
+ // ```
1356
+ // 0 <= `start_time` <= `soft_start_time` <= `end_time` and
1357
+ // 0 <= `start_time` <= `soft_end_time` <= `end_time`.
1358
+ // ```
1359
+ message TimeWindow {
1360
+ // The hard time window start time. If unspecified it will be set to
1361
+ // `ShipmentModel.global_start_time`.
1362
+ google.protobuf.Timestamp start_time = 1;
1363
+
1364
+ // The hard time window end time. If unspecified it will be set to
1365
+ // `ShipmentModel.global_end_time`.
1366
+ google.protobuf.Timestamp end_time = 2;
1367
+
1368
+ // The soft start time of the time window.
1369
+ google.protobuf.Timestamp soft_start_time = 3;
1370
+
1371
+ // The soft end time of the time window.
1372
+ google.protobuf.Timestamp soft_end_time = 4;
1373
+
1374
+ // A cost per hour added to other costs in the model if the event occurs
1375
+ // before soft_start_time, computed as:
1376
+ //
1377
+ // ```
1378
+ // max(0, soft_start_time - t.seconds)
1379
+ // * cost_per_hour_before_soft_start_time / 3600,
1380
+ // t being the time of the event.
1381
+ // ```
1382
+ //
1383
+ // This cost must be positive, and the field can only be set if
1384
+ // soft_start_time has been set.
1385
+ optional double cost_per_hour_before_soft_start_time = 5;
1386
+
1387
+ // A cost per hour added to other costs in the model if the event occurs after
1388
+ // `soft_end_time`, computed as:
1389
+ //
1390
+ // ```
1391
+ // max(0, t.seconds - soft_end_time.seconds)
1392
+ // * cost_per_hour_after_soft_end_time / 3600,
1393
+ // t being the time of the event.
1394
+ // ```
1395
+ //
1396
+ // This cost must be positive, and the field can only be set if
1397
+ // `soft_end_time` has been set.
1398
+ optional double cost_per_hour_after_soft_end_time = 6;
1399
+ }
1400
+
1401
+ // A limit defining a maximum distance which can be traveled. It can be either
1402
+ // hard or soft.
1403
+ //
1404
+ // If a soft limit is defined, both `soft_max_meters` and
1405
+ // `cost_per_kilometer_above_soft_max` must be defined and be nonnegative.
1406
+ message DistanceLimit {
1407
+ // A hard limit constraining the distance to be at most max_meters. The limit
1408
+ // must be nonnegative.
1409
+ optional int64 max_meters = 1;
1410
+
1411
+ // A soft limit not enforcing a maximum distance limit, but when violated
1412
+ // results in a cost which adds up to other costs defined in the model,
1413
+ // with the same unit.
1414
+ //
1415
+ // If defined soft_max_meters must be less than max_meters and must be
1416
+ // nonnegative.
1417
+ optional int64 soft_max_meters = 2;
1418
+
1419
+ // Cost per kilometer incurred if distance is above `soft_max_meters` limit.
1420
+ // The additional cost is 0 if the distance is under the limit, otherwise the
1421
+ // formula used to compute the cost is the following:
1422
+ // ```
1423
+ // (distance_meters - soft_max_meters) / 1000.0 *
1424
+ // cost_per_kilometer_above_soft_max.
1425
+ // ```
1426
+ // The cost must be nonnegative.
1427
+ optional double cost_per_kilometer_above_soft_max = 3;
1428
+ }
1429
+
1430
+ // Specifies attributes of transitions between two consecutive visits on a
1431
+ // route. Several `TransitionAttributes` may apply to the same transition: in
1432
+ // that case, all extra costs add up and the strictest constraint or limit
1433
+ // applies (following natural "AND" semantics).
1434
+ message TransitionAttributes {
1435
+ // Tags defining the set of (src->dst) transitions these attributes apply to.
1436
+ //
1437
+ // A source visit or vehicle start matches iff its
1438
+ // [VisitRequest.tags][google.maps.routeoptimization.v1.Shipment.VisitRequest.tags]
1439
+ // or
1440
+ // [Vehicle.start_tags][google.maps.routeoptimization.v1.Vehicle.start_tags]
1441
+ // either contains `src_tag` or does not contain `excluded_src_tag` (depending
1442
+ // on which of these two fields is non-empty).
1443
+ string src_tag = 1;
1444
+
1445
+ // See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be
1446
+ // non-empty.
1447
+ string excluded_src_tag = 2;
1448
+
1449
+ // A destination visit or vehicle end matches iff its
1450
+ // [VisitRequest.tags][google.maps.routeoptimization.v1.Shipment.VisitRequest.tags]
1451
+ // or [Vehicle.end_tags][google.maps.routeoptimization.v1.Vehicle.end_tags]
1452
+ // either contains `dst_tag` or does not contain `excluded_dst_tag` (depending
1453
+ // on which of these two fields is non-empty).
1454
+ string dst_tag = 3;
1455
+
1456
+ // See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be
1457
+ // non-empty.
1458
+ string excluded_dst_tag = 4;
1459
+
1460
+ // Specifies a cost for performing this transition. This is in the same unit
1461
+ // as all other costs in the model and must not be negative. It is applied on
1462
+ // top of all other existing costs.
1463
+ double cost = 5;
1464
+
1465
+ // Specifies a cost per kilometer applied to the distance traveled while
1466
+ // performing this transition. It adds up to any
1467
+ // [Vehicle.cost_per_kilometer][google.maps.routeoptimization.v1.Vehicle.cost_per_kilometer]
1468
+ // specified on vehicles.
1469
+ double cost_per_kilometer = 6;
1470
+
1471
+ // Specifies a limit on the distance traveled while performing this
1472
+ // transition.
1473
+ //
1474
+ // As of 2021/06, only soft limits are supported.
1475
+ DistanceLimit distance_limit = 7;
1476
+
1477
+ // Specifies a delay incurred when performing this transition.
1478
+ //
1479
+ // This delay always occurs *after* finishing the source visit and *before*
1480
+ // starting the destination visit.
1481
+ google.protobuf.Duration delay = 8;
1482
+ }
1483
+
1484
+ // Encapsulates a waypoint. Waypoints mark arrival and departure locations of
1485
+ // VisitRequests, and start and end locations of Vehicles.
1486
+ message Waypoint {
1487
+ // Different ways to represent a location.
1488
+ oneof location_type {
1489
+ // A point specified using geographic coordinates, including an optional
1490
+ // heading.
1491
+ Location location = 1;
1492
+
1493
+ // The POI Place ID associated with the waypoint.
1494
+ string place_id = 2;
1495
+ }
1496
+
1497
+ // Optional. Indicates that the location of this waypoint is meant to have a
1498
+ // preference for the vehicle to stop at a particular side of road. When you
1499
+ // set this value, the route will pass through the location so that the
1500
+ // vehicle can stop at the side of road that the location is biased towards
1501
+ // from the center of the road. This option doesn't work for the 'WALKING'
1502
+ // travel mode.
1503
+ bool side_of_road = 3 [(google.api.field_behavior) = OPTIONAL];
1504
+ }
1505
+
1506
+ // Encapsulates a location (a geographic point, and an optional heading).
1507
+ message Location {
1508
+ // The waypoint's geographic coordinates.
1509
+ google.type.LatLng lat_lng = 1;
1510
+
1511
+ // The compass heading associated with the direction of the flow of traffic.
1512
+ // This value is used to specify the side of the road to use for pickup and
1513
+ // drop-off. Heading values can be from 0 to 360, where 0 specifies a heading
1514
+ // of due North, 90 specifies a heading of due East, etc.
1515
+ optional int32 heading = 2;
1516
+ }
1517
+
1518
+ // Rules to generate time breaks for a vehicle (e.g. lunch breaks). A break
1519
+ // is a contiguous period of time during which the vehicle remains idle at its
1520
+ // current position and cannot perform any visit. A break may occur:
1521
+ //
1522
+ // * during the travel between two visits (which includes the time right
1523
+ // before or right after a visit, but not in the middle of a visit), in
1524
+ // which case it extends the corresponding transit time between the visits,
1525
+ // * or before the vehicle start (the vehicle may not start in the middle of
1526
+ // a break), in which case it does not affect the vehicle start time.
1527
+ // * or after the vehicle end (ditto, with the vehicle end time).
1528
+ message BreakRule {
1529
+ // The sequence of breaks (i.e. their number and order) that apply to each
1530
+ // vehicle must be known beforehand. The repeated `BreakRequest`s define
1531
+ // that sequence, in the order in which they must occur. Their time windows
1532
+ // (`earliest_start_time` / `latest_start_time`) may overlap, but they must
1533
+ // be compatible with the order (this is checked).
1534
+ message BreakRequest {
1535
+ // Required. Lower bound (inclusive) on the start of the break.
1536
+ google.protobuf.Timestamp earliest_start_time = 1
1537
+ [(google.api.field_behavior) = REQUIRED];
1538
+
1539
+ // Required. Upper bound (inclusive) on the start of the break.
1540
+ google.protobuf.Timestamp latest_start_time = 2
1541
+ [(google.api.field_behavior) = REQUIRED];
1542
+
1543
+ // Required. Minimum duration of the break. Must be positive.
1544
+ google.protobuf.Duration min_duration = 3
1545
+ [(google.api.field_behavior) = REQUIRED];
1546
+ }
1547
+
1548
+ // One may further constrain the frequency and duration of the breaks
1549
+ // specified above, by enforcing a minimum break frequency, such as
1550
+ // "There must be a break of at least 1 hour every 12 hours". Assuming that
1551
+ // this can be interpreted as "Within any sliding time window of 12h, there
1552
+ // must be at least one break of at least one hour", that example would
1553
+ // translate to the following `FrequencyConstraint`:
1554
+ // ```
1555
+ // {
1556
+ // min_break_duration { seconds: 3600 } # 1 hour.
1557
+ // max_inter_break_duration { seconds: 39600 } # 11 hours (12 - 1 = 11).
1558
+ // }
1559
+ // ```
1560
+ //
1561
+ // The timing and duration of the breaks in the solution will respect all
1562
+ // such constraints, in addition to the time windows and minimum durations
1563
+ // already specified in the `BreakRequest`.
1564
+ //
1565
+ // A `FrequencyConstraint` may in practice apply to non-consecutive breaks.
1566
+ // For example, the following schedule honors the "1h every 12h" example:
1567
+ // ```
1568
+ // 04:00 vehicle start
1569
+ // .. performing travel and visits ..
1570
+ // 09:00 1 hour break
1571
+ // 10:00 end of the break
1572
+ // .. performing travel and visits ..
1573
+ // 12:00 20-min lunch break
1574
+ // 12:20 end of the break
1575
+ // .. performing travel and visits ..
1576
+ // 21:00 1 hour break
1577
+ // 22:00 end of the break
1578
+ // .. performing travel and visits ..
1579
+ // 23:59 vehicle end
1580
+ // ```
1581
+ message FrequencyConstraint {
1582
+ // Required. Minimum break duration for this constraint. Nonnegative.
1583
+ // See description of `FrequencyConstraint`.
1584
+ google.protobuf.Duration min_break_duration = 1
1585
+ [(google.api.field_behavior) = REQUIRED];
1586
+
1587
+ // Required. Maximum allowed span of any interval of time in the route that
1588
+ // does not include at least partially a break of `duration >=
1589
+ // min_break_duration`. Must be positive.
1590
+ google.protobuf.Duration max_inter_break_duration = 2
1591
+ [(google.api.field_behavior) = REQUIRED];
1592
+ }
1593
+
1594
+ // Sequence of breaks. See the `BreakRequest` message.
1595
+ repeated BreakRequest break_requests = 1;
1596
+
1597
+ // Several `FrequencyConstraint` may apply. They must all be satisfied by
1598
+ // the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
1599
+ repeated FrequencyConstraint frequency_constraints = 2;
1600
+ }
1601
+
1602
+ // A vehicle's route can be decomposed, along the time axis, like this (we
1603
+ // assume there are n visits):
1604
+ // ```
1605
+ // | | | | | T[2], | | |
1606
+ // | Transition | Visit #0 | | | V[2], | | |
1607
+ // | #0 | aka | T[1] | V[1] | ... | V[n-1] | T[n] |
1608
+ // | aka T[0] | V[0] | | | V[n-2],| | |
1609
+ // | | | | | T[n-1] | | |
1610
+ // ^ ^ ^ ^ ^ ^ ^ ^
1611
+ // vehicle V[0].start V[0].end V[1]. V[1]. V[n]. V[n]. vehicle
1612
+ // start (arrival) (departure) start end start end end
1613
+ // ```
1614
+ // Note that we make a difference between:
1615
+ //
1616
+ // * "punctual events", such as the vehicle start and end and each visit's start
1617
+ // and end (aka arrival and departure). They happen at a given second.
1618
+ // * "time intervals", such as the visits themselves, and the transition between
1619
+ // visits. Though time intervals can sometimes have zero duration, i.e. start
1620
+ // and end at the same second, they often have a positive duration.
1621
+ //
1622
+ // Invariants:
1623
+ //
1624
+ // * If there are n visits, there are n+1 transitions.
1625
+ // * A visit is always surrounded by a transition before it (same index) and a
1626
+ // transition after it (index + 1).
1627
+ // * The vehicle start is always followed by transition #0.
1628
+ // * The vehicle end is always preceded by transition #n.
1629
+ //
1630
+ // Zooming in, here is what happens during a `Transition` and a `Visit`:
1631
+ // ```
1632
+ // ---+-------------------------------------+-----------------------------+-->
1633
+ // | TRANSITION[i] | VISIT[i] |
1634
+ // | | |
1635
+ // | * TRAVEL: the vehicle moves from | PERFORM the visit: |
1636
+ // | VISIT[i-1].departure_location to | |
1637
+ // | VISIT[i].arrival_location, which | * Spend some time: |
1638
+ // | takes a given travel duration | the "visit duration". |
1639
+ // | and distance | |
1640
+ // | | * Load or unload |
1641
+ // | * BREAKS: the driver may have | some quantities from the |
1642
+ // | breaks (e.g. lunch break). | vehicle: the "demand". |
1643
+ // | | |
1644
+ // | * WAIT: the driver/vehicle does | |
1645
+ // | nothing. This can happen for | |
1646
+ // | many reasons, for example when | |
1647
+ // | the vehicle reaches the next | |
1648
+ // | event's destination before the | |
1649
+ // | start of its time window | |
1650
+ // | | |
1651
+ // | * DELAY: *right before* the next | |
1652
+ // | arrival. E.g. the vehicle and/or | |
1653
+ // | driver spends time unloading. | |
1654
+ // | | |
1655
+ // ---+-------------------------------------+-----------------------------+-->
1656
+ // ^ ^ ^
1657
+ // V[i-1].end V[i].start V[i].end
1658
+ // ```
1659
+ // Lastly, here is how the TRAVEL, BREAKS, DELAY and WAIT can be arranged
1660
+ // during a transition.
1661
+ //
1662
+ // * They don't overlap.
1663
+ // * The DELAY is unique and *must* be a contiguous period of time right
1664
+ // before the next visit (or vehicle end). Thus, it suffice to know the
1665
+ // delay duration to know its start and end time.
1666
+ // * The BREAKS are contiguous, non-overlapping periods of time. The
1667
+ // response specifies the start time and duration of each break.
1668
+ // * TRAVEL and WAIT are "preemptable": they can be interrupted several times
1669
+ // during this transition. Clients can assume that travel happens "as soon as
1670
+ // possible" and that "wait" fills the remaining time.
1671
+ //
1672
+ // A (complex) example:
1673
+ // ```
1674
+ // TRANSITION[i]
1675
+ // --++-----+-----------------------------------------------------------++-->
1676
+ // || | | | | | | ||
1677
+ // || T | B | T | | B | | D ||
1678
+ // || r | r | r | W | r | W | e ||
1679
+ // || a | e | a | a | e | a | l ||
1680
+ // || v | a | v | i | a | i | a ||
1681
+ // || e | k | e | t | k | t | y ||
1682
+ // || l | | l | | | | ||
1683
+ // || | | | | | | ||
1684
+ // --++-----------------------------------------------------------------++-->
1685
+ // ```
1686
+ message ShipmentRoute {
1687
+ // A visit performed during a route. This visit corresponds to a pickup or a
1688
+ // delivery of a `Shipment`.
1689
+ message Visit {
1690
+ // Index of the `shipments` field in the source
1691
+ // [ShipmentModel][google.maps.routeoptimization.v1.ShipmentModel].
1692
+ int32 shipment_index = 1;
1693
+
1694
+ // If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it
1695
+ // corresponds to a delivery.
1696
+ bool is_pickup = 2;
1697
+
1698
+ // Index of `VisitRequest` in either the pickup or delivery field of the
1699
+ // `Shipment` (see `is_pickup`).
1700
+ int32 visit_request_index = 3;
1701
+
1702
+ // Time at which the visit starts. Note that the vehicle may arrive earlier
1703
+ // than this at the visit location. Times are consistent with the
1704
+ // `ShipmentModel`.
1705
+ google.protobuf.Timestamp start_time = 4;
1706
+
1707
+ // Total visit load demand as the sum of the shipment and the visit request
1708
+ // `load_demands`. The values are negative if the visit is a delivery.
1709
+ // Demands are reported for the same types as the
1710
+ // [Transition.loads][google.maps.routeoptimization.v1.ShipmentRoute.Transition]
1711
+ // (see this field).
1712
+ map<string, Shipment.Load> load_demands = 11;
1713
+
1714
+ // Extra detour time due to the shipments visited on the route before the
1715
+ // visit and to the potential waiting time induced by time windows.
1716
+ // If the visit is a delivery, the detour is computed from the corresponding
1717
+ // pickup visit and is equal to:
1718
+ // ```
1719
+ // start_time(delivery) - start_time(pickup)
1720
+ // - (duration(pickup) + travel duration from the pickup location
1721
+ // to the delivery location).
1722
+ // ```
1723
+ // Otherwise, it is computed from the vehicle `start_location` and is equal
1724
+ // to:
1725
+ // ```
1726
+ // start_time - vehicle_start_time - travel duration from
1727
+ // the vehicle's `start_location` to the visit.
1728
+ // ```
1729
+ google.protobuf.Duration detour = 6;
1730
+
1731
+ // Copy of the corresponding `Shipment.label`, if specified in the
1732
+ // `Shipment`.
1733
+ string shipment_label = 7;
1734
+
1735
+ // Copy of the corresponding
1736
+ // [VisitRequest.label][google.maps.routeoptimization.v1.Shipment.VisitRequest.label],
1737
+ // if specified in the `VisitRequest`.
1738
+ string visit_label = 8;
1739
+ }
1740
+
1741
+ // Transition between two events on the route. See the description of
1742
+ // [ShipmentRoute][google.maps.routeoptimization.v1.ShipmentRoute].
1743
+ //
1744
+ // If the vehicle does not have a `start_location` and/or `end_location`, the
1745
+ // corresponding travel metrics are 0.
1746
+ message Transition {
1747
+ // Travel duration during this transition.
1748
+ google.protobuf.Duration travel_duration = 1;
1749
+
1750
+ // Distance traveled during the transition.
1751
+ double travel_distance_meters = 2;
1752
+
1753
+ // When traffic is requested via
1754
+ // [OptimizeToursRequest.consider_road_traffic]
1755
+ // [google.maps.routeoptimization.v1.OptimizeToursRequest.consider_road_traffic],
1756
+ // and the traffic info couldn't be retrieved for a `Transition`, this
1757
+ // boolean is set to true. This may be temporary (rare hiccup in the
1758
+ // realtime traffic servers) or permanent (no data for this location).
1759
+ bool traffic_info_unavailable = 3;
1760
+
1761
+ // Sum of the delay durations applied to this transition. If any, the delay
1762
+ // starts exactly `delay_duration` seconds before the next event (visit or
1763
+ // vehicle end). See
1764
+ // [TransitionAttributes.delay][google.maps.routeoptimization.v1.TransitionAttributes.delay].
1765
+ google.protobuf.Duration delay_duration = 4;
1766
+
1767
+ // Sum of the duration of the breaks occurring during this transition, if
1768
+ // any. Details about each break's start time and duration are stored in
1769
+ // [ShipmentRoute.breaks][google.maps.routeoptimization.v1.ShipmentRoute.breaks].
1770
+ google.protobuf.Duration break_duration = 5;
1771
+
1772
+ // Time spent waiting during this transition. Wait duration corresponds to
1773
+ // idle time and does not include break time. Also note that this wait time
1774
+ // may be split into several non-contiguous intervals.
1775
+ google.protobuf.Duration wait_duration = 6;
1776
+
1777
+ // Total duration of the transition, provided for convenience. It is equal
1778
+ // to:
1779
+ //
1780
+ // * next visit `start_time` (or `vehicle_end_time` if this is the last
1781
+ // transition) - this transition's `start_time`;
1782
+ // * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following
1783
+ // additionally holds: `total_duration = travel_duration + delay_duration
1784
+ // + break_duration + wait_duration`.
1785
+ google.protobuf.Duration total_duration = 7;
1786
+
1787
+ // Start time of this transition.
1788
+ google.protobuf.Timestamp start_time = 8;
1789
+
1790
+ // The encoded polyline representation of the route followed during the
1791
+ // transition.
1792
+ // This field is only populated if [populate_transition_polylines]
1793
+ // [google.maps.routeoptimization.v1.OptimizeToursRequest.populate_transition_polylines]
1794
+ // is set to true.
1795
+ EncodedPolyline route_polyline = 9;
1796
+
1797
+ // Vehicle loads during this transition, for each type that either appears
1798
+ // in this vehicle's
1799
+ // [Vehicle.load_limits][google.maps.routeoptimization.v1.Vehicle.load_limits],
1800
+ // or that have non-zero
1801
+ // [Shipment.load_demands][google.maps.routeoptimization.v1.Shipment.load_demands]
1802
+ // on some shipment performed on this route.
1803
+ //
1804
+ // The loads during the first transition are the starting loads of the
1805
+ // vehicle route. Then, after each visit, the visit's `load_demands` are
1806
+ // either added or subtracted to get the next transition's loads, depending
1807
+ // on whether the visit was a pickup or a delivery.
1808
+ map<string, VehicleLoad> vehicle_loads = 11;
1809
+ }
1810
+
1811
+ // Reports the actual load of the vehicle at some point along the route,
1812
+ // for a given type (see
1813
+ // [Transition.vehicle_loads][google.maps.routeoptimization.v1.ShipmentRoute.Transition.vehicle_loads]).
1814
+ message VehicleLoad {
1815
+ // The amount of load on the vehicle, for the given type. The unit of load
1816
+ // is usually indicated by the type. See
1817
+ // [Transition.vehicle_loads][google.maps.routeoptimization.v1.ShipmentRoute.Transition.vehicle_loads].
1818
+ int64 amount = 1;
1819
+ }
1820
+
1821
+ // The encoded representation of a polyline. More information on polyline
1822
+ // encoding can be found here:
1823
+ // https://developers.google.com/maps/documentation/utilities/polylinealgorithm
1824
+ // https://developers.google.com/maps/documentation/javascript/reference/geometry#encoding.
1825
+ message EncodedPolyline {
1826
+ // String representing encoded points of the polyline.
1827
+ string points = 1;
1828
+ }
1829
+
1830
+ // Data representing the execution of a break.
1831
+ message Break {
1832
+ // Start time of a break.
1833
+ google.protobuf.Timestamp start_time = 1;
1834
+
1835
+ // Duration of a break.
1836
+ google.protobuf.Duration duration = 2;
1837
+ }
1838
+
1839
+ // Vehicle performing the route, identified by its index in the source
1840
+ // `ShipmentModel`.
1841
+ int32 vehicle_index = 1;
1842
+
1843
+ // Label of the vehicle performing this route, equal to
1844
+ // `ShipmentModel.vehicles(vehicle_index).label`, if specified.
1845
+ string vehicle_label = 2;
1846
+
1847
+ // Time at which the vehicle starts its route.
1848
+ google.protobuf.Timestamp vehicle_start_time = 5;
1849
+
1850
+ // Time at which the vehicle finishes its route.
1851
+ google.protobuf.Timestamp vehicle_end_time = 6;
1852
+
1853
+ // Ordered sequence of visits representing a route.
1854
+ // visits[i] is the i-th visit in the route.
1855
+ // If this field is empty, the vehicle is considered as unused.
1856
+ repeated Visit visits = 7;
1857
+
1858
+ // Ordered list of transitions for the route.
1859
+ repeated Transition transitions = 8;
1860
+
1861
+ // When
1862
+ // [OptimizeToursRequest.consider_road_traffic][google.maps.routeoptimization.v1.OptimizeToursRequest.consider_road_traffic],
1863
+ // is set to true, this field indicates that inconsistencies in route timings
1864
+ // are predicted using traffic-based travel duration estimates. There may be
1865
+ // insufficient time to complete traffic-adjusted travel, delays, and breaks
1866
+ // between visits, before the first visit, or after the last visit, while
1867
+ // still satisfying the visit and vehicle time windows. For example,
1868
+ //
1869
+ // ```
1870
+ // start_time(previous_visit) + duration(previous_visit) +
1871
+ // travel_duration(previous_visit, next_visit) > start_time(next_visit)
1872
+ // ```
1873
+ //
1874
+ // Arrival at next_visit will likely happen later than its current
1875
+ // time window due the increased estimate of travel time
1876
+ // `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break
1877
+ // may be forced to overlap with a visit due to an increase in travel time
1878
+ // estimates and visit or break time window restrictions.
1879
+ bool has_traffic_infeasibilities = 9;
1880
+
1881
+ // The encoded polyline representation of the route.
1882
+ // This field is only populated if
1883
+ // [OptimizeToursRequest.populate_polylines][google.maps.routeoptimization.v1.OptimizeToursRequest.populate_polylines]
1884
+ // is set to true.
1885
+ EncodedPolyline route_polyline = 10;
1886
+
1887
+ // Breaks scheduled for the vehicle performing this route.
1888
+ // The `breaks` sequence represents time intervals, each starting at the
1889
+ // corresponding `start_time` and lasting `duration` seconds.
1890
+ repeated Break breaks = 11;
1891
+
1892
+ // Duration, distance and load metrics for this route. The fields of
1893
+ // [AggregatedMetrics][google.maps.routeoptimization.v1.AggregatedMetrics] are
1894
+ // summed over all
1895
+ // [ShipmentRoute.transitions][google.maps.routeoptimization.v1.ShipmentRoute.transitions]
1896
+ // or
1897
+ // [ShipmentRoute.visits][google.maps.routeoptimization.v1.ShipmentRoute.visits],
1898
+ // depending on the context.
1899
+ AggregatedMetrics metrics = 12;
1900
+
1901
+ // Cost of the route, broken down by cost-related request fields.
1902
+ // The keys are proto paths, relative to the input OptimizeToursRequest, e.g.
1903
+ // "model.shipments.pickups.cost", and the values are the total cost
1904
+ // generated by the corresponding cost field, aggregated over the whole route.
1905
+ // In other words, costs["model.shipments.pickups.cost"] is the sum of all
1906
+ // pickup costs over the route. All costs defined in the model are reported in
1907
+ // detail here with the exception of costs related to TransitionAttributes
1908
+ // that are only reported in an aggregated way as of 2022/01.
1909
+ map<string, double> route_costs = 17;
1910
+
1911
+ // Total cost of the route. The sum of all costs in the cost map.
1912
+ double route_total_cost = 18;
1913
+ }
1914
+
1915
+ // Specifies details of unperformed shipments in a solution. For trivial cases
1916
+ // and/or if we are able to identify the cause for skipping, we report the
1917
+ // reason here.
1918
+ message SkippedShipment {
1919
+ // If we can explain why the shipment was skipped, reasons will be listed
1920
+ // here. If the reason is not the same for all vehicles, `reason` will have
1921
+ // more than 1 element. A skipped shipment cannot have duplicate reasons,
1922
+ // i.e. where all fields are the same except for `example_vehicle_index`.
1923
+ // Example:
1924
+ // ```
1925
+ // reasons {
1926
+ // code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
1927
+ // example_vehicle_index: 1
1928
+ // example_exceeded_capacity_type: "Apples"
1929
+ // }
1930
+ // reasons {
1931
+ // code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
1932
+ // example_vehicle_index: 3
1933
+ // example_exceeded_capacity_type: "Pears"
1934
+ // }
1935
+ // reasons {
1936
+ // code: CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT
1937
+ // example_vehicle_index: 1
1938
+ // }
1939
+ // ```
1940
+ // The skipped shipment is incompatible with all vehicles. The reasons may
1941
+ // be different for all vehicles but at least one vehicle's "Apples"
1942
+ // capacity would be exceeded (including vehicle 1), at least one vehicle's
1943
+ // "Pears" capacity would be exceeded (including vehicle 3) and at least one
1944
+ // vehicle's distance limit would be exceeded (including vehicle 1).
1945
+ message Reason {
1946
+ // Code identifying the reason type. The order here is meaningless. In
1947
+ // particular, it gives no indication of whether a given reason will
1948
+ // appear before another in the solution, if both apply.
1949
+ enum Code {
1950
+ // This should never be used. If we are unable to understand why a
1951
+ // shipment was skipped, we simply return an empty set of reasons.
1952
+ CODE_UNSPECIFIED = 0;
1953
+
1954
+ // There is no vehicle in the model making all shipments infeasible.
1955
+ NO_VEHICLE = 1;
1956
+
1957
+ // The demand of the shipment exceeds a vehicle's capacity for some
1958
+ // capacity types, one of which is `example_exceeded_capacity_type`.
1959
+ DEMAND_EXCEEDS_VEHICLE_CAPACITY = 2;
1960
+
1961
+ // The minimum distance necessary to perform this shipment, i.e. from
1962
+ // the vehicle's `start_location` to the shipment's pickup and/or delivery
1963
+ // locations and to the vehicle's end location exceeds the vehicle's
1964
+ // `route_distance_limit`.
1965
+ //
1966
+ // Note that for this computation we use the geodesic distances.
1967
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT = 3;
1968
+
1969
+ // The minimum time necessary to perform this shipment, including travel
1970
+ // time, wait time and service time exceeds the vehicle's
1971
+ // `route_duration_limit`.
1972
+ //
1973
+ // Note: travel time is computed in the best-case scenario, namely as
1974
+ // geodesic distance x 36 m/s (roughly 130 km/hour).
1975
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT = 4;
1976
+
1977
+ // Same as above but we only compare minimum travel time and the
1978
+ // vehicle's `travel_duration_limit`.
1979
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT = 5;
1980
+
1981
+ // The vehicle cannot perform this shipment in the best-case scenario
1982
+ // (see `CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT` for time
1983
+ // computation) if it starts at its earliest start time: the total time
1984
+ // would make the vehicle end after its latest end time.
1985
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS = 6;
1986
+
1987
+ // The `allowed_vehicle_indices` field of the shipment is not empty and
1988
+ // this vehicle does not belong to it.
1989
+ VEHICLE_NOT_ALLOWED = 7;
1990
+ }
1991
+
1992
+ // Refer to the comments of Code.
1993
+ Code code = 1;
1994
+
1995
+ // If the reason is related to a shipment-vehicle incompatibility, this
1996
+ // field provides the index of one relevant vehicle.
1997
+ optional int32 example_vehicle_index = 2;
1998
+
1999
+ // If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one
2000
+ // capacity type that is exceeded.
2001
+ string example_exceeded_capacity_type = 3;
2002
+ }
2003
+
2004
+ // The index corresponds to the index of the shipment in the source
2005
+ // `ShipmentModel`.
2006
+ int32 index = 1;
2007
+
2008
+ // Copy of the corresponding
2009
+ // [Shipment.label][google.maps.routeoptimization.v1.Shipment.label], if
2010
+ // specified in the `Shipment`.
2011
+ string label = 2;
2012
+
2013
+ // A list of reasons that explain why the shipment was skipped. See comment
2014
+ // above `Reason`.
2015
+ repeated Reason reasons = 3;
2016
+ }
2017
+
2018
+ // Aggregated metrics for
2019
+ // [ShipmentRoute][google.maps.routeoptimization.v1.ShipmentRoute] (resp. for
2020
+ // [OptimizeToursResponse][google.maps.routeoptimization.v1.OptimizeToursResponse]
2021
+ // over all
2022
+ // [Transition][google.maps.routeoptimization.v1.ShipmentRoute.Transition]
2023
+ // and/or [Visit][google.maps.routeoptimization.v1.ShipmentRoute.Visit] (resp.
2024
+ // over all [ShipmentRoute][google.maps.routeoptimization.v1.ShipmentRoute])
2025
+ // elements.
2026
+ message AggregatedMetrics {
2027
+ // Number of shipments performed. Note that a pickup and delivery pair only
2028
+ // counts once.
2029
+ int32 performed_shipment_count = 1;
2030
+
2031
+ // Total travel duration for a route or a solution.
2032
+ google.protobuf.Duration travel_duration = 2;
2033
+
2034
+ // Total wait duration for a route or a solution.
2035
+ google.protobuf.Duration wait_duration = 3;
2036
+
2037
+ // Total delay duration for a route or a solution.
2038
+ google.protobuf.Duration delay_duration = 4;
2039
+
2040
+ // Total break duration for a route or a solution.
2041
+ google.protobuf.Duration break_duration = 5;
2042
+
2043
+ // Total visit duration for a route or a solution.
2044
+ google.protobuf.Duration visit_duration = 6;
2045
+
2046
+ // The total duration should be equal to the sum of all durations above.
2047
+ // For routes, it also corresponds to:
2048
+ // ```
2049
+ // [ShipmentRoute.vehicle_end_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_end_time]
2050
+ // -
2051
+ // [ShipmentRoute.vehicle_start_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_start_time]
2052
+ // ```
2053
+ google.protobuf.Duration total_duration = 7;
2054
+
2055
+ // Total travel distance for a route or a solution.
2056
+ double travel_distance_meters = 8;
2057
+
2058
+ // Maximum load achieved over the entire route (resp. solution), for each of
2059
+ // the quantities on this route (resp. solution), computed as the maximum over
2060
+ // all
2061
+ // [Transition.vehicle_loads][google.maps.routeoptimization.v1.ShipmentRoute.Transition.vehicle_loads]
2062
+ // (resp.
2063
+ // [ShipmentRoute.metrics.max_loads][google.maps.routeoptimization.v1.AggregatedMetrics.max_loads].
2064
+ map<string, ShipmentRoute.VehicleLoad> max_loads = 9;
2065
+ }
2066
+
2067
+ // Solution injected in the request including information about which visits
2068
+ // must be constrained and how they must be constrained.
2069
+ message InjectedSolutionConstraint {
2070
+ // For a group of vehicles, specifies at what threshold(s) constraints on
2071
+ // visits will be relaxed and to which level. Shipments listed in
2072
+ // the `skipped_shipment` field are constrained to be skipped; i.e., they
2073
+ // cannot be performed.
2074
+ message ConstraintRelaxation {
2075
+ // If `relaxations` is empty, the start time and sequence of all visits
2076
+ // on `routes` are fully constrained and no new visits may be inserted or
2077
+ // added to those routes. Also, a vehicle's start and end time in
2078
+ // `routes` is fully constrained, unless the vehicle is empty (i.e., has no
2079
+ // visits and has `used_if_route_is_empty` set to false in the model).
2080
+ //
2081
+ // `relaxations(i).level` specifies the constraint relaxation level applied
2082
+ // to a visit #j that satisfies:
2083
+ //
2084
+ // * `route.visits(j).start_time >= relaxations(i).threshold_time` AND
2085
+ // * `j + 1 >= relaxations(i).threshold_visit_count`
2086
+ //
2087
+ // Similarly, the vehicle start is relaxed to `relaxations(i).level` if it
2088
+ // satisfies:
2089
+ //
2090
+ // * `vehicle_start_time >= relaxations(i).threshold_time` AND
2091
+ // * `relaxations(i).threshold_visit_count == 0`
2092
+ // and the vehicle end is relaxed to `relaxations(i).level` if it satisfies:
2093
+ // * `vehicle_end_time >= relaxations(i).threshold_time` AND
2094
+ // * `route.visits_size() + 1 >= relaxations(i).threshold_visit_count`
2095
+ //
2096
+ // To apply a relaxation level if a visit meets the `threshold_visit_count`
2097
+ // OR the `threshold_time` add two `relaxations` with the same `level`:
2098
+ // one with only `threshold_visit_count` set and the other with only
2099
+ // `threshold_time` set. If a visit satisfies the conditions of multiple
2100
+ // `relaxations`, the most relaxed level applies. As a result, from the
2101
+ // vehicle start through the route visits in order to the vehicle end, the
2102
+ // relaxation level becomes more relaxed: i.e., the relaxation level is
2103
+ // non-decreasing as the route progresses.
2104
+ //
2105
+ // The timing and sequence of route visits that do not satisfy the
2106
+ // threshold conditions of any `relaxations` are fully constrained
2107
+ // and no visits may be inserted into these sequences. Also, if a
2108
+ // vehicle start or end does not satisfy the conditions of any
2109
+ // relaxation the time is fixed, unless the vehicle is empty.
2110
+ message Relaxation {
2111
+ // Expresses the different constraint relaxation levels, which are
2112
+ // applied for a visit and those that follow when it satisfies the
2113
+ // threshold conditions.
2114
+ //
2115
+ // The enumeration below is in order of increasing relaxation.
2116
+ enum Level {
2117
+ // Implicit default relaxation level: no constraints are relaxed,
2118
+ // i.e., all visits are fully constrained.
2119
+ //
2120
+ // This value must not be explicitly used in `level`.
2121
+ LEVEL_UNSPECIFIED = 0;
2122
+
2123
+ // Visit start times and vehicle start/end times will be relaxed, but
2124
+ // each visit remains bound to the same vehicle and the visit sequence
2125
+ // must be observed: no visit can be inserted between them or before
2126
+ // them.
2127
+ RELAX_VISIT_TIMES_AFTER_THRESHOLD = 1;
2128
+
2129
+ // Same as `RELAX_VISIT_TIMES_AFTER_THRESHOLD`, but the visit sequence
2130
+ // is also relaxed: visits remain simply bound to their vehicle.
2131
+ RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD = 2;
2132
+
2133
+ // Same as `RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD`, but the
2134
+ // vehicle is also relaxed: visits are completely free at or after the
2135
+ // threshold time and can potentially become unperformed.
2136
+ RELAX_ALL_AFTER_THRESHOLD = 3;
2137
+ }
2138
+
2139
+ // The constraint relaxation level that applies when the conditions
2140
+ // at or after `threshold_time` AND at least `threshold_visit_count` are
2141
+ // satisfied.
2142
+ Level level = 1;
2143
+
2144
+ // The time at or after which the relaxation `level` may be applied.
2145
+ google.protobuf.Timestamp threshold_time = 2;
2146
+
2147
+ // The number of visits at or after which the relaxation `level` may be
2148
+ // applied. If `threshold_visit_count` is 0 (or unset), the `level` may be
2149
+ // applied directly at the vehicle start.
2150
+ //
2151
+ // If it is `route.visits_size() + 1`, the `level` may only be applied to
2152
+ // the vehicle end. If it is more than `route.visits_size() + 1`,
2153
+ // `level` is not applied at all for that route.
2154
+ int32 threshold_visit_count = 3;
2155
+ }
2156
+
2157
+ // All the visit constraint relaxations that will apply to visits on
2158
+ // routes with vehicles in `vehicle_indices`.
2159
+ repeated Relaxation relaxations = 1;
2160
+
2161
+ // Specifies the vehicle indices to which the visit constraint
2162
+ // `relaxations` apply. If empty, this is considered the default and the
2163
+ // `relaxations` apply to all vehicles that are not specified in other
2164
+ // `constraint_relaxations`. There can be at most one default, i.e., at
2165
+ // most one constraint relaxation field is allowed empty
2166
+ // `vehicle_indices`. A vehicle index can only be listed once, even within
2167
+ // several `constraint_relaxations`.
2168
+ //
2169
+ // A vehicle index is mapped the same as
2170
+ // [ShipmentRoute.vehicle_index][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_index],
2171
+ // if `interpret_injected_solutions_using_labels` is true (see `fields`
2172
+ // comment).
2173
+ repeated int32 vehicle_indices = 2;
2174
+ }
2175
+
2176
+ // Routes of the solution to inject. Some routes may be omitted from the
2177
+ // original solution. The routes and skipped shipments must satisfy the basic
2178
+ // validity assumptions listed for `injected_first_solution_routes`.
2179
+ repeated ShipmentRoute routes = 1;
2180
+
2181
+ // Skipped shipments of the solution to inject. Some may be omitted from the
2182
+ // original solution. See the `routes` field.
2183
+ repeated SkippedShipment skipped_shipments = 2;
2184
+
2185
+ // For zero or more groups of vehicles, specifies when and how much to relax
2186
+ // constraints. If this field is empty, all non-empty vehicle routes are
2187
+ // fully constrained.
2188
+ repeated ConstraintRelaxation constraint_relaxations = 3;
2189
+ }
2190
+
2191
+ // Describes an error encountered when validating an `OptimizeToursRequest`.
2192
+ message OptimizeToursValidationError {
2193
+ // Specifies a context for the validation error. A `FieldReference` always
2194
+ // refers to a given field in this file and follows the same hierarchical
2195
+ // structure. For example, we may specify element #2 of `start_time_windows`
2196
+ // of vehicle #5 using:
2197
+ // ```
2198
+ // name: "vehicles" index: 5 sub_field { name: "end_time_windows" index: 2 }
2199
+ // ```
2200
+ // We however omit top-level entities such as `OptimizeToursRequest` or
2201
+ // `ShipmentModel` to avoid crowding the message.
2202
+ message FieldReference {
2203
+ // Name of the field, e.g., "vehicles".
2204
+ string name = 1;
2205
+
2206
+ oneof index_or_key {
2207
+ // Index of the field if repeated.
2208
+ int32 index = 2;
2209
+
2210
+ // Key if the field is a map.
2211
+ string key = 4;
2212
+ }
2213
+
2214
+ // Recursively nested sub-field, if needed.
2215
+ FieldReference sub_field = 3;
2216
+ }
2217
+
2218
+ // A validation error is defined by the pair (`code`, `display_name`) which
2219
+ // are always present.
2220
+ //
2221
+ // Other fields (below) provide more context about the error.
2222
+ //
2223
+ // *MULTIPLE ERRORS*:
2224
+ // When there are multiple errors, the validation process tries to output
2225
+ // several of them. Much like a compiler, this is an imperfect process. Some
2226
+ // validation errors will be "fatal", meaning that they stop the entire
2227
+ // validation process. This is the case for `display_name="UNSPECIFIED"`
2228
+ // errors, among others. Some may cause the validation process to skip other
2229
+ // errors.
2230
+ //
2231
+ // *STABILITY*:
2232
+ // `code` and `display_name` should be very stable. But new codes and
2233
+ // display names may appear over time, which may cause a given (invalid)
2234
+ // request to yield a different (`code`, `display_name`) pair because the new
2235
+ // error hid the old one (see "MULTIPLE ERRORS").
2236
+ //
2237
+ // *REFERENCE*: A list of all (code, name) pairs:
2238
+ //
2239
+ // * UNSPECIFIED = 0;
2240
+ // * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within
2241
+ // the deadline.
2242
+ //
2243
+ // * REQUEST_OPTIONS_ERROR = 12;
2244
+ // * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201;
2245
+ // * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203;
2246
+ // * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204;
2247
+ // * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205;
2248
+ // * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206;
2249
+ // * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE
2250
+ // = 1207;
2251
+ // * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208;
2252
+ // * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211;
2253
+ // * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212;
2254
+ // * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213;
2255
+ // * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214;
2256
+ // * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215;
2257
+ // * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216;
2258
+ // * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217;
2259
+ // * INJECTED_SOLUTION_ERROR = 20;
2260
+ // * INJECTED_SOLUTION_MISSING_LABEL = 2000;
2261
+ // * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001;
2262
+ // * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002;
2263
+ // * INJECTED_SOLUTION_INFEASIBLE_AFTER_GETTING_TRAVEL_TIMES = 2003;
2264
+ // * INJECTED_SOLUTION_TRANSITION_INCONSISTENT_WITH_ACTUAL_TRAVEL = 2004;
2265
+ // * INJECTED_SOLUTION_CONCURRENT_SOLUTION_TYPES = 2005;
2266
+ // * INJECTED_SOLUTION_MORE_THAN_ONE_PER_TYPE = 2006;
2267
+ // * INJECTED_SOLUTION_REFRESH_WITHOUT_POPULATE = 2008;
2268
+ // * INJECTED_SOLUTION_CONSTRAINED_ROUTE_PORTION_INFEASIBLE = 2010;
2269
+ // * SHIPMENT_MODEL_ERROR = 22;
2270
+ // * SHIPMENT_MODEL_TOO_LARGE = 2200;
2271
+ // * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201;
2272
+ // * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202;
2273
+ // * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203;
2274
+ // * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204;
2275
+ // * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205;
2276
+ // * SHIPMENT_MODEL_MAX_ACTIVE_VEHICLES_NOT_POSITIVE = 2206;
2277
+ // * SHIPMENT_MODEL_DURATION_MATRIX_TOO_LARGE = 2207;
2278
+ // * INDEX_ERROR = 24;
2279
+ // * TAG_ERROR = 26;
2280
+ // * TIME_WINDOW_ERROR = 28;
2281
+ // * TIME_WINDOW_INVALID_START_TIME = 2800;
2282
+ // * TIME_WINDOW_INVALID_END_TIME = 2801;
2283
+ // * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802;
2284
+ // * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803;
2285
+ // * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804;
2286
+ // * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805;
2287
+ // * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806;
2288
+ // * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807;
2289
+ // * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME
2290
+ // = 2808;
2291
+ // * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809;
2292
+ // * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME
2293
+ // = 2810;
2294
+ // * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811;
2295
+ // * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812;
2296
+ // * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813;
2297
+ // * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814;
2298
+ // * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815;
2299
+ // * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816;
2300
+ // * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS
2301
+ // = 2817;
2302
+ // * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818;
2303
+ // * TRANSITION_ATTRIBUTES_ERROR = 30;
2304
+ // * TRANSITION_ATTRIBUTES_INVALID_COST = 3000;
2305
+ // * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001;
2306
+ // * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002;
2307
+ // * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003;
2308
+ // * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004;
2309
+ // * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005;
2310
+ // * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006;
2311
+ // * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007;
2312
+ // * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008;
2313
+ // * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009;
2314
+ // * AMOUNT_ERROR = 31;
2315
+ // * AMOUNT_NEGATIVE_VALUE = 3100;
2316
+ // * LOAD_LIMIT_ERROR = 33;
2317
+ // * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303;
2318
+ // * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304;
2319
+ // * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305;
2320
+ // * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306;
2321
+ // * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307;
2322
+ // * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308;
2323
+ // * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309;
2324
+ // * INTERVAL_ERROR = 34;
2325
+ // * INTERVAL_MIN_EXCEEDS_MAX = 3401;
2326
+ // * INTERVAL_NEGATIVE_MIN = 3402;
2327
+ // * INTERVAL_NEGATIVE_MAX = 3403;
2328
+ // * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404;
2329
+ // * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405;
2330
+ // * DISTANCE_LIMIT_ERROR = 36;
2331
+ // * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601;
2332
+ // * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602;
2333
+ // * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603;
2334
+ // * DISTANCE_LIMIT_NEGATIVE_MAX = 3604;
2335
+ // * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605;
2336
+ // * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606;
2337
+ // * DURATION_LIMIT_ERROR = 38;
2338
+ // * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800;
2339
+ // * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801;
2340
+ // * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802;
2341
+ // * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803;
2342
+ // * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804;
2343
+ // * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805;
2344
+ // * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806;
2345
+ // * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR
2346
+ // = 3807;
2347
+ // * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX
2348
+ // = 3808;
2349
+ // * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809;
2350
+ // * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810;
2351
+ // * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811;
2352
+ // * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE
2353
+ // = 3812;
2354
+ // * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813;
2355
+ // * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814;
2356
+ // * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION
2357
+ // = 3815;
2358
+ // * SHIPMENT_ERROR = 40;
2359
+ // * SHIPMENT_PD_LIMIT_WITHOUT_PICKUP_AND_DELIVERY = 4014;
2360
+ // * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000;
2361
+ // * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION
2362
+ // = 4001;
2363
+ // * SHIPMENT_PD_RELATIVE_DETOUR_LIMIT_INVALID = 4015;
2364
+ // * SHIPMENT_PD_DETOUR_LIMIT_AND_EXTRA_VISIT_DURATION = 4016;
2365
+ // * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002;
2366
+ // * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003;
2367
+ // * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004;
2368
+ // * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005;
2369
+ // * SHIPMENT_INVALID_PENALTY_COST = 4006;
2370
+ // * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007;
2371
+ // * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008;
2372
+ // * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009;
2373
+ // * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010;
2374
+ // * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011;
2375
+ // * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012;
2376
+ // * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013;
2377
+ // * VEHICLE_ERROR = 42;
2378
+ // * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200;
2379
+ // * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201;
2380
+ // * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202;
2381
+ // * VEHICLE_EMPTY_START_TAG = 4203;
2382
+ // * VEHICLE_DUPLICATE_START_TAG = 4204;
2383
+ // * VEHICLE_EMPTY_END_TAG = 4205;
2384
+ // * VEHICLE_DUPLICATE_END_TAG = 4206;
2385
+ // * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207;
2386
+ // * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208;
2387
+ // * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209;
2388
+ // * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210;
2389
+ // * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211;
2390
+ // * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212;
2391
+ // * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213;
2392
+ // * VEHICLE_LAST_SHIPMENT_IGNORED = 4214;
2393
+ // * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215;
2394
+ // * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216;
2395
+ // * VEHICLE_INVALID_COST_PER_KILOMETER = 4217;
2396
+ // * VEHICLE_INVALID_COST_PER_HOUR = 4218;
2397
+ // * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219;
2398
+ // * VEHICLE_INVALID_FIXED_COST = 4220;
2399
+ // * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221;
2400
+ // * VEHICLE_TRAVEL_DURATION_MULTIPLE_WITH_SHIPMENT_PD_DETOUR_LIMITS
2401
+ // = 4223;
2402
+ // * VEHICLE_MATRIX_INDEX_WITH_SHIPMENT_PD_DETOUR_LIMITS = 4224;
2403
+ // * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222;
2404
+ // * VISIT_REQUEST_ERROR = 44;
2405
+ // * VISIT_REQUEST_EMPTY_TAG = 4400;
2406
+ // * VISIT_REQUEST_DUPLICATE_TAG = 4401;
2407
+ // * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404;
2408
+ // * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405;
2409
+ // * PRECEDENCE_ERROR = 46;
2410
+ // * BREAK_ERROR = 48;
2411
+ // * BREAK_RULE_EMPTY = 4800;
2412
+ // * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801;
2413
+ // * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802;
2414
+ // * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803;
2415
+ // * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804;
2416
+ // * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805;
2417
+ // * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806;
2418
+ // * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807;
2419
+ // * BREAK_REQUEST_NON_SCHEDULABLE = 4808;
2420
+ // * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809;
2421
+ // * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810;
2422
+ // * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811;
2423
+ // * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION
2424
+ // = 4812;
2425
+ // * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813;
2426
+ // * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814;
2427
+ // * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815;
2428
+ // * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50;
2429
+ // * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001;
2430
+ // * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002;
2431
+ // * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003;
2432
+ // * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004;
2433
+ // * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005;
2434
+ // * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52;
2435
+ // * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001;
2436
+ // * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002;
2437
+ // * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003;
2438
+ // * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004;
2439
+ // * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005;
2440
+ // * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006;
2441
+ // * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007;
2442
+ // * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008;
2443
+ // * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009;
2444
+ // * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010;
2445
+ // * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011;
2446
+ // * VEHICLE_OPERATOR_ERROR = 54;
2447
+ // * VEHICLE_OPERATOR_EMPTY_TYPE = 5400;
2448
+ // * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401;
2449
+ // * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402;
2450
+ // * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403;
2451
+ // * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404;
2452
+ // * DURATION_SECONDS_MATRIX_ERROR = 56;
2453
+ // * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600;
2454
+ // * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601;
2455
+ int32 code = 1;
2456
+
2457
+ // The error display name.
2458
+ string display_name = 2;
2459
+
2460
+ // An error context may involve 0, 1 (most of the time) or more fields. For
2461
+ // example, referring to vehicle #4 and shipment #2's first pickup can be
2462
+ // done as follows:
2463
+ // ```
2464
+ // fields { name: "vehicles" index: 4}
2465
+ // fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} }
2466
+ // ```
2467
+ // Note, however, that the cardinality of `fields` should not change for a
2468
+ // given error code.
2469
+ repeated FieldReference fields = 3;
2470
+
2471
+ // Human-readable string describing the error. There is a 1:1 mapping
2472
+ // between `code` and `error_message` (when code != "UNSPECIFIED").
2473
+ //
2474
+ // *STABILITY*: Not stable: the error message associated to a given `code` may
2475
+ // change (hopefully to clarify it) over time. Please rely on the
2476
+ // `display_name` and `code` instead.
2477
+ string error_message = 4;
2478
+
2479
+ // May contain the value(s) of the field(s). This is not always available. You
2480
+ // should absolutely not rely on it and use it only for manual model
2481
+ // debugging.
2482
+ string offending_values = 5;
2483
+ }
2484
+
2485
+ // Specify an input for
2486
+ // [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours].
2487
+ message InputConfig {
2488
+ // Required.
2489
+ oneof source {
2490
+ // A Google Cloud Storage location. This must be a single object (file).
2491
+ GcsSource gcs_source = 1;
2492
+ }
2493
+
2494
+ // Required. The input data format.
2495
+ DataFormat data_format = 2 [(google.api.field_behavior) = REQUIRED];
2496
+ }
2497
+
2498
+ // Specify a destination for
2499
+ // [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours]
2500
+ // results.
2501
+ message OutputConfig {
2502
+ // Required.
2503
+ oneof destination {
2504
+ // The Google Cloud Storage location to write the output to.
2505
+ GcsDestination gcs_destination = 1;
2506
+ }
2507
+
2508
+ // Required. The output data format.
2509
+ DataFormat data_format = 2 [(google.api.field_behavior) = REQUIRED];
2510
+ }
2511
+
2512
+ // The Google Cloud Storage location where the input file will be read from.
2513
+ message GcsSource {
2514
+ // Required. URI of a Google Cloud Storage object with the format
2515
+ // `gs://bucket/path/to/object`.
2516
+ string uri = 1 [(google.api.field_behavior) = REQUIRED];
2517
+ }
2518
+
2519
+ // The Google Cloud Storage location where the output file(s) will be written
2520
+ // to.
2521
+ message GcsDestination {
2522
+ // Required. Google Cloud Storage URI.
2523
+ string uri = 1 [(google.api.field_behavior) = REQUIRED];
2524
+ }
2525
+
2526
+ // Data formats for input and output files.
2527
+ enum DataFormat {
2528
+ // Invalid value, format must not be UNSPECIFIED.
2529
+ DATA_FORMAT_UNSPECIFIED = 0;
2530
+
2531
+ // JavaScript Object Notation.
2532
+ JSON = 1;
2533
+
2534
+ // Protocol Buffers text format. See
2535
+ // https://protobuf.dev/reference/protobuf/textformat-spec/
2536
+ PROTO_TEXT = 2;
2537
+ }