google-maps-routeoptimization 0.1.0__py3-none-any.whl

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.
Files changed (23) hide show
  1. google/maps/routeoptimization/__init__.py +85 -0
  2. google/maps/routeoptimization/gapic_version.py +16 -0
  3. google/maps/routeoptimization/py.typed +2 -0
  4. google/maps/routeoptimization_v1/__init__.py +83 -0
  5. google/maps/routeoptimization_v1/gapic_metadata.json +58 -0
  6. google/maps/routeoptimization_v1/gapic_version.py +16 -0
  7. google/maps/routeoptimization_v1/py.typed +2 -0
  8. google/maps/routeoptimization_v1/services/__init__.py +15 -0
  9. google/maps/routeoptimization_v1/services/route_optimization/__init__.py +22 -0
  10. google/maps/routeoptimization_v1/services/route_optimization/async_client.py +588 -0
  11. google/maps/routeoptimization_v1/services/route_optimization/client.py +992 -0
  12. google/maps/routeoptimization_v1/services/route_optimization/transports/__init__.py +36 -0
  13. google/maps/routeoptimization_v1/services/route_optimization/transports/base.py +200 -0
  14. google/maps/routeoptimization_v1/services/route_optimization/transports/grpc.py +381 -0
  15. google/maps/routeoptimization_v1/services/route_optimization/transports/grpc_asyncio.py +408 -0
  16. google/maps/routeoptimization_v1/services/route_optimization/transports/rest.py +631 -0
  17. google/maps/routeoptimization_v1/types/__init__.py +72 -0
  18. google/maps/routeoptimization_v1/types/route_optimization_service.py +4029 -0
  19. google_maps_routeoptimization-0.1.0.dist-info/LICENSE +202 -0
  20. google_maps_routeoptimization-0.1.0.dist-info/METADATA +137 -0
  21. google_maps_routeoptimization-0.1.0.dist-info/RECORD +23 -0
  22. google_maps_routeoptimization-0.1.0.dist-info/WHEEL +5 -0
  23. google_maps_routeoptimization-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,4029 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from __future__ import annotations
17
+
18
+ from typing import MutableMapping, MutableSequence
19
+
20
+ from google.protobuf import duration_pb2 # type: ignore
21
+ from google.protobuf import timestamp_pb2 # type: ignore
22
+ from google.type import latlng_pb2 # type: ignore
23
+ import proto # type: ignore
24
+
25
+ __protobuf__ = proto.module(
26
+ package="google.maps.routeoptimization.v1",
27
+ manifest={
28
+ "DataFormat",
29
+ "BatchOptimizeToursRequest",
30
+ "BatchOptimizeToursResponse",
31
+ "BatchOptimizeToursMetadata",
32
+ "OptimizeToursRequest",
33
+ "OptimizeToursResponse",
34
+ "ShipmentModel",
35
+ "Shipment",
36
+ "ShipmentTypeIncompatibility",
37
+ "ShipmentTypeRequirement",
38
+ "Vehicle",
39
+ "TimeWindow",
40
+ "DistanceLimit",
41
+ "TransitionAttributes",
42
+ "Waypoint",
43
+ "Location",
44
+ "BreakRule",
45
+ "ShipmentRoute",
46
+ "SkippedShipment",
47
+ "AggregatedMetrics",
48
+ "InjectedSolutionConstraint",
49
+ "OptimizeToursValidationError",
50
+ "InputConfig",
51
+ "OutputConfig",
52
+ "GcsSource",
53
+ "GcsDestination",
54
+ },
55
+ )
56
+
57
+
58
+ class DataFormat(proto.Enum):
59
+ r"""Data formats for input and output files.
60
+
61
+ Values:
62
+ DATA_FORMAT_UNSPECIFIED (0):
63
+ Invalid value, format must not be
64
+ UNSPECIFIED.
65
+ JSON (1):
66
+ JavaScript Object Notation.
67
+ PROTO_TEXT (2):
68
+ Protocol Buffers text format. See
69
+ https://protobuf.dev/reference/protobuf/textformat-spec/
70
+ """
71
+ DATA_FORMAT_UNSPECIFIED = 0
72
+ JSON = 1
73
+ PROTO_TEXT = 2
74
+
75
+
76
+ class BatchOptimizeToursRequest(proto.Message):
77
+ r"""Request to batch optimize tours as an asynchronous operation. Each
78
+ input file should contain one ``OptimizeToursRequest``, and each
79
+ output file will contain one ``OptimizeToursResponse``. The request
80
+ contains information to read/write and parse the files. All the
81
+ input and output files should be under the same project.
82
+
83
+ Attributes:
84
+ parent (str):
85
+ Required. Target project and location to make a call.
86
+
87
+ Format:
88
+
89
+ - ``projects/{project-id}``
90
+ - ``projects/{project-id}/locations/{location-id}``
91
+
92
+ If no location is specified, a region will be chosen
93
+ automatically.
94
+ model_configs (MutableSequence[google.maps.routeoptimization_v1.types.BatchOptimizeToursRequest.AsyncModelConfig]):
95
+ Required. Input/Output information each
96
+ purchase model, such as file paths and data
97
+ formats.
98
+ """
99
+
100
+ class AsyncModelConfig(proto.Message):
101
+ r"""Information for solving one optimization model
102
+ asynchronously.
103
+
104
+ Attributes:
105
+ display_name (str):
106
+ Optional. User defined model name, can be
107
+ used as alias by users to keep track of models.
108
+ input_config (google.maps.routeoptimization_v1.types.InputConfig):
109
+ Required. Information about the input model.
110
+ output_config (google.maps.routeoptimization_v1.types.OutputConfig):
111
+ Required. The desired output location
112
+ information.
113
+ """
114
+
115
+ display_name: str = proto.Field(
116
+ proto.STRING,
117
+ number=1,
118
+ )
119
+ input_config: "InputConfig" = proto.Field(
120
+ proto.MESSAGE,
121
+ number=2,
122
+ message="InputConfig",
123
+ )
124
+ output_config: "OutputConfig" = proto.Field(
125
+ proto.MESSAGE,
126
+ number=3,
127
+ message="OutputConfig",
128
+ )
129
+
130
+ parent: str = proto.Field(
131
+ proto.STRING,
132
+ number=1,
133
+ )
134
+ model_configs: MutableSequence[AsyncModelConfig] = proto.RepeatedField(
135
+ proto.MESSAGE,
136
+ number=2,
137
+ message=AsyncModelConfig,
138
+ )
139
+
140
+
141
+ class BatchOptimizeToursResponse(proto.Message):
142
+ r"""Response to a ``BatchOptimizeToursRequest``. This is returned in the
143
+ Long Running Operation after the operation is complete.
144
+
145
+ """
146
+
147
+
148
+ class BatchOptimizeToursMetadata(proto.Message):
149
+ r"""Operation metadata for ``BatchOptimizeToursRequest`` calls."""
150
+
151
+
152
+ class OptimizeToursRequest(proto.Message):
153
+ r"""Request to be given to a tour optimization solver which
154
+ defines the shipment model to solve as well as optimization
155
+ parameters.
156
+
157
+
158
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
159
+
160
+ Attributes:
161
+ parent (str):
162
+ Required. Target project or location to make a call.
163
+
164
+ Format:
165
+
166
+ - ``projects/{project-id}``
167
+ - ``projects/{project-id}/locations/{location-id}``
168
+
169
+ If no location is specified, a region will be chosen
170
+ automatically.
171
+ timeout (google.protobuf.duration_pb2.Duration):
172
+ If this timeout is set, the server returns a
173
+ response before the timeout period has elapsed
174
+ or the server deadline for synchronous requests
175
+ is reached, whichever is sooner.
176
+
177
+ For asynchronous requests, the server will
178
+ generate a solution (if possible) before the
179
+ timeout has elapsed.
180
+ model (google.maps.routeoptimization_v1.types.ShipmentModel):
181
+ Shipment model to solve.
182
+ solving_mode (google.maps.routeoptimization_v1.types.OptimizeToursRequest.SolvingMode):
183
+ By default, the solving mode is ``DEFAULT_SOLVE`` (0).
184
+ search_mode (google.maps.routeoptimization_v1.types.OptimizeToursRequest.SearchMode):
185
+ Search mode used to solve the request.
186
+ injected_first_solution_routes (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentRoute]):
187
+ Guide the optimization algorithm in finding a first solution
188
+ that is similar to a previous solution.
189
+
190
+ The model is constrained when the first solution is built.
191
+ Any shipments not performed on a route are implicitly
192
+ skipped in the first solution, but they may be performed in
193
+ successive solutions.
194
+
195
+ The solution must satisfy some basic validity assumptions:
196
+
197
+ - for all routes, ``vehicle_index`` must be in range and
198
+ not be duplicated.
199
+ - for all visits, ``shipment_index`` and
200
+ ``visit_request_index`` must be in range.
201
+ - a shipment may only be referenced on one route.
202
+ - the pickup of a pickup-delivery shipment must be
203
+ performed before the delivery.
204
+ - no more than one pickup alternative or delivery
205
+ alternative of a shipment may be performed.
206
+ - for all routes, times are increasing (i.e.,
207
+ ``vehicle_start_time <= visits[0].start_time <= visits[1].start_time ... <= vehicle_end_time``).
208
+ - a shipment may only be performed on a vehicle that is
209
+ allowed. A vehicle is allowed if
210
+ [Shipment.allowed_vehicle_indices][google.maps.routeoptimization.v1.Shipment.allowed_vehicle_indices]
211
+ is empty or its ``vehicle_index`` is included in
212
+ [Shipment.allowed_vehicle_indices][google.maps.routeoptimization.v1.Shipment.allowed_vehicle_indices].
213
+
214
+ If the injected solution is not feasible, a validation error
215
+ is not necessarily returned and an error indicating
216
+ infeasibility may be returned instead.
217
+ injected_solution_constraint (google.maps.routeoptimization_v1.types.InjectedSolutionConstraint):
218
+ Constrain the optimization algorithm to find
219
+ a final solution that is similar to a previous
220
+ solution. For example, this may be used to
221
+ freeze portions of routes which have already
222
+ been completed or which are to be completed but
223
+ must not be modified.
224
+
225
+ If the injected solution is not feasible, a
226
+ validation error is not necessarily returned and
227
+ an error indicating infeasibility may be
228
+ returned instead.
229
+ refresh_details_routes (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentRoute]):
230
+ If non-empty, the given routes will be refreshed, without
231
+ modifying their underlying sequence of visits or travel
232
+ times: only other details will be updated. This does not
233
+ solve the model.
234
+
235
+ As of 2020/11, this only populates the polylines of
236
+ non-empty routes and requires that ``populate_polylines`` is
237
+ true.
238
+
239
+ The ``route_polyline`` fields of the passed-in routes may be
240
+ inconsistent with route ``transitions``.
241
+
242
+ This field must not be used together with
243
+ ``injected_first_solution_routes`` or
244
+ ``injected_solution_constraint``.
245
+
246
+ ``Shipment.ignore`` and ``Vehicle.ignore`` have no effect on
247
+ the behavior. Polylines are still populated between all
248
+ visits in all non-empty routes regardless of whether the
249
+ related shipments or vehicles are ignored.
250
+ interpret_injected_solutions_using_labels (bool):
251
+ If true:
252
+
253
+ - uses
254
+ [ShipmentRoute.vehicle_label][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_label]
255
+ instead of ``vehicle_index`` to match routes in an
256
+ injected solution with vehicles in the request; reuses
257
+ the mapping of original
258
+ [ShipmentRoute.vehicle_index][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_index]
259
+ to new
260
+ [ShipmentRoute.vehicle_index][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_index]
261
+ to update
262
+ [ConstraintRelaxation.vehicle_indices][google.maps.routeoptimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices]
263
+ if non-empty, but the mapping must be unambiguous (i.e.,
264
+ multiple ``ShipmentRoute``\ s must not share the same
265
+ original ``vehicle_index``).
266
+ - uses
267
+ [ShipmentRoute.Visit.shipment_label][google.maps.routeoptimization.v1.ShipmentRoute.Visit.shipment_label]
268
+ instead of ``shipment_index`` to match visits in an
269
+ injected solution with shipments in the request;
270
+ - uses
271
+ [SkippedShipment.label][google.maps.routeoptimization.v1.SkippedShipment.label]
272
+ instead of
273
+ [SkippedShipment.index][google.maps.routeoptimization.v1.SkippedShipment.index]
274
+ to match skipped shipments in the injected solution with
275
+ request shipments.
276
+
277
+ This interpretation applies to the
278
+ ``injected_first_solution_routes``,
279
+ ``injected_solution_constraint``, and
280
+ ``refresh_details_routes`` fields. It can be used when
281
+ shipment or vehicle indices in the request have changed
282
+ since the solution was created, perhaps because shipments or
283
+ vehicles have been removed from or added to the request.
284
+
285
+ If true, labels in the following categories must appear at
286
+ most once in their category:
287
+
288
+ - [Vehicle.label][google.maps.routeoptimization.v1.Vehicle.label]
289
+ in the request;
290
+ - [Shipment.label][google.maps.routeoptimization.v1.Shipment.label]
291
+ in the request;
292
+ - [ShipmentRoute.vehicle_label][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_label]
293
+ in the injected solution;
294
+ - [SkippedShipment.label][google.maps.routeoptimization.v1.SkippedShipment.label]
295
+ and
296
+ [ShipmentRoute.Visit.shipment_label][google.maps.routeoptimization.v1.ShipmentRoute.Visit.shipment_label]
297
+ in the injected solution (except pickup/delivery visit
298
+ pairs, whose ``shipment_label`` must appear twice).
299
+
300
+ If a ``vehicle_label`` in the injected solution does not
301
+ correspond to a request vehicle, the corresponding route is
302
+ removed from the solution along with its visits. If a
303
+ ``shipment_label`` in the injected solution does not
304
+ correspond to a request shipment, the corresponding visit is
305
+ removed from the solution. If a
306
+ [SkippedShipment.label][google.maps.routeoptimization.v1.SkippedShipment.label]
307
+ in the injected solution does not correspond to a request
308
+ shipment, the ``SkippedShipment`` is removed from the
309
+ solution.
310
+
311
+ Removing route visits or entire routes from an injected
312
+ solution may have an effect on the implied constraints,
313
+ which may lead to change in solution, validation errors, or
314
+ infeasibility.
315
+
316
+ NOTE: The caller must ensure that each
317
+ [Vehicle.label][google.maps.routeoptimization.v1.Vehicle.label]
318
+ (resp.
319
+ [Shipment.label][google.maps.routeoptimization.v1.Shipment.label])
320
+ uniquely identifies a vehicle (resp. shipment) entity used
321
+ across the two relevant requests: the past request that
322
+ produced the ``OptimizeToursResponse`` used in the injected
323
+ solution and the current request that includes the injected
324
+ solution. The uniqueness checks described above are not
325
+ enough to guarantee this requirement.
326
+ consider_road_traffic (bool):
327
+ Consider traffic estimation in calculating ``ShipmentRoute``
328
+ fields
329
+ [Transition.travel_duration][google.maps.routeoptimization.v1.ShipmentRoute.Transition.travel_duration],
330
+ [Visit.start_time][google.maps.routeoptimization.v1.ShipmentRoute.Visit.start_time],
331
+ and ``vehicle_end_time``; in setting the
332
+ [ShipmentRoute.has_traffic_infeasibilities][google.maps.routeoptimization.v1.ShipmentRoute.has_traffic_infeasibilities]
333
+ field, and in calculating the
334
+ [OptimizeToursResponse.total_cost][google.maps.routeoptimization.v1.OptimizeToursResponse.total_cost]
335
+ field.
336
+ populate_polylines (bool):
337
+ If true, polylines will be populated in response
338
+ ``ShipmentRoute``\ s.
339
+ populate_transition_polylines (bool):
340
+ If true, polylines will be populated in response
341
+ [ShipmentRoute.transitions][google.maps.routeoptimization.v1.ShipmentRoute.transitions].
342
+ allow_large_deadline_despite_interruption_risk (bool):
343
+ If this is set, then the request can have a
344
+ deadline (see https://grpc.io/blog/deadlines) of
345
+ up to 60 minutes. Otherwise, the maximum
346
+ deadline is only 30 minutes. Note that
347
+ long-lived requests have a significantly larger
348
+ (but still small) risk of interruption.
349
+ use_geodesic_distances (bool):
350
+ If true, travel distances will be computed using geodesic
351
+ distances instead of Google Maps distances, and travel times
352
+ will be computed using geodesic distances with a speed
353
+ defined by ``geodesic_meters_per_second``.
354
+ geodesic_meters_per_second (float):
355
+ When ``use_geodesic_distances`` is true, this field must be
356
+ set and defines the speed applied to compute travel times.
357
+ Its value must be at least 1.0 meters/seconds.
358
+
359
+ This field is a member of `oneof`_ ``_geodesic_meters_per_second``.
360
+ max_validation_errors (int):
361
+ Truncates the number of validation errors returned. These
362
+ errors are typically attached to an INVALID_ARGUMENT error
363
+ payload as a BadRequest error detail
364
+ (https://cloud.google.com/apis/design/errors#error_details),
365
+ unless solving_mode=VALIDATE_ONLY: see the
366
+ [OptimizeToursResponse.validation_errors][google.maps.routeoptimization.v1.OptimizeToursResponse.validation_errors]
367
+ field. This defaults to 100 and is capped at 10,000.
368
+
369
+ This field is a member of `oneof`_ ``_max_validation_errors``.
370
+ label (str):
371
+ Label that may be used to identify this request, reported
372
+ back in the
373
+ [OptimizeToursResponse.request_label][google.maps.routeoptimization.v1.OptimizeToursResponse.request_label].
374
+ """
375
+
376
+ class SolvingMode(proto.Enum):
377
+ r"""Defines how the solver should handle the request. In all modes but
378
+ ``VALIDATE_ONLY``, if the request is invalid, you will receive an
379
+ ``INVALID_REQUEST`` error. See
380
+ [max_validation_errors][google.maps.routeoptimization.v1.OptimizeToursRequest.max_validation_errors]
381
+ to cap the number of errors returned.
382
+
383
+ Values:
384
+ DEFAULT_SOLVE (0):
385
+ Solve the model.
386
+ VALIDATE_ONLY (1):
387
+ Only validates the model without solving it: populates as
388
+ many
389
+ [OptimizeToursResponse.validation_errors][google.maps.routeoptimization.v1.OptimizeToursResponse.validation_errors]
390
+ as possible.
391
+ DETECT_SOME_INFEASIBLE_SHIPMENTS (2):
392
+ Only populates
393
+ [OptimizeToursResponse.validation_errors][google.maps.routeoptimization.v1.OptimizeToursResponse.validation_errors]
394
+ or
395
+ [OptimizeToursResponse.skipped_shipments][google.maps.routeoptimization.v1.OptimizeToursResponse.skipped_shipments],
396
+ and doesn't actually solve the rest of the request
397
+ (``status`` and ``routes`` are unset in the response). If
398
+ infeasibilities in ``injected_solution_constraint`` routes
399
+ are detected they are populated in the
400
+ [OptimizeToursResponse.validation_errors][google.maps.routeoptimization.v1.OptimizeToursResponse.validation_errors]
401
+ field and
402
+ [OptimizeToursResponse.skipped_shipments][google.maps.routeoptimization.v1.OptimizeToursResponse.skipped_shipments]
403
+ is left empty.
404
+
405
+ *IMPORTANT*: not all infeasible shipments are returned here,
406
+ but only the ones that are detected as infeasible during
407
+ preprocessing.
408
+ """
409
+ DEFAULT_SOLVE = 0
410
+ VALIDATE_ONLY = 1
411
+ DETECT_SOME_INFEASIBLE_SHIPMENTS = 2
412
+
413
+ class SearchMode(proto.Enum):
414
+ r"""Mode defining the behavior of the search, trading off latency
415
+ versus solution quality. In all modes, the global request
416
+ deadline is enforced.
417
+
418
+ Values:
419
+ SEARCH_MODE_UNSPECIFIED (0):
420
+ Unspecified search mode, equivalent to ``RETURN_FAST``.
421
+ RETURN_FAST (1):
422
+ Stop the search after finding the first good
423
+ solution.
424
+ CONSUME_ALL_AVAILABLE_TIME (2):
425
+ Spend all the available time to search for
426
+ better solutions.
427
+ """
428
+ SEARCH_MODE_UNSPECIFIED = 0
429
+ RETURN_FAST = 1
430
+ CONSUME_ALL_AVAILABLE_TIME = 2
431
+
432
+ parent: str = proto.Field(
433
+ proto.STRING,
434
+ number=1,
435
+ )
436
+ timeout: duration_pb2.Duration = proto.Field(
437
+ proto.MESSAGE,
438
+ number=2,
439
+ message=duration_pb2.Duration,
440
+ )
441
+ model: "ShipmentModel" = proto.Field(
442
+ proto.MESSAGE,
443
+ number=3,
444
+ message="ShipmentModel",
445
+ )
446
+ solving_mode: SolvingMode = proto.Field(
447
+ proto.ENUM,
448
+ number=4,
449
+ enum=SolvingMode,
450
+ )
451
+ search_mode: SearchMode = proto.Field(
452
+ proto.ENUM,
453
+ number=6,
454
+ enum=SearchMode,
455
+ )
456
+ injected_first_solution_routes: MutableSequence[
457
+ "ShipmentRoute"
458
+ ] = proto.RepeatedField(
459
+ proto.MESSAGE,
460
+ number=7,
461
+ message="ShipmentRoute",
462
+ )
463
+ injected_solution_constraint: "InjectedSolutionConstraint" = proto.Field(
464
+ proto.MESSAGE,
465
+ number=8,
466
+ message="InjectedSolutionConstraint",
467
+ )
468
+ refresh_details_routes: MutableSequence["ShipmentRoute"] = proto.RepeatedField(
469
+ proto.MESSAGE,
470
+ number=9,
471
+ message="ShipmentRoute",
472
+ )
473
+ interpret_injected_solutions_using_labels: bool = proto.Field(
474
+ proto.BOOL,
475
+ number=10,
476
+ )
477
+ consider_road_traffic: bool = proto.Field(
478
+ proto.BOOL,
479
+ number=11,
480
+ )
481
+ populate_polylines: bool = proto.Field(
482
+ proto.BOOL,
483
+ number=12,
484
+ )
485
+ populate_transition_polylines: bool = proto.Field(
486
+ proto.BOOL,
487
+ number=13,
488
+ )
489
+ allow_large_deadline_despite_interruption_risk: bool = proto.Field(
490
+ proto.BOOL,
491
+ number=14,
492
+ )
493
+ use_geodesic_distances: bool = proto.Field(
494
+ proto.BOOL,
495
+ number=15,
496
+ )
497
+ geodesic_meters_per_second: float = proto.Field(
498
+ proto.DOUBLE,
499
+ number=16,
500
+ optional=True,
501
+ )
502
+ max_validation_errors: int = proto.Field(
503
+ proto.INT32,
504
+ number=5,
505
+ optional=True,
506
+ )
507
+ label: str = proto.Field(
508
+ proto.STRING,
509
+ number=17,
510
+ )
511
+
512
+
513
+ class OptimizeToursResponse(proto.Message):
514
+ r"""Response after solving a tour optimization problem containing
515
+ the routes followed by each vehicle, the shipments which have
516
+ been skipped and the overall cost of the solution.
517
+
518
+ Attributes:
519
+ routes (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentRoute]):
520
+ Routes computed for each vehicle; the i-th
521
+ route corresponds to the i-th vehicle in the
522
+ model.
523
+ request_label (str):
524
+ Copy of the
525
+ [OptimizeToursRequest.label][google.maps.routeoptimization.v1.OptimizeToursRequest.label],
526
+ if a label was specified in the request.
527
+ skipped_shipments (MutableSequence[google.maps.routeoptimization_v1.types.SkippedShipment]):
528
+ The list of all shipments skipped.
529
+ validation_errors (MutableSequence[google.maps.routeoptimization_v1.types.OptimizeToursValidationError]):
530
+ List of all the validation errors that we were able to
531
+ detect independently. See the "MULTIPLE ERRORS" explanation
532
+ for the
533
+ [OptimizeToursValidationError][google.maps.routeoptimization.v1.OptimizeToursValidationError]
534
+ message.
535
+ metrics (google.maps.routeoptimization_v1.types.OptimizeToursResponse.Metrics):
536
+ Duration, distance and usage metrics for this
537
+ solution.
538
+ """
539
+
540
+ class Metrics(proto.Message):
541
+ r"""Overall metrics, aggregated over all routes.
542
+
543
+ Attributes:
544
+ aggregated_route_metrics (google.maps.routeoptimization_v1.types.AggregatedMetrics):
545
+ Aggregated over the routes. Each metric is the sum (or max,
546
+ for loads) over all
547
+ [ShipmentRoute.metrics][google.maps.routeoptimization.v1.ShipmentRoute.metrics]
548
+ fields of the same name.
549
+ skipped_mandatory_shipment_count (int):
550
+ Number of mandatory shipments skipped.
551
+ used_vehicle_count (int):
552
+ Number of vehicles used. Note: if a vehicle route is empty
553
+ and
554
+ [Vehicle.used_if_route_is_empty][google.maps.routeoptimization.v1.Vehicle.used_if_route_is_empty]
555
+ is true, the vehicle is considered used.
556
+ earliest_vehicle_start_time (google.protobuf.timestamp_pb2.Timestamp):
557
+ The earliest start time for a used vehicle, computed as the
558
+ minimum over all used vehicles of
559
+ [ShipmentRoute.vehicle_start_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_start_time].
560
+ latest_vehicle_end_time (google.protobuf.timestamp_pb2.Timestamp):
561
+ The latest end time for a used vehicle, computed as the
562
+ maximum over all used vehicles of
563
+ [ShipmentRoute.vehicle_end_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_end_time].
564
+ costs (MutableMapping[str, float]):
565
+ Cost of the solution, broken down by cost-related request
566
+ fields. The keys are proto paths, relative to the input
567
+ OptimizeToursRequest, e.g. "model.shipments.pickups.cost",
568
+ and the values are the total cost generated by the
569
+ corresponding cost field, aggregated over the whole
570
+ solution. In other words,
571
+ costs["model.shipments.pickups.cost"] is the sum of all
572
+ pickup costs over the solution. All costs defined in the
573
+ model are reported in detail here with the exception of
574
+ costs related to TransitionAttributes that are only reported
575
+ in an aggregated way as of 2022/01.
576
+ total_cost (float):
577
+ Total cost of the solution. The sum of all
578
+ values in the costs map.
579
+ """
580
+
581
+ aggregated_route_metrics: "AggregatedMetrics" = proto.Field(
582
+ proto.MESSAGE,
583
+ number=1,
584
+ message="AggregatedMetrics",
585
+ )
586
+ skipped_mandatory_shipment_count: int = proto.Field(
587
+ proto.INT32,
588
+ number=2,
589
+ )
590
+ used_vehicle_count: int = proto.Field(
591
+ proto.INT32,
592
+ number=3,
593
+ )
594
+ earliest_vehicle_start_time: timestamp_pb2.Timestamp = proto.Field(
595
+ proto.MESSAGE,
596
+ number=4,
597
+ message=timestamp_pb2.Timestamp,
598
+ )
599
+ latest_vehicle_end_time: timestamp_pb2.Timestamp = proto.Field(
600
+ proto.MESSAGE,
601
+ number=5,
602
+ message=timestamp_pb2.Timestamp,
603
+ )
604
+ costs: MutableMapping[str, float] = proto.MapField(
605
+ proto.STRING,
606
+ proto.DOUBLE,
607
+ number=10,
608
+ )
609
+ total_cost: float = proto.Field(
610
+ proto.DOUBLE,
611
+ number=6,
612
+ )
613
+
614
+ routes: MutableSequence["ShipmentRoute"] = proto.RepeatedField(
615
+ proto.MESSAGE,
616
+ number=1,
617
+ message="ShipmentRoute",
618
+ )
619
+ request_label: str = proto.Field(
620
+ proto.STRING,
621
+ number=3,
622
+ )
623
+ skipped_shipments: MutableSequence["SkippedShipment"] = proto.RepeatedField(
624
+ proto.MESSAGE,
625
+ number=4,
626
+ message="SkippedShipment",
627
+ )
628
+ validation_errors: MutableSequence[
629
+ "OptimizeToursValidationError"
630
+ ] = proto.RepeatedField(
631
+ proto.MESSAGE,
632
+ number=5,
633
+ message="OptimizeToursValidationError",
634
+ )
635
+ metrics: Metrics = proto.Field(
636
+ proto.MESSAGE,
637
+ number=6,
638
+ message=Metrics,
639
+ )
640
+
641
+
642
+ class ShipmentModel(proto.Message):
643
+ r"""A shipment model contains a set of shipments which must be performed
644
+ by a set of vehicles, while minimizing the overall cost, which is
645
+ the sum of:
646
+
647
+ - the cost of routing the vehicles (sum of cost per total time,
648
+ cost per travel time, and fixed cost over all vehicles).
649
+ - the unperformed shipment penalties.
650
+ - the cost of the global duration of the shipments
651
+
652
+
653
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
654
+
655
+ Attributes:
656
+ shipments (MutableSequence[google.maps.routeoptimization_v1.types.Shipment]):
657
+ Set of shipments which must be performed in
658
+ the model.
659
+ vehicles (MutableSequence[google.maps.routeoptimization_v1.types.Vehicle]):
660
+ Set of vehicles which can be used to perform
661
+ visits.
662
+ max_active_vehicles (int):
663
+ Constrains the maximum number of active
664
+ vehicles. A vehicle is active if its route
665
+ performs at least one shipment. This can be used
666
+ to limit the number of routes in the case where
667
+ there are fewer drivers than vehicles and that
668
+ the fleet of vehicles is heterogeneous. The
669
+ optimization will then select the best subset of
670
+ vehicles to use. Must be strictly positive.
671
+
672
+ This field is a member of `oneof`_ ``_max_active_vehicles``.
673
+ global_start_time (google.protobuf.timestamp_pb2.Timestamp):
674
+ Global start and end time of the model: no times outside of
675
+ this range can be considered valid.
676
+
677
+ The model's time span must be less than a year, i.e. the
678
+ ``global_end_time`` and the ``global_start_time`` must be
679
+ within 31536000 seconds of each other.
680
+
681
+ When using ``cost_per_*hour`` fields, you might want to set
682
+ this window to a smaller interval to increase performance
683
+ (eg. if you model a single day, you should set the global
684
+ time limits to that day). If unset, 00:00:00 UTC, January 1,
685
+ 1970 (i.e. seconds: 0, nanos: 0) is used as default.
686
+ global_end_time (google.protobuf.timestamp_pb2.Timestamp):
687
+ If unset, 00:00:00 UTC, January 1, 1971 (i.e.
688
+ seconds: 31536000, nanos: 0) is used as default.
689
+ global_duration_cost_per_hour (float):
690
+ The "global duration" of the overall plan is the difference
691
+ between the earliest effective start time and the latest
692
+ effective end time of all vehicles. Users can assign a cost
693
+ per hour to that quantity to try and optimize for earliest
694
+ job completion, for example. This cost must be in the same
695
+ unit as
696
+ [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost].
697
+ duration_distance_matrices (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentModel.DurationDistanceMatrix]):
698
+ Specifies duration and distance matrices used in the model.
699
+ If this field is empty, Google Maps or geodesic distances
700
+ will be used instead, depending on the value of the
701
+ ``use_geodesic_distances`` field. If it is not empty,
702
+ ``use_geodesic_distances`` cannot be true and neither
703
+ ``duration_distance_matrix_src_tags`` nor
704
+ ``duration_distance_matrix_dst_tags`` can be empty.
705
+
706
+ Usage examples:
707
+
708
+ - There are two locations: locA and locB.
709
+ - 1 vehicle starting its route at locA and ending it at
710
+ locA.
711
+ - 1 pickup visit request at locB.
712
+
713
+ ::
714
+
715
+ model {
716
+ vehicles { start_tags: "locA" end_tags: "locA" }
717
+ shipments { pickups { tags: "locB" } }
718
+ duration_distance_matrix_src_tags: "locA"
719
+ duration_distance_matrix_src_tags: "locB"
720
+ duration_distance_matrix_dst_tags: "locA"
721
+ duration_distance_matrix_dst_tags: "locB"
722
+ duration_distance_matrices {
723
+ rows { # from: locA
724
+ durations { seconds: 0 } meters: 0 # to: locA
725
+ durations { seconds: 100 } meters: 1000 # to: locB
726
+ }
727
+ rows { # from: locB
728
+ durations { seconds: 102 } meters: 990 # to: locA
729
+ durations { seconds: 0 } meters: 0 # to: locB
730
+ }
731
+ }
732
+ }
733
+
734
+ - There are three locations: locA, locB and locC.
735
+ - 1 vehicle starting its route at locA and ending it at
736
+ locB, using matrix "fast".
737
+ - 1 vehicle starting its route at locB and ending it at
738
+ locB, using matrix "slow".
739
+ - 1 vehicle starting its route at locB and ending it at
740
+ locB, using matrix "fast".
741
+ - 1 pickup visit request at locC.
742
+
743
+ ::
744
+
745
+ model {
746
+ vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" }
747
+ vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" }
748
+ vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" }
749
+ shipments { pickups { tags: "locC" } }
750
+ duration_distance_matrix_src_tags: "locA"
751
+ duration_distance_matrix_src_tags: "locB"
752
+ duration_distance_matrix_src_tags: "locC"
753
+ duration_distance_matrix_dst_tags: "locB"
754
+ duration_distance_matrix_dst_tags: "locC"
755
+ duration_distance_matrices {
756
+ vehicle_start_tag: "fast"
757
+ rows { # from: locA
758
+ durations { seconds: 1000 } meters: 2000 # to: locB
759
+ durations { seconds: 600 } meters: 1000 # to: locC
760
+ }
761
+ rows { # from: locB
762
+ durations { seconds: 0 } meters: 0 # to: locB
763
+ durations { seconds: 700 } meters: 1200 # to: locC
764
+ }
765
+ rows { # from: locC
766
+ durations { seconds: 702 } meters: 1190 # to: locB
767
+ durations { seconds: 0 } meters: 0 # to: locC
768
+ }
769
+ }
770
+ duration_distance_matrices {
771
+ vehicle_start_tag: "slow"
772
+ rows { # from: locA
773
+ durations { seconds: 1800 } meters: 2001 # to: locB
774
+ durations { seconds: 900 } meters: 1002 # to: locC
775
+ }
776
+ rows { # from: locB
777
+ durations { seconds: 0 } meters: 0 # to: locB
778
+ durations { seconds: 1000 } meters: 1202 # to: locC
779
+ }
780
+ rows { # from: locC
781
+ durations { seconds: 1001 } meters: 1195 # to: locB
782
+ durations { seconds: 0 } meters: 0 # to: locC
783
+ }
784
+ }
785
+ }
786
+ duration_distance_matrix_src_tags (MutableSequence[str]):
787
+ Tags defining the sources of the duration and distance
788
+ matrices; ``duration_distance_matrices(i).rows(j)`` defines
789
+ durations and distances from visits with tag
790
+ ``duration_distance_matrix_src_tags(j)`` to other visits in
791
+ matrix i.
792
+
793
+ Tags correspond to
794
+ [VisitRequest.tags][google.maps.routeoptimization.v1.Shipment.VisitRequest.tags]
795
+ or
796
+ [Vehicle.start_tags][google.maps.routeoptimization.v1.Vehicle.start_tags].
797
+ A given ``VisitRequest`` or ``Vehicle`` must match exactly
798
+ one tag in this field. Note that a ``Vehicle``'s source,
799
+ destination and matrix tags may be the same; similarly a
800
+ ``VisitRequest``'s source and destination tags may be the
801
+ same. All tags must be different and cannot be empty
802
+ strings. If this field is not empty, then
803
+ ``duration_distance_matrices`` must not be empty.
804
+ duration_distance_matrix_dst_tags (MutableSequence[str]):
805
+ Tags defining the destinations of the duration and distance
806
+ matrices;
807
+ ``duration_distance_matrices(i).rows(j).durations(k)``
808
+ (resp. ``duration_distance_matrices(i).rows(j).meters(k))``
809
+ defines the duration (resp. the distance) of the travel from
810
+ visits with tag ``duration_distance_matrix_src_tags(j)`` to
811
+ visits with tag ``duration_distance_matrix_dst_tags(k)`` in
812
+ matrix i.
813
+
814
+ Tags correspond to
815
+ [VisitRequest.tags][google.maps.routeoptimization.v1.Shipment.VisitRequest.tags]
816
+ or
817
+ [Vehicle.start_tags][google.maps.routeoptimization.v1.Vehicle.start_tags].
818
+ A given ``VisitRequest`` or ``Vehicle`` must match exactly
819
+ one tag in this field. Note that a ``Vehicle``'s source,
820
+ destination and matrix tags may be the same; similarly a
821
+ ``VisitRequest``'s source and destination tags may be the
822
+ same. All tags must be different and cannot be empty
823
+ strings. If this field is not empty, then
824
+ ``duration_distance_matrices`` must not be empty.
825
+ transition_attributes (MutableSequence[google.maps.routeoptimization_v1.types.TransitionAttributes]):
826
+ Transition attributes added to the model.
827
+ shipment_type_incompatibilities (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentTypeIncompatibility]):
828
+ Sets of incompatible shipment_types (see
829
+ ``ShipmentTypeIncompatibility``).
830
+ shipment_type_requirements (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentTypeRequirement]):
831
+ Sets of ``shipment_type`` requirements (see
832
+ ``ShipmentTypeRequirement``).
833
+ precedence_rules (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentModel.PrecedenceRule]):
834
+ Set of precedence rules which must be
835
+ enforced in the model.
836
+ """
837
+
838
+ class DurationDistanceMatrix(proto.Message):
839
+ r"""Specifies a duration and distance matrix from visit and
840
+ vehicle start locations to visit and vehicle end locations.
841
+
842
+ Attributes:
843
+ rows (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentModel.DurationDistanceMatrix.Row]):
844
+ Specifies the rows of the duration and distance matrix. It
845
+ must have as many elements as
846
+ [ShipmentModel.duration_distance_matrix_src_tags][google.maps.routeoptimization.v1.ShipmentModel.duration_distance_matrix_src_tags].
847
+ vehicle_start_tag (str):
848
+ Tag defining to which vehicles this duration and distance
849
+ matrix applies. If empty, this applies to all vehicles, and
850
+ there can only be a single matrix.
851
+
852
+ Each vehicle start must match exactly one matrix, i.e.
853
+ exactly one of their ``start_tags`` field must match the
854
+ ``vehicle_start_tag`` of a matrix (and of that matrix only).
855
+
856
+ All matrices must have a different ``vehicle_start_tag``.
857
+ """
858
+
859
+ class Row(proto.Message):
860
+ r"""Specifies a row of the duration and distance matrix.
861
+
862
+ Attributes:
863
+ durations (MutableSequence[google.protobuf.duration_pb2.Duration]):
864
+ Duration values for a given row. It must have as many
865
+ elements as
866
+ [ShipmentModel.duration_distance_matrix_dst_tags][google.maps.routeoptimization.v1.ShipmentModel.duration_distance_matrix_dst_tags].
867
+ meters (MutableSequence[float]):
868
+ Distance values for a given row. If no costs or constraints
869
+ refer to distances in the model, this can be left empty;
870
+ otherwise it must have as many elements as ``durations``.
871
+ """
872
+
873
+ durations: MutableSequence[duration_pb2.Duration] = proto.RepeatedField(
874
+ proto.MESSAGE,
875
+ number=1,
876
+ message=duration_pb2.Duration,
877
+ )
878
+ meters: MutableSequence[float] = proto.RepeatedField(
879
+ proto.DOUBLE,
880
+ number=2,
881
+ )
882
+
883
+ rows: MutableSequence[
884
+ "ShipmentModel.DurationDistanceMatrix.Row"
885
+ ] = proto.RepeatedField(
886
+ proto.MESSAGE,
887
+ number=1,
888
+ message="ShipmentModel.DurationDistanceMatrix.Row",
889
+ )
890
+ vehicle_start_tag: str = proto.Field(
891
+ proto.STRING,
892
+ number=2,
893
+ )
894
+
895
+ class PrecedenceRule(proto.Message):
896
+ r"""A precedence rule between two events (each event is the pickup or
897
+ the delivery of a shipment): the "second" event has to start at
898
+ least ``offset_duration`` after "first" has started.
899
+
900
+ Several precedences can refer to the same (or related) events, e.g.,
901
+ "pickup of B happens after delivery of A" and "pickup of C happens
902
+ after pickup of B".
903
+
904
+ Furthermore, precedences only apply when both shipments are
905
+ performed and are otherwise ignored.
906
+
907
+
908
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
909
+
910
+ Attributes:
911
+ first_index (int):
912
+ Shipment index of the "first" event. This
913
+ field must be specified.
914
+
915
+ This field is a member of `oneof`_ ``_first_index``.
916
+ first_is_delivery (bool):
917
+ Indicates if the "first" event is a delivery.
918
+ second_index (int):
919
+ Shipment index of the "second" event. This
920
+ field must be specified.
921
+
922
+ This field is a member of `oneof`_ ``_second_index``.
923
+ second_is_delivery (bool):
924
+ Indicates if the "second" event is a
925
+ delivery.
926
+ offset_duration (google.protobuf.duration_pb2.Duration):
927
+ The offset between the "first" and "second"
928
+ event. It can be negative.
929
+ """
930
+
931
+ first_index: int = proto.Field(
932
+ proto.INT32,
933
+ number=1,
934
+ optional=True,
935
+ )
936
+ first_is_delivery: bool = proto.Field(
937
+ proto.BOOL,
938
+ number=3,
939
+ )
940
+ second_index: int = proto.Field(
941
+ proto.INT32,
942
+ number=2,
943
+ optional=True,
944
+ )
945
+ second_is_delivery: bool = proto.Field(
946
+ proto.BOOL,
947
+ number=4,
948
+ )
949
+ offset_duration: duration_pb2.Duration = proto.Field(
950
+ proto.MESSAGE,
951
+ number=5,
952
+ message=duration_pb2.Duration,
953
+ )
954
+
955
+ shipments: MutableSequence["Shipment"] = proto.RepeatedField(
956
+ proto.MESSAGE,
957
+ number=1,
958
+ message="Shipment",
959
+ )
960
+ vehicles: MutableSequence["Vehicle"] = proto.RepeatedField(
961
+ proto.MESSAGE,
962
+ number=2,
963
+ message="Vehicle",
964
+ )
965
+ max_active_vehicles: int = proto.Field(
966
+ proto.INT32,
967
+ number=4,
968
+ optional=True,
969
+ )
970
+ global_start_time: timestamp_pb2.Timestamp = proto.Field(
971
+ proto.MESSAGE,
972
+ number=5,
973
+ message=timestamp_pb2.Timestamp,
974
+ )
975
+ global_end_time: timestamp_pb2.Timestamp = proto.Field(
976
+ proto.MESSAGE,
977
+ number=6,
978
+ message=timestamp_pb2.Timestamp,
979
+ )
980
+ global_duration_cost_per_hour: float = proto.Field(
981
+ proto.DOUBLE,
982
+ number=7,
983
+ )
984
+ duration_distance_matrices: MutableSequence[
985
+ DurationDistanceMatrix
986
+ ] = proto.RepeatedField(
987
+ proto.MESSAGE,
988
+ number=8,
989
+ message=DurationDistanceMatrix,
990
+ )
991
+ duration_distance_matrix_src_tags: MutableSequence[str] = proto.RepeatedField(
992
+ proto.STRING,
993
+ number=9,
994
+ )
995
+ duration_distance_matrix_dst_tags: MutableSequence[str] = proto.RepeatedField(
996
+ proto.STRING,
997
+ number=10,
998
+ )
999
+ transition_attributes: MutableSequence[
1000
+ "TransitionAttributes"
1001
+ ] = proto.RepeatedField(
1002
+ proto.MESSAGE,
1003
+ number=11,
1004
+ message="TransitionAttributes",
1005
+ )
1006
+ shipment_type_incompatibilities: MutableSequence[
1007
+ "ShipmentTypeIncompatibility"
1008
+ ] = proto.RepeatedField(
1009
+ proto.MESSAGE,
1010
+ number=12,
1011
+ message="ShipmentTypeIncompatibility",
1012
+ )
1013
+ shipment_type_requirements: MutableSequence[
1014
+ "ShipmentTypeRequirement"
1015
+ ] = proto.RepeatedField(
1016
+ proto.MESSAGE,
1017
+ number=13,
1018
+ message="ShipmentTypeRequirement",
1019
+ )
1020
+ precedence_rules: MutableSequence[PrecedenceRule] = proto.RepeatedField(
1021
+ proto.MESSAGE,
1022
+ number=14,
1023
+ message=PrecedenceRule,
1024
+ )
1025
+
1026
+
1027
+ class Shipment(proto.Message):
1028
+ r"""The shipment of a single item, from one of its pickups to one
1029
+ of its deliveries. For the shipment to be considered as
1030
+ performed, a unique vehicle must visit one of its pickup
1031
+ locations (and decrease its spare capacities accordingly), then
1032
+ visit one of its delivery locations later on (and therefore
1033
+ re-increase its spare capacities accordingly).
1034
+
1035
+
1036
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1037
+
1038
+ Attributes:
1039
+ display_name (str):
1040
+ The user-defined display name of the
1041
+ shipment. It can be up to 63 characters long and
1042
+ may use UTF-8 characters.
1043
+ pickups (MutableSequence[google.maps.routeoptimization_v1.types.Shipment.VisitRequest]):
1044
+ Set of pickup alternatives associated to the
1045
+ shipment. If not specified, the vehicle only
1046
+ needs to visit a location corresponding to the
1047
+ deliveries.
1048
+ deliveries (MutableSequence[google.maps.routeoptimization_v1.types.Shipment.VisitRequest]):
1049
+ Set of delivery alternatives associated to
1050
+ the shipment. If not specified, the vehicle only
1051
+ needs to visit a location corresponding to the
1052
+ pickups.
1053
+ load_demands (MutableMapping[str, google.maps.routeoptimization_v1.types.Shipment.Load]):
1054
+ Load demands of the shipment (for example weight, volume,
1055
+ number of pallets etc). The keys in the map should be
1056
+ identifiers describing the type of the corresponding load,
1057
+ ideally also including the units. For example: "weight_kg",
1058
+ "volume_gallons", "pallet_count", etc. If a given key does
1059
+ not appear in the map, the corresponding load is considered
1060
+ as null.
1061
+ penalty_cost (float):
1062
+ If the shipment is not completed, this penalty is added to
1063
+ the overall cost of the routes. A shipment is considered
1064
+ completed if one of its pickup and delivery alternatives is
1065
+ visited. The cost may be expressed in the same unit used for
1066
+ all other cost-related fields in the model and must be
1067
+ positive.
1068
+
1069
+ *IMPORTANT*: If this penalty is not specified, it is
1070
+ considered infinite, i.e. the shipment must be completed.
1071
+
1072
+ This field is a member of `oneof`_ ``_penalty_cost``.
1073
+ allowed_vehicle_indices (MutableSequence[int]):
1074
+ The set of vehicles that may perform this shipment. If
1075
+ empty, all vehicles may perform it. Vehicles are given by
1076
+ their index in the ``ShipmentModel``'s ``vehicles`` list.
1077
+ costs_per_vehicle (MutableSequence[float]):
1078
+ Specifies the cost that is incurred when this shipment is
1079
+ delivered by each vehicle. If specified, it must have
1080
+ EITHER:
1081
+
1082
+ - the same number of elements as
1083
+ ``costs_per_vehicle_indices``. ``costs_per_vehicle[i]``
1084
+ corresponds to vehicle ``costs_per_vehicle_indices[i]``
1085
+ of the model.
1086
+ - the same number of elements as there are vehicles in the
1087
+ model. The i-th element corresponds to vehicle #i of the
1088
+ model.
1089
+
1090
+ These costs must be in the same unit as ``penalty_cost`` and
1091
+ must not be negative. Leave this field empty, if there are
1092
+ no such costs.
1093
+ costs_per_vehicle_indices (MutableSequence[int]):
1094
+ Indices of the vehicles to which ``costs_per_vehicle``
1095
+ applies. If non-empty, it must have the same number of
1096
+ elements as ``costs_per_vehicle``. A vehicle index may not
1097
+ be specified more than once. If a vehicle is excluded from
1098
+ ``costs_per_vehicle_indices``, its cost is zero.
1099
+ pickup_to_delivery_relative_detour_limit (float):
1100
+ Specifies the maximum relative detour time compared to the
1101
+ shortest path from pickup to delivery. If specified, it must
1102
+ be nonnegative, and the shipment must contain at least a
1103
+ pickup and a delivery.
1104
+
1105
+ For example, let t be the shortest time taken to go from the
1106
+ selected pickup alternative directly to the selected
1107
+ delivery alternative. Then setting
1108
+ ``pickup_to_delivery_relative_detour_limit`` enforces:
1109
+
1110
+ ::
1111
+
1112
+ start_time(delivery) - start_time(pickup) <=
1113
+ std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit))
1114
+
1115
+ If both relative and absolute limits are specified on the
1116
+ same shipment, the more constraining limit is used for each
1117
+ possible pickup/delivery pair. As of 2017/10, detours are
1118
+ only supported when travel durations do not depend on
1119
+ vehicles.
1120
+
1121
+ This field is a member of `oneof`_ ``_pickup_to_delivery_relative_detour_limit``.
1122
+ pickup_to_delivery_absolute_detour_limit (google.protobuf.duration_pb2.Duration):
1123
+ Specifies the maximum absolute detour time compared to the
1124
+ shortest path from pickup to delivery. If specified, it must
1125
+ be nonnegative, and the shipment must contain at least a
1126
+ pickup and a delivery.
1127
+
1128
+ For example, let t be the shortest time taken to go from the
1129
+ selected pickup alternative directly to the selected
1130
+ delivery alternative. Then setting
1131
+ ``pickup_to_delivery_absolute_detour_limit`` enforces:
1132
+
1133
+ ::
1134
+
1135
+ start_time(delivery) - start_time(pickup) <=
1136
+ t + pickup_to_delivery_absolute_detour_limit
1137
+
1138
+ If both relative and absolute limits are specified on the
1139
+ same shipment, the more constraining limit is used for each
1140
+ possible pickup/delivery pair. As of 2017/10, detours are
1141
+ only supported when travel durations do not depend on
1142
+ vehicles.
1143
+ pickup_to_delivery_time_limit (google.protobuf.duration_pb2.Duration):
1144
+ Specifies the maximum duration from start of
1145
+ pickup to start of delivery of a shipment. If
1146
+ specified, it must be nonnegative, and the
1147
+ shipment must contain at least a pickup and a
1148
+ delivery. This does not depend on which
1149
+ alternatives are selected for pickup and
1150
+ delivery, nor on vehicle speed. This can be
1151
+ specified alongside maximum detour constraints:
1152
+ the solution will respect both specifications.
1153
+ shipment_type (str):
1154
+ Non-empty string specifying a "type" for this shipment. This
1155
+ feature can be used to define incompatibilities or
1156
+ requirements between ``shipment_types`` (see
1157
+ ``shipment_type_incompatibilities`` and
1158
+ ``shipment_type_requirements`` in ``ShipmentModel``).
1159
+
1160
+ Differs from ``visit_types`` which is specified for a single
1161
+ visit: All pickup/deliveries belonging to the same shipment
1162
+ share the same ``shipment_type``.
1163
+ label (str):
1164
+ Specifies a label for this shipment. This label is reported
1165
+ in the response in the ``shipment_label`` of the
1166
+ corresponding
1167
+ [ShipmentRoute.Visit][google.maps.routeoptimization.v1.ShipmentRoute.Visit].
1168
+ ignore (bool):
1169
+ If true, skip this shipment, but don't apply a
1170
+ ``penalty_cost``.
1171
+
1172
+ Ignoring a shipment results in a validation error when there
1173
+ are any ``shipment_type_requirements`` in the model.
1174
+
1175
+ Ignoring a shipment that is performed in
1176
+ ``injected_first_solution_routes`` or
1177
+ ``injected_solution_constraint`` is permitted; the solver
1178
+ removes the related pickup/delivery visits from the
1179
+ performing route. ``precedence_rules`` that reference
1180
+ ignored shipments will also be ignored.
1181
+ """
1182
+
1183
+ class VisitRequest(proto.Message):
1184
+ r"""Request for a visit which can be done by a vehicle: it has a
1185
+ geo-location (or two, see below), opening and closing times
1186
+ represented by time windows, and a service duration time (time
1187
+ spent by the vehicle once it has arrived to pickup or drop off
1188
+ goods).
1189
+
1190
+ Attributes:
1191
+ arrival_location (google.type.latlng_pb2.LatLng):
1192
+ The geo-location where the vehicle arrives when performing
1193
+ this ``VisitRequest``. If the shipment model has duration
1194
+ distance matrices, ``arrival_location`` must not be
1195
+ specified.
1196
+ arrival_waypoint (google.maps.routeoptimization_v1.types.Waypoint):
1197
+ The waypoint where the vehicle arrives when performing this
1198
+ ``VisitRequest``. If the shipment model has duration
1199
+ distance matrices, ``arrival_waypoint`` must not be
1200
+ specified.
1201
+ departure_location (google.type.latlng_pb2.LatLng):
1202
+ The geo-location where the vehicle departs after completing
1203
+ this ``VisitRequest``. Can be omitted if it is the same as
1204
+ ``arrival_location``. If the shipment model has duration
1205
+ distance matrices, ``departure_location`` must not be
1206
+ specified.
1207
+ departure_waypoint (google.maps.routeoptimization_v1.types.Waypoint):
1208
+ The waypoint where the vehicle departs after completing this
1209
+ ``VisitRequest``. Can be omitted if it is the same as
1210
+ ``arrival_waypoint``. If the shipment model has duration
1211
+ distance matrices, ``departure_waypoint`` must not be
1212
+ specified.
1213
+ tags (MutableSequence[str]):
1214
+ Specifies tags attached to the visit request.
1215
+ Empty or duplicate strings are not allowed.
1216
+ time_windows (MutableSequence[google.maps.routeoptimization_v1.types.TimeWindow]):
1217
+ Time windows which constrain the arrival time at a visit.
1218
+ Note that a vehicle may depart outside of the arrival time
1219
+ window, i.e. arrival time + duration do not need to be
1220
+ inside a time window. This can result in waiting time if the
1221
+ vehicle arrives before
1222
+ [TimeWindow.start_time][google.maps.routeoptimization.v1.TimeWindow.start_time].
1223
+
1224
+ The absence of ``TimeWindow`` means that the vehicle can
1225
+ perform this visit at any time.
1226
+
1227
+ Time windows must be disjoint, i.e. no time window must
1228
+ overlap with or be adjacent to another, and they must be in
1229
+ increasing order.
1230
+
1231
+ ``cost_per_hour_after_soft_end_time`` and ``soft_end_time``
1232
+ can only be set if there is a single time window.
1233
+ duration (google.protobuf.duration_pb2.Duration):
1234
+ Duration of the visit, i.e. time spent by the vehicle
1235
+ between arrival and departure (to be added to the possible
1236
+ waiting time; see ``time_windows``).
1237
+ cost (float):
1238
+ Cost to service this visit request on a vehicle route. This
1239
+ can be used to pay different costs for each alternative
1240
+ pickup or delivery of a shipment. This cost must be in the
1241
+ same unit as ``Shipment.penalty_cost`` and must not be
1242
+ negative.
1243
+ load_demands (MutableMapping[str, google.maps.routeoptimization_v1.types.Shipment.Load]):
1244
+ Load demands of this visit request. This is just like
1245
+ [Shipment.load_demands][google.maps.routeoptimization.v1.Shipment.load_demands]
1246
+ field, except that it only applies to this
1247
+ [VisitRequest][google.maps.routeoptimization.v1.Shipment.VisitRequest]
1248
+ instead of the whole
1249
+ [Shipment][google.maps.routeoptimization.v1.Shipment]. The
1250
+ demands listed here are added to the demands listed in
1251
+ [Shipment.load_demands][google.maps.routeoptimization.v1.Shipment.load_demands].
1252
+ visit_types (MutableSequence[str]):
1253
+ Specifies the types of the visit. This may be used to
1254
+ allocate additional time required for a vehicle to complete
1255
+ this visit (see
1256
+ [Vehicle.extra_visit_duration_for_visit_type][google.maps.routeoptimization.v1.Vehicle.extra_visit_duration_for_visit_type]).
1257
+
1258
+ A type can only appear once.
1259
+ label (str):
1260
+ Specifies a label for this ``VisitRequest``. This label is
1261
+ reported in the response as ``visit_label`` in the
1262
+ corresponding
1263
+ [ShipmentRoute.Visit][google.maps.routeoptimization.v1.ShipmentRoute.Visit].
1264
+ """
1265
+
1266
+ arrival_location: latlng_pb2.LatLng = proto.Field(
1267
+ proto.MESSAGE,
1268
+ number=1,
1269
+ message=latlng_pb2.LatLng,
1270
+ )
1271
+ arrival_waypoint: "Waypoint" = proto.Field(
1272
+ proto.MESSAGE,
1273
+ number=2,
1274
+ message="Waypoint",
1275
+ )
1276
+ departure_location: latlng_pb2.LatLng = proto.Field(
1277
+ proto.MESSAGE,
1278
+ number=3,
1279
+ message=latlng_pb2.LatLng,
1280
+ )
1281
+ departure_waypoint: "Waypoint" = proto.Field(
1282
+ proto.MESSAGE,
1283
+ number=4,
1284
+ message="Waypoint",
1285
+ )
1286
+ tags: MutableSequence[str] = proto.RepeatedField(
1287
+ proto.STRING,
1288
+ number=5,
1289
+ )
1290
+ time_windows: MutableSequence["TimeWindow"] = proto.RepeatedField(
1291
+ proto.MESSAGE,
1292
+ number=6,
1293
+ message="TimeWindow",
1294
+ )
1295
+ duration: duration_pb2.Duration = proto.Field(
1296
+ proto.MESSAGE,
1297
+ number=7,
1298
+ message=duration_pb2.Duration,
1299
+ )
1300
+ cost: float = proto.Field(
1301
+ proto.DOUBLE,
1302
+ number=8,
1303
+ )
1304
+ load_demands: MutableMapping[str, "Shipment.Load"] = proto.MapField(
1305
+ proto.STRING,
1306
+ proto.MESSAGE,
1307
+ number=12,
1308
+ message="Shipment.Load",
1309
+ )
1310
+ visit_types: MutableSequence[str] = proto.RepeatedField(
1311
+ proto.STRING,
1312
+ number=10,
1313
+ )
1314
+ label: str = proto.Field(
1315
+ proto.STRING,
1316
+ number=11,
1317
+ )
1318
+
1319
+ class Load(proto.Message):
1320
+ r"""When performing a visit, a predefined amount may be added to the
1321
+ vehicle load if it's a pickup, or subtracted if it's a delivery.
1322
+ This message defines such amount. See
1323
+ [load_demands][google.maps.routeoptimization.v1.Shipment.load_demands].
1324
+
1325
+ Attributes:
1326
+ amount (int):
1327
+ The amount by which the load of the vehicle
1328
+ performing the corresponding visit will vary.
1329
+ Since it is an integer, users are advised to
1330
+ choose an appropriate unit to avoid loss of
1331
+ precision. Must be ≥ 0.
1332
+ """
1333
+
1334
+ amount: int = proto.Field(
1335
+ proto.INT64,
1336
+ number=2,
1337
+ )
1338
+
1339
+ display_name: str = proto.Field(
1340
+ proto.STRING,
1341
+ number=16,
1342
+ )
1343
+ pickups: MutableSequence[VisitRequest] = proto.RepeatedField(
1344
+ proto.MESSAGE,
1345
+ number=1,
1346
+ message=VisitRequest,
1347
+ )
1348
+ deliveries: MutableSequence[VisitRequest] = proto.RepeatedField(
1349
+ proto.MESSAGE,
1350
+ number=2,
1351
+ message=VisitRequest,
1352
+ )
1353
+ load_demands: MutableMapping[str, Load] = proto.MapField(
1354
+ proto.STRING,
1355
+ proto.MESSAGE,
1356
+ number=14,
1357
+ message=Load,
1358
+ )
1359
+ penalty_cost: float = proto.Field(
1360
+ proto.DOUBLE,
1361
+ number=4,
1362
+ optional=True,
1363
+ )
1364
+ allowed_vehicle_indices: MutableSequence[int] = proto.RepeatedField(
1365
+ proto.INT32,
1366
+ number=5,
1367
+ )
1368
+ costs_per_vehicle: MutableSequence[float] = proto.RepeatedField(
1369
+ proto.DOUBLE,
1370
+ number=6,
1371
+ )
1372
+ costs_per_vehicle_indices: MutableSequence[int] = proto.RepeatedField(
1373
+ proto.INT32,
1374
+ number=7,
1375
+ )
1376
+ pickup_to_delivery_relative_detour_limit: float = proto.Field(
1377
+ proto.DOUBLE,
1378
+ number=8,
1379
+ optional=True,
1380
+ )
1381
+ pickup_to_delivery_absolute_detour_limit: duration_pb2.Duration = proto.Field(
1382
+ proto.MESSAGE,
1383
+ number=9,
1384
+ message=duration_pb2.Duration,
1385
+ )
1386
+ pickup_to_delivery_time_limit: duration_pb2.Duration = proto.Field(
1387
+ proto.MESSAGE,
1388
+ number=10,
1389
+ message=duration_pb2.Duration,
1390
+ )
1391
+ shipment_type: str = proto.Field(
1392
+ proto.STRING,
1393
+ number=11,
1394
+ )
1395
+ label: str = proto.Field(
1396
+ proto.STRING,
1397
+ number=12,
1398
+ )
1399
+ ignore: bool = proto.Field(
1400
+ proto.BOOL,
1401
+ number=13,
1402
+ )
1403
+
1404
+
1405
+ class ShipmentTypeIncompatibility(proto.Message):
1406
+ r"""Specifies incompatibilties between shipments depending on their
1407
+ shipment_type. The appearance of incompatible shipments on the same
1408
+ route is restricted based on the incompatibility mode.
1409
+
1410
+ Attributes:
1411
+ types (MutableSequence[str]):
1412
+ List of incompatible types. Two shipments having different
1413
+ ``shipment_types`` among those listed are "incompatible".
1414
+ incompatibility_mode (google.maps.routeoptimization_v1.types.ShipmentTypeIncompatibility.IncompatibilityMode):
1415
+ Mode applied to the incompatibility.
1416
+ """
1417
+
1418
+ class IncompatibilityMode(proto.Enum):
1419
+ r"""Modes defining how the appearance of incompatible shipments
1420
+ are restricted on the same route.
1421
+
1422
+ Values:
1423
+ INCOMPATIBILITY_MODE_UNSPECIFIED (0):
1424
+ Unspecified incompatibility mode. This value
1425
+ should never be used.
1426
+ NOT_PERFORMED_BY_SAME_VEHICLE (1):
1427
+ In this mode, two shipments with incompatible
1428
+ types can never share the same vehicle.
1429
+ NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY (2):
1430
+ For two shipments with incompatible types with the
1431
+ ``NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY`` incompatibility mode:
1432
+
1433
+ - If both are pickups only (no deliveries) or deliveries
1434
+ only (no pickups), they cannot share the same vehicle at
1435
+ all.
1436
+ - If one of the shipments has a delivery and the other a
1437
+ pickup, the two shipments can share the same vehicle iff
1438
+ the former shipment is delivered before the latter is
1439
+ picked up.
1440
+ """
1441
+ INCOMPATIBILITY_MODE_UNSPECIFIED = 0
1442
+ NOT_PERFORMED_BY_SAME_VEHICLE = 1
1443
+ NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY = 2
1444
+
1445
+ types: MutableSequence[str] = proto.RepeatedField(
1446
+ proto.STRING,
1447
+ number=1,
1448
+ )
1449
+ incompatibility_mode: IncompatibilityMode = proto.Field(
1450
+ proto.ENUM,
1451
+ number=2,
1452
+ enum=IncompatibilityMode,
1453
+ )
1454
+
1455
+
1456
+ class ShipmentTypeRequirement(proto.Message):
1457
+ r"""Specifies requirements between shipments based on their
1458
+ shipment_type. The specifics of the requirement are defined by the
1459
+ requirement mode.
1460
+
1461
+ Attributes:
1462
+ required_shipment_type_alternatives (MutableSequence[str]):
1463
+ List of alternative shipment types required by the
1464
+ ``dependent_shipment_types``.
1465
+ dependent_shipment_types (MutableSequence[str]):
1466
+ All shipments with a type in the
1467
+ ``dependent_shipment_types`` field require at least one
1468
+ shipment of type ``required_shipment_type_alternatives`` to
1469
+ be visited on the same route.
1470
+
1471
+ NOTE: Chains of requirements such that a ``shipment_type``
1472
+ depends on itself are not allowed.
1473
+ requirement_mode (google.maps.routeoptimization_v1.types.ShipmentTypeRequirement.RequirementMode):
1474
+ Mode applied to the requirement.
1475
+ """
1476
+
1477
+ class RequirementMode(proto.Enum):
1478
+ r"""Modes defining the appearance of dependent shipments on a
1479
+ route.
1480
+
1481
+ Values:
1482
+ REQUIREMENT_MODE_UNSPECIFIED (0):
1483
+ Unspecified requirement mode. This value
1484
+ should never be used.
1485
+ PERFORMED_BY_SAME_VEHICLE (1):
1486
+ In this mode, all "dependent" shipments must
1487
+ share the same vehicle as at least one of their
1488
+ "required" shipments.
1489
+ IN_SAME_VEHICLE_AT_PICKUP_TIME (2):
1490
+ With the ``IN_SAME_VEHICLE_AT_PICKUP_TIME`` mode, all
1491
+ "dependent" shipments need to have at least one "required"
1492
+ shipment on their vehicle at the time of their pickup.
1493
+
1494
+ A "dependent" shipment pickup must therefore have either:
1495
+
1496
+ - A delivery-only "required" shipment delivered on the
1497
+ route after, or
1498
+ - A "required" shipment picked up on the route before it,
1499
+ and if the "required" shipment has a delivery, this
1500
+ delivery must be performed after the "dependent"
1501
+ shipment's pickup.
1502
+ IN_SAME_VEHICLE_AT_DELIVERY_TIME (3):
1503
+ Same as before, except the "dependent" shipments need to
1504
+ have a "required" shipment on their vehicle at the time of
1505
+ their *delivery*.
1506
+ """
1507
+ REQUIREMENT_MODE_UNSPECIFIED = 0
1508
+ PERFORMED_BY_SAME_VEHICLE = 1
1509
+ IN_SAME_VEHICLE_AT_PICKUP_TIME = 2
1510
+ IN_SAME_VEHICLE_AT_DELIVERY_TIME = 3
1511
+
1512
+ required_shipment_type_alternatives: MutableSequence[str] = proto.RepeatedField(
1513
+ proto.STRING,
1514
+ number=1,
1515
+ )
1516
+ dependent_shipment_types: MutableSequence[str] = proto.RepeatedField(
1517
+ proto.STRING,
1518
+ number=2,
1519
+ )
1520
+ requirement_mode: RequirementMode = proto.Field(
1521
+ proto.ENUM,
1522
+ number=3,
1523
+ enum=RequirementMode,
1524
+ )
1525
+
1526
+
1527
+ class Vehicle(proto.Message):
1528
+ r"""Models a vehicle in a shipment problem. Solving a shipment problem
1529
+ will build a route starting from ``start_location`` and ending at
1530
+ ``end_location`` for this vehicle. A route is a sequence of visits
1531
+ (see ``ShipmentRoute``).
1532
+
1533
+
1534
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1535
+
1536
+ Attributes:
1537
+ display_name (str):
1538
+ The user-defined display name of the vehicle.
1539
+ It can be up to 63 characters long and may use
1540
+ UTF-8 characters.
1541
+ travel_mode (google.maps.routeoptimization_v1.types.Vehicle.TravelMode):
1542
+ The travel mode which affects the roads usable by the
1543
+ vehicle and its speed. See also
1544
+ ``travel_duration_multiple``.
1545
+ start_location (google.type.latlng_pb2.LatLng):
1546
+ Geographic location where the vehicle starts before picking
1547
+ up any shipments. If not specified, the vehicle starts at
1548
+ its first pickup. If the shipment model has duration and
1549
+ distance matrices, ``start_location`` must not be specified.
1550
+ start_waypoint (google.maps.routeoptimization_v1.types.Waypoint):
1551
+ Waypoint representing a geographic location where the
1552
+ vehicle starts before picking up any shipments. If neither
1553
+ ``start_waypoint`` nor ``start_location`` is specified, the
1554
+ vehicle starts at its first pickup. If the shipment model
1555
+ has duration and distance matrices, ``start_waypoint`` must
1556
+ not be specified.
1557
+ end_location (google.type.latlng_pb2.LatLng):
1558
+ Geographic location where the vehicle ends after it has
1559
+ completed its last ``VisitRequest``. If not specified the
1560
+ vehicle's ``ShipmentRoute`` ends immediately when it
1561
+ completes its last ``VisitRequest``. If the shipment model
1562
+ has duration and distance matrices, ``end_location`` must
1563
+ not be specified.
1564
+ end_waypoint (google.maps.routeoptimization_v1.types.Waypoint):
1565
+ Waypoint representing a geographic location where the
1566
+ vehicle ends after it has completed its last
1567
+ ``VisitRequest``. If neither ``end_waypoint`` nor
1568
+ ``end_location`` is specified, the vehicle's
1569
+ ``ShipmentRoute`` ends immediately when it completes its
1570
+ last ``VisitRequest``. If the shipment model has duration
1571
+ and distance matrices, ``end_waypoint`` must not be
1572
+ specified.
1573
+ start_tags (MutableSequence[str]):
1574
+ Specifies tags attached to the start of the
1575
+ vehicle's route.
1576
+ Empty or duplicate strings are not allowed.
1577
+ end_tags (MutableSequence[str]):
1578
+ Specifies tags attached to the end of the
1579
+ vehicle's route.
1580
+ Empty or duplicate strings are not allowed.
1581
+ start_time_windows (MutableSequence[google.maps.routeoptimization_v1.types.TimeWindow]):
1582
+ Time windows during which the vehicle may depart its start
1583
+ location. They must be within the global time limits (see
1584
+ [ShipmentModel.global_*][google.maps.routeoptimization.v1.ShipmentModel.global_start_time]
1585
+ fields). If unspecified, there is no limitation besides
1586
+ those global time limits.
1587
+
1588
+ Time windows belonging to the same repeated field must be
1589
+ disjoint, i.e. no time window can overlap with or be
1590
+ adjacent to another, and they must be in chronological
1591
+ order.
1592
+
1593
+ ``cost_per_hour_after_soft_end_time`` and ``soft_end_time``
1594
+ can only be set if there is a single time window.
1595
+ end_time_windows (MutableSequence[google.maps.routeoptimization_v1.types.TimeWindow]):
1596
+ Time windows during which the vehicle may arrive at its end
1597
+ location. They must be within the global time limits (see
1598
+ [ShipmentModel.global_*][google.maps.routeoptimization.v1.ShipmentModel.global_start_time]
1599
+ fields). If unspecified, there is no limitation besides
1600
+ those global time limits.
1601
+
1602
+ Time windows belonging to the same repeated field must be
1603
+ disjoint, i.e. no time window can overlap with or be
1604
+ adjacent to another, and they must be in chronological
1605
+ order.
1606
+
1607
+ ``cost_per_hour_after_soft_end_time`` and ``soft_end_time``
1608
+ can only be set if there is a single time window.
1609
+ travel_duration_multiple (float):
1610
+ Specifies a multiplicative factor that can be used to
1611
+ increase or decrease travel times of this vehicle. For
1612
+ example, setting this to 2.0 means that this vehicle is
1613
+ slower and has travel times that are twice what they are for
1614
+ standard vehicles. This multiple does not affect visit
1615
+ durations. It does affect cost if ``cost_per_hour`` or
1616
+ ``cost_per_traveled_hour`` are specified. This must be in
1617
+ the range [0.001, 1000.0]. If unset, the vehicle is
1618
+ standard, and this multiple is considered 1.0.
1619
+
1620
+ WARNING: Travel times will be rounded to the nearest second
1621
+ after this multiple is applied but before performing any
1622
+ numerical operations, thus, a small multiple may result in a
1623
+ loss of precision.
1624
+
1625
+ See also ``extra_visit_duration_for_visit_type`` below.
1626
+
1627
+ This field is a member of `oneof`_ ``_travel_duration_multiple``.
1628
+ unloading_policy (google.maps.routeoptimization_v1.types.Vehicle.UnloadingPolicy):
1629
+ Unloading policy enforced on the vehicle.
1630
+ load_limits (MutableMapping[str, google.maps.routeoptimization_v1.types.Vehicle.LoadLimit]):
1631
+ Capacities of the vehicle (weight, volume, # of pallets for
1632
+ example). The keys in the map are the identifiers of the
1633
+ type of load, consistent with the keys of the
1634
+ [Shipment.load_demands][google.maps.routeoptimization.v1.Shipment.load_demands]
1635
+ field. If a given key is absent from this map, the
1636
+ corresponding capacity is considered to be limitless.
1637
+ cost_per_hour (float):
1638
+ Vehicle costs: all costs add up and must be in the same unit
1639
+ as
1640
+ [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost].
1641
+
1642
+ Cost per hour of the vehicle route. This cost is applied to
1643
+ the total time taken by the route, and includes travel time,
1644
+ waiting time, and visit time. Using ``cost_per_hour``
1645
+ instead of just ``cost_per_traveled_hour`` may result in
1646
+ additional latency.
1647
+ cost_per_traveled_hour (float):
1648
+ Cost per traveled hour of the vehicle route. This cost is
1649
+ applied only to travel time taken by the route (i.e., that
1650
+ reported in
1651
+ [ShipmentRoute.transitions][google.maps.routeoptimization.v1.ShipmentRoute.transitions]),
1652
+ and excludes waiting time and visit time.
1653
+ cost_per_kilometer (float):
1654
+ Cost per kilometer of the vehicle route. This cost is
1655
+ applied to the distance reported in the
1656
+ [ShipmentRoute.transitions][google.maps.routeoptimization.v1.ShipmentRoute.transitions]
1657
+ and does not apply to any distance implicitly traveled from
1658
+ the ``arrival_location`` to the ``departure_location`` of a
1659
+ single ``VisitRequest``.
1660
+ fixed_cost (float):
1661
+ Fixed cost applied if this vehicle is used to
1662
+ handle a shipment.
1663
+ used_if_route_is_empty (bool):
1664
+ This field only applies to vehicles when their route does
1665
+ not serve any shipments. It indicates if the vehicle should
1666
+ be considered as used or not in this case.
1667
+
1668
+ If true, the vehicle goes from its start to its end location
1669
+ even if it doesn't serve any shipments, and time and
1670
+ distance costs resulting from its start --> end travel are
1671
+ taken into account.
1672
+
1673
+ Otherwise, it doesn't travel from its start to its end
1674
+ location, and no ``break_rule`` or delay (from
1675
+ ``TransitionAttributes``) are scheduled for this vehicle. In
1676
+ this case, the vehicle's ``ShipmentRoute`` doesn't contain
1677
+ any information except for the vehicle index and label.
1678
+ route_duration_limit (google.maps.routeoptimization_v1.types.Vehicle.DurationLimit):
1679
+ Limit applied to the total duration of the vehicle's route.
1680
+ In a given ``OptimizeToursResponse``, the route duration of
1681
+ a vehicle is the difference between its ``vehicle_end_time``
1682
+ and ``vehicle_start_time``.
1683
+ travel_duration_limit (google.maps.routeoptimization_v1.types.Vehicle.DurationLimit):
1684
+ Limit applied to the travel duration of the vehicle's route.
1685
+ In a given ``OptimizeToursResponse``, the route travel
1686
+ duration is the sum of all its
1687
+ [transitions.travel_duration][google.maps.routeoptimization.v1.ShipmentRoute.Transition.travel_duration].
1688
+ route_distance_limit (google.maps.routeoptimization_v1.types.DistanceLimit):
1689
+ Limit applied to the total distance of the vehicle's route.
1690
+ In a given ``OptimizeToursResponse``, the route distance is
1691
+ the sum of all its
1692
+ [transitions.travel_distance_meters][google.maps.routeoptimization.v1.ShipmentRoute.Transition.travel_distance_meters].
1693
+ extra_visit_duration_for_visit_type (MutableMapping[str, google.protobuf.duration_pb2.Duration]):
1694
+ Specifies a map from visit_types strings to durations. The
1695
+ duration is time in addition to
1696
+ [VisitRequest.duration][google.maps.routeoptimization.v1.Shipment.VisitRequest.duration]
1697
+ to be taken at visits with the specified ``visit_types``.
1698
+ This extra visit duration adds cost if ``cost_per_hour`` is
1699
+ specified. Keys (i.e. ``visit_types``) cannot be empty
1700
+ strings.
1701
+
1702
+ If a visit request has multiple types, a duration will be
1703
+ added for each type in the map.
1704
+ break_rule (google.maps.routeoptimization_v1.types.BreakRule):
1705
+ Describes the break schedule to be enforced
1706
+ on this vehicle. If empty, no breaks will be
1707
+ scheduled for this vehicle.
1708
+ label (str):
1709
+ Specifies a label for this vehicle. This label is reported
1710
+ in the response as the ``vehicle_label`` of the
1711
+ corresponding
1712
+ [ShipmentRoute][google.maps.routeoptimization.v1.ShipmentRoute].
1713
+ ignore (bool):
1714
+ If true, ``used_if_route_is_empty`` must be false, and this
1715
+ vehicle will remain unused.
1716
+
1717
+ If a shipment is performed by an ignored vehicle in
1718
+ ``injected_first_solution_routes``, it is skipped in the
1719
+ first solution but is free to be performed in the response.
1720
+
1721
+ If a shipment is performed by an ignored vehicle in
1722
+ ``injected_solution_constraint`` and any related
1723
+ pickup/delivery is constrained to remain on the vehicle
1724
+ (i.e., not relaxed to level ``RELAX_ALL_AFTER_THRESHOLD``),
1725
+ it is skipped in the response. If a shipment has a non-empty
1726
+ ``allowed_vehicle_indices`` field and all of the allowed
1727
+ vehicles are ignored, it is skipped in the response.
1728
+ """
1729
+
1730
+ class TravelMode(proto.Enum):
1731
+ r"""Travel modes which can be used by vehicles.
1732
+
1733
+ These should be a subset of the Google Maps Platform Routes
1734
+ Preferred API travel modes, see:
1735
+ https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode.
1736
+
1737
+ Values:
1738
+ TRAVEL_MODE_UNSPECIFIED (0):
1739
+ Unspecified travel mode, equivalent to ``DRIVING``.
1740
+ DRIVING (1):
1741
+ Travel mode corresponding to driving
1742
+ directions (car, ...).
1743
+ WALKING (2):
1744
+ Travel mode corresponding to walking
1745
+ directions.
1746
+ """
1747
+ TRAVEL_MODE_UNSPECIFIED = 0
1748
+ DRIVING = 1
1749
+ WALKING = 2
1750
+
1751
+ class UnloadingPolicy(proto.Enum):
1752
+ r"""Policy on how a vehicle can be unloaded. Applies only to shipments
1753
+ having both a pickup and a delivery.
1754
+
1755
+ Other shipments are free to occur anywhere on the route independent
1756
+ of ``unloading_policy``.
1757
+
1758
+ Values:
1759
+ UNLOADING_POLICY_UNSPECIFIED (0):
1760
+ Unspecified unloading policy; deliveries must
1761
+ just occur after their corresponding pickups.
1762
+ LAST_IN_FIRST_OUT (1):
1763
+ Deliveries must occur in reverse order of
1764
+ pickups
1765
+ FIRST_IN_FIRST_OUT (2):
1766
+ Deliveries must occur in the same order as
1767
+ pickups
1768
+ """
1769
+ UNLOADING_POLICY_UNSPECIFIED = 0
1770
+ LAST_IN_FIRST_OUT = 1
1771
+ FIRST_IN_FIRST_OUT = 2
1772
+
1773
+ class LoadLimit(proto.Message):
1774
+ r"""Defines a load limit applying to a vehicle, e.g. "this truck may
1775
+ only carry up to 3500 kg". See
1776
+ [load_limits][google.maps.routeoptimization.v1.Vehicle.load_limits].
1777
+
1778
+
1779
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1780
+
1781
+ Attributes:
1782
+ max_load (int):
1783
+ The maximum acceptable amount of load.
1784
+
1785
+ This field is a member of `oneof`_ ``_max_load``.
1786
+ soft_max_load (int):
1787
+ A soft limit of the load. See
1788
+ [cost_per_unit_above_soft_max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max].
1789
+ cost_per_unit_above_soft_max (float):
1790
+ If the load ever exceeds
1791
+ [soft_max_load][google.maps.routeoptimization.v1.Vehicle.LoadLimit.soft_max_load]
1792
+ along this vehicle's route, the following cost penalty
1793
+ applies (only once per vehicle): (load -
1794
+ [soft_max_load][google.maps.routeoptimization.v1.Vehicle.LoadLimit.soft_max_load])
1795
+
1796
+ - [cost_per_unit_above_soft_max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max].
1797
+ All costs add up and must be in the same unit as
1798
+ [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost].
1799
+ start_load_interval (google.maps.routeoptimization_v1.types.Vehicle.LoadLimit.Interval):
1800
+ The acceptable load interval of the vehicle
1801
+ at the start of the route.
1802
+ end_load_interval (google.maps.routeoptimization_v1.types.Vehicle.LoadLimit.Interval):
1803
+ The acceptable load interval of the vehicle
1804
+ at the end of the route.
1805
+ """
1806
+
1807
+ class Interval(proto.Message):
1808
+ r"""Interval of acceptable load amounts.
1809
+
1810
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1811
+
1812
+ Attributes:
1813
+ min_ (int):
1814
+ A minimum acceptable load. Must be ≥ 0. If they're both
1815
+ specified,
1816
+ [min][google.maps.routeoptimization.v1.Vehicle.LoadLimit.Interval.min]
1817
+ must be ≤
1818
+ [max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.Interval.max].
1819
+ max_ (int):
1820
+ A maximum acceptable load. Must be ≥ 0. If unspecified, the
1821
+ maximum load is unrestricted by this message. If they're
1822
+ both specified,
1823
+ [min][google.maps.routeoptimization.v1.Vehicle.LoadLimit.Interval.min]
1824
+ must be ≤
1825
+ [max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.Interval.max].
1826
+
1827
+ This field is a member of `oneof`_ ``_max``.
1828
+ """
1829
+
1830
+ min_: int = proto.Field(
1831
+ proto.INT64,
1832
+ number=1,
1833
+ )
1834
+ max_: int = proto.Field(
1835
+ proto.INT64,
1836
+ number=2,
1837
+ optional=True,
1838
+ )
1839
+
1840
+ max_load: int = proto.Field(
1841
+ proto.INT64,
1842
+ number=1,
1843
+ optional=True,
1844
+ )
1845
+ soft_max_load: int = proto.Field(
1846
+ proto.INT64,
1847
+ number=2,
1848
+ )
1849
+ cost_per_unit_above_soft_max: float = proto.Field(
1850
+ proto.DOUBLE,
1851
+ number=3,
1852
+ )
1853
+ start_load_interval: "Vehicle.LoadLimit.Interval" = proto.Field(
1854
+ proto.MESSAGE,
1855
+ number=4,
1856
+ message="Vehicle.LoadLimit.Interval",
1857
+ )
1858
+ end_load_interval: "Vehicle.LoadLimit.Interval" = proto.Field(
1859
+ proto.MESSAGE,
1860
+ number=5,
1861
+ message="Vehicle.LoadLimit.Interval",
1862
+ )
1863
+
1864
+ class DurationLimit(proto.Message):
1865
+ r"""A limit defining a maximum duration of the route of a
1866
+ vehicle. It can be either hard or soft.
1867
+
1868
+ When a soft limit field is defined, both the soft max threshold
1869
+ and its associated cost must be defined together.
1870
+
1871
+
1872
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1873
+
1874
+ Attributes:
1875
+ max_duration (google.protobuf.duration_pb2.Duration):
1876
+ A hard limit constraining the duration to be at most
1877
+ max_duration.
1878
+ soft_max_duration (google.protobuf.duration_pb2.Duration):
1879
+ A soft limit not enforcing a maximum duration limit, but
1880
+ when violated makes the route incur a cost. This cost adds
1881
+ up to other costs defined in the model, with the same unit.
1882
+
1883
+ If defined, ``soft_max_duration`` must be nonnegative. If
1884
+ max_duration is also defined, ``soft_max_duration`` must be
1885
+ less than max_duration.
1886
+ cost_per_hour_after_soft_max (float):
1887
+ Cost per hour incurred if the ``soft_max_duration``
1888
+ threshold is violated. The additional cost is 0 if the
1889
+ duration is under the threshold, otherwise the cost depends
1890
+ on the duration as follows:
1891
+
1892
+ ::
1893
+
1894
+ cost_per_hour_after_soft_max * (duration - soft_max_duration)
1895
+
1896
+ The cost must be nonnegative.
1897
+
1898
+ This field is a member of `oneof`_ ``_cost_per_hour_after_soft_max``.
1899
+ quadratic_soft_max_duration (google.protobuf.duration_pb2.Duration):
1900
+ A soft limit not enforcing a maximum duration limit, but
1901
+ when violated makes the route incur a cost, quadratic in the
1902
+ duration. This cost adds up to other costs defined in the
1903
+ model, with the same unit.
1904
+
1905
+ If defined, ``quadratic_soft_max_duration`` must be
1906
+ nonnegative. If ``max_duration`` is also defined,
1907
+ ``quadratic_soft_max_duration`` must be less than
1908
+ ``max_duration``, and the difference must be no larger than
1909
+ one day:
1910
+
1911
+ ::
1912
+
1913
+ `max_duration - quadratic_soft_max_duration <= 86400 seconds`
1914
+ cost_per_square_hour_after_quadratic_soft_max (float):
1915
+ Cost per square hour incurred if the
1916
+ ``quadratic_soft_max_duration`` threshold is violated.
1917
+
1918
+ The additional cost is 0 if the duration is under the
1919
+ threshold, otherwise the cost depends on the duration as
1920
+ follows:
1921
+
1922
+ ::
1923
+
1924
+ cost_per_square_hour_after_quadratic_soft_max *
1925
+ (duration - quadratic_soft_max_duration)^2
1926
+
1927
+ The cost must be nonnegative.
1928
+
1929
+ This field is a member of `oneof`_ ``_cost_per_square_hour_after_quadratic_soft_max``.
1930
+ """
1931
+
1932
+ max_duration: duration_pb2.Duration = proto.Field(
1933
+ proto.MESSAGE,
1934
+ number=1,
1935
+ message=duration_pb2.Duration,
1936
+ )
1937
+ soft_max_duration: duration_pb2.Duration = proto.Field(
1938
+ proto.MESSAGE,
1939
+ number=2,
1940
+ message=duration_pb2.Duration,
1941
+ )
1942
+ cost_per_hour_after_soft_max: float = proto.Field(
1943
+ proto.DOUBLE,
1944
+ number=3,
1945
+ optional=True,
1946
+ )
1947
+ quadratic_soft_max_duration: duration_pb2.Duration = proto.Field(
1948
+ proto.MESSAGE,
1949
+ number=4,
1950
+ message=duration_pb2.Duration,
1951
+ )
1952
+ cost_per_square_hour_after_quadratic_soft_max: float = proto.Field(
1953
+ proto.DOUBLE,
1954
+ number=5,
1955
+ optional=True,
1956
+ )
1957
+
1958
+ display_name: str = proto.Field(
1959
+ proto.STRING,
1960
+ number=32,
1961
+ )
1962
+ travel_mode: TravelMode = proto.Field(
1963
+ proto.ENUM,
1964
+ number=1,
1965
+ enum=TravelMode,
1966
+ )
1967
+ start_location: latlng_pb2.LatLng = proto.Field(
1968
+ proto.MESSAGE,
1969
+ number=3,
1970
+ message=latlng_pb2.LatLng,
1971
+ )
1972
+ start_waypoint: "Waypoint" = proto.Field(
1973
+ proto.MESSAGE,
1974
+ number=4,
1975
+ message="Waypoint",
1976
+ )
1977
+ end_location: latlng_pb2.LatLng = proto.Field(
1978
+ proto.MESSAGE,
1979
+ number=5,
1980
+ message=latlng_pb2.LatLng,
1981
+ )
1982
+ end_waypoint: "Waypoint" = proto.Field(
1983
+ proto.MESSAGE,
1984
+ number=6,
1985
+ message="Waypoint",
1986
+ )
1987
+ start_tags: MutableSequence[str] = proto.RepeatedField(
1988
+ proto.STRING,
1989
+ number=7,
1990
+ )
1991
+ end_tags: MutableSequence[str] = proto.RepeatedField(
1992
+ proto.STRING,
1993
+ number=8,
1994
+ )
1995
+ start_time_windows: MutableSequence["TimeWindow"] = proto.RepeatedField(
1996
+ proto.MESSAGE,
1997
+ number=9,
1998
+ message="TimeWindow",
1999
+ )
2000
+ end_time_windows: MutableSequence["TimeWindow"] = proto.RepeatedField(
2001
+ proto.MESSAGE,
2002
+ number=10,
2003
+ message="TimeWindow",
2004
+ )
2005
+ travel_duration_multiple: float = proto.Field(
2006
+ proto.DOUBLE,
2007
+ number=11,
2008
+ optional=True,
2009
+ )
2010
+ unloading_policy: UnloadingPolicy = proto.Field(
2011
+ proto.ENUM,
2012
+ number=12,
2013
+ enum=UnloadingPolicy,
2014
+ )
2015
+ load_limits: MutableMapping[str, LoadLimit] = proto.MapField(
2016
+ proto.STRING,
2017
+ proto.MESSAGE,
2018
+ number=30,
2019
+ message=LoadLimit,
2020
+ )
2021
+ cost_per_hour: float = proto.Field(
2022
+ proto.DOUBLE,
2023
+ number=16,
2024
+ )
2025
+ cost_per_traveled_hour: float = proto.Field(
2026
+ proto.DOUBLE,
2027
+ number=17,
2028
+ )
2029
+ cost_per_kilometer: float = proto.Field(
2030
+ proto.DOUBLE,
2031
+ number=18,
2032
+ )
2033
+ fixed_cost: float = proto.Field(
2034
+ proto.DOUBLE,
2035
+ number=19,
2036
+ )
2037
+ used_if_route_is_empty: bool = proto.Field(
2038
+ proto.BOOL,
2039
+ number=20,
2040
+ )
2041
+ route_duration_limit: DurationLimit = proto.Field(
2042
+ proto.MESSAGE,
2043
+ number=21,
2044
+ message=DurationLimit,
2045
+ )
2046
+ travel_duration_limit: DurationLimit = proto.Field(
2047
+ proto.MESSAGE,
2048
+ number=22,
2049
+ message=DurationLimit,
2050
+ )
2051
+ route_distance_limit: "DistanceLimit" = proto.Field(
2052
+ proto.MESSAGE,
2053
+ number=23,
2054
+ message="DistanceLimit",
2055
+ )
2056
+ extra_visit_duration_for_visit_type: MutableMapping[
2057
+ str, duration_pb2.Duration
2058
+ ] = proto.MapField(
2059
+ proto.STRING,
2060
+ proto.MESSAGE,
2061
+ number=24,
2062
+ message=duration_pb2.Duration,
2063
+ )
2064
+ break_rule: "BreakRule" = proto.Field(
2065
+ proto.MESSAGE,
2066
+ number=25,
2067
+ message="BreakRule",
2068
+ )
2069
+ label: str = proto.Field(
2070
+ proto.STRING,
2071
+ number=27,
2072
+ )
2073
+ ignore: bool = proto.Field(
2074
+ proto.BOOL,
2075
+ number=28,
2076
+ )
2077
+
2078
+
2079
+ class TimeWindow(proto.Message):
2080
+ r"""Time windows constrain the time of an event, such as the arrival
2081
+ time at a visit, or the start and end time of a vehicle.
2082
+
2083
+ Hard time window bounds, ``start_time`` and ``end_time``, enforce
2084
+ the earliest and latest time of the event, such that
2085
+ ``start_time <= event_time <= end_time``. The soft time window lower
2086
+ bound, ``soft_start_time``, expresses a preference for the event to
2087
+ happen at or after ``soft_start_time`` by incurring a cost
2088
+ proportional to how long before soft_start_time the event occurs.
2089
+ The soft time window upper bound, ``soft_end_time``, expresses a
2090
+ preference for the event to happen at or before ``soft_end_time`` by
2091
+ incurring a cost proportional to how long after ``soft_end_time``
2092
+ the event occurs. ``start_time``, ``end_time``, ``soft_start_time``
2093
+ and ``soft_end_time`` should be within the global time limits (see
2094
+ [ShipmentModel.global_start_time][google.maps.routeoptimization.v1.ShipmentModel.global_start_time]
2095
+ and
2096
+ [ShipmentModel.global_end_time][google.maps.routeoptimization.v1.ShipmentModel.global_end_time])
2097
+ and should respect:
2098
+
2099
+ ::
2100
+
2101
+ 0 <= `start_time` <= `soft_start_time` <= `end_time` and
2102
+ 0 <= `start_time` <= `soft_end_time` <= `end_time`.
2103
+
2104
+
2105
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2106
+
2107
+ Attributes:
2108
+ start_time (google.protobuf.timestamp_pb2.Timestamp):
2109
+ The hard time window start time. If unspecified it will be
2110
+ set to ``ShipmentModel.global_start_time``.
2111
+ end_time (google.protobuf.timestamp_pb2.Timestamp):
2112
+ The hard time window end time. If unspecified it will be set
2113
+ to ``ShipmentModel.global_end_time``.
2114
+ soft_start_time (google.protobuf.timestamp_pb2.Timestamp):
2115
+ The soft start time of the time window.
2116
+ soft_end_time (google.protobuf.timestamp_pb2.Timestamp):
2117
+ The soft end time of the time window.
2118
+ cost_per_hour_before_soft_start_time (float):
2119
+ A cost per hour added to other costs in the model if the
2120
+ event occurs before soft_start_time, computed as:
2121
+
2122
+ ::
2123
+
2124
+ max(0, soft_start_time - t.seconds)
2125
+ * cost_per_hour_before_soft_start_time / 3600,
2126
+ t being the time of the event.
2127
+
2128
+ This cost must be positive, and the field can only be set if
2129
+ soft_start_time has been set.
2130
+
2131
+ This field is a member of `oneof`_ ``_cost_per_hour_before_soft_start_time``.
2132
+ cost_per_hour_after_soft_end_time (float):
2133
+ A cost per hour added to other costs in the model if the
2134
+ event occurs after ``soft_end_time``, computed as:
2135
+
2136
+ ::
2137
+
2138
+ max(0, t.seconds - soft_end_time.seconds)
2139
+ * cost_per_hour_after_soft_end_time / 3600,
2140
+ t being the time of the event.
2141
+
2142
+ This cost must be positive, and the field can only be set if
2143
+ ``soft_end_time`` has been set.
2144
+
2145
+ This field is a member of `oneof`_ ``_cost_per_hour_after_soft_end_time``.
2146
+ """
2147
+
2148
+ start_time: timestamp_pb2.Timestamp = proto.Field(
2149
+ proto.MESSAGE,
2150
+ number=1,
2151
+ message=timestamp_pb2.Timestamp,
2152
+ )
2153
+ end_time: timestamp_pb2.Timestamp = proto.Field(
2154
+ proto.MESSAGE,
2155
+ number=2,
2156
+ message=timestamp_pb2.Timestamp,
2157
+ )
2158
+ soft_start_time: timestamp_pb2.Timestamp = proto.Field(
2159
+ proto.MESSAGE,
2160
+ number=3,
2161
+ message=timestamp_pb2.Timestamp,
2162
+ )
2163
+ soft_end_time: timestamp_pb2.Timestamp = proto.Field(
2164
+ proto.MESSAGE,
2165
+ number=4,
2166
+ message=timestamp_pb2.Timestamp,
2167
+ )
2168
+ cost_per_hour_before_soft_start_time: float = proto.Field(
2169
+ proto.DOUBLE,
2170
+ number=5,
2171
+ optional=True,
2172
+ )
2173
+ cost_per_hour_after_soft_end_time: float = proto.Field(
2174
+ proto.DOUBLE,
2175
+ number=6,
2176
+ optional=True,
2177
+ )
2178
+
2179
+
2180
+ class DistanceLimit(proto.Message):
2181
+ r"""A limit defining a maximum distance which can be traveled. It can be
2182
+ either hard or soft.
2183
+
2184
+ If a soft limit is defined, both ``soft_max_meters`` and
2185
+ ``cost_per_kilometer_above_soft_max`` must be defined and be
2186
+ nonnegative.
2187
+
2188
+
2189
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2190
+
2191
+ Attributes:
2192
+ max_meters (int):
2193
+ A hard limit constraining the distance to be at most
2194
+ max_meters. The limit must be nonnegative.
2195
+
2196
+ This field is a member of `oneof`_ ``_max_meters``.
2197
+ soft_max_meters (int):
2198
+ A soft limit not enforcing a maximum distance limit, but
2199
+ when violated results in a cost which adds up to other costs
2200
+ defined in the model, with the same unit.
2201
+
2202
+ If defined soft_max_meters must be less than max_meters and
2203
+ must be nonnegative.
2204
+
2205
+ This field is a member of `oneof`_ ``_soft_max_meters``.
2206
+ cost_per_kilometer_above_soft_max (float):
2207
+ Cost per kilometer incurred if distance is above
2208
+ ``soft_max_meters`` limit. The additional cost is 0 if the
2209
+ distance is under the limit, otherwise the formula used to
2210
+ compute the cost is the following:
2211
+
2212
+ ::
2213
+
2214
+ (distance_meters - soft_max_meters) / 1000.0 *
2215
+ cost_per_kilometer_above_soft_max.
2216
+
2217
+ The cost must be nonnegative.
2218
+
2219
+ This field is a member of `oneof`_ ``_cost_per_kilometer_above_soft_max``.
2220
+ """
2221
+
2222
+ max_meters: int = proto.Field(
2223
+ proto.INT64,
2224
+ number=1,
2225
+ optional=True,
2226
+ )
2227
+ soft_max_meters: int = proto.Field(
2228
+ proto.INT64,
2229
+ number=2,
2230
+ optional=True,
2231
+ )
2232
+ cost_per_kilometer_above_soft_max: float = proto.Field(
2233
+ proto.DOUBLE,
2234
+ number=3,
2235
+ optional=True,
2236
+ )
2237
+
2238
+
2239
+ class TransitionAttributes(proto.Message):
2240
+ r"""Specifies attributes of transitions between two consecutive visits
2241
+ on a route. Several ``TransitionAttributes`` may apply to the same
2242
+ transition: in that case, all extra costs add up and the strictest
2243
+ constraint or limit applies (following natural "AND" semantics).
2244
+
2245
+ Attributes:
2246
+ src_tag (str):
2247
+ Tags defining the set of (src->dst) transitions these
2248
+ attributes apply to.
2249
+
2250
+ A source visit or vehicle start matches iff its
2251
+ [VisitRequest.tags][google.maps.routeoptimization.v1.Shipment.VisitRequest.tags]
2252
+ or
2253
+ [Vehicle.start_tags][google.maps.routeoptimization.v1.Vehicle.start_tags]
2254
+ either contains ``src_tag`` or does not contain
2255
+ ``excluded_src_tag`` (depending on which of these two fields
2256
+ is non-empty).
2257
+ excluded_src_tag (str):
2258
+ See ``src_tag``. Exactly one of ``src_tag`` and
2259
+ ``excluded_src_tag`` must be non-empty.
2260
+ dst_tag (str):
2261
+ A destination visit or vehicle end matches iff its
2262
+ [VisitRequest.tags][google.maps.routeoptimization.v1.Shipment.VisitRequest.tags]
2263
+ or
2264
+ [Vehicle.end_tags][google.maps.routeoptimization.v1.Vehicle.end_tags]
2265
+ either contains ``dst_tag`` or does not contain
2266
+ ``excluded_dst_tag`` (depending on which of these two fields
2267
+ is non-empty).
2268
+ excluded_dst_tag (str):
2269
+ See ``dst_tag``. Exactly one of ``dst_tag`` and
2270
+ ``excluded_dst_tag`` must be non-empty.
2271
+ cost (float):
2272
+ Specifies a cost for performing this
2273
+ transition. This is in the same unit as all
2274
+ other costs in the model and must not be
2275
+ negative. It is applied on top of all other
2276
+ existing costs.
2277
+ cost_per_kilometer (float):
2278
+ Specifies a cost per kilometer applied to the distance
2279
+ traveled while performing this transition. It adds up to any
2280
+ [Vehicle.cost_per_kilometer][google.maps.routeoptimization.v1.Vehicle.cost_per_kilometer]
2281
+ specified on vehicles.
2282
+ distance_limit (google.maps.routeoptimization_v1.types.DistanceLimit):
2283
+ Specifies a limit on the distance traveled
2284
+ while performing this transition.
2285
+
2286
+ As of 2021/06, only soft limits are supported.
2287
+ delay (google.protobuf.duration_pb2.Duration):
2288
+ Specifies a delay incurred when performing this transition.
2289
+
2290
+ This delay always occurs *after* finishing the source visit
2291
+ and *before* starting the destination visit.
2292
+ """
2293
+
2294
+ src_tag: str = proto.Field(
2295
+ proto.STRING,
2296
+ number=1,
2297
+ )
2298
+ excluded_src_tag: str = proto.Field(
2299
+ proto.STRING,
2300
+ number=2,
2301
+ )
2302
+ dst_tag: str = proto.Field(
2303
+ proto.STRING,
2304
+ number=3,
2305
+ )
2306
+ excluded_dst_tag: str = proto.Field(
2307
+ proto.STRING,
2308
+ number=4,
2309
+ )
2310
+ cost: float = proto.Field(
2311
+ proto.DOUBLE,
2312
+ number=5,
2313
+ )
2314
+ cost_per_kilometer: float = proto.Field(
2315
+ proto.DOUBLE,
2316
+ number=6,
2317
+ )
2318
+ distance_limit: "DistanceLimit" = proto.Field(
2319
+ proto.MESSAGE,
2320
+ number=7,
2321
+ message="DistanceLimit",
2322
+ )
2323
+ delay: duration_pb2.Duration = proto.Field(
2324
+ proto.MESSAGE,
2325
+ number=8,
2326
+ message=duration_pb2.Duration,
2327
+ )
2328
+
2329
+
2330
+ class Waypoint(proto.Message):
2331
+ r"""Encapsulates a waypoint. Waypoints mark arrival and departure
2332
+ locations of VisitRequests, and start and end locations of
2333
+ Vehicles.
2334
+
2335
+ This message has `oneof`_ fields (mutually exclusive fields).
2336
+ For each oneof, at most one member field can be set at the same time.
2337
+ Setting any member of the oneof automatically clears all other
2338
+ members.
2339
+
2340
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2341
+
2342
+ Attributes:
2343
+ location (google.maps.routeoptimization_v1.types.Location):
2344
+ A point specified using geographic
2345
+ coordinates, including an optional heading.
2346
+
2347
+ This field is a member of `oneof`_ ``location_type``.
2348
+ place_id (str):
2349
+ The POI Place ID associated with the
2350
+ waypoint.
2351
+
2352
+ This field is a member of `oneof`_ ``location_type``.
2353
+ side_of_road (bool):
2354
+ Optional. Indicates that the location of this
2355
+ waypoint is meant to have a preference for the
2356
+ vehicle to stop at a particular side of road.
2357
+ When you set this value, the route will pass
2358
+ through the location so that the vehicle can
2359
+ stop at the side of road that the location is
2360
+ biased towards from the center of the road. This
2361
+ option doesn't work for the 'WALKING' travel
2362
+ mode.
2363
+ """
2364
+
2365
+ location: "Location" = proto.Field(
2366
+ proto.MESSAGE,
2367
+ number=1,
2368
+ oneof="location_type",
2369
+ message="Location",
2370
+ )
2371
+ place_id: str = proto.Field(
2372
+ proto.STRING,
2373
+ number=2,
2374
+ oneof="location_type",
2375
+ )
2376
+ side_of_road: bool = proto.Field(
2377
+ proto.BOOL,
2378
+ number=3,
2379
+ )
2380
+
2381
+
2382
+ class Location(proto.Message):
2383
+ r"""Encapsulates a location (a geographic point, and an optional
2384
+ heading).
2385
+
2386
+
2387
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2388
+
2389
+ Attributes:
2390
+ lat_lng (google.type.latlng_pb2.LatLng):
2391
+ The waypoint's geographic coordinates.
2392
+ heading (int):
2393
+ The compass heading associated with the
2394
+ direction of the flow of traffic. This value is
2395
+ used to specify the side of the road to use for
2396
+ pickup and drop-off. Heading values can be from
2397
+ 0 to 360, where 0 specifies a heading of due
2398
+ North, 90 specifies a heading of due East, etc.
2399
+
2400
+ This field is a member of `oneof`_ ``_heading``.
2401
+ """
2402
+
2403
+ lat_lng: latlng_pb2.LatLng = proto.Field(
2404
+ proto.MESSAGE,
2405
+ number=1,
2406
+ message=latlng_pb2.LatLng,
2407
+ )
2408
+ heading: int = proto.Field(
2409
+ proto.INT32,
2410
+ number=2,
2411
+ optional=True,
2412
+ )
2413
+
2414
+
2415
+ class BreakRule(proto.Message):
2416
+ r"""Rules to generate time breaks for a vehicle (e.g. lunch breaks). A
2417
+ break is a contiguous period of time during which the vehicle
2418
+ remains idle at its current position and cannot perform any visit. A
2419
+ break may occur:
2420
+
2421
+ - during the travel between two visits (which includes the time
2422
+ right before or right after a visit, but not in the middle of a
2423
+ visit), in which case it extends the corresponding transit time
2424
+ between the visits,
2425
+ - or before the vehicle start (the vehicle may not start in the
2426
+ middle of a break), in which case it does not affect the vehicle
2427
+ start time.
2428
+ - or after the vehicle end (ditto, with the vehicle end time).
2429
+
2430
+ Attributes:
2431
+ break_requests (MutableSequence[google.maps.routeoptimization_v1.types.BreakRule.BreakRequest]):
2432
+ Sequence of breaks. See the ``BreakRequest`` message.
2433
+ frequency_constraints (MutableSequence[google.maps.routeoptimization_v1.types.BreakRule.FrequencyConstraint]):
2434
+ Several ``FrequencyConstraint`` may apply. They must all be
2435
+ satisfied by the ``BreakRequest``\ s of this ``BreakRule``.
2436
+ See ``FrequencyConstraint``.
2437
+ """
2438
+
2439
+ class BreakRequest(proto.Message):
2440
+ r"""The sequence of breaks (i.e. their number and order) that apply to
2441
+ each vehicle must be known beforehand. The repeated
2442
+ ``BreakRequest``\ s define that sequence, in the order in which they
2443
+ must occur. Their time windows (``earliest_start_time`` /
2444
+ ``latest_start_time``) may overlap, but they must be compatible with
2445
+ the order (this is checked).
2446
+
2447
+ Attributes:
2448
+ earliest_start_time (google.protobuf.timestamp_pb2.Timestamp):
2449
+ Required. Lower bound (inclusive) on the
2450
+ start of the break.
2451
+ latest_start_time (google.protobuf.timestamp_pb2.Timestamp):
2452
+ Required. Upper bound (inclusive) on the
2453
+ start of the break.
2454
+ min_duration (google.protobuf.duration_pb2.Duration):
2455
+ Required. Minimum duration of the break. Must
2456
+ be positive.
2457
+ """
2458
+
2459
+ earliest_start_time: timestamp_pb2.Timestamp = proto.Field(
2460
+ proto.MESSAGE,
2461
+ number=1,
2462
+ message=timestamp_pb2.Timestamp,
2463
+ )
2464
+ latest_start_time: timestamp_pb2.Timestamp = proto.Field(
2465
+ proto.MESSAGE,
2466
+ number=2,
2467
+ message=timestamp_pb2.Timestamp,
2468
+ )
2469
+ min_duration: duration_pb2.Duration = proto.Field(
2470
+ proto.MESSAGE,
2471
+ number=3,
2472
+ message=duration_pb2.Duration,
2473
+ )
2474
+
2475
+ class FrequencyConstraint(proto.Message):
2476
+ r"""One may further constrain the frequency and duration of the breaks
2477
+ specified above, by enforcing a minimum break frequency, such as
2478
+ "There must be a break of at least 1 hour every 12 hours". Assuming
2479
+ that this can be interpreted as "Within any sliding time window of
2480
+ 12h, there must be at least one break of at least one hour", that
2481
+ example would translate to the following ``FrequencyConstraint``:
2482
+
2483
+ ::
2484
+
2485
+ {
2486
+ min_break_duration { seconds: 3600 } # 1 hour.
2487
+ max_inter_break_duration { seconds: 39600 } # 11 hours (12 - 1 = 11).
2488
+ }
2489
+
2490
+ The timing and duration of the breaks in the solution will respect
2491
+ all such constraints, in addition to the time windows and minimum
2492
+ durations already specified in the ``BreakRequest``.
2493
+
2494
+ A ``FrequencyConstraint`` may in practice apply to non-consecutive
2495
+ breaks. For example, the following schedule honors the "1h every
2496
+ 12h" example:
2497
+
2498
+ ::
2499
+
2500
+ 04:00 vehicle start
2501
+ .. performing travel and visits ..
2502
+ 09:00 1 hour break
2503
+ 10:00 end of the break
2504
+ .. performing travel and visits ..
2505
+ 12:00 20-min lunch break
2506
+ 12:20 end of the break
2507
+ .. performing travel and visits ..
2508
+ 21:00 1 hour break
2509
+ 22:00 end of the break
2510
+ .. performing travel and visits ..
2511
+ 23:59 vehicle end
2512
+
2513
+ Attributes:
2514
+ min_break_duration (google.protobuf.duration_pb2.Duration):
2515
+ Required. Minimum break duration for this constraint.
2516
+ Nonnegative. See description of ``FrequencyConstraint``.
2517
+ max_inter_break_duration (google.protobuf.duration_pb2.Duration):
2518
+ Required. Maximum allowed span of any interval of time in
2519
+ the route that does not include at least partially a break
2520
+ of ``duration >= min_break_duration``. Must be positive.
2521
+ """
2522
+
2523
+ min_break_duration: duration_pb2.Duration = proto.Field(
2524
+ proto.MESSAGE,
2525
+ number=1,
2526
+ message=duration_pb2.Duration,
2527
+ )
2528
+ max_inter_break_duration: duration_pb2.Duration = proto.Field(
2529
+ proto.MESSAGE,
2530
+ number=2,
2531
+ message=duration_pb2.Duration,
2532
+ )
2533
+
2534
+ break_requests: MutableSequence[BreakRequest] = proto.RepeatedField(
2535
+ proto.MESSAGE,
2536
+ number=1,
2537
+ message=BreakRequest,
2538
+ )
2539
+ frequency_constraints: MutableSequence[FrequencyConstraint] = proto.RepeatedField(
2540
+ proto.MESSAGE,
2541
+ number=2,
2542
+ message=FrequencyConstraint,
2543
+ )
2544
+
2545
+
2546
+ class ShipmentRoute(proto.Message):
2547
+ r"""A vehicle's route can be decomposed, along the time axis, like this
2548
+ (we assume there are n visits):
2549
+
2550
+ ::
2551
+
2552
+ | | | | | T[2], | | |
2553
+ | Transition | Visit #0 | | | V[2], | | |
2554
+ | #0 | aka | T[1] | V[1] | ... | V[n-1] | T[n] |
2555
+ | aka T[0] | V[0] | | | V[n-2],| | |
2556
+ | | | | | T[n-1] | | |
2557
+ ^ ^ ^ ^ ^ ^ ^ ^
2558
+ vehicle V[0].start V[0].end V[1]. V[1]. V[n]. V[n]. vehicle
2559
+ start (arrival) (departure) start end start end end
2560
+
2561
+ Note that we make a difference between:
2562
+
2563
+ - "punctual events", such as the vehicle start and end and each
2564
+ visit's start and end (aka arrival and departure). They happen at
2565
+ a given second.
2566
+ - "time intervals", such as the visits themselves, and the
2567
+ transition between visits. Though time intervals can sometimes
2568
+ have zero duration, i.e. start and end at the same second, they
2569
+ often have a positive duration.
2570
+
2571
+ Invariants:
2572
+
2573
+ - If there are n visits, there are n+1 transitions.
2574
+ - A visit is always surrounded by a transition before it (same
2575
+ index) and a transition after it (index + 1).
2576
+ - The vehicle start is always followed by transition #0.
2577
+ - The vehicle end is always preceded by transition #n.
2578
+
2579
+ Zooming in, here is what happens during a ``Transition`` and a
2580
+ ``Visit``:
2581
+
2582
+ ::
2583
+
2584
+ ---+-------------------------------------+-----------------------------+-->
2585
+ | TRANSITION[i] | VISIT[i] |
2586
+ | | |
2587
+ | * TRAVEL: the vehicle moves from | PERFORM the visit: |
2588
+ | VISIT[i-1].departure_location to | |
2589
+ | VISIT[i].arrival_location, which | * Spend some time: |
2590
+ | takes a given travel duration | the "visit duration". |
2591
+ | and distance | |
2592
+ | | * Load or unload |
2593
+ | * BREAKS: the driver may have | some quantities from the |
2594
+ | breaks (e.g. lunch break). | vehicle: the "demand". |
2595
+ | | |
2596
+ | * WAIT: the driver/vehicle does | |
2597
+ | nothing. This can happen for | |
2598
+ | many reasons, for example when | |
2599
+ | the vehicle reaches the next | |
2600
+ | event's destination before the | |
2601
+ | start of its time window | |
2602
+ | | |
2603
+ | * DELAY: *right before* the next | |
2604
+ | arrival. E.g. the vehicle and/or | |
2605
+ | driver spends time unloading. | |
2606
+ | | |
2607
+ ---+-------------------------------------+-----------------------------+-->
2608
+ ^ ^ ^
2609
+ V[i-1].end V[i].start V[i].end
2610
+
2611
+ Lastly, here is how the TRAVEL, BREAKS, DELAY and WAIT can be
2612
+ arranged during a transition.
2613
+
2614
+ - They don't overlap.
2615
+ - The DELAY is unique and *must* be a contiguous period of time
2616
+ right before the next visit (or vehicle end). Thus, it suffice to
2617
+ know the delay duration to know its start and end time.
2618
+ - The BREAKS are contiguous, non-overlapping periods of time. The
2619
+ response specifies the start time and duration of each break.
2620
+ - TRAVEL and WAIT are "preemptable": they can be interrupted
2621
+ several times during this transition. Clients can assume that
2622
+ travel happens "as soon as possible" and that "wait" fills the
2623
+ remaining time.
2624
+
2625
+ A (complex) example:
2626
+
2627
+ ::
2628
+
2629
+ TRANSITION[i]
2630
+ --++-----+-----------------------------------------------------------++-->
2631
+ || | | | | | | ||
2632
+ || T | B | T | | B | | D ||
2633
+ || r | r | r | W | r | W | e ||
2634
+ || a | e | a | a | e | a | l ||
2635
+ || v | a | v | i | a | i | a ||
2636
+ || e | k | e | t | k | t | y ||
2637
+ || l | | l | | | | ||
2638
+ || | | | | | | ||
2639
+ --++-----------------------------------------------------------------++-->
2640
+
2641
+ Attributes:
2642
+ vehicle_index (int):
2643
+ Vehicle performing the route, identified by its index in the
2644
+ source ``ShipmentModel``.
2645
+ vehicle_label (str):
2646
+ Label of the vehicle performing this route, equal to
2647
+ ``ShipmentModel.vehicles(vehicle_index).label``, if
2648
+ specified.
2649
+ vehicle_start_time (google.protobuf.timestamp_pb2.Timestamp):
2650
+ Time at which the vehicle starts its route.
2651
+ vehicle_end_time (google.protobuf.timestamp_pb2.Timestamp):
2652
+ Time at which the vehicle finishes its route.
2653
+ visits (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentRoute.Visit]):
2654
+ Ordered sequence of visits representing a route. visits[i]
2655
+ is the i-th visit in the route. If this field is empty, the
2656
+ vehicle is considered as unused.
2657
+ transitions (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentRoute.Transition]):
2658
+ Ordered list of transitions for the route.
2659
+ has_traffic_infeasibilities (bool):
2660
+ When
2661
+ [OptimizeToursRequest.consider_road_traffic][google.maps.routeoptimization.v1.OptimizeToursRequest.consider_road_traffic],
2662
+ is set to true, this field indicates that inconsistencies in
2663
+ route timings are predicted using traffic-based travel
2664
+ duration estimates. There may be insufficient time to
2665
+ complete traffic-adjusted travel, delays, and breaks between
2666
+ visits, before the first visit, or after the last visit,
2667
+ while still satisfying the visit and vehicle time windows.
2668
+ For example,
2669
+
2670
+ ::
2671
+
2672
+ start_time(previous_visit) + duration(previous_visit) +
2673
+ travel_duration(previous_visit, next_visit) > start_time(next_visit)
2674
+
2675
+ Arrival at next_visit will likely happen later than its
2676
+ current time window due the increased estimate of travel
2677
+ time ``travel_duration(previous_visit, next_visit)`` due to
2678
+ traffic. Also, a break may be forced to overlap with a visit
2679
+ due to an increase in travel time estimates and visit or
2680
+ break time window restrictions.
2681
+ route_polyline (google.maps.routeoptimization_v1.types.ShipmentRoute.EncodedPolyline):
2682
+ The encoded polyline representation of the route. This field
2683
+ is only populated if
2684
+ [OptimizeToursRequest.populate_polylines][google.maps.routeoptimization.v1.OptimizeToursRequest.populate_polylines]
2685
+ is set to true.
2686
+ breaks (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentRoute.Break]):
2687
+ Breaks scheduled for the vehicle performing this route. The
2688
+ ``breaks`` sequence represents time intervals, each starting
2689
+ at the corresponding ``start_time`` and lasting ``duration``
2690
+ seconds.
2691
+ metrics (google.maps.routeoptimization_v1.types.AggregatedMetrics):
2692
+ Duration, distance and load metrics for this route. The
2693
+ fields of
2694
+ [AggregatedMetrics][google.maps.routeoptimization.v1.AggregatedMetrics]
2695
+ are summed over all
2696
+ [ShipmentRoute.transitions][google.maps.routeoptimization.v1.ShipmentRoute.transitions]
2697
+ or
2698
+ [ShipmentRoute.visits][google.maps.routeoptimization.v1.ShipmentRoute.visits],
2699
+ depending on the context.
2700
+ route_costs (MutableMapping[str, float]):
2701
+ Cost of the route, broken down by cost-related request
2702
+ fields. The keys are proto paths, relative to the input
2703
+ OptimizeToursRequest, e.g. "model.shipments.pickups.cost",
2704
+ and the values are the total cost generated by the
2705
+ corresponding cost field, aggregated over the whole route.
2706
+ In other words, costs["model.shipments.pickups.cost"] is the
2707
+ sum of all pickup costs over the route. All costs defined in
2708
+ the model are reported in detail here with the exception of
2709
+ costs related to TransitionAttributes that are only reported
2710
+ in an aggregated way as of 2022/01.
2711
+ route_total_cost (float):
2712
+ Total cost of the route. The sum of all costs
2713
+ in the cost map.
2714
+ """
2715
+
2716
+ class Visit(proto.Message):
2717
+ r"""A visit performed during a route. This visit corresponds to a pickup
2718
+ or a delivery of a ``Shipment``.
2719
+
2720
+ Attributes:
2721
+ shipment_index (int):
2722
+ Index of the ``shipments`` field in the source
2723
+ [ShipmentModel][google.maps.routeoptimization.v1.ShipmentModel].
2724
+ is_pickup (bool):
2725
+ If true the visit corresponds to a pickup of a ``Shipment``.
2726
+ Otherwise, it corresponds to a delivery.
2727
+ visit_request_index (int):
2728
+ Index of ``VisitRequest`` in either the pickup or delivery
2729
+ field of the ``Shipment`` (see ``is_pickup``).
2730
+ start_time (google.protobuf.timestamp_pb2.Timestamp):
2731
+ Time at which the visit starts. Note that the vehicle may
2732
+ arrive earlier than this at the visit location. Times are
2733
+ consistent with the ``ShipmentModel``.
2734
+ load_demands (MutableMapping[str, google.maps.routeoptimization_v1.types.Shipment.Load]):
2735
+ Total visit load demand as the sum of the shipment and the
2736
+ visit request ``load_demands``. The values are negative if
2737
+ the visit is a delivery. Demands are reported for the same
2738
+ types as the
2739
+ [Transition.loads][google.maps.routeoptimization.v1.ShipmentRoute.Transition]
2740
+ (see this field).
2741
+ detour (google.protobuf.duration_pb2.Duration):
2742
+ Extra detour time due to the shipments visited on the route
2743
+ before the visit and to the potential waiting time induced
2744
+ by time windows. If the visit is a delivery, the detour is
2745
+ computed from the corresponding pickup visit and is equal
2746
+ to:
2747
+
2748
+ ::
2749
+
2750
+ start_time(delivery) - start_time(pickup)
2751
+ - (duration(pickup) + travel duration from the pickup location
2752
+ to the delivery location).
2753
+
2754
+ Otherwise, it is computed from the vehicle
2755
+ ``start_location`` and is equal to:
2756
+
2757
+ ::
2758
+
2759
+ start_time - vehicle_start_time - travel duration from
2760
+ the vehicle's `start_location` to the visit.
2761
+ shipment_label (str):
2762
+ Copy of the corresponding ``Shipment.label``, if specified
2763
+ in the ``Shipment``.
2764
+ visit_label (str):
2765
+ Copy of the corresponding
2766
+ [VisitRequest.label][google.maps.routeoptimization.v1.Shipment.VisitRequest.label],
2767
+ if specified in the ``VisitRequest``.
2768
+ """
2769
+
2770
+ shipment_index: int = proto.Field(
2771
+ proto.INT32,
2772
+ number=1,
2773
+ )
2774
+ is_pickup: bool = proto.Field(
2775
+ proto.BOOL,
2776
+ number=2,
2777
+ )
2778
+ visit_request_index: int = proto.Field(
2779
+ proto.INT32,
2780
+ number=3,
2781
+ )
2782
+ start_time: timestamp_pb2.Timestamp = proto.Field(
2783
+ proto.MESSAGE,
2784
+ number=4,
2785
+ message=timestamp_pb2.Timestamp,
2786
+ )
2787
+ load_demands: MutableMapping[str, "Shipment.Load"] = proto.MapField(
2788
+ proto.STRING,
2789
+ proto.MESSAGE,
2790
+ number=11,
2791
+ message="Shipment.Load",
2792
+ )
2793
+ detour: duration_pb2.Duration = proto.Field(
2794
+ proto.MESSAGE,
2795
+ number=6,
2796
+ message=duration_pb2.Duration,
2797
+ )
2798
+ shipment_label: str = proto.Field(
2799
+ proto.STRING,
2800
+ number=7,
2801
+ )
2802
+ visit_label: str = proto.Field(
2803
+ proto.STRING,
2804
+ number=8,
2805
+ )
2806
+
2807
+ class Transition(proto.Message):
2808
+ r"""Transition between two events on the route. See the description of
2809
+ [ShipmentRoute][google.maps.routeoptimization.v1.ShipmentRoute].
2810
+
2811
+ If the vehicle does not have a ``start_location`` and/or
2812
+ ``end_location``, the corresponding travel metrics are 0.
2813
+
2814
+ Attributes:
2815
+ travel_duration (google.protobuf.duration_pb2.Duration):
2816
+ Travel duration during this transition.
2817
+ travel_distance_meters (float):
2818
+ Distance traveled during the transition.
2819
+ traffic_info_unavailable (bool):
2820
+ When traffic is requested via
2821
+ [OptimizeToursRequest.consider_road_traffic]
2822
+ [google.maps.routeoptimization.v1.OptimizeToursRequest.consider_road_traffic],
2823
+ and the traffic info couldn't be retrieved for a
2824
+ ``Transition``, this boolean is set to true. This may be
2825
+ temporary (rare hiccup in the realtime traffic servers) or
2826
+ permanent (no data for this location).
2827
+ delay_duration (google.protobuf.duration_pb2.Duration):
2828
+ Sum of the delay durations applied to this transition. If
2829
+ any, the delay starts exactly ``delay_duration`` seconds
2830
+ before the next event (visit or vehicle end). See
2831
+ [TransitionAttributes.delay][google.maps.routeoptimization.v1.TransitionAttributes.delay].
2832
+ break_duration (google.protobuf.duration_pb2.Duration):
2833
+ Sum of the duration of the breaks occurring during this
2834
+ transition, if any. Details about each break's start time
2835
+ and duration are stored in
2836
+ [ShipmentRoute.breaks][google.maps.routeoptimization.v1.ShipmentRoute.breaks].
2837
+ wait_duration (google.protobuf.duration_pb2.Duration):
2838
+ Time spent waiting during this transition.
2839
+ Wait duration corresponds to idle time and does
2840
+ not include break time. Also note that this wait
2841
+ time may be split into several non-contiguous
2842
+ intervals.
2843
+ total_duration (google.protobuf.duration_pb2.Duration):
2844
+ Total duration of the transition, provided for convenience.
2845
+ It is equal to:
2846
+
2847
+ - next visit ``start_time`` (or ``vehicle_end_time`` if
2848
+ this is the last transition) - this transition's
2849
+ ``start_time``;
2850
+ - if ``ShipmentRoute.has_traffic_infeasibilities`` is
2851
+ false, the following additionally holds: \`total_duration
2852
+ = travel_duration + delay_duration
2853
+
2854
+ - break_duration + wait_duration`.
2855
+ start_time (google.protobuf.timestamp_pb2.Timestamp):
2856
+ Start time of this transition.
2857
+ route_polyline (google.maps.routeoptimization_v1.types.ShipmentRoute.EncodedPolyline):
2858
+ The encoded polyline representation of the route followed
2859
+ during the transition. This field is only populated if
2860
+ [populate_transition_polylines]
2861
+ [google.maps.routeoptimization.v1.OptimizeToursRequest.populate_transition_polylines]
2862
+ is set to true.
2863
+ vehicle_loads (MutableMapping[str, google.maps.routeoptimization_v1.types.ShipmentRoute.VehicleLoad]):
2864
+ Vehicle loads during this transition, for each type that
2865
+ either appears in this vehicle's
2866
+ [Vehicle.load_limits][google.maps.routeoptimization.v1.Vehicle.load_limits],
2867
+ or that have non-zero
2868
+ [Shipment.load_demands][google.maps.routeoptimization.v1.Shipment.load_demands]
2869
+ on some shipment performed on this route.
2870
+
2871
+ The loads during the first transition are the starting loads
2872
+ of the vehicle route. Then, after each visit, the visit's
2873
+ ``load_demands`` are either added or subtracted to get the
2874
+ next transition's loads, depending on whether the visit was
2875
+ a pickup or a delivery.
2876
+ """
2877
+
2878
+ travel_duration: duration_pb2.Duration = proto.Field(
2879
+ proto.MESSAGE,
2880
+ number=1,
2881
+ message=duration_pb2.Duration,
2882
+ )
2883
+ travel_distance_meters: float = proto.Field(
2884
+ proto.DOUBLE,
2885
+ number=2,
2886
+ )
2887
+ traffic_info_unavailable: bool = proto.Field(
2888
+ proto.BOOL,
2889
+ number=3,
2890
+ )
2891
+ delay_duration: duration_pb2.Duration = proto.Field(
2892
+ proto.MESSAGE,
2893
+ number=4,
2894
+ message=duration_pb2.Duration,
2895
+ )
2896
+ break_duration: duration_pb2.Duration = proto.Field(
2897
+ proto.MESSAGE,
2898
+ number=5,
2899
+ message=duration_pb2.Duration,
2900
+ )
2901
+ wait_duration: duration_pb2.Duration = proto.Field(
2902
+ proto.MESSAGE,
2903
+ number=6,
2904
+ message=duration_pb2.Duration,
2905
+ )
2906
+ total_duration: duration_pb2.Duration = proto.Field(
2907
+ proto.MESSAGE,
2908
+ number=7,
2909
+ message=duration_pb2.Duration,
2910
+ )
2911
+ start_time: timestamp_pb2.Timestamp = proto.Field(
2912
+ proto.MESSAGE,
2913
+ number=8,
2914
+ message=timestamp_pb2.Timestamp,
2915
+ )
2916
+ route_polyline: "ShipmentRoute.EncodedPolyline" = proto.Field(
2917
+ proto.MESSAGE,
2918
+ number=9,
2919
+ message="ShipmentRoute.EncodedPolyline",
2920
+ )
2921
+ vehicle_loads: MutableMapping[
2922
+ str, "ShipmentRoute.VehicleLoad"
2923
+ ] = proto.MapField(
2924
+ proto.STRING,
2925
+ proto.MESSAGE,
2926
+ number=11,
2927
+ message="ShipmentRoute.VehicleLoad",
2928
+ )
2929
+
2930
+ class VehicleLoad(proto.Message):
2931
+ r"""Reports the actual load of the vehicle at some point along the
2932
+ route, for a given type (see
2933
+ [Transition.vehicle_loads][google.maps.routeoptimization.v1.ShipmentRoute.Transition.vehicle_loads]).
2934
+
2935
+ Attributes:
2936
+ amount (int):
2937
+ The amount of load on the vehicle, for the given type. The
2938
+ unit of load is usually indicated by the type. See
2939
+ [Transition.vehicle_loads][google.maps.routeoptimization.v1.ShipmentRoute.Transition.vehicle_loads].
2940
+ """
2941
+
2942
+ amount: int = proto.Field(
2943
+ proto.INT64,
2944
+ number=1,
2945
+ )
2946
+
2947
+ class EncodedPolyline(proto.Message):
2948
+ r"""The encoded representation of a polyline. More information on
2949
+ polyline encoding can be found here:
2950
+
2951
+ https://developers.google.com/maps/documentation/utilities/polylinealgorithm
2952
+ https://developers.google.com/maps/documentation/javascript/reference/geometry#encoding.
2953
+
2954
+ Attributes:
2955
+ points (str):
2956
+ String representing encoded points of the
2957
+ polyline.
2958
+ """
2959
+
2960
+ points: str = proto.Field(
2961
+ proto.STRING,
2962
+ number=1,
2963
+ )
2964
+
2965
+ class Break(proto.Message):
2966
+ r"""Data representing the execution of a break.
2967
+
2968
+ Attributes:
2969
+ start_time (google.protobuf.timestamp_pb2.Timestamp):
2970
+ Start time of a break.
2971
+ duration (google.protobuf.duration_pb2.Duration):
2972
+ Duration of a break.
2973
+ """
2974
+
2975
+ start_time: timestamp_pb2.Timestamp = proto.Field(
2976
+ proto.MESSAGE,
2977
+ number=1,
2978
+ message=timestamp_pb2.Timestamp,
2979
+ )
2980
+ duration: duration_pb2.Duration = proto.Field(
2981
+ proto.MESSAGE,
2982
+ number=2,
2983
+ message=duration_pb2.Duration,
2984
+ )
2985
+
2986
+ vehicle_index: int = proto.Field(
2987
+ proto.INT32,
2988
+ number=1,
2989
+ )
2990
+ vehicle_label: str = proto.Field(
2991
+ proto.STRING,
2992
+ number=2,
2993
+ )
2994
+ vehicle_start_time: timestamp_pb2.Timestamp = proto.Field(
2995
+ proto.MESSAGE,
2996
+ number=5,
2997
+ message=timestamp_pb2.Timestamp,
2998
+ )
2999
+ vehicle_end_time: timestamp_pb2.Timestamp = proto.Field(
3000
+ proto.MESSAGE,
3001
+ number=6,
3002
+ message=timestamp_pb2.Timestamp,
3003
+ )
3004
+ visits: MutableSequence[Visit] = proto.RepeatedField(
3005
+ proto.MESSAGE,
3006
+ number=7,
3007
+ message=Visit,
3008
+ )
3009
+ transitions: MutableSequence[Transition] = proto.RepeatedField(
3010
+ proto.MESSAGE,
3011
+ number=8,
3012
+ message=Transition,
3013
+ )
3014
+ has_traffic_infeasibilities: bool = proto.Field(
3015
+ proto.BOOL,
3016
+ number=9,
3017
+ )
3018
+ route_polyline: EncodedPolyline = proto.Field(
3019
+ proto.MESSAGE,
3020
+ number=10,
3021
+ message=EncodedPolyline,
3022
+ )
3023
+ breaks: MutableSequence[Break] = proto.RepeatedField(
3024
+ proto.MESSAGE,
3025
+ number=11,
3026
+ message=Break,
3027
+ )
3028
+ metrics: "AggregatedMetrics" = proto.Field(
3029
+ proto.MESSAGE,
3030
+ number=12,
3031
+ message="AggregatedMetrics",
3032
+ )
3033
+ route_costs: MutableMapping[str, float] = proto.MapField(
3034
+ proto.STRING,
3035
+ proto.DOUBLE,
3036
+ number=17,
3037
+ )
3038
+ route_total_cost: float = proto.Field(
3039
+ proto.DOUBLE,
3040
+ number=18,
3041
+ )
3042
+
3043
+
3044
+ class SkippedShipment(proto.Message):
3045
+ r"""Specifies details of unperformed shipments in a solution. For
3046
+ trivial cases and/or if we are able to identify the cause for
3047
+ skipping, we report the reason here.
3048
+
3049
+ Attributes:
3050
+ index (int):
3051
+ The index corresponds to the index of the shipment in the
3052
+ source ``ShipmentModel``.
3053
+ label (str):
3054
+ Copy of the corresponding
3055
+ [Shipment.label][google.maps.routeoptimization.v1.Shipment.label],
3056
+ if specified in the ``Shipment``.
3057
+ reasons (MutableSequence[google.maps.routeoptimization_v1.types.SkippedShipment.Reason]):
3058
+ A list of reasons that explain why the shipment was skipped.
3059
+ See comment above ``Reason``.
3060
+ """
3061
+
3062
+ class Reason(proto.Message):
3063
+ r"""If we can explain why the shipment was skipped, reasons will be
3064
+ listed here. If the reason is not the same for all vehicles,
3065
+ ``reason`` will have more than 1 element. A skipped shipment cannot
3066
+ have duplicate reasons, i.e. where all fields are the same except
3067
+ for ``example_vehicle_index``. Example:
3068
+
3069
+ ::
3070
+
3071
+ reasons {
3072
+ code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
3073
+ example_vehicle_index: 1
3074
+ example_exceeded_capacity_type: "Apples"
3075
+ }
3076
+ reasons {
3077
+ code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
3078
+ example_vehicle_index: 3
3079
+ example_exceeded_capacity_type: "Pears"
3080
+ }
3081
+ reasons {
3082
+ code: CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT
3083
+ example_vehicle_index: 1
3084
+ }
3085
+
3086
+ The skipped shipment is incompatible with all vehicles. The reasons
3087
+ may be different for all vehicles but at least one vehicle's
3088
+ "Apples" capacity would be exceeded (including vehicle 1), at least
3089
+ one vehicle's "Pears" capacity would be exceeded (including vehicle
3090
+ 3) and at least one vehicle's distance limit would be exceeded
3091
+ (including vehicle 1).
3092
+
3093
+
3094
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
3095
+
3096
+ Attributes:
3097
+ code (google.maps.routeoptimization_v1.types.SkippedShipment.Reason.Code):
3098
+ Refer to the comments of Code.
3099
+ example_vehicle_index (int):
3100
+ If the reason is related to a
3101
+ shipment-vehicle incompatibility, this field
3102
+ provides the index of one relevant vehicle.
3103
+
3104
+ This field is a member of `oneof`_ ``_example_vehicle_index``.
3105
+ example_exceeded_capacity_type (str):
3106
+ If the reason code is ``DEMAND_EXCEEDS_VEHICLE_CAPACITY``,
3107
+ documents one capacity type that is exceeded.
3108
+ """
3109
+
3110
+ class Code(proto.Enum):
3111
+ r"""Code identifying the reason type. The order here is
3112
+ meaningless. In particular, it gives no indication of whether a
3113
+ given reason will appear before another in the solution, if both
3114
+ apply.
3115
+
3116
+ Values:
3117
+ CODE_UNSPECIFIED (0):
3118
+ This should never be used. If we are unable
3119
+ to understand why a shipment was skipped, we
3120
+ simply return an empty set of reasons.
3121
+ NO_VEHICLE (1):
3122
+ There is no vehicle in the model making all
3123
+ shipments infeasible.
3124
+ DEMAND_EXCEEDS_VEHICLE_CAPACITY (2):
3125
+ The demand of the shipment exceeds a vehicle's capacity for
3126
+ some capacity types, one of which is
3127
+ ``example_exceeded_capacity_type``.
3128
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT (3):
3129
+ The minimum distance necessary to perform this shipment,
3130
+ i.e. from the vehicle's ``start_location`` to the shipment's
3131
+ pickup and/or delivery locations and to the vehicle's end
3132
+ location exceeds the vehicle's ``route_distance_limit``.
3133
+
3134
+ Note that for this computation we use the geodesic
3135
+ distances.
3136
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT (4):
3137
+ The minimum time necessary to perform this shipment,
3138
+ including travel time, wait time and service time exceeds
3139
+ the vehicle's ``route_duration_limit``.
3140
+
3141
+ Note: travel time is computed in the best-case scenario,
3142
+ namely as geodesic distance x 36 m/s (roughly 130 km/hour).
3143
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT (5):
3144
+ Same as above but we only compare minimum travel time and
3145
+ the vehicle's ``travel_duration_limit``.
3146
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS (6):
3147
+ The vehicle cannot perform this shipment in the best-case
3148
+ scenario (see
3149
+ ``CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT`` for
3150
+ time computation) if it starts at its earliest start time:
3151
+ the total time would make the vehicle end after its latest
3152
+ end time.
3153
+ VEHICLE_NOT_ALLOWED (7):
3154
+ The ``allowed_vehicle_indices`` field of the shipment is not
3155
+ empty and this vehicle does not belong to it.
3156
+ """
3157
+ CODE_UNSPECIFIED = 0
3158
+ NO_VEHICLE = 1
3159
+ DEMAND_EXCEEDS_VEHICLE_CAPACITY = 2
3160
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT = 3
3161
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT = 4
3162
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT = 5
3163
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS = 6
3164
+ VEHICLE_NOT_ALLOWED = 7
3165
+
3166
+ code: "SkippedShipment.Reason.Code" = proto.Field(
3167
+ proto.ENUM,
3168
+ number=1,
3169
+ enum="SkippedShipment.Reason.Code",
3170
+ )
3171
+ example_vehicle_index: int = proto.Field(
3172
+ proto.INT32,
3173
+ number=2,
3174
+ optional=True,
3175
+ )
3176
+ example_exceeded_capacity_type: str = proto.Field(
3177
+ proto.STRING,
3178
+ number=3,
3179
+ )
3180
+
3181
+ index: int = proto.Field(
3182
+ proto.INT32,
3183
+ number=1,
3184
+ )
3185
+ label: str = proto.Field(
3186
+ proto.STRING,
3187
+ number=2,
3188
+ )
3189
+ reasons: MutableSequence[Reason] = proto.RepeatedField(
3190
+ proto.MESSAGE,
3191
+ number=3,
3192
+ message=Reason,
3193
+ )
3194
+
3195
+
3196
+ class AggregatedMetrics(proto.Message):
3197
+ r"""Aggregated metrics for
3198
+ [ShipmentRoute][google.maps.routeoptimization.v1.ShipmentRoute]
3199
+ (resp. for
3200
+ [OptimizeToursResponse][google.maps.routeoptimization.v1.OptimizeToursResponse]
3201
+ over all
3202
+ [Transition][google.maps.routeoptimization.v1.ShipmentRoute.Transition]
3203
+ and/or [Visit][google.maps.routeoptimization.v1.ShipmentRoute.Visit]
3204
+ (resp. over all
3205
+ [ShipmentRoute][google.maps.routeoptimization.v1.ShipmentRoute])
3206
+ elements.
3207
+
3208
+ Attributes:
3209
+ performed_shipment_count (int):
3210
+ Number of shipments performed. Note that a
3211
+ pickup and delivery pair only counts once.
3212
+ travel_duration (google.protobuf.duration_pb2.Duration):
3213
+ Total travel duration for a route or a
3214
+ solution.
3215
+ wait_duration (google.protobuf.duration_pb2.Duration):
3216
+ Total wait duration for a route or a
3217
+ solution.
3218
+ delay_duration (google.protobuf.duration_pb2.Duration):
3219
+ Total delay duration for a route or a
3220
+ solution.
3221
+ break_duration (google.protobuf.duration_pb2.Duration):
3222
+ Total break duration for a route or a
3223
+ solution.
3224
+ visit_duration (google.protobuf.duration_pb2.Duration):
3225
+ Total visit duration for a route or a
3226
+ solution.
3227
+ total_duration (google.protobuf.duration_pb2.Duration):
3228
+ The total duration should be equal to the sum of all
3229
+ durations above. For routes, it also corresponds to:
3230
+
3231
+ ::
3232
+
3233
+ [ShipmentRoute.vehicle_end_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_end_time]
3234
+ -
3235
+ [ShipmentRoute.vehicle_start_time][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_start_time]
3236
+ travel_distance_meters (float):
3237
+ Total travel distance for a route or a
3238
+ solution.
3239
+ max_loads (MutableMapping[str, google.maps.routeoptimization_v1.types.ShipmentRoute.VehicleLoad]):
3240
+ Maximum load achieved over the entire route (resp.
3241
+ solution), for each of the quantities on this route (resp.
3242
+ solution), computed as the maximum over all
3243
+ [Transition.vehicle_loads][google.maps.routeoptimization.v1.ShipmentRoute.Transition.vehicle_loads]
3244
+ (resp.
3245
+ [ShipmentRoute.metrics.max_loads][google.maps.routeoptimization.v1.AggregatedMetrics.max_loads].
3246
+ """
3247
+
3248
+ performed_shipment_count: int = proto.Field(
3249
+ proto.INT32,
3250
+ number=1,
3251
+ )
3252
+ travel_duration: duration_pb2.Duration = proto.Field(
3253
+ proto.MESSAGE,
3254
+ number=2,
3255
+ message=duration_pb2.Duration,
3256
+ )
3257
+ wait_duration: duration_pb2.Duration = proto.Field(
3258
+ proto.MESSAGE,
3259
+ number=3,
3260
+ message=duration_pb2.Duration,
3261
+ )
3262
+ delay_duration: duration_pb2.Duration = proto.Field(
3263
+ proto.MESSAGE,
3264
+ number=4,
3265
+ message=duration_pb2.Duration,
3266
+ )
3267
+ break_duration: duration_pb2.Duration = proto.Field(
3268
+ proto.MESSAGE,
3269
+ number=5,
3270
+ message=duration_pb2.Duration,
3271
+ )
3272
+ visit_duration: duration_pb2.Duration = proto.Field(
3273
+ proto.MESSAGE,
3274
+ number=6,
3275
+ message=duration_pb2.Duration,
3276
+ )
3277
+ total_duration: duration_pb2.Duration = proto.Field(
3278
+ proto.MESSAGE,
3279
+ number=7,
3280
+ message=duration_pb2.Duration,
3281
+ )
3282
+ travel_distance_meters: float = proto.Field(
3283
+ proto.DOUBLE,
3284
+ number=8,
3285
+ )
3286
+ max_loads: MutableMapping[str, "ShipmentRoute.VehicleLoad"] = proto.MapField(
3287
+ proto.STRING,
3288
+ proto.MESSAGE,
3289
+ number=9,
3290
+ message="ShipmentRoute.VehicleLoad",
3291
+ )
3292
+
3293
+
3294
+ class InjectedSolutionConstraint(proto.Message):
3295
+ r"""Solution injected in the request including information about
3296
+ which visits must be constrained and how they must be
3297
+ constrained.
3298
+
3299
+ Attributes:
3300
+ routes (MutableSequence[google.maps.routeoptimization_v1.types.ShipmentRoute]):
3301
+ Routes of the solution to inject. Some routes may be omitted
3302
+ from the original solution. The routes and skipped shipments
3303
+ must satisfy the basic validity assumptions listed for
3304
+ ``injected_first_solution_routes``.
3305
+ skipped_shipments (MutableSequence[google.maps.routeoptimization_v1.types.SkippedShipment]):
3306
+ Skipped shipments of the solution to inject. Some may be
3307
+ omitted from the original solution. See the ``routes``
3308
+ field.
3309
+ constraint_relaxations (MutableSequence[google.maps.routeoptimization_v1.types.InjectedSolutionConstraint.ConstraintRelaxation]):
3310
+ For zero or more groups of vehicles,
3311
+ specifies when and how much to relax
3312
+ constraints. If this field is empty, all
3313
+ non-empty vehicle routes are fully constrained.
3314
+ """
3315
+
3316
+ class ConstraintRelaxation(proto.Message):
3317
+ r"""For a group of vehicles, specifies at what threshold(s) constraints
3318
+ on visits will be relaxed and to which level. Shipments listed in
3319
+ the ``skipped_shipment`` field are constrained to be skipped; i.e.,
3320
+ they cannot be performed.
3321
+
3322
+ Attributes:
3323
+ relaxations (MutableSequence[google.maps.routeoptimization_v1.types.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation]):
3324
+ All the visit constraint relaxations that will apply to
3325
+ visits on routes with vehicles in ``vehicle_indices``.
3326
+ vehicle_indices (MutableSequence[int]):
3327
+ Specifies the vehicle indices to which the visit constraint
3328
+ ``relaxations`` apply. If empty, this is considered the
3329
+ default and the ``relaxations`` apply to all vehicles that
3330
+ are not specified in other ``constraint_relaxations``. There
3331
+ can be at most one default, i.e., at most one constraint
3332
+ relaxation field is allowed empty ``vehicle_indices``. A
3333
+ vehicle index can only be listed once, even within several
3334
+ ``constraint_relaxations``.
3335
+
3336
+ A vehicle index is mapped the same as
3337
+ [ShipmentRoute.vehicle_index][google.maps.routeoptimization.v1.ShipmentRoute.vehicle_index],
3338
+ if ``interpret_injected_solutions_using_labels`` is true
3339
+ (see ``fields`` comment).
3340
+ """
3341
+
3342
+ class Relaxation(proto.Message):
3343
+ r"""If ``relaxations`` is empty, the start time and sequence of all
3344
+ visits on ``routes`` are fully constrained and no new visits may be
3345
+ inserted or added to those routes. Also, a vehicle's start and end
3346
+ time in ``routes`` is fully constrained, unless the vehicle is empty
3347
+ (i.e., has no visits and has ``used_if_route_is_empty`` set to false
3348
+ in the model).
3349
+
3350
+ ``relaxations(i).level`` specifies the constraint relaxation level
3351
+ applied to a visit #j that satisfies:
3352
+
3353
+ - ``route.visits(j).start_time >= relaxations(i).threshold_time``
3354
+ AND
3355
+ - ``j + 1 >= relaxations(i).threshold_visit_count``
3356
+
3357
+ Similarly, the vehicle start is relaxed to ``relaxations(i).level``
3358
+ if it satisfies:
3359
+
3360
+ - ``vehicle_start_time >= relaxations(i).threshold_time`` AND
3361
+ - ``relaxations(i).threshold_visit_count == 0`` and the vehicle end
3362
+ is relaxed to ``relaxations(i).level`` if it satisfies:
3363
+ - ``vehicle_end_time >= relaxations(i).threshold_time`` AND
3364
+ - ``route.visits_size() + 1 >= relaxations(i).threshold_visit_count``
3365
+
3366
+ To apply a relaxation level if a visit meets the
3367
+ ``threshold_visit_count`` OR the ``threshold_time`` add two
3368
+ ``relaxations`` with the same ``level``: one with only
3369
+ ``threshold_visit_count`` set and the other with only
3370
+ ``threshold_time`` set. If a visit satisfies the conditions of
3371
+ multiple ``relaxations``, the most relaxed level applies. As a
3372
+ result, from the vehicle start through the route visits in order to
3373
+ the vehicle end, the relaxation level becomes more relaxed: i.e.,
3374
+ the relaxation level is non-decreasing as the route progresses.
3375
+
3376
+ The timing and sequence of route visits that do not satisfy the
3377
+ threshold conditions of any ``relaxations`` are fully constrained
3378
+ and no visits may be inserted into these sequences. Also, if a
3379
+ vehicle start or end does not satisfy the conditions of any
3380
+ relaxation the time is fixed, unless the vehicle is empty.
3381
+
3382
+ Attributes:
3383
+ level (google.maps.routeoptimization_v1.types.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level):
3384
+ The constraint relaxation level that applies when the
3385
+ conditions at or after ``threshold_time`` AND at least
3386
+ ``threshold_visit_count`` are satisfied.
3387
+ threshold_time (google.protobuf.timestamp_pb2.Timestamp):
3388
+ The time at or after which the relaxation ``level`` may be
3389
+ applied.
3390
+ threshold_visit_count (int):
3391
+ The number of visits at or after which the relaxation
3392
+ ``level`` may be applied. If ``threshold_visit_count`` is 0
3393
+ (or unset), the ``level`` may be applied directly at the
3394
+ vehicle start.
3395
+
3396
+ If it is ``route.visits_size() + 1``, the ``level`` may only
3397
+ be applied to the vehicle end. If it is more than
3398
+ ``route.visits_size() + 1``, ``level`` is not applied at all
3399
+ for that route.
3400
+ """
3401
+
3402
+ class Level(proto.Enum):
3403
+ r"""Expresses the different constraint relaxation levels, which
3404
+ are applied for a visit and those that follow when it satisfies
3405
+ the threshold conditions.
3406
+
3407
+ The enumeration below is in order of increasing relaxation.
3408
+
3409
+ Values:
3410
+ LEVEL_UNSPECIFIED (0):
3411
+ Implicit default relaxation level: no constraints are
3412
+ relaxed, i.e., all visits are fully constrained.
3413
+
3414
+ This value must not be explicitly used in ``level``.
3415
+ RELAX_VISIT_TIMES_AFTER_THRESHOLD (1):
3416
+ Visit start times and vehicle start/end times
3417
+ will be relaxed, but each visit remains bound to
3418
+ the same vehicle and the visit sequence must be
3419
+ observed: no visit can be inserted between them
3420
+ or before them.
3421
+ RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD (2):
3422
+ Same as ``RELAX_VISIT_TIMES_AFTER_THRESHOLD``, but the visit
3423
+ sequence is also relaxed: visits remain simply bound to
3424
+ their vehicle.
3425
+ RELAX_ALL_AFTER_THRESHOLD (3):
3426
+ Same as ``RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD``,
3427
+ but the vehicle is also relaxed: visits are completely free
3428
+ at or after the threshold time and can potentially become
3429
+ unperformed.
3430
+ """
3431
+ LEVEL_UNSPECIFIED = 0
3432
+ RELAX_VISIT_TIMES_AFTER_THRESHOLD = 1
3433
+ RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD = 2
3434
+ RELAX_ALL_AFTER_THRESHOLD = 3
3435
+
3436
+ level: "InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level" = proto.Field(
3437
+ proto.ENUM,
3438
+ number=1,
3439
+ enum="InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level",
3440
+ )
3441
+ threshold_time: timestamp_pb2.Timestamp = proto.Field(
3442
+ proto.MESSAGE,
3443
+ number=2,
3444
+ message=timestamp_pb2.Timestamp,
3445
+ )
3446
+ threshold_visit_count: int = proto.Field(
3447
+ proto.INT32,
3448
+ number=3,
3449
+ )
3450
+
3451
+ relaxations: MutableSequence[
3452
+ "InjectedSolutionConstraint.ConstraintRelaxation.Relaxation"
3453
+ ] = proto.RepeatedField(
3454
+ proto.MESSAGE,
3455
+ number=1,
3456
+ message="InjectedSolutionConstraint.ConstraintRelaxation.Relaxation",
3457
+ )
3458
+ vehicle_indices: MutableSequence[int] = proto.RepeatedField(
3459
+ proto.INT32,
3460
+ number=2,
3461
+ )
3462
+
3463
+ routes: MutableSequence["ShipmentRoute"] = proto.RepeatedField(
3464
+ proto.MESSAGE,
3465
+ number=1,
3466
+ message="ShipmentRoute",
3467
+ )
3468
+ skipped_shipments: MutableSequence["SkippedShipment"] = proto.RepeatedField(
3469
+ proto.MESSAGE,
3470
+ number=2,
3471
+ message="SkippedShipment",
3472
+ )
3473
+ constraint_relaxations: MutableSequence[ConstraintRelaxation] = proto.RepeatedField(
3474
+ proto.MESSAGE,
3475
+ number=3,
3476
+ message=ConstraintRelaxation,
3477
+ )
3478
+
3479
+
3480
+ class OptimizeToursValidationError(proto.Message):
3481
+ r"""Describes an error encountered when validating an
3482
+ ``OptimizeToursRequest``.
3483
+
3484
+ Attributes:
3485
+ code (int):
3486
+ A validation error is defined by the pair (``code``,
3487
+ ``display_name``) which are always present.
3488
+
3489
+ Other fields (below) provide more context about the error.
3490
+
3491
+ *MULTIPLE ERRORS*: When there are multiple errors, the
3492
+ validation process tries to output several of them. Much
3493
+ like a compiler, this is an imperfect process. Some
3494
+ validation errors will be "fatal", meaning that they stop
3495
+ the entire validation process. This is the case for
3496
+ ``display_name="UNSPECIFIED"`` errors, among others. Some
3497
+ may cause the validation process to skip other errors.
3498
+
3499
+ *STABILITY*: ``code`` and ``display_name`` should be very
3500
+ stable. But new codes and display names may appear over
3501
+ time, which may cause a given (invalid) request to yield a
3502
+ different (``code``, ``display_name``) pair because the new
3503
+ error hid the old one (see "MULTIPLE ERRORS").
3504
+
3505
+ *REFERENCE*: A list of all (code, name) pairs:
3506
+
3507
+ - UNSPECIFIED = 0;
3508
+
3509
+ - VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be
3510
+ completed within the deadline.
3511
+
3512
+ - REQUEST_OPTIONS_ERROR = 12;
3513
+
3514
+ - REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201;
3515
+ - REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203;
3516
+ - REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND =
3517
+ 1204;
3518
+ - REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL =
3519
+ 1205;
3520
+ - REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND =
3521
+ 1206;
3522
+ - REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE
3523
+ = 1207;
3524
+ - REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE
3525
+ = 1208;
3526
+ - REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC
3527
+ = 1211;
3528
+ - REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212;
3529
+ - REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213;
3530
+ - REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME
3531
+ = 1214;
3532
+ - REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES =
3533
+ 1215;
3534
+ - REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216;
3535
+ - REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC
3536
+ = 1217;
3537
+
3538
+ - INJECTED_SOLUTION_ERROR = 20;
3539
+
3540
+ - INJECTED_SOLUTION_MISSING_LABEL = 2000;
3541
+ - INJECTED_SOLUTION_DUPLICATE_LABEL = 2001;
3542
+ - INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002;
3543
+ - INJECTED_SOLUTION_INFEASIBLE_AFTER_GETTING_TRAVEL_TIMES
3544
+ = 2003;
3545
+ - INJECTED_SOLUTION_TRANSITION_INCONSISTENT_WITH_ACTUAL_TRAVEL
3546
+ = 2004;
3547
+ - INJECTED_SOLUTION_CONCURRENT_SOLUTION_TYPES = 2005;
3548
+ - INJECTED_SOLUTION_MORE_THAN_ONE_PER_TYPE = 2006;
3549
+ - INJECTED_SOLUTION_REFRESH_WITHOUT_POPULATE = 2008;
3550
+ - INJECTED_SOLUTION_CONSTRAINED_ROUTE_PORTION_INFEASIBLE
3551
+ = 2010;
3552
+
3553
+ - SHIPMENT_MODEL_ERROR = 22;
3554
+
3555
+ - SHIPMENT_MODEL_TOO_LARGE = 2200;
3556
+ - SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201;
3557
+ - SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN =
3558
+ 2202;
3559
+ - SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN =
3560
+ 2203;
3561
+ - SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME
3562
+ = 2204;
3563
+ - SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205;
3564
+ - SHIPMENT_MODEL_MAX_ACTIVE_VEHICLES_NOT_POSITIVE =
3565
+ 2206;
3566
+ - SHIPMENT_MODEL_DURATION_MATRIX_TOO_LARGE = 2207;
3567
+
3568
+ - INDEX_ERROR = 24;
3569
+
3570
+ - TAG_ERROR = 26;
3571
+
3572
+ - TIME_WINDOW_ERROR = 28;
3573
+
3574
+ - TIME_WINDOW_INVALID_START_TIME = 2800;
3575
+ - TIME_WINDOW_INVALID_END_TIME = 2801;
3576
+ - TIME_WINDOW_INVALID_SOFT_START_TIME = 2802;
3577
+ - TIME_WINDOW_INVALID_SOFT_END_TIME = 2803;
3578
+ - TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804;
3579
+ - TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805;
3580
+ - TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME
3581
+ = 2806;
3582
+ - TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME
3583
+ = 2807;
3584
+ - TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME
3585
+ = 2808;
3586
+ - TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME
3587
+ = 2809;
3588
+ - TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME
3589
+ = 2810;
3590
+ - TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME
3591
+ = 2811;
3592
+ - TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS
3593
+ = 2812;
3594
+ - TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813;
3595
+ - TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814;
3596
+ - TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815;
3597
+ - TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816;
3598
+ - TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS
3599
+ = 2817;
3600
+ - TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS
3601
+ = 2818;
3602
+ - TRANSITION_ATTRIBUTES_ERROR = 30;
3603
+ - TRANSITION_ATTRIBUTES_INVALID_COST = 3000;
3604
+ - TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER =
3605
+ 3001;
3606
+ - TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002;
3607
+ - TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED
3608
+ = 3003;
3609
+ - TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004;
3610
+ - TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS =
3611
+ 3005;
3612
+ - TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS =
3613
+ 3006;
3614
+ - TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS
3615
+ = 3007;
3616
+ - TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN =
3617
+ 3008;
3618
+ - TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION
3619
+ = 3009;
3620
+
3621
+ - AMOUNT_ERROR = 31;
3622
+
3623
+ - AMOUNT_NEGATIVE_VALUE = 3100;
3624
+
3625
+ - LOAD_LIMIT_ERROR = 33;
3626
+
3627
+ - LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303;
3628
+ - LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX =
3629
+ 3304;
3630
+ - LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX =
3631
+ 3305;
3632
+ - LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306;
3633
+ - LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307;
3634
+ - LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308;
3635
+ - LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309;
3636
+
3637
+ - INTERVAL_ERROR = 34;
3638
+
3639
+ - INTERVAL_MIN_EXCEEDS_MAX = 3401;
3640
+ - INTERVAL_NEGATIVE_MIN = 3402;
3641
+ - INTERVAL_NEGATIVE_MAX = 3403;
3642
+ - INTERVAL_MIN_EXCEEDS_CAPACITY = 3404;
3643
+ - INTERVAL_MAX_EXCEEDS_CAPACITY = 3405;
3644
+
3645
+ - DISTANCE_LIMIT_ERROR = 36;
3646
+
3647
+ - DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601;
3648
+ - DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX =
3649
+ 3602;
3650
+ - DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX =
3651
+ 3603;
3652
+ - DISTANCE_LIMIT_NEGATIVE_MAX = 3604;
3653
+ - DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605;
3654
+ - DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606;
3655
+
3656
+ - DURATION_LIMIT_ERROR = 38;
3657
+
3658
+ - DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800;
3659
+ - DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN =
3660
+ 3801;
3661
+ - DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX =
3662
+ 3802;
3663
+ - DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX =
3664
+ 3803;
3665
+ - DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX =
3666
+ 3804;
3667
+ - DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN
3668
+ = 3805;
3669
+ - DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX =
3670
+ 3806;
3671
+ - DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR
3672
+ = 3807;
3673
+ - DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX
3674
+ = 3808;
3675
+ - DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809;
3676
+ - DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810;
3677
+ - DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX =
3678
+ 3811;
3679
+ - DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE
3680
+ = 3812;
3681
+ - DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION =
3682
+ 3813;
3683
+ - DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION
3684
+ = 3814;
3685
+ - DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION
3686
+ = 3815;
3687
+
3688
+ - SHIPMENT_ERROR = 40;
3689
+
3690
+ - SHIPMENT_PD_LIMIT_WITHOUT_PICKUP_AND_DELIVERY = 4014;
3691
+ - SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN
3692
+ = 4000;
3693
+ - SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION
3694
+ = 4001;
3695
+ - SHIPMENT_PD_RELATIVE_DETOUR_LIMIT_INVALID = 4015;
3696
+ - SHIPMENT_PD_DETOUR_LIMIT_AND_EXTRA_VISIT_DURATION =
3697
+ 4016;
3698
+ - SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN =
3699
+ 4002;
3700
+ - SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION
3701
+ = 4003;
3702
+ - SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004;
3703
+ - SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005;
3704
+ - SHIPMENT_INVALID_PENALTY_COST = 4006;
3705
+ - SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007;
3706
+ - SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008;
3707
+ - SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX
3708
+ = 4009;
3709
+ - SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX
3710
+ = 4010;
3711
+ - SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011;
3712
+ - SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012;
3713
+ - SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013;
3714
+
3715
+ - VEHICLE_ERROR = 42;
3716
+
3717
+ - VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200;
3718
+ - VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201;
3719
+ - VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE =
3720
+ 4202;
3721
+ - VEHICLE_EMPTY_START_TAG = 4203;
3722
+ - VEHICLE_DUPLICATE_START_TAG = 4204;
3723
+ - VEHICLE_EMPTY_END_TAG = 4205;
3724
+ - VEHICLE_DUPLICATE_END_TAG = 4206;
3725
+ - VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207;
3726
+ - VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION =
3727
+ 4208;
3728
+ - VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209;
3729
+ - VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210;
3730
+ - VEHICLE_FIRST_SHIPMENT_IGNORED = 4211;
3731
+ - VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212;
3732
+ - VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213;
3733
+ - VEHICLE_LAST_SHIPMENT_IGNORED = 4214;
3734
+ - VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215;
3735
+ - VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216;
3736
+ - VEHICLE_INVALID_COST_PER_KILOMETER = 4217;
3737
+ - VEHICLE_INVALID_COST_PER_HOUR = 4218;
3738
+ - VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219;
3739
+ - VEHICLE_INVALID_FIXED_COST = 4220;
3740
+ - VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221;
3741
+ - VEHICLE_TRAVEL_DURATION_MULTIPLE_WITH_SHIPMENT_PD_DETOUR_LIMITS
3742
+ = 4223;
3743
+ - VEHICLE_MATRIX_INDEX_WITH_SHIPMENT_PD_DETOUR_LIMITS =
3744
+ 4224;
3745
+ - VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT =
3746
+ 4222;
3747
+
3748
+ - VISIT_REQUEST_ERROR = 44;
3749
+
3750
+ - VISIT_REQUEST_EMPTY_TAG = 4400;
3751
+ - VISIT_REQUEST_DUPLICATE_TAG = 4401;
3752
+ - VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404;
3753
+ - VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405;
3754
+
3755
+ - PRECEDENCE_ERROR = 46;
3756
+
3757
+ - BREAK_ERROR = 48;
3758
+
3759
+ - BREAK_RULE_EMPTY = 4800;
3760
+ - BREAK_REQUEST_UNSPECIFIED_DURATION = 4801;
3761
+ - BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802;
3762
+ - BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803;
3763
+ - BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804;
3764
+ - BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME
3765
+ = 4805;
3766
+ - BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME
3767
+ = 4806;
3768
+ - BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME =
3769
+ 4807;
3770
+ - BREAK_REQUEST_NON_SCHEDULABLE = 4808;
3771
+ - BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN
3772
+ = 4809;
3773
+ - BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN =
3774
+ 4810;
3775
+ - BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION
3776
+ = 4811;
3777
+ - BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION
3778
+ = 4812;
3779
+ - BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813;
3780
+ - BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION =
3781
+ 4814;
3782
+ - BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815;
3783
+
3784
+ - SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50;
3785
+
3786
+ - SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001;
3787
+ - SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES =
3788
+ 5002;
3789
+ - SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003;
3790
+ - SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE
3791
+ = 5004;
3792
+ - SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES
3793
+ = 5005;
3794
+
3795
+ - SHIPMENT_TYPE_REQUIREMENT_ERROR = 52;
3796
+
3797
+ - SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001;
3798
+ - SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002;
3799
+ - SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE =
3800
+ 52003;
3801
+ - SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS =
3802
+ 52004;
3803
+ - SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005;
3804
+ - SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE =
3805
+ 52006;
3806
+ - SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND =
3807
+ 52007;
3808
+ - SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE =
3809
+ 52008;
3810
+ - SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE =
3811
+ 52009;
3812
+ - SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010;
3813
+ - SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011;
3814
+
3815
+ - VEHICLE_OPERATOR_ERROR = 54;
3816
+
3817
+ - VEHICLE_OPERATOR_EMPTY_TYPE = 5400;
3818
+ - VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401;
3819
+ - VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402;
3820
+ - VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403;
3821
+ - VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404;
3822
+
3823
+ - DURATION_SECONDS_MATRIX_ERROR = 56;
3824
+
3825
+ - DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN =
3826
+ 5600;
3827
+ - DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION
3828
+ = 5601;
3829
+ display_name (str):
3830
+ The error display name.
3831
+ fields (MutableSequence[google.maps.routeoptimization_v1.types.OptimizeToursValidationError.FieldReference]):
3832
+ An error context may involve 0, 1 (most of the time) or more
3833
+ fields. For example, referring to vehicle #4 and shipment
3834
+ #2's first pickup can be done as follows:
3835
+
3836
+ ::
3837
+
3838
+ fields { name: "vehicles" index: 4}
3839
+ fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} }
3840
+
3841
+ Note, however, that the cardinality of ``fields`` should not
3842
+ change for a given error code.
3843
+ error_message (str):
3844
+ Human-readable string describing the error. There is a 1:1
3845
+ mapping between ``code`` and ``error_message`` (when code !=
3846
+ "UNSPECIFIED").
3847
+
3848
+ *STABILITY*: Not stable: the error message associated to a
3849
+ given ``code`` may change (hopefully to clarify it) over
3850
+ time. Please rely on the ``display_name`` and ``code``
3851
+ instead.
3852
+ offending_values (str):
3853
+ May contain the value(s) of the field(s).
3854
+ This is not always available. You should
3855
+ absolutely not rely on it and use it only for
3856
+ manual model debugging.
3857
+ """
3858
+
3859
+ class FieldReference(proto.Message):
3860
+ r"""Specifies a context for the validation error. A ``FieldReference``
3861
+ always refers to a given field in this file and follows the same
3862
+ hierarchical structure. For example, we may specify element #2 of
3863
+ ``start_time_windows`` of vehicle #5 using:
3864
+
3865
+ ::
3866
+
3867
+ name: "vehicles" index: 5 sub_field { name: "end_time_windows" index: 2 }
3868
+
3869
+ We however omit top-level entities such as ``OptimizeToursRequest``
3870
+ or ``ShipmentModel`` to avoid crowding the message.
3871
+
3872
+ This message has `oneof`_ fields (mutually exclusive fields).
3873
+ For each oneof, at most one member field can be set at the same time.
3874
+ Setting any member of the oneof automatically clears all other
3875
+ members.
3876
+
3877
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
3878
+
3879
+ Attributes:
3880
+ name (str):
3881
+ Name of the field, e.g., "vehicles".
3882
+ index (int):
3883
+ Index of the field if repeated.
3884
+
3885
+ This field is a member of `oneof`_ ``index_or_key``.
3886
+ key (str):
3887
+ Key if the field is a map.
3888
+
3889
+ This field is a member of `oneof`_ ``index_or_key``.
3890
+ sub_field (google.maps.routeoptimization_v1.types.OptimizeToursValidationError.FieldReference):
3891
+ Recursively nested sub-field, if needed.
3892
+ """
3893
+
3894
+ name: str = proto.Field(
3895
+ proto.STRING,
3896
+ number=1,
3897
+ )
3898
+ index: int = proto.Field(
3899
+ proto.INT32,
3900
+ number=2,
3901
+ oneof="index_or_key",
3902
+ )
3903
+ key: str = proto.Field(
3904
+ proto.STRING,
3905
+ number=4,
3906
+ oneof="index_or_key",
3907
+ )
3908
+ sub_field: "OptimizeToursValidationError.FieldReference" = proto.Field(
3909
+ proto.MESSAGE,
3910
+ number=3,
3911
+ message="OptimizeToursValidationError.FieldReference",
3912
+ )
3913
+
3914
+ code: int = proto.Field(
3915
+ proto.INT32,
3916
+ number=1,
3917
+ )
3918
+ display_name: str = proto.Field(
3919
+ proto.STRING,
3920
+ number=2,
3921
+ )
3922
+ fields: MutableSequence[FieldReference] = proto.RepeatedField(
3923
+ proto.MESSAGE,
3924
+ number=3,
3925
+ message=FieldReference,
3926
+ )
3927
+ error_message: str = proto.Field(
3928
+ proto.STRING,
3929
+ number=4,
3930
+ )
3931
+ offending_values: str = proto.Field(
3932
+ proto.STRING,
3933
+ number=5,
3934
+ )
3935
+
3936
+
3937
+ class InputConfig(proto.Message):
3938
+ r"""Specify an input for
3939
+ [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours].
3940
+
3941
+
3942
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
3943
+
3944
+ Attributes:
3945
+ gcs_source (google.maps.routeoptimization_v1.types.GcsSource):
3946
+ A Google Cloud Storage location. This must be
3947
+ a single object (file).
3948
+
3949
+ This field is a member of `oneof`_ ``source``.
3950
+ data_format (google.maps.routeoptimization_v1.types.DataFormat):
3951
+ Required. The input data format.
3952
+ """
3953
+
3954
+ gcs_source: "GcsSource" = proto.Field(
3955
+ proto.MESSAGE,
3956
+ number=1,
3957
+ oneof="source",
3958
+ message="GcsSource",
3959
+ )
3960
+ data_format: "DataFormat" = proto.Field(
3961
+ proto.ENUM,
3962
+ number=2,
3963
+ enum="DataFormat",
3964
+ )
3965
+
3966
+
3967
+ class OutputConfig(proto.Message):
3968
+ r"""Specify a destination for
3969
+ [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours]
3970
+ results.
3971
+
3972
+
3973
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
3974
+
3975
+ Attributes:
3976
+ gcs_destination (google.maps.routeoptimization_v1.types.GcsDestination):
3977
+ The Google Cloud Storage location to write
3978
+ the output to.
3979
+
3980
+ This field is a member of `oneof`_ ``destination``.
3981
+ data_format (google.maps.routeoptimization_v1.types.DataFormat):
3982
+ Required. The output data format.
3983
+ """
3984
+
3985
+ gcs_destination: "GcsDestination" = proto.Field(
3986
+ proto.MESSAGE,
3987
+ number=1,
3988
+ oneof="destination",
3989
+ message="GcsDestination",
3990
+ )
3991
+ data_format: "DataFormat" = proto.Field(
3992
+ proto.ENUM,
3993
+ number=2,
3994
+ enum="DataFormat",
3995
+ )
3996
+
3997
+
3998
+ class GcsSource(proto.Message):
3999
+ r"""The Google Cloud Storage location where the input file will
4000
+ be read from.
4001
+
4002
+ Attributes:
4003
+ uri (str):
4004
+ Required. URI of a Google Cloud Storage object with the
4005
+ format ``gs://bucket/path/to/object``.
4006
+ """
4007
+
4008
+ uri: str = proto.Field(
4009
+ proto.STRING,
4010
+ number=1,
4011
+ )
4012
+
4013
+
4014
+ class GcsDestination(proto.Message):
4015
+ r"""The Google Cloud Storage location where the output file(s)
4016
+ will be written to.
4017
+
4018
+ Attributes:
4019
+ uri (str):
4020
+ Required. Google Cloud Storage URI.
4021
+ """
4022
+
4023
+ uri: str = proto.Field(
4024
+ proto.STRING,
4025
+ number=1,
4026
+ )
4027
+
4028
+
4029
+ __all__ = tuple(sorted(__protobuf__.manifest))