google-maps-route_optimization-v1 0.a → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +153 -8
  5. data/lib/google/maps/route_optimization/v1/rest.rb +37 -0
  6. data/lib/google/maps/route_optimization/v1/route_optimization/client.rb +1272 -0
  7. data/lib/google/maps/route_optimization/v1/route_optimization/credentials.rb +47 -0
  8. data/lib/google/maps/route_optimization/v1/route_optimization/operations.rb +843 -0
  9. data/lib/google/maps/route_optimization/v1/route_optimization/rest/client.rb +1201 -0
  10. data/lib/google/maps/route_optimization/v1/route_optimization/rest/operations.rb +927 -0
  11. data/lib/google/maps/route_optimization/v1/route_optimization/rest/service_stub.rb +361 -0
  12. data/lib/google/maps/route_optimization/v1/route_optimization/rest.rb +68 -0
  13. data/lib/google/maps/route_optimization/v1/route_optimization.rb +71 -0
  14. data/lib/google/maps/route_optimization/v1/version.rb +7 -2
  15. data/lib/google/maps/route_optimization/v1.rb +45 -0
  16. data/lib/google/maps/routeoptimization/v1/route_optimization_service_pb.rb +93 -0
  17. data/lib/google/maps/routeoptimization/v1/route_optimization_service_services_pb.rb +148 -0
  18. data/lib/google-maps-route_optimization-v1.rb +21 -0
  19. data/proto_docs/README.md +4 -0
  20. data/proto_docs/google/api/client.rb +593 -0
  21. data/proto_docs/google/api/field_behavior.rb +85 -0
  22. data/proto_docs/google/api/launch_stage.rb +71 -0
  23. data/proto_docs/google/api/resource.rb +227 -0
  24. data/proto_docs/google/longrunning/operations.rb +191 -0
  25. data/proto_docs/google/maps/routeoptimization/v1/route_optimization_service.rb +2931 -0
  26. data/proto_docs/google/protobuf/any.rb +145 -0
  27. data/proto_docs/google/protobuf/duration.rb +98 -0
  28. data/proto_docs/google/protobuf/empty.rb +34 -0
  29. data/proto_docs/google/protobuf/timestamp.rb +128 -0
  30. data/proto_docs/google/rpc/status.rb +48 -0
  31. data/proto_docs/google/type/latlng.rb +38 -0
  32. metadata +66 -9
@@ -0,0 +1,2931 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Maps
22
+ module RouteOptimization
23
+ module V1
24
+ # A Universal Resource Identifier that points to a resource that can be read
25
+ # and written by the Route Optimization API.
26
+ # @!attribute [rw] uri
27
+ # @return [::String]
28
+ # The URI of the resource. The resource may not yet exist.
29
+ #
30
+ # The contents of the resource are encoded as either JSON
31
+ # or textproto. Only Google Cloud Storage resources are supported. If the
32
+ # resource is encoded as JSON, the resource name must be suffixed with
33
+ # `.json`. If the resource is encoded as textproto, the resource name must
34
+ # be suffixed with `.txtpb`. For example, a Google Cloud Storage URI to
35
+ # a JSON encoded file might look like: `gs://bucket/path/input/object.json`.
36
+ class Uri
37
+ include ::Google::Protobuf::MessageExts
38
+ extend ::Google::Protobuf::MessageExts::ClassMethods
39
+ end
40
+
41
+ # A request used by the `OptimizeToursUri` method.
42
+ # @!attribute [rw] parent
43
+ # @return [::String]
44
+ # Required. Target project or location to make a call.
45
+ #
46
+ # Format:
47
+ # * `projects/{project-id}`
48
+ # * `projects/{project-id}/locations/{location-id}`
49
+ #
50
+ # If no location is specified, a region will be chosen automatically.
51
+ # @!attribute [rw] input
52
+ # @return [::Google::Maps::RouteOptimization::V1::Uri]
53
+ # Required. The URI of the Cloud Storage object containing the
54
+ # `OptimizeToursRequest`.
55
+ # @!attribute [rw] output
56
+ # @return [::Google::Maps::RouteOptimization::V1::Uri]
57
+ # Required. The URI of the Cloud Storage object that will contain the
58
+ # `OptimizeToursResponse`.
59
+ class OptimizeToursUriRequest
60
+ include ::Google::Protobuf::MessageExts
61
+ extend ::Google::Protobuf::MessageExts::ClassMethods
62
+ end
63
+
64
+ # A response returned by the `OptimizeToursUri` method.
65
+ # @!attribute [rw] output
66
+ # @return [::Google::Maps::RouteOptimization::V1::Uri]
67
+ # Optional. The URI of the Cloud Storage object containing the
68
+ # `OptimizeToursResponse` encoded as either JSON or textproto. If the object
69
+ # was encoded as JSON, the extension of the object name will be
70
+ # `.json`. If the object was encoded as textproto, the extension of the
71
+ # object name will be `.txtpb`.
72
+ #
73
+ # The `crc32_checksum` of the resource can be used to verify the contents of
74
+ # the resource have not been modified.
75
+ class OptimizeToursUriResponse
76
+ include ::Google::Protobuf::MessageExts
77
+ extend ::Google::Protobuf::MessageExts::ClassMethods
78
+ end
79
+
80
+ # Operation metadata for `OptimizeToursUri` calls.
81
+ class OptimizeToursUriMetadata
82
+ include ::Google::Protobuf::MessageExts
83
+ extend ::Google::Protobuf::MessageExts::ClassMethods
84
+ end
85
+
86
+ # Request to batch optimize tours as an asynchronous operation.
87
+ # Each input file should contain one `OptimizeToursRequest`, and each output
88
+ # file will contain one `OptimizeToursResponse`. The request contains
89
+ # information to read/write and parse the files. All the input and output files
90
+ # should be under the same project.
91
+ # @!attribute [rw] parent
92
+ # @return [::String]
93
+ # Required. Target project and location to make a call.
94
+ #
95
+ # Format:
96
+ # * `projects/{project-id}`
97
+ # * `projects/{project-id}/locations/{location-id}`
98
+ #
99
+ # If no location is specified, a region will be chosen automatically.
100
+ # @!attribute [rw] model_configs
101
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::BatchOptimizeToursRequest::AsyncModelConfig>]
102
+ # Required. Input/Output information each purchase model, such as file paths
103
+ # and data formats.
104
+ class BatchOptimizeToursRequest
105
+ include ::Google::Protobuf::MessageExts
106
+ extend ::Google::Protobuf::MessageExts::ClassMethods
107
+
108
+ # Information for solving one optimization model asynchronously.
109
+ # @!attribute [rw] display_name
110
+ # @return [::String]
111
+ # Optional. User defined model name, can be used as alias by users to keep
112
+ # track of models.
113
+ # @!attribute [rw] input_config
114
+ # @return [::Google::Maps::RouteOptimization::V1::InputConfig]
115
+ # Required. Information about the input model.
116
+ # @!attribute [rw] output_config
117
+ # @return [::Google::Maps::RouteOptimization::V1::OutputConfig]
118
+ # Required. The desired output location information.
119
+ class AsyncModelConfig
120
+ include ::Google::Protobuf::MessageExts
121
+ extend ::Google::Protobuf::MessageExts::ClassMethods
122
+ end
123
+ end
124
+
125
+ # Response to a `BatchOptimizeToursRequest`. This is returned in
126
+ # the Long Running Operation after the operation is complete.
127
+ class BatchOptimizeToursResponse
128
+ include ::Google::Protobuf::MessageExts
129
+ extend ::Google::Protobuf::MessageExts::ClassMethods
130
+ end
131
+
132
+ # Operation metadata for `BatchOptimizeToursRequest` calls.
133
+ class BatchOptimizeToursMetadata
134
+ include ::Google::Protobuf::MessageExts
135
+ extend ::Google::Protobuf::MessageExts::ClassMethods
136
+ end
137
+
138
+ # Operation metadata for `OptimizeToursLongRunning` calls.
139
+ class OptimizeToursLongRunningMetadata
140
+ include ::Google::Protobuf::MessageExts
141
+ extend ::Google::Protobuf::MessageExts::ClassMethods
142
+ end
143
+
144
+ # Request to be given to a tour optimization solver which defines the
145
+ # shipment model to solve as well as optimization parameters.
146
+ # @!attribute [rw] parent
147
+ # @return [::String]
148
+ # Required. Target project or location to make a call.
149
+ #
150
+ # Format:
151
+ # * `projects/{project-id}`
152
+ # * `projects/{project-id}/locations/{location-id}`
153
+ #
154
+ # If no location is specified, a region will be chosen automatically.
155
+ # @!attribute [rw] timeout
156
+ # @return [::Google::Protobuf::Duration]
157
+ # If this timeout is set, the server returns a response before the timeout
158
+ # period has elapsed or the server deadline for synchronous requests is
159
+ # reached, whichever is sooner.
160
+ #
161
+ # For asynchronous requests, the server will generate a solution (if
162
+ # possible) before the timeout has elapsed.
163
+ # @!attribute [rw] model
164
+ # @return [::Google::Maps::RouteOptimization::V1::ShipmentModel]
165
+ # Shipment model to solve.
166
+ # @!attribute [rw] solving_mode
167
+ # @return [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest::SolvingMode]
168
+ # By default, the solving mode is `DEFAULT_SOLVE` (0).
169
+ # @!attribute [rw] search_mode
170
+ # @return [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest::SearchMode]
171
+ # Search mode used to solve the request.
172
+ # @!attribute [rw] injected_first_solution_routes
173
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute>]
174
+ # Guide the optimization algorithm in finding a first solution that is
175
+ # similar to a previous solution.
176
+ #
177
+ # The model is constrained when the first solution is built.
178
+ # Any shipments not performed on a route are implicitly skipped in the first
179
+ # solution, but they may be performed in successive solutions.
180
+ #
181
+ # The solution must satisfy some basic validity assumptions:
182
+ #
183
+ # * for all routes, `vehicle_index` must be in range and not be duplicated.
184
+ # * for all visits, `shipment_index` and `visit_request_index` must be
185
+ # in range.
186
+ # * a shipment may only be referenced on one route.
187
+ # * the pickup of a pickup-delivery shipment must be performed before
188
+ # the delivery.
189
+ # * no more than one pickup alternative or delivery alternative of
190
+ # a shipment may be performed.
191
+ # * for all routes, times are increasing (i.e., `vehicle_start_time
192
+ # <= visits[0].start_time <= visits[1].start_time ...
193
+ # <= vehicle_end_time`).
194
+ # * a shipment may only be performed on a vehicle that is allowed. A
195
+ # vehicle is allowed if
196
+ # {::Google::Maps::RouteOptimization::V1::Shipment#allowed_vehicle_indices Shipment.allowed_vehicle_indices}
197
+ # is empty or its `vehicle_index` is included in
198
+ # {::Google::Maps::RouteOptimization::V1::Shipment#allowed_vehicle_indices Shipment.allowed_vehicle_indices}.
199
+ #
200
+ # If the injected solution is not feasible, a validation error is not
201
+ # necessarily returned and an error indicating infeasibility may be returned
202
+ # instead.
203
+ # @!attribute [rw] injected_solution_constraint
204
+ # @return [::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint]
205
+ # Constrain the optimization algorithm to find a final solution that is
206
+ # similar to a previous solution. For example, this may be used to freeze
207
+ # portions of routes which have already been completed or which are to be
208
+ # completed but must not be modified.
209
+ #
210
+ # If the injected solution is not feasible, a validation error is not
211
+ # necessarily returned and an error indicating infeasibility may be returned
212
+ # instead.
213
+ # @!attribute [rw] refresh_details_routes
214
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute>]
215
+ # If non-empty, the given routes will be refreshed, without modifying their
216
+ # underlying sequence of visits or travel times: only other details will be
217
+ # updated. This does not solve the model.
218
+ #
219
+ # As of 2020/11, this only populates the polylines of non-empty routes and
220
+ # requires that `populate_polylines` is true.
221
+ #
222
+ # The `route_polyline` fields of the passed-in routes may be inconsistent
223
+ # with route `transitions`.
224
+ #
225
+ # This field must not be used together with `injected_first_solution_routes`
226
+ # or `injected_solution_constraint`.
227
+ #
228
+ # `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior.
229
+ # Polylines are still populated between all visits in all non-empty routes
230
+ # regardless of whether the related shipments or vehicles are ignored.
231
+ # @!attribute [rw] interpret_injected_solutions_using_labels
232
+ # @return [::Boolean]
233
+ # If true:
234
+ #
235
+ # * uses
236
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_label ShipmentRoute.vehicle_label}
237
+ # instead of `vehicle_index` to
238
+ # match routes in an injected solution with vehicles in the request;
239
+ # reuses the mapping of original
240
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_index ShipmentRoute.vehicle_index}
241
+ # to new
242
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_index ShipmentRoute.vehicle_index}
243
+ # to update
244
+ # {::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint::ConstraintRelaxation#vehicle_indices ConstraintRelaxation.vehicle_indices}
245
+ # if non-empty, but the mapping must be unambiguous (i.e., multiple
246
+ # `ShipmentRoute`s must not share the same original `vehicle_index`).
247
+ # * uses
248
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#shipment_label ShipmentRoute.Visit.shipment_label}
249
+ # instead of `shipment_index`
250
+ # to match visits in an injected solution with shipments in the request;
251
+ # * uses
252
+ # {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label}
253
+ # instead of
254
+ # {::Google::Maps::RouteOptimization::V1::SkippedShipment#index SkippedShipment.index}
255
+ # to
256
+ # match skipped shipments in the injected solution with request
257
+ # shipments.
258
+ #
259
+ # This interpretation applies to the `injected_first_solution_routes`,
260
+ # `injected_solution_constraint`, and `refresh_details_routes` fields.
261
+ # It can be used when shipment or vehicle indices in the request have
262
+ # changed since the solution was created, perhaps because shipments or
263
+ # vehicles have been removed from or added to the request.
264
+ #
265
+ # If true, labels in the following categories must appear at most once in
266
+ # their category:
267
+ #
268
+ # * {::Google::Maps::RouteOptimization::V1::Vehicle#label Vehicle.label} in the
269
+ # request;
270
+ # * {::Google::Maps::RouteOptimization::V1::Shipment#label Shipment.label} in
271
+ # the request;
272
+ # * {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_label ShipmentRoute.vehicle_label} in the injected solution;
273
+ # * {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label} and {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#shipment_label ShipmentRoute.Visit.shipment_label} in
274
+ # the injected solution (except pickup/delivery visit pairs, whose
275
+ # `shipment_label` must appear twice).
276
+ #
277
+ # If a `vehicle_label` in the injected solution does not correspond to a
278
+ # request vehicle, the corresponding route is removed from the solution
279
+ # along with its visits. If a `shipment_label` in the injected solution does
280
+ # not correspond to a request shipment, the corresponding visit is removed
281
+ # from the solution. If a
282
+ # {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label}
283
+ # in the injected solution does not correspond to a request shipment, the
284
+ # `SkippedShipment` is removed from the solution.
285
+ #
286
+ # Removing route visits or entire routes from an injected solution may
287
+ # have an effect on the implied constraints, which may lead to change in
288
+ # solution, validation errors, or infeasibility.
289
+ #
290
+ # NOTE: The caller must ensure that each
291
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#label Vehicle.label} (resp.
292
+ # {::Google::Maps::RouteOptimization::V1::Shipment#label Shipment.label}) uniquely
293
+ # identifies a vehicle (resp. shipment) entity used across the two relevant
294
+ # requests: the past request that produced the `OptimizeToursResponse` used
295
+ # in the injected solution and the current request that includes the injected
296
+ # solution. The uniqueness checks described above are not enough to guarantee
297
+ # this requirement.
298
+ # @!attribute [rw] consider_road_traffic
299
+ # @return [::Boolean]
300
+ # Consider traffic estimation in calculating `ShipmentRoute` fields
301
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition#travel_duration Transition.travel_duration},
302
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#start_time Visit.start_time},
303
+ # and `vehicle_end_time`; in setting the
304
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#has_traffic_infeasibilities ShipmentRoute.has_traffic_infeasibilities}
305
+ # field, and in calculating the
306
+ # [OptimizeToursResponse.total_cost][google.maps.routeoptimization.v1.OptimizeToursResponse.total_cost]
307
+ # field.
308
+ # @!attribute [rw] populate_polylines
309
+ # @return [::Boolean]
310
+ # If true, polylines will be populated in response `ShipmentRoute`s.
311
+ # @!attribute [rw] populate_transition_polylines
312
+ # @return [::Boolean]
313
+ # If true, polylines and route tokens will be populated in response
314
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#transitions ShipmentRoute.transitions}.
315
+ # @!attribute [rw] allow_large_deadline_despite_interruption_risk
316
+ # @return [::Boolean]
317
+ # If this is set, then the request can have a deadline
318
+ # (see https://grpc.io/blog/deadlines) of up to 60 minutes.
319
+ # Otherwise, the maximum deadline is only 30 minutes.
320
+ # Note that long-lived requests have a significantly larger (but still small)
321
+ # risk of interruption.
322
+ # @!attribute [rw] use_geodesic_distances
323
+ # @return [::Boolean]
324
+ # If true, travel distances will be computed using geodesic distances instead
325
+ # of Google Maps distances, and travel times will be computed using geodesic
326
+ # distances with a speed defined by `geodesic_meters_per_second`.
327
+ # @!attribute [rw] geodesic_meters_per_second
328
+ # @return [::Float]
329
+ # When `use_geodesic_distances` is true, this field must be set and defines
330
+ # the speed applied to compute travel times. Its value must be at least 1.0
331
+ # meters/seconds.
332
+ # @!attribute [rw] max_validation_errors
333
+ # @return [::Integer]
334
+ # Truncates the number of validation errors returned. These errors are
335
+ # typically attached to an INVALID_ARGUMENT error payload as a BadRequest
336
+ # error detail (https://cloud.google.com/apis/design/errors#error_details),
337
+ # unless solving_mode=VALIDATE_ONLY: see the
338
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#validation_errors OptimizeToursResponse.validation_errors}
339
+ # field.
340
+ # This defaults to 100 and is capped at 10,000.
341
+ # @!attribute [rw] label
342
+ # @return [::String]
343
+ # Label that may be used to identify this request, reported back in the
344
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#request_label OptimizeToursResponse.request_label}.
345
+ class OptimizeToursRequest
346
+ include ::Google::Protobuf::MessageExts
347
+ extend ::Google::Protobuf::MessageExts::ClassMethods
348
+
349
+ # Defines how the solver should handle the request. In all modes but
350
+ # `VALIDATE_ONLY`, if the request is invalid, you will receive an
351
+ # `INVALID_REQUEST` error. See
352
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursRequest#max_validation_errors max_validation_errors}
353
+ # to cap the number of errors returned.
354
+ module SolvingMode
355
+ # Solve the model. Warnings may be issued in
356
+ # [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors].
357
+ DEFAULT_SOLVE = 0
358
+
359
+ # Only validates the model without solving it: populates as many
360
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#validation_errors OptimizeToursResponse.validation_errors}
361
+ # as possible.
362
+ VALIDATE_ONLY = 1
363
+
364
+ # Only populates
365
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#validation_errors OptimizeToursResponse.validation_errors}
366
+ # or
367
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#skipped_shipments OptimizeToursResponse.skipped_shipments},
368
+ # and doesn't actually solve the rest of the request (`status` and `routes`
369
+ # are unset in the response).
370
+ # If infeasibilities in `injected_solution_constraint` routes are detected
371
+ # they are populated in the
372
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#validation_errors OptimizeToursResponse.validation_errors}
373
+ # field and
374
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#skipped_shipments OptimizeToursResponse.skipped_shipments}
375
+ # is left empty.
376
+ #
377
+ # *IMPORTANT*: not all infeasible shipments are returned here, but only the
378
+ # ones that are detected as infeasible during preprocessing.
379
+ DETECT_SOME_INFEASIBLE_SHIPMENTS = 2
380
+
381
+ # This mode only works if `ShipmentModel.objectives` is not empty. The
382
+ # request is not solved. It is only validated and filled with costs
383
+ # corresponding to the given objectives. Also see the documentation of
384
+ # `ShipmentModel.objectives`. The resulting request is returned as
385
+ # `OptimizeToursResponse.processed_request`.
386
+ #
387
+ # Experimental: See
388
+ # https://developers.google.com/maps/tt/route-optimization/experimental/objectives/make-request
389
+ # for more details.
390
+ TRANSFORM_AND_RETURN_REQUEST = 3
391
+ end
392
+
393
+ # Mode defining the behavior of the search, trading off latency versus
394
+ # solution quality. In all modes, the global request deadline is enforced.
395
+ module SearchMode
396
+ # Unspecified search mode, equivalent to `RETURN_FAST`.
397
+ SEARCH_MODE_UNSPECIFIED = 0
398
+
399
+ # Stop the search after finding the first good solution.
400
+ RETURN_FAST = 1
401
+
402
+ # Spend all the available time to search for better solutions.
403
+ CONSUME_ALL_AVAILABLE_TIME = 2
404
+ end
405
+ end
406
+
407
+ # Response after solving a tour optimization problem containing the routes
408
+ # followed by each vehicle, the shipments which have been skipped and the
409
+ # overall cost of the solution.
410
+ # @!attribute [rw] routes
411
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute>]
412
+ # Routes computed for each vehicle; the i-th route corresponds to the i-th
413
+ # vehicle in the model.
414
+ # @!attribute [rw] request_label
415
+ # @return [::String]
416
+ # Copy of the
417
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursRequest#label OptimizeToursRequest.label},
418
+ # if a label was specified in the request.
419
+ # @!attribute [rw] skipped_shipments
420
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::SkippedShipment>]
421
+ # The list of all shipments skipped.
422
+ # @!attribute [rw] validation_errors
423
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::OptimizeToursValidationError>]
424
+ # List of all the validation errors that we were able to detect
425
+ # independently. See the "MULTIPLE ERRORS" explanation for the
426
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursValidationError OptimizeToursValidationError}
427
+ # message. Instead of errors, this will include warnings in the case
428
+ # `solving_mode` is `DEFAULT_SOLVE`.
429
+ # @!attribute [rw] processed_request
430
+ # @return [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest]
431
+ # In some cases we modify the incoming request before solving it, i.e. adding
432
+ # costs. If solving_mode == TRANSFORM_AND_RETURN_REQUEST, the
433
+ # modified request is returned here.
434
+ #
435
+ # Experimental: See
436
+ # https://developers.google.com/maps/tt/route-optimization/experimental/objectives/make-request
437
+ # for more details.
438
+ # @!attribute [rw] metrics
439
+ # @return [::Google::Maps::RouteOptimization::V1::OptimizeToursResponse::Metrics]
440
+ # Duration, distance and usage metrics for this solution.
441
+ class OptimizeToursResponse
442
+ include ::Google::Protobuf::MessageExts
443
+ extend ::Google::Protobuf::MessageExts::ClassMethods
444
+
445
+ # Overall metrics, aggregated over all routes.
446
+ # @!attribute [rw] aggregated_route_metrics
447
+ # @return [::Google::Maps::RouteOptimization::V1::AggregatedMetrics]
448
+ # Aggregated over the routes. Each metric is the sum (or max, for loads)
449
+ # over all
450
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#metrics ShipmentRoute.metrics}
451
+ # fields of the same name.
452
+ # @!attribute [rw] skipped_mandatory_shipment_count
453
+ # @return [::Integer]
454
+ # Number of mandatory shipments skipped.
455
+ # @!attribute [rw] used_vehicle_count
456
+ # @return [::Integer]
457
+ # Number of vehicles used. Note: if a vehicle route is empty and
458
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#used_if_route_is_empty Vehicle.used_if_route_is_empty}
459
+ # is true, the vehicle is considered used.
460
+ # @!attribute [rw] earliest_vehicle_start_time
461
+ # @return [::Google::Protobuf::Timestamp]
462
+ # The earliest start time for a used vehicle, computed as the minimum over
463
+ # all used vehicles of
464
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_start_time ShipmentRoute.vehicle_start_time}.
465
+ # @!attribute [rw] latest_vehicle_end_time
466
+ # @return [::Google::Protobuf::Timestamp]
467
+ # The latest end time for a used vehicle, computed as the maximum over all
468
+ # used vehicles of
469
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_end_time ShipmentRoute.vehicle_end_time}.
470
+ # @!attribute [rw] costs
471
+ # @return [::Google::Protobuf::Map{::String => ::Float}]
472
+ # Cost of the solution, broken down by cost-related request fields.
473
+ # The keys are proto paths, relative to the input OptimizeToursRequest,
474
+ # e.g. "model.shipments.pickups.cost", and the values are the total cost
475
+ # generated by the corresponding cost field, aggregated over the whole
476
+ # solution. In other words, costs["model.shipments.pickups.cost"] is the
477
+ # sum of all pickup costs over the solution. All costs defined in the model
478
+ # are reported in detail here with the exception of costs related to
479
+ # TransitionAttributes that are only reported in an aggregated way as of
480
+ # 2022/01.
481
+ # @!attribute [rw] total_cost
482
+ # @return [::Float]
483
+ # Total cost of the solution. The sum of all values in the costs map.
484
+ class Metrics
485
+ include ::Google::Protobuf::MessageExts
486
+ extend ::Google::Protobuf::MessageExts::ClassMethods
487
+
488
+ # @!attribute [rw] key
489
+ # @return [::String]
490
+ # @!attribute [rw] value
491
+ # @return [::Float]
492
+ class CostsEntry
493
+ include ::Google::Protobuf::MessageExts
494
+ extend ::Google::Protobuf::MessageExts::ClassMethods
495
+ end
496
+ end
497
+ end
498
+
499
+ # A shipment model contains a set of shipments which must be performed by a
500
+ # set of vehicles, while minimizing the overall cost, which is the sum of:
501
+ #
502
+ # * the cost of routing the vehicles (sum of cost per total time, cost per
503
+ # travel time, and fixed cost over all vehicles).
504
+ # * the unperformed shipment penalties.
505
+ # * the cost of the global duration of the shipments
506
+ # @!attribute [rw] shipments
507
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::Shipment>]
508
+ # Set of shipments which must be performed in the model.
509
+ # @!attribute [rw] vehicles
510
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::Vehicle>]
511
+ # Set of vehicles which can be used to perform visits.
512
+ # @!attribute [rw] objectives
513
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentModel::Objective>]
514
+ # The set of objectives for this model, that we will transform into costs.
515
+ # If not empty, the input model has to be costless.
516
+ # To obtain the modified request, please use `solving_mode` =
517
+ # TRANSFORM_AND_RETURN_REQUEST. Note that the request will not
518
+ # be solved in this case. See corresponding documentation.
519
+ #
520
+ # Experimental: See
521
+ # https://developers.google.com/maps/tt/route-optimization/experimental/objectives/make-request
522
+ # for more details.
523
+ # @!attribute [rw] max_active_vehicles
524
+ # @return [::Integer]
525
+ # Constrains the maximum number of active vehicles. A vehicle is active if
526
+ # its route performs at least one shipment. This can be used to limit the
527
+ # number of routes in the case where there are fewer drivers than
528
+ # vehicles and that the fleet of vehicles is heterogeneous. The optimization
529
+ # will then select the best subset of vehicles to use.
530
+ # Must be strictly positive.
531
+ # @!attribute [rw] global_start_time
532
+ # @return [::Google::Protobuf::Timestamp]
533
+ # Global start and end time of the model: no times outside of this range
534
+ # can be considered valid.
535
+ #
536
+ # The model's time span must be less than a year, i.e. the `global_end_time`
537
+ # and the `global_start_time` must be within 31536000 seconds of each other.
538
+ #
539
+ # When using `cost_per_*hour` fields, you might want to set this window to a
540
+ # smaller interval to increase performance (eg. if you model a single day,
541
+ # you should set the global time limits to that day).
542
+ # If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used
543
+ # as default.
544
+ # @!attribute [rw] global_end_time
545
+ # @return [::Google::Protobuf::Timestamp]
546
+ # If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0)
547
+ # is used as default.
548
+ # @!attribute [rw] global_duration_cost_per_hour
549
+ # @return [::Float]
550
+ # The "global duration" of the overall plan is the difference between the
551
+ # earliest effective start time and the latest effective end time of
552
+ # all vehicles. Users can assign a cost per hour to that quantity to try
553
+ # and optimize for earliest job completion, for example. This cost must be in
554
+ # the same unit as
555
+ # {::Google::Maps::RouteOptimization::V1::Shipment#penalty_cost Shipment.penalty_cost}.
556
+ # @!attribute [rw] duration_distance_matrices
557
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentModel::DurationDistanceMatrix>]
558
+ # Specifies duration and distance matrices used in the model. If this field
559
+ # is empty, Google Maps or geodesic distances will be used instead, depending
560
+ # on the value of the `use_geodesic_distances` field. If it is not empty,
561
+ # `use_geodesic_distances` cannot be true and neither
562
+ # `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags`
563
+ # can be empty.
564
+ #
565
+ # Usage examples:
566
+ #
567
+ # * There are two locations: locA and locB.
568
+ # * 1 vehicle starting its route at locA and ending it at locA.
569
+ # * 1 pickup visit request at locB.
570
+ #
571
+ # ```
572
+ # model {
573
+ # vehicles { start_tags: "locA" end_tags: "locA" }
574
+ # shipments { pickups { tags: "locB" } }
575
+ # duration_distance_matrix_src_tags: "locA"
576
+ # duration_distance_matrix_src_tags: "locB"
577
+ # duration_distance_matrix_dst_tags: "locA"
578
+ # duration_distance_matrix_dst_tags: "locB"
579
+ # duration_distance_matrices {
580
+ # rows { # from: locA
581
+ # durations { seconds: 0 } meters: 0 # to: locA
582
+ # durations { seconds: 100 } meters: 1000 # to: locB
583
+ # }
584
+ # rows { # from: locB
585
+ # durations { seconds: 102 } meters: 990 # to: locA
586
+ # durations { seconds: 0 } meters: 0 # to: locB
587
+ # }
588
+ # }
589
+ # }
590
+ # ```
591
+ #
592
+ # * There are three locations: locA, locB and locC.
593
+ # * 1 vehicle starting its route at locA and ending it at locB, using
594
+ # matrix "fast".
595
+ # * 1 vehicle starting its route at locB and ending it at locB, using
596
+ # matrix "slow".
597
+ # * 1 vehicle starting its route at locB and ending it at locB, using
598
+ # matrix "fast".
599
+ # * 1 pickup visit request at locC.
600
+ #
601
+ # ```
602
+ # model {
603
+ # vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" }
604
+ # vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" }
605
+ # vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" }
606
+ # shipments { pickups { tags: "locC" } }
607
+ # duration_distance_matrix_src_tags: "locA"
608
+ # duration_distance_matrix_src_tags: "locB"
609
+ # duration_distance_matrix_src_tags: "locC"
610
+ # duration_distance_matrix_dst_tags: "locB"
611
+ # duration_distance_matrix_dst_tags: "locC"
612
+ # duration_distance_matrices {
613
+ # vehicle_start_tag: "fast"
614
+ # rows { # from: locA
615
+ # durations { seconds: 1000 } meters: 2000 # to: locB
616
+ # durations { seconds: 600 } meters: 1000 # to: locC
617
+ # }
618
+ # rows { # from: locB
619
+ # durations { seconds: 0 } meters: 0 # to: locB
620
+ # durations { seconds: 700 } meters: 1200 # to: locC
621
+ # }
622
+ # rows { # from: locC
623
+ # durations { seconds: 702 } meters: 1190 # to: locB
624
+ # durations { seconds: 0 } meters: 0 # to: locC
625
+ # }
626
+ # }
627
+ # duration_distance_matrices {
628
+ # vehicle_start_tag: "slow"
629
+ # rows { # from: locA
630
+ # durations { seconds: 1800 } meters: 2001 # to: locB
631
+ # durations { seconds: 900 } meters: 1002 # to: locC
632
+ # }
633
+ # rows { # from: locB
634
+ # durations { seconds: 0 } meters: 0 # to: locB
635
+ # durations { seconds: 1000 } meters: 1202 # to: locC
636
+ # }
637
+ # rows { # from: locC
638
+ # durations { seconds: 1001 } meters: 1195 # to: locB
639
+ # durations { seconds: 0 } meters: 0 # to: locC
640
+ # }
641
+ # }
642
+ # }
643
+ # ```
644
+ # @!attribute [rw] duration_distance_matrix_src_tags
645
+ # @return [::Array<::String>]
646
+ # Tags defining the sources of the duration and distance matrices;
647
+ # `duration_distance_matrices(i).rows(j)` defines durations and distances
648
+ # from visits with tag `duration_distance_matrix_src_tags(j)` to other visits
649
+ # in matrix i.
650
+ #
651
+ # Tags correspond to
652
+ # {::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest#tags VisitRequest.tags}
653
+ # or
654
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#start_tags Vehicle.start_tags}.
655
+ # A given `VisitRequest` or `Vehicle` must match exactly one tag in this
656
+ # field. Note that a `Vehicle`'s source, destination and matrix tags may be
657
+ # the same; similarly a `VisitRequest`'s source and destination tags may be
658
+ # the same. All tags must be different and cannot be empty strings. If this
659
+ # field is not empty, then `duration_distance_matrices` must not be empty.
660
+ # @!attribute [rw] duration_distance_matrix_dst_tags
661
+ # @return [::Array<::String>]
662
+ # Tags defining the destinations of the duration and distance matrices;
663
+ # `duration_distance_matrices(i).rows(j).durations(k)` (resp.
664
+ # `duration_distance_matrices(i).rows(j).meters(k))` defines the duration
665
+ # (resp. the distance) of the travel from visits with tag
666
+ # `duration_distance_matrix_src_tags(j)` to visits with tag
667
+ # `duration_distance_matrix_dst_tags(k)` in matrix i.
668
+ #
669
+ # Tags correspond to
670
+ # {::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest#tags VisitRequest.tags}
671
+ # or
672
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#start_tags Vehicle.start_tags}.
673
+ # A given `VisitRequest` or `Vehicle` must match exactly one tag in this
674
+ # field. Note that a `Vehicle`'s source, destination and matrix tags may be
675
+ # the same; similarly a `VisitRequest`'s source and destination tags may be
676
+ # the same. All tags must be different and cannot be empty strings. If this
677
+ # field is not empty, then `duration_distance_matrices` must not be empty.
678
+ # @!attribute [rw] transition_attributes
679
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::TransitionAttributes>]
680
+ # Transition attributes added to the model.
681
+ # @!attribute [rw] shipment_type_incompatibilities
682
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentTypeIncompatibility>]
683
+ # Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`).
684
+ # @!attribute [rw] shipment_type_requirements
685
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentTypeRequirement>]
686
+ # Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`).
687
+ # @!attribute [rw] precedence_rules
688
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentModel::PrecedenceRule>]
689
+ # Set of precedence rules which must be enforced in the model.
690
+ #
691
+ # *IMPORTANT*: Use of precedence rules limits the size of problem that can be
692
+ # optimized. Requests using precedence rules that include many shipments may
693
+ # be rejected.
694
+ class ShipmentModel
695
+ include ::Google::Protobuf::MessageExts
696
+ extend ::Google::Protobuf::MessageExts::ClassMethods
697
+
698
+ # Objectives replace the cost model completely, and are therefore
699
+ # incompatible with pre-existing costs. Each objective maps to a number of
700
+ # pre-defined costs for, e.g., vehicles, shipments or transition attributes.
701
+ #
702
+ # Experimental: See
703
+ # https://developers.google.com/maps/tt/route-optimization/experimental/objectives/make-request
704
+ # for more details.
705
+ # @!attribute [rw] type
706
+ # @return [::Google::Maps::RouteOptimization::V1::ShipmentModel::Objective::Type]
707
+ # The type of the objective.
708
+ # @!attribute [rw] weight
709
+ # @return [::Float]
710
+ # How much this objective should count relatively to the others. This can
711
+ # be any non-negative number, weights do not have to sum to 1. Weights
712
+ # default to 1.0.
713
+ class Objective
714
+ include ::Google::Protobuf::MessageExts
715
+ extend ::Google::Protobuf::MessageExts::ClassMethods
716
+
717
+ # The objective type that will be mapped to a set of costs.
718
+ module Type
719
+ # A default set of costs will be used, to ensure a reasonable solution.
720
+ # Note: this objective can be used on its own, but will also always be
721
+ # added with weight 1.0, as a baseline, to the objectives specified by
722
+ # the user, if it's not already present.
723
+ DEFAULT = 0
724
+
725
+ # "MIN" objectives.
726
+ # Minimize the total distance traveled.
727
+ MIN_DISTANCE = 10
728
+
729
+ # Minimize the total working time, summed over all vehicles.
730
+ MIN_WORKING_TIME = 11
731
+
732
+ # Same as above but focusing on travel time only.
733
+ MIN_TRAVEL_TIME = 12
734
+
735
+ # Minimize the number of vehicles used.
736
+ MIN_NUM_VEHICLES = 13
737
+ end
738
+ end
739
+
740
+ # Specifies a duration and distance matrix from visit and vehicle start
741
+ # locations to visit and vehicle end locations.
742
+ # @!attribute [rw] rows
743
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentModel::DurationDistanceMatrix::Row>]
744
+ # Specifies the rows of the duration and distance matrix. It must have as
745
+ # many elements as
746
+ # {::Google::Maps::RouteOptimization::V1::ShipmentModel#duration_distance_matrix_src_tags ShipmentModel.duration_distance_matrix_src_tags}.
747
+ # @!attribute [rw] vehicle_start_tag
748
+ # @return [::String]
749
+ # Tag defining to which vehicles this duration and distance matrix applies.
750
+ # If empty, this applies to all vehicles, and there can only be a single
751
+ # matrix.
752
+ #
753
+ # Each vehicle start must match exactly one matrix, i.e. exactly one of
754
+ # their `start_tags` field must match the `vehicle_start_tag` of a matrix
755
+ # (and of that matrix only).
756
+ #
757
+ # All matrices must have a different `vehicle_start_tag`.
758
+ class DurationDistanceMatrix
759
+ include ::Google::Protobuf::MessageExts
760
+ extend ::Google::Protobuf::MessageExts::ClassMethods
761
+
762
+ # Specifies a row of the duration and distance matrix.
763
+ # @!attribute [rw] durations
764
+ # @return [::Array<::Google::Protobuf::Duration>]
765
+ # Duration values for a given row. It must have as many elements as
766
+ # {::Google::Maps::RouteOptimization::V1::ShipmentModel#duration_distance_matrix_dst_tags ShipmentModel.duration_distance_matrix_dst_tags}.
767
+ # @!attribute [rw] meters
768
+ # @return [::Array<::Float>]
769
+ # Distance values for a given row. If no costs or constraints refer to
770
+ # distances in the model, this can be left empty; otherwise it must have
771
+ # as many elements as `durations`.
772
+ class Row
773
+ include ::Google::Protobuf::MessageExts
774
+ extend ::Google::Protobuf::MessageExts::ClassMethods
775
+ end
776
+ end
777
+
778
+ # A precedence rule between two events (each event is the pickup or the
779
+ # delivery of a shipment): the "second" event has to start at least
780
+ # `offset_duration` after "first" has started.
781
+ #
782
+ # Several precedences can refer to the same (or related) events, e.g.,
783
+ # "pickup of B happens after delivery of A" and "pickup of C happens after
784
+ # pickup of B".
785
+ #
786
+ # Furthermore, precedences only apply when both shipments are performed and
787
+ # are otherwise ignored.
788
+ # @!attribute [rw] first_index
789
+ # @return [::Integer]
790
+ # Shipment index of the "first" event. This field must be specified.
791
+ # @!attribute [rw] first_is_delivery
792
+ # @return [::Boolean]
793
+ # Indicates if the "first" event is a delivery.
794
+ # @!attribute [rw] second_index
795
+ # @return [::Integer]
796
+ # Shipment index of the "second" event. This field must be specified.
797
+ # @!attribute [rw] second_is_delivery
798
+ # @return [::Boolean]
799
+ # Indicates if the "second" event is a delivery.
800
+ # @!attribute [rw] offset_duration
801
+ # @return [::Google::Protobuf::Duration]
802
+ # The offset between the "first" and "second" event. It can be negative.
803
+ class PrecedenceRule
804
+ include ::Google::Protobuf::MessageExts
805
+ extend ::Google::Protobuf::MessageExts::ClassMethods
806
+ end
807
+ end
808
+
809
+ # The shipment of a single item, from one of its pickups to one of its
810
+ # deliveries. For the shipment to be considered as performed, a unique vehicle
811
+ # must visit one of its pickup locations (and decrease its spare capacities
812
+ # accordingly), then visit one of its delivery locations later on (and
813
+ # therefore re-increase its spare capacities accordingly).
814
+ # @!attribute [rw] display_name
815
+ # @return [::String]
816
+ # The user-defined display name of the shipment.
817
+ # It can be up to 63 characters long and may use UTF-8 characters.
818
+ # @!attribute [rw] pickups
819
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest>]
820
+ # Set of pickup alternatives associated to the shipment. If not specified,
821
+ # the vehicle only needs to visit a location corresponding to the deliveries.
822
+ # @!attribute [rw] deliveries
823
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest>]
824
+ # Set of delivery alternatives associated to the shipment. If not specified,
825
+ # the vehicle only needs to visit a location corresponding to the pickups.
826
+ # @!attribute [rw] load_demands
827
+ # @return [::Google::Protobuf::Map{::String => ::Google::Maps::RouteOptimization::V1::Shipment::Load}]
828
+ # Load demands of the shipment (for example weight, volume, number of
829
+ # pallets etc). The keys in the map should be identifiers describing the type
830
+ # of the corresponding load, ideally also including the units.
831
+ # For example: "weight_kg", "volume_gallons", "pallet_count", etc.
832
+ # If a given key does not appear in the map, the corresponding load is
833
+ # considered as null.
834
+ # @!attribute [rw] penalty_cost
835
+ # @return [::Float]
836
+ # If the shipment is not completed, this penalty is added to the overall
837
+ # cost of the routes. A shipment is considered completed if one of its pickup
838
+ # and delivery alternatives is visited. The cost may be expressed in the
839
+ # same unit used for all other cost-related fields in the model and must be
840
+ # positive.
841
+ #
842
+ # *IMPORTANT*: If this penalty is not specified, it is considered infinite,
843
+ # i.e. the shipment must be completed.
844
+ # @!attribute [rw] allowed_vehicle_indices
845
+ # @return [::Array<::Integer>]
846
+ # The set of vehicles that may perform this shipment. If empty, all vehicles
847
+ # may perform it. Vehicles are given by their index in the `ShipmentModel`'s
848
+ # `vehicles` list.
849
+ # @!attribute [rw] costs_per_vehicle
850
+ # @return [::Array<::Float>]
851
+ # Specifies the cost that is incurred when this shipment is delivered by each
852
+ # vehicle. If specified, it must have EITHER:
853
+ #
854
+ # * the same number of elements as `costs_per_vehicle_indices`.
855
+ # `costs_per_vehicle[i]` corresponds to vehicle
856
+ # `costs_per_vehicle_indices[i]` of the model.
857
+ # * the same number of elements as there are vehicles in the model. The
858
+ # i-th element corresponds to vehicle #i of the model.
859
+ #
860
+ # These costs must be in the same unit as `penalty_cost` and must not be
861
+ # negative. Leave this field empty, if there are no such costs.
862
+ # @!attribute [rw] costs_per_vehicle_indices
863
+ # @return [::Array<::Integer>]
864
+ # Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty,
865
+ # it must have the same number of elements as `costs_per_vehicle`. A vehicle
866
+ # index may not be specified more than once. If a vehicle is excluded from
867
+ # `costs_per_vehicle_indices`, its cost is zero.
868
+ # @!attribute [rw] pickup_to_delivery_relative_detour_limit
869
+ # @return [::Float]
870
+ # Specifies the maximum relative detour time compared to the shortest path
871
+ # from pickup to delivery. If specified, it must be nonnegative, and the
872
+ # shipment must contain at least a pickup and a delivery.
873
+ #
874
+ # For example, let t be the shortest time taken to go from the selected
875
+ # pickup alternative directly to the selected delivery alternative. Then
876
+ # setting `pickup_to_delivery_relative_detour_limit` enforces:
877
+ #
878
+ # ```
879
+ # start_time(delivery) - start_time(pickup) <=
880
+ # std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit))
881
+ # ```
882
+ #
883
+ # If both relative and absolute limits are specified on the same shipment,
884
+ # the more constraining limit is used for each possible pickup/delivery pair.
885
+ # As of 2017/10, detours are only supported when travel durations do not
886
+ # depend on vehicles.
887
+ # @!attribute [rw] pickup_to_delivery_absolute_detour_limit
888
+ # @return [::Google::Protobuf::Duration]
889
+ # Specifies the maximum absolute detour time compared to the shortest path
890
+ # from pickup to delivery. If specified, it must be nonnegative, and the
891
+ # shipment must contain at least a pickup and a delivery.
892
+ #
893
+ # For example, let t be the shortest time taken to go from the selected
894
+ # pickup alternative directly to the selected delivery alternative. Then
895
+ # setting `pickup_to_delivery_absolute_detour_limit` enforces:
896
+ #
897
+ # ```
898
+ # start_time(delivery) - start_time(pickup) <=
899
+ # t + pickup_to_delivery_absolute_detour_limit
900
+ # ```
901
+ #
902
+ # If both relative and absolute limits are specified on the same shipment,
903
+ # the more constraining limit is used for each possible pickup/delivery pair.
904
+ # As of 2017/10, detours are only supported when travel durations do not
905
+ # depend on vehicles.
906
+ # @!attribute [rw] pickup_to_delivery_time_limit
907
+ # @return [::Google::Protobuf::Duration]
908
+ # Specifies the maximum duration from start of pickup to start of delivery of
909
+ # a shipment. If specified, it must be nonnegative, and the shipment must
910
+ # contain at least a pickup and a delivery. This does not depend on which
911
+ # alternatives are selected for pickup and delivery, nor on vehicle speed.
912
+ # This can be specified alongside maximum detour constraints: the solution
913
+ # will respect both specifications.
914
+ # @!attribute [rw] shipment_type
915
+ # @return [::String]
916
+ # Non-empty string specifying a "type" for this shipment.
917
+ # This feature can be used to define incompatibilities or requirements
918
+ # between `shipment_types` (see `shipment_type_incompatibilities` and
919
+ # `shipment_type_requirements` in `ShipmentModel`).
920
+ #
921
+ # Differs from `visit_types` which is specified for a single visit: All
922
+ # pickup/deliveries belonging to the same shipment share the same
923
+ # `shipment_type`.
924
+ # @!attribute [rw] label
925
+ # @return [::String]
926
+ # Specifies a label for this shipment. This label is reported in the response
927
+ # in the `shipment_label` of the corresponding
928
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit ShipmentRoute.Visit}.
929
+ # @!attribute [rw] ignore
930
+ # @return [::Boolean]
931
+ # If true, skip this shipment, but don't apply a `penalty_cost`.
932
+ #
933
+ # Ignoring a shipment results in a validation error when there are any
934
+ # `shipment_type_requirements` in the model.
935
+ #
936
+ # Ignoring a shipment that is performed in `injected_first_solution_routes`
937
+ # or `injected_solution_constraint` is permitted; the solver removes the
938
+ # related pickup/delivery visits from the performing route.
939
+ # `precedence_rules` that reference ignored shipments will also be ignored.
940
+ class Shipment
941
+ include ::Google::Protobuf::MessageExts
942
+ extend ::Google::Protobuf::MessageExts::ClassMethods
943
+
944
+ # Request for a visit which can be done by a vehicle: it has a geo-location
945
+ # (or two, see below), opening and closing times represented by time windows,
946
+ # and a service duration time (time spent by the vehicle once it has arrived
947
+ # to pickup or drop off goods).
948
+ # @!attribute [rw] arrival_location
949
+ # @return [::Google::Type::LatLng]
950
+ # The geo-location where the vehicle arrives when performing this
951
+ # `VisitRequest`. If the shipment model has duration distance matrices,
952
+ # `arrival_location` must not be specified.
953
+ # @!attribute [rw] arrival_waypoint
954
+ # @return [::Google::Maps::RouteOptimization::V1::Waypoint]
955
+ # The waypoint where the vehicle arrives when performing this
956
+ # `VisitRequest`. If the shipment model has duration distance matrices,
957
+ # `arrival_waypoint` must not be specified.
958
+ # @!attribute [rw] departure_location
959
+ # @return [::Google::Type::LatLng]
960
+ # The geo-location where the vehicle departs after completing this
961
+ # `VisitRequest`. Can be omitted if it is the same as `arrival_location`.
962
+ # If the shipment model has duration distance matrices,
963
+ # `departure_location` must not be specified.
964
+ # @!attribute [rw] departure_waypoint
965
+ # @return [::Google::Maps::RouteOptimization::V1::Waypoint]
966
+ # The waypoint where the vehicle departs after completing this
967
+ # `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`.
968
+ # If the shipment model has duration distance matrices,
969
+ # `departure_waypoint` must not be specified.
970
+ # @!attribute [rw] tags
971
+ # @return [::Array<::String>]
972
+ # Specifies tags attached to the visit request.
973
+ # Empty or duplicate strings are not allowed.
974
+ # @!attribute [rw] time_windows
975
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::TimeWindow>]
976
+ # Time windows which constrain the arrival time at a visit.
977
+ # Note that a vehicle may depart outside of the arrival time window, i.e.
978
+ # arrival time + duration do not need to be inside a time window. This can
979
+ # result in waiting time if the vehicle arrives before
980
+ # {::Google::Maps::RouteOptimization::V1::TimeWindow#start_time TimeWindow.start_time}.
981
+ #
982
+ # The absence of `TimeWindow` means that the vehicle can perform this visit
983
+ # at any time.
984
+ #
985
+ # Time windows must be disjoint, i.e. no time window must overlap with or
986
+ # be adjacent to another, and they must be in increasing order.
987
+ #
988
+ # `cost_per_hour_after_soft_end_time` and `soft_end_time` can only
989
+ # be set if there is a single time window.
990
+ # @!attribute [rw] duration
991
+ # @return [::Google::Protobuf::Duration]
992
+ # Duration of the visit, i.e. time spent by the vehicle between arrival
993
+ # and departure (to be added to the possible waiting time; see
994
+ # `time_windows`).
995
+ # @!attribute [rw] cost
996
+ # @return [::Float]
997
+ # Cost to service this visit request on a vehicle route. This can be used
998
+ # to pay different costs for each alternative pickup or delivery of a
999
+ # shipment. This cost must be in the same unit as `Shipment.penalty_cost`
1000
+ # and must not be negative.
1001
+ # @!attribute [rw] load_demands
1002
+ # @return [::Google::Protobuf::Map{::String => ::Google::Maps::RouteOptimization::V1::Shipment::Load}]
1003
+ # Load demands of this visit request. This is just like
1004
+ # {::Google::Maps::RouteOptimization::V1::Shipment#load_demands Shipment.load_demands}
1005
+ # field, except that it only applies to this
1006
+ # {::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest VisitRequest}
1007
+ # instead of the whole
1008
+ # {::Google::Maps::RouteOptimization::V1::Shipment Shipment}. The demands listed
1009
+ # here are added to the demands listed in
1010
+ # {::Google::Maps::RouteOptimization::V1::Shipment#load_demands Shipment.load_demands}.
1011
+ # @!attribute [rw] visit_types
1012
+ # @return [::Array<::String>]
1013
+ # Specifies the types of the visit. This may be used to allocate additional
1014
+ # time required for a vehicle to complete this visit (see
1015
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#extra_visit_duration_for_visit_type Vehicle.extra_visit_duration_for_visit_type}).
1016
+ #
1017
+ # A type can only appear once.
1018
+ # @!attribute [rw] label
1019
+ # @return [::String]
1020
+ # Specifies a label for this `VisitRequest`. This label is reported in the
1021
+ # response as `visit_label` in the corresponding
1022
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit ShipmentRoute.Visit}.
1023
+ # @!attribute [rw] avoid_u_turns
1024
+ # @return [::Boolean]
1025
+ # Specifies whether U-turns should be avoided in driving routes at this
1026
+ # location.
1027
+ # U-turn avoidance is best effort and complete avoidance is not guaranteed.
1028
+ # This is an experimental feature and behavior is subject to change.
1029
+ #
1030
+ # Experimental: See
1031
+ # https://developers.google.com/maps/tt/route-optimization/experimental/u-turn-avoidance/make-request
1032
+ # for more details.
1033
+ class VisitRequest
1034
+ include ::Google::Protobuf::MessageExts
1035
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1036
+
1037
+ # @!attribute [rw] key
1038
+ # @return [::String]
1039
+ # @!attribute [rw] value
1040
+ # @return [::Google::Maps::RouteOptimization::V1::Shipment::Load]
1041
+ class LoadDemandsEntry
1042
+ include ::Google::Protobuf::MessageExts
1043
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1044
+ end
1045
+ end
1046
+
1047
+ # When performing a visit, a predefined amount may be added to the vehicle
1048
+ # load if it's a pickup, or subtracted if it's a delivery. This message
1049
+ # defines such amount. See
1050
+ # {::Google::Maps::RouteOptimization::V1::Shipment#load_demands load_demands}.
1051
+ # @!attribute [rw] amount
1052
+ # @return [::Integer]
1053
+ # The amount by which the load of the vehicle performing the corresponding
1054
+ # visit will vary. Since it is an integer, users are advised to choose an
1055
+ # appropriate unit to avoid loss of precision. Must be ≥ 0.
1056
+ class Load
1057
+ include ::Google::Protobuf::MessageExts
1058
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1059
+ end
1060
+
1061
+ # @!attribute [rw] key
1062
+ # @return [::String]
1063
+ # @!attribute [rw] value
1064
+ # @return [::Google::Maps::RouteOptimization::V1::Shipment::Load]
1065
+ class LoadDemandsEntry
1066
+ include ::Google::Protobuf::MessageExts
1067
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1068
+ end
1069
+ end
1070
+
1071
+ # Specifies incompatibilties between shipments depending on their
1072
+ # shipment_type. The appearance of incompatible shipments on the same route is
1073
+ # restricted based on the incompatibility mode.
1074
+ # @!attribute [rw] types
1075
+ # @return [::Array<::String>]
1076
+ # List of incompatible types. Two shipments having different `shipment_types`
1077
+ # among those listed are "incompatible".
1078
+ # @!attribute [rw] incompatibility_mode
1079
+ # @return [::Google::Maps::RouteOptimization::V1::ShipmentTypeIncompatibility::IncompatibilityMode]
1080
+ # Mode applied to the incompatibility.
1081
+ class ShipmentTypeIncompatibility
1082
+ include ::Google::Protobuf::MessageExts
1083
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1084
+
1085
+ # Modes defining how the appearance of incompatible shipments are restricted
1086
+ # on the same route.
1087
+ module IncompatibilityMode
1088
+ # Unspecified incompatibility mode. This value should never be used.
1089
+ INCOMPATIBILITY_MODE_UNSPECIFIED = 0
1090
+
1091
+ # In this mode, two shipments with incompatible types can never share the
1092
+ # same vehicle.
1093
+ NOT_PERFORMED_BY_SAME_VEHICLE = 1
1094
+
1095
+ # In this mode, two shipments with incompatible types can never be on the
1096
+ # same vehicle at the same time:
1097
+ # * They can share the same vehicle only if one is delivered before the
1098
+ # other is picked up.
1099
+ # * When both shipments are pickups-only (no deliveries) or deliveries-only
1100
+ # (no pickups), they can't share the same vehicle at all.
1101
+ NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY = 2
1102
+ end
1103
+ end
1104
+
1105
+ # Specifies requirements between shipments based on their shipment_type.
1106
+ # The specifics of the requirement are defined by the requirement mode.
1107
+ # @!attribute [rw] required_shipment_type_alternatives
1108
+ # @return [::Array<::String>]
1109
+ # List of alternative shipment types required by the
1110
+ # `dependent_shipment_types`.
1111
+ # @!attribute [rw] dependent_shipment_types
1112
+ # @return [::Array<::String>]
1113
+ # All shipments with a type in the `dependent_shipment_types` field require
1114
+ # at least one shipment of type `required_shipment_type_alternatives` to be
1115
+ # visited on the same route.
1116
+ #
1117
+ # NOTE: Chains of requirements such that a `shipment_type` depends on itself
1118
+ # are not allowed.
1119
+ # @!attribute [rw] requirement_mode
1120
+ # @return [::Google::Maps::RouteOptimization::V1::ShipmentTypeRequirement::RequirementMode]
1121
+ # Mode applied to the requirement.
1122
+ class ShipmentTypeRequirement
1123
+ include ::Google::Protobuf::MessageExts
1124
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1125
+
1126
+ # Modes defining the appearance of dependent shipments on a route.
1127
+ module RequirementMode
1128
+ # Unspecified requirement mode. This value should never be used.
1129
+ REQUIREMENT_MODE_UNSPECIFIED = 0
1130
+
1131
+ # In this mode, all "dependent" shipments must share the same vehicle as at
1132
+ # least one of their "required" shipments.
1133
+ PERFORMED_BY_SAME_VEHICLE = 1
1134
+
1135
+ # With the `IN_SAME_VEHICLE_AT_PICKUP_TIME` mode, all "dependent"
1136
+ # shipments need to have at least one "required" shipment on their vehicle
1137
+ # at the time of their pickup.
1138
+ #
1139
+ # A "dependent" shipment pickup must therefore have either:
1140
+ #
1141
+ # * A delivery-only "required" shipment delivered on the route after, or
1142
+ # * A "required" shipment picked up on the route before it, and if the
1143
+ # "required" shipment has a delivery, this delivery must be performed
1144
+ # after the "dependent" shipment's pickup.
1145
+ IN_SAME_VEHICLE_AT_PICKUP_TIME = 2
1146
+
1147
+ # Same as before, except the "dependent" shipments need to have a
1148
+ # "required" shipment on their vehicle at the time of their *delivery*.
1149
+ IN_SAME_VEHICLE_AT_DELIVERY_TIME = 3
1150
+ end
1151
+ end
1152
+
1153
+ # Encapsulates a set of optional conditions to satisfy when calculating
1154
+ # vehicle routes. This is similar to `RouteModifiers` in the Google Maps
1155
+ # Platform Routes Preferred API; see:
1156
+ # https://developers.google.com/maps/documentation/routes/reference/rest/v2/RouteModifiers.
1157
+ # @!attribute [rw] avoid_tolls
1158
+ # @return [::Boolean]
1159
+ # Specifies whether to avoid toll roads where reasonable. Preference will be
1160
+ # given to routes not containing toll roads. Applies only to motorized travel
1161
+ # modes.
1162
+ # @!attribute [rw] avoid_highways
1163
+ # @return [::Boolean]
1164
+ # Specifies whether to avoid highways where reasonable. Preference will be
1165
+ # given to routes not containing highways. Applies only to motorized travel
1166
+ # modes.
1167
+ # @!attribute [rw] avoid_ferries
1168
+ # @return [::Boolean]
1169
+ # Specifies whether to avoid ferries where reasonable. Preference will be
1170
+ # given to routes not containing travel by ferries. Applies only to motorized
1171
+ # travel modes.
1172
+ # @!attribute [rw] avoid_indoor
1173
+ # @return [::Boolean]
1174
+ # Optional. Specifies whether to avoid navigating indoors where reasonable.
1175
+ # Preference will be given to routes not containing indoor navigation.
1176
+ # Applies only to the `WALKING` travel mode.
1177
+ class RouteModifiers
1178
+ include ::Google::Protobuf::MessageExts
1179
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1180
+ end
1181
+
1182
+ # Models a vehicle in a shipment problem. Solving a shipment problem will
1183
+ # build a route starting from `start_location` and ending at `end_location`
1184
+ # for this vehicle. A route is a sequence of visits (see `ShipmentRoute`).
1185
+ # @!attribute [rw] display_name
1186
+ # @return [::String]
1187
+ # The user-defined display name of the vehicle.
1188
+ # It can be up to 63 characters long and may use UTF-8 characters.
1189
+ # @!attribute [rw] travel_mode
1190
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::TravelMode]
1191
+ # The travel mode which affects the roads usable by the vehicle and its
1192
+ # speed. See also `travel_duration_multiple`.
1193
+ # @!attribute [rw] route_modifiers
1194
+ # @return [::Google::Maps::RouteOptimization::V1::RouteModifiers]
1195
+ # A set of conditions to satisfy that affect the way routes are calculated
1196
+ # for the given vehicle.
1197
+ # @!attribute [rw] start_location
1198
+ # @return [::Google::Type::LatLng]
1199
+ # Geographic location where the vehicle starts before picking up any
1200
+ # shipments. If not specified, the vehicle starts at its first pickup.
1201
+ # If the shipment model has duration and distance matrices, `start_location`
1202
+ # must not be specified.
1203
+ # @!attribute [rw] start_waypoint
1204
+ # @return [::Google::Maps::RouteOptimization::V1::Waypoint]
1205
+ # Waypoint representing a geographic location where the vehicle starts before
1206
+ # picking up any shipments. If neither `start_waypoint` nor `start_location`
1207
+ # is specified, the vehicle starts at its first pickup.
1208
+ # If the shipment model has duration and distance matrices, `start_waypoint`
1209
+ # must not be specified.
1210
+ # @!attribute [rw] end_location
1211
+ # @return [::Google::Type::LatLng]
1212
+ # Geographic location where the vehicle ends after it has completed its last
1213
+ # `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends
1214
+ # immediately when it completes its last `VisitRequest`.
1215
+ # If the shipment model has duration and distance matrices, `end_location`
1216
+ # must not be specified.
1217
+ # @!attribute [rw] end_waypoint
1218
+ # @return [::Google::Maps::RouteOptimization::V1::Waypoint]
1219
+ # Waypoint representing a geographic location where the vehicle ends after
1220
+ # it has completed its last `VisitRequest`. If neither `end_waypoint` nor
1221
+ # `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately
1222
+ # when it completes its last `VisitRequest`.
1223
+ # If the shipment model has duration and distance matrices, `end_waypoint`
1224
+ # must not be specified.
1225
+ # @!attribute [rw] start_tags
1226
+ # @return [::Array<::String>]
1227
+ # Specifies tags attached to the start of the vehicle's route.
1228
+ #
1229
+ # Empty or duplicate strings are not allowed.
1230
+ # @!attribute [rw] end_tags
1231
+ # @return [::Array<::String>]
1232
+ # Specifies tags attached to the end of the vehicle's route.
1233
+ #
1234
+ # Empty or duplicate strings are not allowed.
1235
+ # @!attribute [rw] start_time_windows
1236
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::TimeWindow>]
1237
+ # Time windows during which the vehicle may depart its start location.
1238
+ # They must be within the global time limits (see
1239
+ # [ShipmentModel.global_*][google.maps.routeoptimization.v1.ShipmentModel.global_start_time]
1240
+ # fields). If unspecified, there is no limitation besides those global time
1241
+ # limits.
1242
+ #
1243
+ # Time windows belonging to the same repeated field must be disjoint, i.e. no
1244
+ # time window can overlap with or be adjacent to another, and they must be in
1245
+ # chronological order.
1246
+ #
1247
+ # `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if
1248
+ # there is a single time window.
1249
+ # @!attribute [rw] end_time_windows
1250
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::TimeWindow>]
1251
+ # Time windows during which the vehicle may arrive at its end location.
1252
+ # They must be within the global time limits (see
1253
+ # [ShipmentModel.global_*][google.maps.routeoptimization.v1.ShipmentModel.global_start_time]
1254
+ # fields). If unspecified, there is no limitation besides those global time
1255
+ # limits.
1256
+ #
1257
+ # Time windows belonging to the same repeated field must be disjoint, i.e. no
1258
+ # time window can overlap with or be adjacent to another, and they must be in
1259
+ # chronological order.
1260
+ #
1261
+ # `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if
1262
+ # there is a single time window.
1263
+ # @!attribute [rw] travel_duration_multiple
1264
+ # @return [::Float]
1265
+ # Specifies a multiplicative factor that can be used to increase or decrease
1266
+ # travel times of this vehicle. For example, setting this to 2.0 means
1267
+ # that this vehicle is slower and has travel times that are twice what they
1268
+ # are for standard vehicles. This multiple does not affect visit durations.
1269
+ # It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are
1270
+ # specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle
1271
+ # is standard, and this multiple is considered 1.0.
1272
+ #
1273
+ # WARNING: Travel times will be rounded to the nearest second after this
1274
+ # multiple is applied but before performing any numerical operations, thus,
1275
+ # a small multiple may result in a loss of precision.
1276
+ #
1277
+ # See also `extra_visit_duration_for_visit_type` below.
1278
+ # @!attribute [rw] unloading_policy
1279
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::UnloadingPolicy]
1280
+ # Unloading policy enforced on the vehicle.
1281
+ # @!attribute [rw] load_limits
1282
+ # @return [::Google::Protobuf::Map{::String => ::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit}]
1283
+ # Capacities of the vehicle (weight, volume, # of pallets for example).
1284
+ # The keys in the map are the identifiers of the type of load, consistent
1285
+ # with the keys of the
1286
+ # {::Google::Maps::RouteOptimization::V1::Shipment#load_demands Shipment.load_demands}
1287
+ # field. If a given key is absent from this map, the corresponding capacity
1288
+ # is considered to be limitless.
1289
+ # @!attribute [rw] cost_per_hour
1290
+ # @return [::Float]
1291
+ # Vehicle costs: all costs add up and must be in the same unit as
1292
+ # {::Google::Maps::RouteOptimization::V1::Shipment#penalty_cost Shipment.penalty_cost}.
1293
+ #
1294
+ # Cost per hour of the vehicle route. This cost is applied to the total time
1295
+ # taken by the route, and includes travel time, waiting time, and visit time.
1296
+ # Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result
1297
+ # in additional latency.
1298
+ # @!attribute [rw] cost_per_traveled_hour
1299
+ # @return [::Float]
1300
+ # Cost per traveled hour of the vehicle route. This cost is applied only to
1301
+ # travel time taken by the route (i.e., that reported in
1302
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#transitions ShipmentRoute.transitions}),
1303
+ # and excludes waiting time and visit time.
1304
+ # @!attribute [rw] cost_per_kilometer
1305
+ # @return [::Float]
1306
+ # Cost per kilometer of the vehicle route. This cost is applied to the
1307
+ # distance reported in the
1308
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#transitions ShipmentRoute.transitions}
1309
+ # and does not apply to any distance implicitly traveled from the
1310
+ # `arrival_location` to the `departure_location` of a single `VisitRequest`.
1311
+ # @!attribute [rw] fixed_cost
1312
+ # @return [::Float]
1313
+ # Fixed cost applied if this vehicle is used to handle a shipment.
1314
+ # @!attribute [rw] used_if_route_is_empty
1315
+ # @return [::Boolean]
1316
+ # This field only applies to vehicles when their route does not serve any
1317
+ # shipments. It indicates if the vehicle should be considered as used or not
1318
+ # in this case.
1319
+ #
1320
+ # If true, the vehicle goes from its start to its end location even if it
1321
+ # doesn't serve any shipments, and time and distance costs resulting from its
1322
+ # start --> end travel are taken into account.
1323
+ #
1324
+ # Otherwise, it doesn't travel from its start to its end location, and no
1325
+ # `break_rule` or delay (from `TransitionAttributes`) are scheduled for this
1326
+ # vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any
1327
+ # information except for the vehicle index and label.
1328
+ # @!attribute [rw] route_duration_limit
1329
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::DurationLimit]
1330
+ # Limit applied to the total duration of the vehicle's route. In a given
1331
+ # `OptimizeToursResponse`, the route duration of a vehicle is the
1332
+ # difference between its `vehicle_end_time` and `vehicle_start_time`.
1333
+ # @!attribute [rw] travel_duration_limit
1334
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::DurationLimit]
1335
+ # Limit applied to the travel duration of the vehicle's route. In a given
1336
+ # `OptimizeToursResponse`, the route travel duration is the sum of all its
1337
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition#travel_duration transitions.travel_duration}.
1338
+ # @!attribute [rw] route_distance_limit
1339
+ # @return [::Google::Maps::RouteOptimization::V1::DistanceLimit]
1340
+ # Limit applied to the total distance of the vehicle's route. In a given
1341
+ # `OptimizeToursResponse`, the route distance is the sum of all its
1342
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition#travel_distance_meters transitions.travel_distance_meters}.
1343
+ # @!attribute [rw] extra_visit_duration_for_visit_type
1344
+ # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Duration}]
1345
+ # Specifies a map from visit_types strings to durations. The duration is time
1346
+ # in addition to
1347
+ # {::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest#duration VisitRequest.duration}
1348
+ # to be taken at visits with the specified `visit_types`. This extra visit
1349
+ # duration adds cost if `cost_per_hour` is specified. Keys (i.e.
1350
+ # `visit_types`) cannot be empty strings.
1351
+ #
1352
+ # If a visit request has multiple types, a duration will be added for each
1353
+ # type in the map.
1354
+ # @!attribute [rw] break_rule
1355
+ # @return [::Google::Maps::RouteOptimization::V1::BreakRule]
1356
+ # Describes the break schedule to be enforced on this vehicle.
1357
+ # If empty, no breaks will be scheduled for this vehicle.
1358
+ # @!attribute [rw] label
1359
+ # @return [::String]
1360
+ # Specifies a label for this vehicle. This label is reported in the response
1361
+ # as the `vehicle_label` of the corresponding
1362
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute ShipmentRoute}.
1363
+ # @!attribute [rw] ignore
1364
+ # @return [::Boolean]
1365
+ # If true, `used_if_route_is_empty` must be false, and this vehicle will
1366
+ # remain unused.
1367
+ #
1368
+ # If a shipment is performed by an ignored vehicle in
1369
+ # `injected_first_solution_routes`, it is skipped in the first solution but
1370
+ # is free to be performed in the response.
1371
+ #
1372
+ # If a shipment is performed by an ignored vehicle in
1373
+ # `injected_solution_constraint` and any related pickup/delivery is
1374
+ # constrained to remain on the vehicle (i.e., not relaxed to level
1375
+ # `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response.
1376
+ # If a shipment has a non-empty `allowed_vehicle_indices` field and all of
1377
+ # the allowed vehicles are ignored, it is skipped in the response.
1378
+ class Vehicle
1379
+ include ::Google::Protobuf::MessageExts
1380
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1381
+
1382
+ # Defines a load limit applying to a vehicle, e.g. "this truck may only
1383
+ # carry up to 3500 kg". See
1384
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#load_limits load_limits}.
1385
+ # @!attribute [rw] max_load
1386
+ # @return [::Integer]
1387
+ # The maximum acceptable amount of load.
1388
+ # @!attribute [rw] soft_max_load
1389
+ # @return [::Integer]
1390
+ # A soft limit of the load. See
1391
+ # {::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit#cost_per_unit_above_soft_max cost_per_unit_above_soft_max}.
1392
+ # @!attribute [rw] cost_per_unit_above_soft_max
1393
+ # @return [::Float]
1394
+ # If the load ever exceeds
1395
+ # {::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit#soft_max_load soft_max_load}
1396
+ # along this vehicle's route, the following cost penalty applies (only once
1397
+ # per vehicle): (load -
1398
+ # {::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit#soft_max_load soft_max_load})
1399
+ # * {::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit#cost_per_unit_above_soft_max cost_per_unit_above_soft_max}. All costs
1400
+ # add up and must be in the same unit as
1401
+ # {::Google::Maps::RouteOptimization::V1::Shipment#penalty_cost Shipment.penalty_cost}.
1402
+ # Soft limits may only be defined on types that apply to either pickups
1403
+ # only or deliveries only throughout the model.
1404
+ # @!attribute [rw] start_load_interval
1405
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit::Interval]
1406
+ # The acceptable load interval of the vehicle at the start of the route.
1407
+ # @!attribute [rw] end_load_interval
1408
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit::Interval]
1409
+ # The acceptable load interval of the vehicle at the end of the route.
1410
+ # @!attribute [rw] cost_per_kilometer
1411
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit::LoadCost]
1412
+ # Cost of moving one unit of load over one kilometer for this vehicle.
1413
+ # This can be used as a proxy for fuel consumption: if the load is a weight
1414
+ # (in Newtons), then load*kilometer has the dimension of an energy.
1415
+ #
1416
+ # Experimental: See
1417
+ # https://developers.google.com/maps/tt/route-optimization/experimental/load-cost/make-request
1418
+ # for more details.
1419
+ # @!attribute [rw] cost_per_traveled_hour
1420
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit::LoadCost]
1421
+ # Cost of traveling with a unit of load during one hour for this vehicle.
1422
+ #
1423
+ # Experimental: See
1424
+ # https://developers.google.com/maps/tt/route-optimization/experimental/load-cost/make-request
1425
+ # for more details.
1426
+ class LoadLimit
1427
+ include ::Google::Protobuf::MessageExts
1428
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1429
+
1430
+ # Interval of acceptable load amounts.
1431
+ # @!attribute [rw] min
1432
+ # @return [::Integer]
1433
+ # A minimum acceptable load. Must be ≥ 0.
1434
+ # If they're both specified,
1435
+ # {::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit::Interval#min min}
1436
+ # must be ≤
1437
+ # {::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit::Interval#max max}.
1438
+ # @!attribute [rw] max
1439
+ # @return [::Integer]
1440
+ # A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum
1441
+ # load is unrestricted by this message.
1442
+ # If they're both specified,
1443
+ # {::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit::Interval#min min}
1444
+ # must be ≤
1445
+ # {::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit::Interval#max max}.
1446
+ class Interval
1447
+ include ::Google::Protobuf::MessageExts
1448
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1449
+ end
1450
+
1451
+ # Cost of moving one unit of load during a `Transition`.
1452
+ # For a given load, the cost is the sum of two parts:
1453
+ #
1454
+ # - min(load, `load_threshold`) * `cost_per_unit_below_threshold`
1455
+ # - max(0, load - `load_threshold`) * `cost_per_unit_above_threshold`
1456
+ #
1457
+ # With this cost, solutions prefer to deliver high demands first,
1458
+ # or equivalently pickup high demands last.
1459
+ # For example, if a vehicle has
1460
+ #
1461
+ # load_limit {
1462
+ # key: "weight"
1463
+ # value {
1464
+ # cost_per_kilometer {
1465
+ # load_threshold: 15
1466
+ # cost_per_unit_below_threshold: 2.0
1467
+ # cost_per_unit_above_threshold: 10.0
1468
+ # }
1469
+ # }
1470
+ # }
1471
+ #
1472
+ # and its route is start,pickup,pickup,delivery,delivery,end with
1473
+ # transitions:
1474
+ #
1475
+ # transition { vehicle_load['weight'] { amount: 0 }
1476
+ # travel_distance_meters: 1000.0 }
1477
+ # transition { vehicle_load['weight'] { amount: 10 }
1478
+ # travel_distance_meters: 1000.0 }
1479
+ # transition { vehicle_load['weight'] { amount: 20 }
1480
+ # travel_distance_meters: 1000.0 }
1481
+ # transition { vehicle_load['weight'] { amount: 10 }
1482
+ # travel_distance_meters: 1000.0 }
1483
+ # transition { vehicle_load['weight'] { amount: 0 }
1484
+ # travel_distance_meters: 1000.0 }
1485
+ #
1486
+ # then the cost incurred by this `LoadCost` is
1487
+ # (cost_below * load_below * kilometers + cost_above * load_above * kms)
1488
+ #
1489
+ # - transition 0: 0.0
1490
+ # - transition 1: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
1491
+ # - transition 2: 2.0 * 15 * 1.0 + 10.0 * (20 - 15) * 1.0 = 80.0
1492
+ # - transition 3: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
1493
+ # - transition 4: 0.0
1494
+ #
1495
+ # So the `LoadCost` over the route is 120.0.
1496
+ #
1497
+ # However, if the route is start,pickup,delivery,pickup,delivery,end
1498
+ # with transitions:
1499
+ #
1500
+ # transition { vehicle_load['weight'] { amount: 0 }
1501
+ # travel_distance_meters: 1000.0 }
1502
+ # transition { vehicle_load['weight'] { amount: 10 }
1503
+ # travel_distance_meters: 1000.0 }
1504
+ # transition { vehicle_load['weight'] { amount: 0 }
1505
+ # travel_distance_meters: 1000.0 }
1506
+ # transition { vehicle_load['weight'] { amount: 10 }
1507
+ # travel_distance_meters: 1000.0 }
1508
+ # transition { vehicle_load['weight'] { amount: 0 }
1509
+ # travel_distance_meters: 1000.0 }
1510
+ #
1511
+ # then the cost incurred by this `LoadCost` is
1512
+ #
1513
+ # - transition 0: 0.0
1514
+ # - transition 1: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
1515
+ # - transition 2: 0.0
1516
+ # - transition 3: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
1517
+ # - transition 4: 0.0
1518
+ #
1519
+ # Here the `LoadCost` over the route is 40.0.
1520
+ #
1521
+ # `LoadCost` makes solutions with heavy-loaded transitions more expensive.
1522
+ #
1523
+ # Experimental: See
1524
+ # https://developers.google.com/maps/tt/route-optimization/experimental/load-cost/make-request
1525
+ # for more details.
1526
+ # @!attribute [rw] load_threshold
1527
+ # @return [::Integer]
1528
+ # Amount of load above which the cost of moving a unit of load changes
1529
+ # from cost_per_unit_below_threshold to cost_per_unit_above_threshold.
1530
+ # Must be >= 0.
1531
+ # @!attribute [rw] cost_per_unit_below_threshold
1532
+ # @return [::Float]
1533
+ # Cost of moving a unit of load, for each unit between 0 and threshold.
1534
+ # Must be a finite value, and >= 0.
1535
+ # @!attribute [rw] cost_per_unit_above_threshold
1536
+ # @return [::Float]
1537
+ # Cost of moving a unit of load, for each unit above threshold.
1538
+ # In the special case threshold = 0, this is a fixed cost per unit.
1539
+ # Must be a finite value, and >= 0.
1540
+ class LoadCost
1541
+ include ::Google::Protobuf::MessageExts
1542
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1543
+ end
1544
+ end
1545
+
1546
+ # A limit defining a maximum duration of the route of a vehicle. It can be
1547
+ # either hard or soft.
1548
+ #
1549
+ # When a soft limit field is defined, both the soft max threshold and its
1550
+ # associated cost must be defined together.
1551
+ # @!attribute [rw] max_duration
1552
+ # @return [::Google::Protobuf::Duration]
1553
+ # A hard limit constraining the duration to be at most max_duration.
1554
+ # @!attribute [rw] soft_max_duration
1555
+ # @return [::Google::Protobuf::Duration]
1556
+ # A soft limit not enforcing a maximum duration limit, but when violated
1557
+ # makes the route incur a cost. This cost adds up to other costs defined in
1558
+ # the model, with the same unit.
1559
+ #
1560
+ # If defined, `soft_max_duration` must be nonnegative. If max_duration is
1561
+ # also defined, `soft_max_duration` must be less than max_duration.
1562
+ # @!attribute [rw] cost_per_hour_after_soft_max
1563
+ # @return [::Float]
1564
+ # Cost per hour incurred if the `soft_max_duration` threshold is violated.
1565
+ # The additional cost is 0 if the duration is under the threshold,
1566
+ # otherwise the cost depends on the duration as follows:
1567
+ # ```
1568
+ # cost_per_hour_after_soft_max * (duration - soft_max_duration)
1569
+ # ```
1570
+ # The cost must be nonnegative.
1571
+ # @!attribute [rw] quadratic_soft_max_duration
1572
+ # @return [::Google::Protobuf::Duration]
1573
+ # A soft limit not enforcing a maximum duration limit, but when violated
1574
+ # makes the route incur a cost, quadratic in the duration. This cost adds
1575
+ # up to other costs defined in the model, with the same unit.
1576
+ #
1577
+ # If defined, `quadratic_soft_max_duration` must be nonnegative. If
1578
+ # `max_duration` is also defined, `quadratic_soft_max_duration` must be
1579
+ # less than `max_duration`, and the difference must be no larger than one
1580
+ # day:
1581
+ #
1582
+ # `max_duration - quadratic_soft_max_duration <= 86400 seconds`
1583
+ # @!attribute [rw] cost_per_square_hour_after_quadratic_soft_max
1584
+ # @return [::Float]
1585
+ # Cost per square hour incurred if the
1586
+ # `quadratic_soft_max_duration` threshold is violated.
1587
+ #
1588
+ # The additional cost is 0 if the duration is under the threshold,
1589
+ # otherwise the cost depends on the duration as follows:
1590
+ #
1591
+ # ```
1592
+ # cost_per_square_hour_after_quadratic_soft_max *
1593
+ # (duration - quadratic_soft_max_duration)^2
1594
+ # ```
1595
+ #
1596
+ # The cost must be nonnegative.
1597
+ class DurationLimit
1598
+ include ::Google::Protobuf::MessageExts
1599
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1600
+ end
1601
+
1602
+ # @!attribute [rw] key
1603
+ # @return [::String]
1604
+ # @!attribute [rw] value
1605
+ # @return [::Google::Maps::RouteOptimization::V1::Vehicle::LoadLimit]
1606
+ class LoadLimitsEntry
1607
+ include ::Google::Protobuf::MessageExts
1608
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1609
+ end
1610
+
1611
+ # @!attribute [rw] key
1612
+ # @return [::String]
1613
+ # @!attribute [rw] value
1614
+ # @return [::Google::Protobuf::Duration]
1615
+ class ExtraVisitDurationForVisitTypeEntry
1616
+ include ::Google::Protobuf::MessageExts
1617
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1618
+ end
1619
+
1620
+ # Travel modes which can be used by vehicles.
1621
+ #
1622
+ # These should be a subset of the Google Maps Platform Routes API travel
1623
+ # modes, see:
1624
+ # https://developers.google.com/maps/documentation/routes/reference/rest/v2/RouteTravelMode
1625
+ #
1626
+ # Note: `WALKING` routes are in beta and might sometimes be missing clear
1627
+ # sidewalks or pedestrian paths. You must display this warning to the user
1628
+ # for all walking routes that you display in your app.
1629
+ module TravelMode
1630
+ # Unspecified travel mode, equivalent to `DRIVING`.
1631
+ TRAVEL_MODE_UNSPECIFIED = 0
1632
+
1633
+ # Travel mode corresponding to driving directions (car, ...).
1634
+ DRIVING = 1
1635
+
1636
+ # Travel mode corresponding to walking directions.
1637
+ WALKING = 2
1638
+ end
1639
+
1640
+ # Policy on how a vehicle can be unloaded. Applies only to shipments having
1641
+ # both a pickup and a delivery.
1642
+ #
1643
+ # Other shipments are free to occur anywhere on the route independent of
1644
+ # `unloading_policy`.
1645
+ module UnloadingPolicy
1646
+ # Unspecified unloading policy; deliveries must just occur after their
1647
+ # corresponding pickups.
1648
+ UNLOADING_POLICY_UNSPECIFIED = 0
1649
+
1650
+ # Deliveries must occur in reverse order of pickups
1651
+ LAST_IN_FIRST_OUT = 1
1652
+
1653
+ # Deliveries must occur in the same order as pickups
1654
+ FIRST_IN_FIRST_OUT = 2
1655
+ end
1656
+ end
1657
+
1658
+ # Time windows constrain the time of an event, such as the arrival time at a
1659
+ # visit, or the start and end time of a vehicle.
1660
+ #
1661
+ # Hard time window bounds, `start_time` and `end_time`, enforce the earliest
1662
+ # and latest time of the event, such that `start_time <= event_time <=
1663
+ # end_time`. The soft time window lower bound, `soft_start_time`, expresses a
1664
+ # preference for the event to happen at or after `soft_start_time` by incurring
1665
+ # a cost proportional to how long before soft_start_time the event occurs. The
1666
+ # soft time window upper bound, `soft_end_time`, expresses a preference for the
1667
+ # event to happen at or before `soft_end_time` by incurring a cost proportional
1668
+ # to how long after `soft_end_time` the event occurs. `start_time`, `end_time`,
1669
+ # `soft_start_time` and `soft_end_time` should be within the global time limits
1670
+ # (see
1671
+ # {::Google::Maps::RouteOptimization::V1::ShipmentModel#global_start_time ShipmentModel.global_start_time}
1672
+ # and
1673
+ # {::Google::Maps::RouteOptimization::V1::ShipmentModel#global_end_time ShipmentModel.global_end_time})
1674
+ # and should respect:
1675
+ # ```
1676
+ # 0 <= `start_time` <= `end_time` and
1677
+ # 0 <= `start_time` <= `soft_start_time` and
1678
+ # 0 <= `soft_end_time` <= `end_time`.
1679
+ # ```
1680
+ # @!attribute [rw] start_time
1681
+ # @return [::Google::Protobuf::Timestamp]
1682
+ # The hard time window start time. If unspecified it will be set to
1683
+ # `ShipmentModel.global_start_time`.
1684
+ # @!attribute [rw] end_time
1685
+ # @return [::Google::Protobuf::Timestamp]
1686
+ # The hard time window end time. If unspecified it will be set to
1687
+ # `ShipmentModel.global_end_time`.
1688
+ # @!attribute [rw] soft_start_time
1689
+ # @return [::Google::Protobuf::Timestamp]
1690
+ # The soft start time of the time window.
1691
+ # @!attribute [rw] soft_end_time
1692
+ # @return [::Google::Protobuf::Timestamp]
1693
+ # The soft end time of the time window.
1694
+ # @!attribute [rw] cost_per_hour_before_soft_start_time
1695
+ # @return [::Float]
1696
+ # A cost per hour added to other costs in the model if the event occurs
1697
+ # before soft_start_time, computed as:
1698
+ #
1699
+ # ```
1700
+ # max(0, soft_start_time - t.seconds)
1701
+ # * cost_per_hour_before_soft_start_time / 3600,
1702
+ # t being the time of the event.
1703
+ # ```
1704
+ #
1705
+ # This cost must be positive, and the field can only be set if
1706
+ # soft_start_time has been set.
1707
+ # @!attribute [rw] cost_per_hour_after_soft_end_time
1708
+ # @return [::Float]
1709
+ # A cost per hour added to other costs in the model if the event occurs after
1710
+ # `soft_end_time`, computed as:
1711
+ #
1712
+ # ```
1713
+ # max(0, t.seconds - soft_end_time.seconds)
1714
+ # * cost_per_hour_after_soft_end_time / 3600,
1715
+ # t being the time of the event.
1716
+ # ```
1717
+ #
1718
+ # This cost must be positive, and the field can only be set if
1719
+ # `soft_end_time` has been set.
1720
+ class TimeWindow
1721
+ include ::Google::Protobuf::MessageExts
1722
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1723
+ end
1724
+
1725
+ # A limit defining a maximum distance which can be traveled. It can be either
1726
+ # hard or soft.
1727
+ #
1728
+ # If a soft limit is defined, both `soft_max_meters` and
1729
+ # `cost_per_kilometer_above_soft_max` must be defined and be nonnegative.
1730
+ # @!attribute [rw] max_meters
1731
+ # @return [::Integer]
1732
+ # A hard limit constraining the distance to be at most max_meters. The limit
1733
+ # must be nonnegative.
1734
+ # @!attribute [rw] soft_max_meters
1735
+ # @return [::Integer]
1736
+ # A soft limit not enforcing a maximum distance limit, but when violated
1737
+ # results in a cost which adds up to other costs defined in the model,
1738
+ # with the same unit.
1739
+ #
1740
+ # If defined soft_max_meters must be less than max_meters and must be
1741
+ # nonnegative.
1742
+ # @!attribute [rw] cost_per_kilometer_below_soft_max
1743
+ # @return [::Float]
1744
+ # Cost per kilometer incurred, increasing up to `soft_max_meters`, with
1745
+ # formula:
1746
+ # ```
1747
+ # min(distance_meters, soft_max_meters) / 1000.0 *
1748
+ # cost_per_kilometer_below_soft_max.
1749
+ # ```
1750
+ # This cost is not supported in `route_distance_limit`.
1751
+ # @!attribute [rw] cost_per_kilometer_above_soft_max
1752
+ # @return [::Float]
1753
+ # Cost per kilometer incurred if distance is above `soft_max_meters` limit.
1754
+ # The additional cost is 0 if the distance is under the limit, otherwise the
1755
+ # formula used to compute the cost is the following:
1756
+ # ```
1757
+ # (distance_meters - soft_max_meters) / 1000.0 *
1758
+ # cost_per_kilometer_above_soft_max.
1759
+ # ```
1760
+ # The cost must be nonnegative.
1761
+ class DistanceLimit
1762
+ include ::Google::Protobuf::MessageExts
1763
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1764
+ end
1765
+
1766
+ # Specifies attributes of transitions between two consecutive visits on a
1767
+ # route. Several `TransitionAttributes` may apply to the same transition: in
1768
+ # that case, all extra costs add up and the strictest constraint or limit
1769
+ # applies (following natural "AND" semantics).
1770
+ # @!attribute [rw] src_tag
1771
+ # @return [::String]
1772
+ # Tags defining the set of (src->dst) transitions these attributes apply to.
1773
+ #
1774
+ # A source visit or vehicle start matches iff its
1775
+ # {::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest#tags VisitRequest.tags}
1776
+ # or
1777
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#start_tags Vehicle.start_tags}
1778
+ # either contains `src_tag` or does not contain `excluded_src_tag` (depending
1779
+ # on which of these two fields is non-empty).
1780
+ # @!attribute [rw] excluded_src_tag
1781
+ # @return [::String]
1782
+ # See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be
1783
+ # non-empty.
1784
+ # @!attribute [rw] dst_tag
1785
+ # @return [::String]
1786
+ # A destination visit or vehicle end matches iff its
1787
+ # {::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest#tags VisitRequest.tags}
1788
+ # or {::Google::Maps::RouteOptimization::V1::Vehicle#end_tags Vehicle.end_tags}
1789
+ # either contains `dst_tag` or does not contain `excluded_dst_tag` (depending
1790
+ # on which of these two fields is non-empty).
1791
+ # @!attribute [rw] excluded_dst_tag
1792
+ # @return [::String]
1793
+ # See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be
1794
+ # non-empty.
1795
+ # @!attribute [rw] cost
1796
+ # @return [::Float]
1797
+ # Specifies a cost for performing this transition. This is in the same unit
1798
+ # as all other costs in the model and must not be negative. It is applied on
1799
+ # top of all other existing costs.
1800
+ # @!attribute [rw] cost_per_kilometer
1801
+ # @return [::Float]
1802
+ # Specifies a cost per kilometer applied to the distance traveled while
1803
+ # performing this transition. It adds up to any
1804
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#cost_per_kilometer Vehicle.cost_per_kilometer}
1805
+ # specified on vehicles.
1806
+ # @!attribute [rw] distance_limit
1807
+ # @return [::Google::Maps::RouteOptimization::V1::DistanceLimit]
1808
+ # Specifies a limit on the distance traveled while performing this
1809
+ # transition.
1810
+ #
1811
+ # As of 2021/06, only soft limits are supported.
1812
+ # @!attribute [rw] delay
1813
+ # @return [::Google::Protobuf::Duration]
1814
+ # Specifies a delay incurred when performing this transition.
1815
+ #
1816
+ # This delay always occurs *after* finishing the source visit and *before*
1817
+ # starting the destination visit.
1818
+ class TransitionAttributes
1819
+ include ::Google::Protobuf::MessageExts
1820
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1821
+ end
1822
+
1823
+ # Encapsulates a waypoint. Waypoints mark arrival and departure locations of
1824
+ # VisitRequests, and start and end locations of Vehicles.
1825
+ # @!attribute [rw] location
1826
+ # @return [::Google::Maps::RouteOptimization::V1::Location]
1827
+ # A point specified using geographic coordinates, including an optional
1828
+ # heading.
1829
+ #
1830
+ # Note: The following fields are mutually exclusive: `location`, `place_id`. If a field in that set is populated, all other fields in the set will automatically be cleared.
1831
+ # @!attribute [rw] place_id
1832
+ # @return [::String]
1833
+ # The POI place ID associated with the waypoint.
1834
+ #
1835
+ # When using a place ID to specify arrival or departure location of a
1836
+ # VisitRequest, use a place ID that is specific enough to determine a
1837
+ # LatLng location for navigation to the place.
1838
+ # For example, a place ID representing a building is suitable, but a place
1839
+ # ID representing a road is discouraged.
1840
+ #
1841
+ # Note: The following fields are mutually exclusive: `place_id`, `location`. If a field in that set is populated, all other fields in the set will automatically be cleared.
1842
+ # @!attribute [rw] side_of_road
1843
+ # @return [::Boolean]
1844
+ # Optional. Indicates that the location of this waypoint is meant to have a
1845
+ # preference for the vehicle to stop at a particular side of road. When you
1846
+ # set this value, the route will pass through the location so that the
1847
+ # vehicle can stop at the side of road that the location is biased towards
1848
+ # from the center of the road. This option doesn't work for the 'WALKING'
1849
+ # travel mode.
1850
+ # @!attribute [rw] vehicle_stopover
1851
+ # @return [::Boolean]
1852
+ # Indicates that the waypoint is meant for vehicles to stop at, where the
1853
+ # intention is to either pick up or drop off. This option works only for the
1854
+ # 'DRIVING' travel mode, and when the 'location_type' is 'location'.
1855
+ #
1856
+ # Experimental: This field's behavior or existence may change in future.
1857
+ class Waypoint
1858
+ include ::Google::Protobuf::MessageExts
1859
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1860
+ end
1861
+
1862
+ # Encapsulates a location (a geographic point, and an optional heading).
1863
+ # @!attribute [rw] lat_lng
1864
+ # @return [::Google::Type::LatLng]
1865
+ # The waypoint's geographic coordinates.
1866
+ # @!attribute [rw] heading
1867
+ # @return [::Integer]
1868
+ # The compass heading associated with the direction of the flow of traffic.
1869
+ # This value is used to specify the side of the road to use for pickup and
1870
+ # drop-off. Heading values can be from 0 to 360, where 0 specifies a heading
1871
+ # of due North, 90 specifies a heading of due East, etc.
1872
+ class Location
1873
+ include ::Google::Protobuf::MessageExts
1874
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1875
+ end
1876
+
1877
+ # Rules to generate time breaks for a vehicle (e.g. lunch breaks). A break
1878
+ # is a contiguous period of time during which the vehicle remains idle at its
1879
+ # current position and cannot perform any visit. A break may occur:
1880
+ #
1881
+ # * during the travel between two visits (which includes the time right
1882
+ # before or right after a visit, but not in the middle of a visit), in
1883
+ # which case it extends the corresponding transit time between the visits,
1884
+ # * or before the vehicle start (the vehicle may not start in the middle of
1885
+ # a break), in which case it does not affect the vehicle start time.
1886
+ # * or after the vehicle end (ditto, with the vehicle end time).
1887
+ # @!attribute [rw] break_requests
1888
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::BreakRule::BreakRequest>]
1889
+ # Sequence of breaks. See the `BreakRequest` message.
1890
+ # @!attribute [rw] frequency_constraints
1891
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::BreakRule::FrequencyConstraint>]
1892
+ # Several `FrequencyConstraint` may apply. They must all be satisfied by
1893
+ # the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`.
1894
+ class BreakRule
1895
+ include ::Google::Protobuf::MessageExts
1896
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1897
+
1898
+ # The sequence of breaks (i.e. their number and order) that apply to each
1899
+ # vehicle must be known beforehand. The repeated `BreakRequest`s define
1900
+ # that sequence, in the order in which they must occur. Their time windows
1901
+ # (`earliest_start_time` / `latest_start_time`) may overlap, but they must
1902
+ # be compatible with the order (this is checked).
1903
+ # @!attribute [rw] earliest_start_time
1904
+ # @return [::Google::Protobuf::Timestamp]
1905
+ # Required. Lower bound (inclusive) on the start of the break.
1906
+ # @!attribute [rw] latest_start_time
1907
+ # @return [::Google::Protobuf::Timestamp]
1908
+ # Required. Upper bound (inclusive) on the start of the break.
1909
+ # @!attribute [rw] min_duration
1910
+ # @return [::Google::Protobuf::Duration]
1911
+ # Required. Minimum duration of the break. Must be positive.
1912
+ class BreakRequest
1913
+ include ::Google::Protobuf::MessageExts
1914
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1915
+ end
1916
+
1917
+ # One may further constrain the frequency and duration of the breaks
1918
+ # specified above, by enforcing a minimum break frequency, such as
1919
+ # "There must be a break of at least 1 hour every 12 hours". Assuming that
1920
+ # this can be interpreted as "Within any sliding time window of 12h, there
1921
+ # must be at least one break of at least one hour", that example would
1922
+ # translate to the following `FrequencyConstraint`:
1923
+ # ```
1924
+ # {
1925
+ # min_break_duration { seconds: 3600 } # 1 hour.
1926
+ # max_inter_break_duration { seconds: 39600 } # 11 hours (12 - 1 = 11).
1927
+ # }
1928
+ # ```
1929
+ #
1930
+ # The timing and duration of the breaks in the solution will respect all
1931
+ # such constraints, in addition to the time windows and minimum durations
1932
+ # already specified in the `BreakRequest`.
1933
+ #
1934
+ # A `FrequencyConstraint` may in practice apply to non-consecutive breaks.
1935
+ # For example, the following schedule honors the "1h every 12h" example:
1936
+ # ```
1937
+ # 04:00 vehicle start
1938
+ # .. performing travel and visits ..
1939
+ # 09:00 1 hour break
1940
+ # 10:00 end of the break
1941
+ # .. performing travel and visits ..
1942
+ # 12:00 20-min lunch break
1943
+ # 12:20 end of the break
1944
+ # .. performing travel and visits ..
1945
+ # 21:00 1 hour break
1946
+ # 22:00 end of the break
1947
+ # .. performing travel and visits ..
1948
+ # 23:59 vehicle end
1949
+ # ```
1950
+ # @!attribute [rw] min_break_duration
1951
+ # @return [::Google::Protobuf::Duration]
1952
+ # Required. Minimum break duration for this constraint. Nonnegative.
1953
+ # See description of `FrequencyConstraint`.
1954
+ # @!attribute [rw] max_inter_break_duration
1955
+ # @return [::Google::Protobuf::Duration]
1956
+ # Required. Maximum allowed span of any interval of time in the route that
1957
+ # does not include at least partially a break of `duration >=
1958
+ # min_break_duration`. Must be positive.
1959
+ class FrequencyConstraint
1960
+ include ::Google::Protobuf::MessageExts
1961
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1962
+ end
1963
+ end
1964
+
1965
+ # A vehicle's route can be decomposed, along the time axis, like this (we
1966
+ # assume there are n visits):
1967
+ # ```
1968
+ # | | | | | T[2], | | |
1969
+ # | Transition | Visit #0 | | | V[2], | | |
1970
+ # | #0 | aka | T[1] | V[1] | ... | V[n-1] | T[n] |
1971
+ # | aka T[0] | V[0] | | | V[n-2],| | |
1972
+ # | | | | | T[n-1] | | |
1973
+ # ^ ^ ^ ^ ^ ^ ^ ^
1974
+ # vehicle V[0].start V[0].end V[1]. V[1]. V[n]. V[n]. vehicle
1975
+ # start (arrival) (departure) start end start end end
1976
+ # ```
1977
+ # Note that we make a difference between:
1978
+ #
1979
+ # * "punctual events", such as the vehicle start and end and each visit's start
1980
+ # and end (aka arrival and departure). They happen at a given second.
1981
+ # * "time intervals", such as the visits themselves, and the transition between
1982
+ # visits. Though time intervals can sometimes have zero duration, i.e. start
1983
+ # and end at the same second, they often have a positive duration.
1984
+ #
1985
+ # Invariants:
1986
+ #
1987
+ # * If there are n visits, there are n+1 transitions.
1988
+ # * A visit is always surrounded by a transition before it (same index) and a
1989
+ # transition after it (index + 1).
1990
+ # * The vehicle start is always followed by transition #0.
1991
+ # * The vehicle end is always preceded by transition #n.
1992
+ #
1993
+ # Zooming in, here is what happens during a `Transition` and a `Visit`:
1994
+ # ```
1995
+ # ---+-------------------------------------+-----------------------------+-->
1996
+ # | TRANSITION[i] | VISIT[i] |
1997
+ # | | |
1998
+ # | * TRAVEL: the vehicle moves from | PERFORM the visit: |
1999
+ # | VISIT[i-1].departure_location to | |
2000
+ # | VISIT[i].arrival_location, which | * Spend some time: |
2001
+ # | takes a given travel duration | the "visit duration". |
2002
+ # | and distance | |
2003
+ # | | * Load or unload |
2004
+ # | * BREAKS: the driver may have | some quantities from the |
2005
+ # | breaks (e.g. lunch break). | vehicle: the "demand". |
2006
+ # | | |
2007
+ # | * WAIT: the driver/vehicle does | |
2008
+ # | nothing. This can happen for | |
2009
+ # | many reasons, for example when | |
2010
+ # | the vehicle reaches the next | |
2011
+ # | event's destination before the | |
2012
+ # | start of its time window | |
2013
+ # | | |
2014
+ # | * DELAY: *right before* the next | |
2015
+ # | arrival. E.g. the vehicle and/or | |
2016
+ # | driver spends time unloading. | |
2017
+ # | | |
2018
+ # ---+-------------------------------------+-----------------------------+-->
2019
+ # ^ ^ ^
2020
+ # V[i-1].end V[i].start V[i].end
2021
+ # ```
2022
+ # Lastly, here is how the TRAVEL, BREAKS, DELAY and WAIT can be arranged
2023
+ # during a transition.
2024
+ #
2025
+ # * They don't overlap.
2026
+ # * The DELAY is unique and *must* be a contiguous period of time right
2027
+ # before the next visit (or vehicle end). Thus, it suffice to know the
2028
+ # delay duration to know its start and end time.
2029
+ # * The BREAKS are contiguous, non-overlapping periods of time. The
2030
+ # response specifies the start time and duration of each break.
2031
+ # * TRAVEL and WAIT are "preemptable": they can be interrupted several times
2032
+ # during this transition. Clients can assume that travel happens "as soon as
2033
+ # possible" and that "wait" fills the remaining time.
2034
+ #
2035
+ # A (complex) example:
2036
+ # ```
2037
+ # TRANSITION[i]
2038
+ # --++-----+-----------------------------------------------------------++-->
2039
+ # || | | | | | | ||
2040
+ # || T | B | T | | B | | D ||
2041
+ # || r | r | r | W | r | W | e ||
2042
+ # || a | e | a | a | e | a | l ||
2043
+ # || v | a | v | i | a | i | a ||
2044
+ # || e | k | e | t | k | t | y ||
2045
+ # || l | | l | | | | ||
2046
+ # || | | | | | | ||
2047
+ # --++-----------------------------------------------------------------++-->
2048
+ # ```
2049
+ # @!attribute [rw] vehicle_index
2050
+ # @return [::Integer]
2051
+ # Vehicle performing the route, identified by its index in the source
2052
+ # `ShipmentModel`.
2053
+ # @!attribute [rw] vehicle_label
2054
+ # @return [::String]
2055
+ # Label of the vehicle performing this route, equal to
2056
+ # `ShipmentModel.vehicles(vehicle_index).label`, if specified.
2057
+ # @!attribute [rw] vehicle_start_time
2058
+ # @return [::Google::Protobuf::Timestamp]
2059
+ # Time at which the vehicle starts its route.
2060
+ # @!attribute [rw] vehicle_end_time
2061
+ # @return [::Google::Protobuf::Timestamp]
2062
+ # Time at which the vehicle finishes its route.
2063
+ # @!attribute [rw] visits
2064
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit>]
2065
+ # Ordered sequence of visits representing a route.
2066
+ # visits[i] is the i-th visit in the route.
2067
+ # If this field is empty, the vehicle is considered as unused.
2068
+ # @!attribute [rw] transitions
2069
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition>]
2070
+ # Ordered list of transitions for the route.
2071
+ # @!attribute [rw] has_traffic_infeasibilities
2072
+ # @return [::Boolean]
2073
+ # When
2074
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursRequest#consider_road_traffic OptimizeToursRequest.consider_road_traffic},
2075
+ # is set to true, this field indicates that inconsistencies in route timings
2076
+ # are predicted using traffic-based travel duration estimates. There may be
2077
+ # insufficient time to complete traffic-adjusted travel, delays, and breaks
2078
+ # between visits, before the first visit, or after the last visit, while
2079
+ # still satisfying the visit and vehicle time windows. For example,
2080
+ #
2081
+ # ```
2082
+ # start_time(previous_visit) + duration(previous_visit) +
2083
+ # travel_duration(previous_visit, next_visit) > start_time(next_visit)
2084
+ # ```
2085
+ #
2086
+ # Arrival at next_visit will likely happen later than its current
2087
+ # time window due the increased estimate of travel time
2088
+ # `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break
2089
+ # may be forced to overlap with a visit due to an increase in travel time
2090
+ # estimates and visit or break time window restrictions.
2091
+ # @!attribute [rw] route_polyline
2092
+ # @return [::Google::Maps::RouteOptimization::V1::ShipmentRoute::EncodedPolyline]
2093
+ # The encoded polyline representation of the route.
2094
+ # This field is only populated if
2095
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursRequest#populate_polylines OptimizeToursRequest.populate_polylines}
2096
+ # is set to true.
2097
+ # @!attribute [rw] breaks
2098
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute::Break>]
2099
+ # Breaks scheduled for the vehicle performing this route.
2100
+ # The `breaks` sequence represents time intervals, each starting at the
2101
+ # corresponding `start_time` and lasting `duration` seconds.
2102
+ # @!attribute [rw] metrics
2103
+ # @return [::Google::Maps::RouteOptimization::V1::AggregatedMetrics]
2104
+ # Duration, distance and load metrics for this route. The fields of
2105
+ # {::Google::Maps::RouteOptimization::V1::AggregatedMetrics AggregatedMetrics} are
2106
+ # summed over all
2107
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#transitions ShipmentRoute.transitions}
2108
+ # or
2109
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#visits ShipmentRoute.visits},
2110
+ # depending on the context.
2111
+ # @!attribute [rw] vehicle_fullness
2112
+ # @return [::Google::Maps::RouteOptimization::V1::VehicleFullness]
2113
+ # {::Google::Maps::RouteOptimization::V1::VehicleFullness VehicleFullness} field
2114
+ # for computing how close the capped metrics are to their respective vehicle
2115
+ # limits. Its fields are ratios between a capped metric field (e.g.
2116
+ # {::Google::Maps::RouteOptimization::V1::AggregatedMetrics#travel_distance_meters AggregatedMetrics.travel_distance_meters})
2117
+ # and the related vehicle limit (e.g.
2118
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#route_distance_limit Vehicle.route_distance_limit}).
2119
+ #
2120
+ # Experimental: This field's behavior or existence may change in future.
2121
+ # @!attribute [rw] route_costs
2122
+ # @return [::Google::Protobuf::Map{::String => ::Float}]
2123
+ # Cost of the route, broken down by cost-related request fields.
2124
+ # The keys are proto paths, relative to the input OptimizeToursRequest, e.g.
2125
+ # "model.shipments.pickups.cost", and the values are the total cost
2126
+ # generated by the corresponding cost field, aggregated over the whole route.
2127
+ # In other words, costs["model.shipments.pickups.cost"] is the sum of all
2128
+ # pickup costs over the route. All costs defined in the model are reported in
2129
+ # detail here with the exception of costs related to TransitionAttributes
2130
+ # that are only reported in an aggregated way as of 2022/01.
2131
+ # @!attribute [rw] route_total_cost
2132
+ # @return [::Float]
2133
+ # Total cost of the route. The sum of all costs in the cost map.
2134
+ class ShipmentRoute
2135
+ include ::Google::Protobuf::MessageExts
2136
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2137
+
2138
+ # A visit performed during a route. This visit corresponds to a pickup or a
2139
+ # delivery of a `Shipment`.
2140
+ # @!attribute [rw] shipment_index
2141
+ # @return [::Integer]
2142
+ # Index of the `shipments` field in the source
2143
+ # {::Google::Maps::RouteOptimization::V1::ShipmentModel ShipmentModel}.
2144
+ # @!attribute [rw] is_pickup
2145
+ # @return [::Boolean]
2146
+ # If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it
2147
+ # corresponds to a delivery.
2148
+ # @!attribute [rw] visit_request_index
2149
+ # @return [::Integer]
2150
+ # Index of `VisitRequest` in either the pickup or delivery field of the
2151
+ # `Shipment` (see `is_pickup`).
2152
+ # @!attribute [rw] start_time
2153
+ # @return [::Google::Protobuf::Timestamp]
2154
+ # Time at which the visit starts. Note that the vehicle may arrive earlier
2155
+ # than this at the visit location. Times are consistent with the
2156
+ # `ShipmentModel`.
2157
+ # @!attribute [rw] load_demands
2158
+ # @return [::Google::Protobuf::Map{::String => ::Google::Maps::RouteOptimization::V1::Shipment::Load}]
2159
+ # Total visit load demand as the sum of the shipment and the visit request
2160
+ # `load_demands`. The values are negative if the visit is a delivery.
2161
+ # Demands are reported for the same types as the
2162
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition Transition.loads}
2163
+ # (see this field).
2164
+ # @!attribute [rw] detour
2165
+ # @return [::Google::Protobuf::Duration]
2166
+ # Extra detour time due to the shipments visited on the route before the
2167
+ # visit and to the potential waiting time induced by time windows.
2168
+ # If the visit is a delivery, the detour is computed from the corresponding
2169
+ # pickup visit and is equal to:
2170
+ # ```
2171
+ # start_time(delivery) - start_time(pickup)
2172
+ # - (duration(pickup) + travel duration from the pickup location
2173
+ # to the delivery location).
2174
+ # ```
2175
+ # Otherwise, it is computed from the vehicle `start_location` and is equal
2176
+ # to:
2177
+ # ```
2178
+ # start_time - vehicle_start_time - travel duration from
2179
+ # the vehicle's `start_location` to the visit.
2180
+ # ```
2181
+ # @!attribute [rw] shipment_label
2182
+ # @return [::String]
2183
+ # Copy of the corresponding `Shipment.label`, if specified in the
2184
+ # `Shipment`.
2185
+ # @!attribute [rw] visit_label
2186
+ # @return [::String]
2187
+ # Copy of the corresponding
2188
+ # {::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest#label VisitRequest.label},
2189
+ # if specified in the `VisitRequest`.
2190
+ # @!attribute [rw] injected_solution_location_token
2191
+ # @return [::Integer]
2192
+ # An opaque token representing information about a visit location.
2193
+ #
2194
+ # This field may be populated in the result routes' visits when
2195
+ # {::Google::Maps::RouteOptimization::V1::Shipment::VisitRequest#avoid_u_turns VisitRequest.avoid_u_turns}
2196
+ # was set to true for this visit or if
2197
+ # [ShipmentModel.avoid_u_turns][google.maps.routeoptimization.v1.ShipmentModel.avoid_u_turns]
2198
+ # was set to true in the request
2199
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursRequest OptimizeToursRequest}.
2200
+ #
2201
+ # Experimental: See
2202
+ # https://developers.google.com/maps/tt/route-optimization/experimental/u-turn-avoidance/make-request
2203
+ # for more details.
2204
+ class Visit
2205
+ include ::Google::Protobuf::MessageExts
2206
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2207
+
2208
+ # @!attribute [rw] key
2209
+ # @return [::String]
2210
+ # @!attribute [rw] value
2211
+ # @return [::Google::Maps::RouteOptimization::V1::Shipment::Load]
2212
+ class LoadDemandsEntry
2213
+ include ::Google::Protobuf::MessageExts
2214
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2215
+ end
2216
+ end
2217
+
2218
+ # Transition between two events on the route. See the description of
2219
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute ShipmentRoute}.
2220
+ #
2221
+ # If the vehicle does not have a `start_location` and/or `end_location`, the
2222
+ # corresponding travel metrics are 0.
2223
+ # @!attribute [rw] travel_duration
2224
+ # @return [::Google::Protobuf::Duration]
2225
+ # Travel duration during this transition.
2226
+ # @!attribute [rw] travel_distance_meters
2227
+ # @return [::Float]
2228
+ # Distance traveled during the transition.
2229
+ # @!attribute [rw] traffic_info_unavailable
2230
+ # @return [::Boolean]
2231
+ # When traffic is requested via
2232
+ # [OptimizeToursRequest.consider_road_traffic]
2233
+ # [google.maps.routeoptimization.v1.OptimizeToursRequest.consider_road_traffic],
2234
+ # and the traffic info couldn't be retrieved for a `Transition`, this
2235
+ # boolean is set to true. This may be temporary (rare hiccup in the
2236
+ # realtime traffic servers) or permanent (no data for this location).
2237
+ # @!attribute [rw] delay_duration
2238
+ # @return [::Google::Protobuf::Duration]
2239
+ # Sum of the delay durations applied to this transition. If any, the delay
2240
+ # starts exactly `delay_duration` seconds before the next event (visit or
2241
+ # vehicle end). See
2242
+ # {::Google::Maps::RouteOptimization::V1::TransitionAttributes#delay TransitionAttributes.delay}.
2243
+ # @!attribute [rw] break_duration
2244
+ # @return [::Google::Protobuf::Duration]
2245
+ # Sum of the duration of the breaks occurring during this transition, if
2246
+ # any. Details about each break's start time and duration are stored in
2247
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#breaks ShipmentRoute.breaks}.
2248
+ # @!attribute [rw] wait_duration
2249
+ # @return [::Google::Protobuf::Duration]
2250
+ # Time spent waiting during this transition. Wait duration corresponds to
2251
+ # idle time and does not include break time. Also note that this wait time
2252
+ # may be split into several non-contiguous intervals.
2253
+ # @!attribute [rw] total_duration
2254
+ # @return [::Google::Protobuf::Duration]
2255
+ # Total duration of the transition, provided for convenience. It is equal
2256
+ # to:
2257
+ #
2258
+ # * next visit `start_time` (or `vehicle_end_time` if this is the last
2259
+ # transition) - this transition's `start_time`;
2260
+ # * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following
2261
+ # additionally holds: `total_duration = travel_duration + delay_duration
2262
+ # + break_duration + wait_duration`.
2263
+ # @!attribute [rw] start_time
2264
+ # @return [::Google::Protobuf::Timestamp]
2265
+ # Start time of this transition.
2266
+ # @!attribute [rw] route_polyline
2267
+ # @return [::Google::Maps::RouteOptimization::V1::ShipmentRoute::EncodedPolyline]
2268
+ # The encoded polyline representation of the route followed during the
2269
+ # transition.
2270
+ # This field is only populated if [populate_transition_polylines]
2271
+ # [google.maps.routeoptimization.v1.OptimizeToursRequest.populate_transition_polylines]
2272
+ # is set to true.
2273
+ # @!attribute [r] route_token
2274
+ # @return [::String]
2275
+ # Output only. An opaque token that can be passed to [Navigation
2276
+ # SDK](https://developers.google.com/maps/documentation/navigation) to
2277
+ # reconstruct the route during navigation, and, in the event of rerouting,
2278
+ # honor the original intention when the route was created. Treat this token
2279
+ # as an opaque blob. Don't compare its value across requests as its value
2280
+ # may change even if the service returns the exact same route. This field
2281
+ # is only populated if [populate_transition_polylines]
2282
+ # [google.maps.routeoptimization.v1.OptimizeToursRequest.populate_transition_polylines]
2283
+ # is set to true.
2284
+ # @!attribute [rw] vehicle_loads
2285
+ # @return [::Google::Protobuf::Map{::String => ::Google::Maps::RouteOptimization::V1::ShipmentRoute::VehicleLoad}]
2286
+ # Vehicle loads during this transition, for each type that either appears
2287
+ # in this vehicle's
2288
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#load_limits Vehicle.load_limits},
2289
+ # or that have non-zero
2290
+ # {::Google::Maps::RouteOptimization::V1::Shipment#load_demands Shipment.load_demands}
2291
+ # on some shipment performed on this route.
2292
+ #
2293
+ # The loads during the first transition are the starting loads of the
2294
+ # vehicle route. Then, after each visit, the visit's `load_demands` are
2295
+ # either added or subtracted to get the next transition's loads, depending
2296
+ # on whether the visit was a pickup or a delivery.
2297
+ class Transition
2298
+ include ::Google::Protobuf::MessageExts
2299
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2300
+
2301
+ # @!attribute [rw] key
2302
+ # @return [::String]
2303
+ # @!attribute [rw] value
2304
+ # @return [::Google::Maps::RouteOptimization::V1::ShipmentRoute::VehicleLoad]
2305
+ class VehicleLoadsEntry
2306
+ include ::Google::Protobuf::MessageExts
2307
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2308
+ end
2309
+ end
2310
+
2311
+ # Reports the actual load of the vehicle at some point along the route,
2312
+ # for a given type (see
2313
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition#vehicle_loads Transition.vehicle_loads}).
2314
+ # @!attribute [rw] amount
2315
+ # @return [::Integer]
2316
+ # The amount of load on the vehicle, for the given type. The unit of load
2317
+ # is usually indicated by the type. See
2318
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition#vehicle_loads Transition.vehicle_loads}.
2319
+ class VehicleLoad
2320
+ include ::Google::Protobuf::MessageExts
2321
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2322
+ end
2323
+
2324
+ # The encoded representation of a polyline. More information on polyline
2325
+ # encoding can be found here:
2326
+ # https://developers.google.com/maps/documentation/utilities/polylinealgorithm
2327
+ # https://developers.google.com/maps/documentation/javascript/reference/geometry#encoding.
2328
+ # @!attribute [rw] points
2329
+ # @return [::String]
2330
+ # String representing encoded points of the polyline.
2331
+ class EncodedPolyline
2332
+ include ::Google::Protobuf::MessageExts
2333
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2334
+ end
2335
+
2336
+ # Data representing the execution of a break.
2337
+ # @!attribute [rw] start_time
2338
+ # @return [::Google::Protobuf::Timestamp]
2339
+ # Start time of a break.
2340
+ # @!attribute [rw] duration
2341
+ # @return [::Google::Protobuf::Duration]
2342
+ # Duration of a break.
2343
+ class Break
2344
+ include ::Google::Protobuf::MessageExts
2345
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2346
+ end
2347
+
2348
+ # @!attribute [rw] key
2349
+ # @return [::String]
2350
+ # @!attribute [rw] value
2351
+ # @return [::Float]
2352
+ class RouteCostsEntry
2353
+ include ::Google::Protobuf::MessageExts
2354
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2355
+ end
2356
+ end
2357
+
2358
+ # Specifies details of unperformed shipments in a solution. For trivial cases
2359
+ # and/or if we are able to identify the cause for skipping, we report the
2360
+ # reason here.
2361
+ # @!attribute [rw] index
2362
+ # @return [::Integer]
2363
+ # The index corresponds to the index of the shipment in the source
2364
+ # `ShipmentModel`.
2365
+ # @!attribute [rw] label
2366
+ # @return [::String]
2367
+ # Copy of the corresponding
2368
+ # {::Google::Maps::RouteOptimization::V1::Shipment#label Shipment.label}, if
2369
+ # specified in the `Shipment`.
2370
+ # @!attribute [rw] penalty_cost
2371
+ # @return [::Float]
2372
+ # This is a copy of the
2373
+ # {::Google::Maps::RouteOptimization::V1::Shipment#penalty_cost Shipment.penalty_cost},
2374
+ # included here to make it easier to see the severity of a skipped shipment.
2375
+ #
2376
+ # Experimental: This field's behavior or existence may change in future.
2377
+ # @!attribute [rw] estimated_incompatible_vehicle_ratio
2378
+ # @return [::Float]
2379
+ # Estimated ratio of vehicles that cannot perform this shipment for at least
2380
+ # one of the reasons below.
2381
+ # Note: this is only filled when reasons involve a vehicle.
2382
+ #
2383
+ # Experimental: This field's behavior or existence may change in future.
2384
+ # @!attribute [rw] reasons
2385
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::SkippedShipment::Reason>]
2386
+ # A list of reasons that explain why the shipment was skipped. See comment
2387
+ # above `Reason`. If we are unable to understand why a shipment was skipped,
2388
+ # reasons will not be set.
2389
+ class SkippedShipment
2390
+ include ::Google::Protobuf::MessageExts
2391
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2392
+
2393
+ # If we can explain why the shipment was skipped, reasons will be listed
2394
+ # here. If the reason is not the same for all vehicles, `reason` will have
2395
+ # more than 1 element. A skipped shipment cannot have duplicate reasons,
2396
+ # i.e. where all fields are the same except for `example_vehicle_index`.
2397
+ # Example:
2398
+ # ```
2399
+ # reasons {
2400
+ # code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
2401
+ # example_vehicle_index: 1
2402
+ # example_exceeded_capacity_type: "Apples"
2403
+ # }
2404
+ # reasons {
2405
+ # code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
2406
+ # example_vehicle_index: 3
2407
+ # example_exceeded_capacity_type: "Pears"
2408
+ # }
2409
+ # reasons {
2410
+ # code: CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT
2411
+ # example_vehicle_index: 1
2412
+ # }
2413
+ # ```
2414
+ # The skipped shipment is incompatible with all vehicles. The reasons may
2415
+ # be different for all vehicles but at least one vehicle's "Apples"
2416
+ # capacity would be exceeded (including vehicle 1), at least one vehicle's
2417
+ # "Pears" capacity would be exceeded (including vehicle 3) and at least one
2418
+ # vehicle's distance limit would be exceeded (including vehicle 1).
2419
+ # @!attribute [rw] code
2420
+ # @return [::Google::Maps::RouteOptimization::V1::SkippedShipment::Reason::Code]
2421
+ # Refer to the comments of Code.
2422
+ # @!attribute [rw] example_vehicle_index
2423
+ # @return [::Integer]
2424
+ # If the reason is related to a shipment-vehicle incompatibility, this
2425
+ # field provides the index of one relevant vehicle.
2426
+ # @!attribute [rw] example_vehicle_indices
2427
+ # @return [::Array<::Integer>]
2428
+ # Same as
2429
+ # {::Google::Maps::RouteOptimization::V1::SkippedShipment::Reason#example_vehicle_index example_vehicle_index}
2430
+ # except that we provide the list of multiple identified vehicles. This
2431
+ # list is not necessarily exhaustive. This is only filled if
2432
+ # [fill_example_vehicle_indices_in_skipped_reasons][] is true.
2433
+ #
2434
+ # Experimental: This field's behavior or existence may change in future.
2435
+ # @!attribute [rw] example_exceeded_capacity_type
2436
+ # @return [::String]
2437
+ # If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one
2438
+ # capacity type that is exceeded.
2439
+ class Reason
2440
+ include ::Google::Protobuf::MessageExts
2441
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2442
+
2443
+ # Code identifying the reason type. The order here is meaningless. In
2444
+ # particular, it gives no indication of whether a given reason will
2445
+ # appear before another in the solution, if both apply.
2446
+ module Code
2447
+ # This should never be used.
2448
+ CODE_UNSPECIFIED = 0
2449
+
2450
+ # There is no vehicle in the model making all shipments infeasible.
2451
+ NO_VEHICLE = 1
2452
+
2453
+ # The demand of the shipment exceeds a vehicle's capacity for some
2454
+ # capacity types, one of which is `example_exceeded_capacity_type`.
2455
+ DEMAND_EXCEEDS_VEHICLE_CAPACITY = 2
2456
+
2457
+ # The minimum distance necessary to perform this shipment, i.e. from
2458
+ # the vehicle's `start_location` to the shipment's pickup and/or delivery
2459
+ # locations and to the vehicle's end location exceeds the vehicle's
2460
+ # `route_distance_limit`.
2461
+ #
2462
+ # Note that for this computation we use the geodesic distances.
2463
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT = 3
2464
+
2465
+ # The minimum time necessary to perform this shipment, including travel
2466
+ # time, wait time and service time exceeds the vehicle's
2467
+ # `route_duration_limit`.
2468
+ #
2469
+ # Note: travel time is computed in the best-case scenario, namely as
2470
+ # geodesic distance x 36 m/s (roughly 130 km/hour).
2471
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT = 4
2472
+
2473
+ # Same as above but we only compare minimum travel time and the
2474
+ # vehicle's `travel_duration_limit`.
2475
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT = 5
2476
+
2477
+ # The vehicle cannot perform this shipment in the best-case scenario
2478
+ # (see `CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT` for time
2479
+ # computation) if it starts at its earliest start time: the total time
2480
+ # would make the vehicle end after its latest end time.
2481
+ CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS = 6
2482
+
2483
+ # The `allowed_vehicle_indices` field of the shipment is not empty and
2484
+ # this vehicle does not belong to it.
2485
+ VEHICLE_NOT_ALLOWED = 7
2486
+
2487
+ # The vehicle's `ignore` field is true.
2488
+ #
2489
+ # Experimental: This field's behavior or existence may change in future.
2490
+ VEHICLE_IGNORED = 8
2491
+
2492
+ # The shipment's `ignore` field is true.
2493
+ #
2494
+ # Experimental: This field's behavior or existence may change in future.
2495
+ SHIPMENT_IGNORED = 9
2496
+
2497
+ # The shipment is skipped in the `injected_solution_constraint`.
2498
+ #
2499
+ # Experimental: This field's behavior or existence may change in future.
2500
+ SKIPPED_IN_INJECTED_SOLUTION_CONSTRAINT = 10
2501
+
2502
+ # The vehicle route relaxation specified in the
2503
+ # `injected_solution_constraint` doesn't permit any visit to be inserted.
2504
+ #
2505
+ # Experimental: This field's behavior or existence may change in future.
2506
+ VEHICLE_ROUTE_IS_FULLY_SEQUENCE_CONSTRAINED = 11
2507
+
2508
+ # The shipment has a zero penalty cost. While this can be useful as an
2509
+ # advanced modelling choice, it may also explain after the fact why a
2510
+ # shipment was skipped.
2511
+ #
2512
+ # Experimental: This field's behavior or existence may change in future.
2513
+ ZERO_PENALTY_COST = 13
2514
+ end
2515
+ end
2516
+ end
2517
+
2518
+ # Aggregated metrics for
2519
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute ShipmentRoute} (resp. for
2520
+ # {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse OptimizeToursResponse}
2521
+ # over all
2522
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition Transition}
2523
+ # and/or {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit Visit} (resp.
2524
+ # over all {::Google::Maps::RouteOptimization::V1::ShipmentRoute ShipmentRoute})
2525
+ # elements.
2526
+ # @!attribute [rw] performed_shipment_count
2527
+ # @return [::Integer]
2528
+ # Number of shipments performed. Note that a pickup and delivery pair only
2529
+ # counts once.
2530
+ # @!attribute [rw] performed_mandatory_shipment_count
2531
+ # @return [::Integer]
2532
+ # Number of mandatory shipments performed.
2533
+ #
2534
+ # Experimental: This field's behavior or existence may change in future.
2535
+ # @!attribute [rw] performed_shipment_penalty_cost_sum
2536
+ # @return [::Float]
2537
+ # The sum of the
2538
+ # {::Google::Maps::RouteOptimization::V1::Shipment#penalty_cost Shipment.penalty_cost}
2539
+ # of the performed shipments.
2540
+ #
2541
+ # Experimental: This field's behavior or existence may change in future.
2542
+ # @!attribute [rw] travel_duration
2543
+ # @return [::Google::Protobuf::Duration]
2544
+ # Total travel duration for a route or a solution.
2545
+ # @!attribute [rw] wait_duration
2546
+ # @return [::Google::Protobuf::Duration]
2547
+ # Total wait duration for a route or a solution.
2548
+ # @!attribute [rw] delay_duration
2549
+ # @return [::Google::Protobuf::Duration]
2550
+ # Total delay duration for a route or a solution.
2551
+ # @!attribute [rw] break_duration
2552
+ # @return [::Google::Protobuf::Duration]
2553
+ # Total break duration for a route or a solution.
2554
+ # @!attribute [rw] visit_duration
2555
+ # @return [::Google::Protobuf::Duration]
2556
+ # Total visit duration for a route or a solution.
2557
+ # @!attribute [rw] total_duration
2558
+ # @return [::Google::Protobuf::Duration]
2559
+ # The total duration should be equal to the sum of all durations above.
2560
+ # For routes, it also corresponds to:
2561
+ # ```
2562
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_end_time ShipmentRoute.vehicle_end_time}
2563
+ # -
2564
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_start_time ShipmentRoute.vehicle_start_time}
2565
+ # ```
2566
+ # @!attribute [rw] travel_distance_meters
2567
+ # @return [::Float]
2568
+ # Total travel distance for a route or a solution.
2569
+ # @!attribute [rw] max_loads
2570
+ # @return [::Google::Protobuf::Map{::String => ::Google::Maps::RouteOptimization::V1::ShipmentRoute::VehicleLoad}]
2571
+ # Maximum load achieved over the entire route (resp. solution), for each of
2572
+ # the quantities on this route (resp. solution), computed as the maximum over
2573
+ # all
2574
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition#vehicle_loads Transition.vehicle_loads}
2575
+ # (resp.
2576
+ # {::Google::Maps::RouteOptimization::V1::AggregatedMetrics#max_loads ShipmentRoute.metrics.max_loads}.
2577
+ class AggregatedMetrics
2578
+ include ::Google::Protobuf::MessageExts
2579
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2580
+
2581
+ # @!attribute [rw] key
2582
+ # @return [::String]
2583
+ # @!attribute [rw] value
2584
+ # @return [::Google::Maps::RouteOptimization::V1::ShipmentRoute::VehicleLoad]
2585
+ class MaxLoadsEntry
2586
+ include ::Google::Protobuf::MessageExts
2587
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2588
+ end
2589
+ end
2590
+
2591
+ # {::Google::Maps::RouteOptimization::V1::VehicleFullness VehicleFullness} is a
2592
+ # metric which computes how full a vehicle is. Each
2593
+ # {::Google::Maps::RouteOptimization::V1::VehicleFullness VehicleFullness} field is
2594
+ # between 0 and 1, computed as the ratio between a capped metric field (e.g.
2595
+ # {::Google::Maps::RouteOptimization::V1::AggregatedMetrics#travel_distance_meters AggregatedMetrics.travel_distance_meters})
2596
+ # and its related vehicle limit (e.g.
2597
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#route_distance_limit Vehicle.route_distance_limit}),
2598
+ # if it exists. Otherwise the fullness ratio stays unset. If the limit is 0,
2599
+ # the field is set to 1. Note: when a route is subject to traffic
2600
+ # infeasibilities, some raw fullness ratios might exceed 1.0, e.g. the vehicle
2601
+ # might exceed its distance limit. In these cases, we cap the fullness values
2602
+ # at 1.0.
2603
+ # @!attribute [rw] max_fullness
2604
+ # @return [::Float]
2605
+ # Maximum of all other fields in this message.
2606
+ # @!attribute [rw] distance
2607
+ # @return [::Float]
2608
+ # The ratio between
2609
+ # {::Google::Maps::RouteOptimization::V1::AggregatedMetrics#travel_distance_meters AggregatedMetrics.travel_distance_meters}
2610
+ # and
2611
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#route_distance_limit Vehicle.route_distance_limit}.
2612
+ # If
2613
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#route_distance_limit Vehicle.route_distance_limit}
2614
+ # is unset, this field will be unset.
2615
+ # @!attribute [rw] travel_duration
2616
+ # @return [::Float]
2617
+ # The ratio between [AggregatedMetrics.travel_duration_seconds][] and
2618
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#travel_duration_limit Vehicle.travel_duration_limit}.
2619
+ # If
2620
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#travel_duration_limit Vehicle.travel_duration_limit}
2621
+ # is unset, this field will be unset.
2622
+ # @!attribute [rw] active_duration
2623
+ # @return [::Float]
2624
+ # The ratio between [AggregatedMetrics.total_duration_seconds][] and
2625
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#route_duration_limit Vehicle.route_duration_limit}.
2626
+ # If
2627
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#route_duration_limit Vehicle.route_duration_limit}
2628
+ # is unset, this field will be unset.
2629
+ # @!attribute [rw] max_load
2630
+ # @return [::Float]
2631
+ # The maximum ratio among all types of [AggregatedMetrics.max_load][] and
2632
+ # their respective
2633
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#load_limits Vehicle.load_limits}.
2634
+ # If all
2635
+ # {::Google::Maps::RouteOptimization::V1::Vehicle#load_limits Vehicle.load_limits}
2636
+ # fields are unset, this field will be unset.
2637
+ # @!attribute [rw] active_span
2638
+ # @return [::Float]
2639
+ # The ratio (vehicle_end_time - vehicle_start_time) /
2640
+ # (latest_vehicle_end_time - earliest_vehicle_start_time) for a given
2641
+ # vehicle. If the denominator is not present, it uses
2642
+ # ({::Google::Maps::RouteOptimization::V1::ShipmentModel#global_end_time ShipmentModel.global_end_time}
2643
+ # -
2644
+ # {::Google::Maps::RouteOptimization::V1::ShipmentModel#global_start_time ShipmentModel.global_start_time})
2645
+ # instead.
2646
+ class VehicleFullness
2647
+ include ::Google::Protobuf::MessageExts
2648
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2649
+ end
2650
+
2651
+ # Solution injected in the request including information about which visits
2652
+ # must be constrained and how they must be constrained.
2653
+ # @!attribute [rw] routes
2654
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute>]
2655
+ # Routes of the solution to inject. Some routes may be omitted from the
2656
+ # original solution. The routes and skipped shipments must satisfy the basic
2657
+ # validity assumptions listed for `injected_first_solution_routes`.
2658
+ # @!attribute [rw] skipped_shipments
2659
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::SkippedShipment>]
2660
+ # Skipped shipments of the solution to inject. Some may be omitted from the
2661
+ # original solution. See the `routes` field.
2662
+ # @!attribute [rw] constraint_relaxations
2663
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint::ConstraintRelaxation>]
2664
+ # For zero or more groups of vehicles, specifies when and how much to relax
2665
+ # constraints. If this field is empty, all non-empty vehicle routes are
2666
+ # fully constrained.
2667
+ class InjectedSolutionConstraint
2668
+ include ::Google::Protobuf::MessageExts
2669
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2670
+
2671
+ # For a group of vehicles, specifies at what threshold(s) constraints on
2672
+ # visits will be relaxed and to which level. Shipments listed in
2673
+ # the `skipped_shipment` field are constrained to be skipped; i.e., they
2674
+ # cannot be performed.
2675
+ # @!attribute [rw] relaxations
2676
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint::ConstraintRelaxation::Relaxation>]
2677
+ # All the visit constraint relaxations that will apply to visits on
2678
+ # routes with vehicles in `vehicle_indices`.
2679
+ # @!attribute [rw] vehicle_indices
2680
+ # @return [::Array<::Integer>]
2681
+ # Specifies the vehicle indices to which the visit constraint
2682
+ # `relaxations` apply. If empty, this is considered the default and the
2683
+ # `relaxations` apply to all vehicles that are not specified in other
2684
+ # `constraint_relaxations`. There can be at most one default, i.e., at
2685
+ # most one constraint relaxation field is allowed empty
2686
+ # `vehicle_indices`. A vehicle index can only be listed once, even within
2687
+ # several `constraint_relaxations`.
2688
+ #
2689
+ # A vehicle index is mapped the same as
2690
+ # {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_index ShipmentRoute.vehicle_index},
2691
+ # if `interpret_injected_solutions_using_labels` is true (see `fields`
2692
+ # comment).
2693
+ class ConstraintRelaxation
2694
+ include ::Google::Protobuf::MessageExts
2695
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2696
+
2697
+ # If `relaxations` is empty, the start time and sequence of all visits
2698
+ # on `routes` are fully constrained and no new visits may be inserted or
2699
+ # added to those routes. Also, a vehicle's start and end time in
2700
+ # `routes` is fully constrained, unless the vehicle is empty (i.e., has no
2701
+ # visits and has `used_if_route_is_empty` set to false in the model).
2702
+ #
2703
+ # `relaxations(i).level` specifies the constraint relaxation level applied
2704
+ # to a visit #j that satisfies:
2705
+ #
2706
+ # * `route.visits(j).start_time >= relaxations(i).threshold_time` AND
2707
+ # * `j + 1 >= relaxations(i).threshold_visit_count`
2708
+ #
2709
+ # Similarly, the vehicle start is relaxed to `relaxations(i).level` if it
2710
+ # satisfies:
2711
+ #
2712
+ # * `vehicle_start_time >= relaxations(i).threshold_time` AND
2713
+ # * `relaxations(i).threshold_visit_count == 0`
2714
+ # and the vehicle end is relaxed to `relaxations(i).level` if it satisfies:
2715
+ # * `vehicle_end_time >= relaxations(i).threshold_time` AND
2716
+ # * `route.visits_size() + 1 >= relaxations(i).threshold_visit_count`
2717
+ #
2718
+ # To apply a relaxation level if a visit meets the `threshold_visit_count`
2719
+ # OR the `threshold_time` add two `relaxations` with the same `level`:
2720
+ # one with only `threshold_visit_count` set and the other with only
2721
+ # `threshold_time` set. If a visit satisfies the conditions of multiple
2722
+ # `relaxations`, the most relaxed level applies. As a result, from the
2723
+ # vehicle start through the route visits in order to the vehicle end, the
2724
+ # relaxation level becomes more relaxed: i.e., the relaxation level is
2725
+ # non-decreasing as the route progresses.
2726
+ #
2727
+ # The timing and sequence of route visits that do not satisfy the
2728
+ # threshold conditions of any `relaxations` are fully constrained
2729
+ # and no visits may be inserted into these sequences. Also, if a
2730
+ # vehicle start or end does not satisfy the conditions of any
2731
+ # relaxation the time is fixed, unless the vehicle is empty.
2732
+ # @!attribute [rw] level
2733
+ # @return [::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint::ConstraintRelaxation::Relaxation::Level]
2734
+ # The constraint relaxation level that applies when the conditions
2735
+ # at or after `threshold_time` AND at least `threshold_visit_count` are
2736
+ # satisfied.
2737
+ # @!attribute [rw] threshold_time
2738
+ # @return [::Google::Protobuf::Timestamp]
2739
+ # The time at or after which the relaxation `level` may be applied.
2740
+ # @!attribute [rw] threshold_visit_count
2741
+ # @return [::Integer]
2742
+ # The number of visits at or after which the relaxation `level` may be
2743
+ # applied. If `threshold_visit_count` is 0 (or unset), the `level` may be
2744
+ # applied directly at the vehicle start.
2745
+ #
2746
+ # If it is `route.visits_size() + 1`, the `level` may only be applied to
2747
+ # the vehicle end. If it is more than `route.visits_size() + 1`,
2748
+ # `level` is not applied at all for that route.
2749
+ class Relaxation
2750
+ include ::Google::Protobuf::MessageExts
2751
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2752
+
2753
+ # Expresses the different constraint relaxation levels, which are
2754
+ # applied for a visit and those that follow when it satisfies the
2755
+ # threshold conditions.
2756
+ #
2757
+ # The enumeration below is in order of increasing relaxation.
2758
+ module Level
2759
+ # Implicit default relaxation level: no constraints are relaxed,
2760
+ # i.e., all visits are fully constrained.
2761
+ #
2762
+ # This value must not be explicitly used in `level`.
2763
+ LEVEL_UNSPECIFIED = 0
2764
+
2765
+ # Visit start times and vehicle start/end times will be relaxed, but
2766
+ # each visit remains bound to the same vehicle and the visit sequence
2767
+ # must be observed: no visit can be inserted between them or before
2768
+ # them.
2769
+ RELAX_VISIT_TIMES_AFTER_THRESHOLD = 1
2770
+
2771
+ # Same as `RELAX_VISIT_TIMES_AFTER_THRESHOLD`, but the visit sequence
2772
+ # is also relaxed: visits can only be performed by this vehicle, but
2773
+ # can potentially become unperformed.
2774
+ RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD = 2
2775
+
2776
+ # Same as `RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD`, but the
2777
+ # vehicle is also relaxed: visits are completely free at or after the
2778
+ # threshold time and can potentially become unperformed.
2779
+ RELAX_ALL_AFTER_THRESHOLD = 3
2780
+ end
2781
+ end
2782
+ end
2783
+ end
2784
+
2785
+ # Describes an error or warning encountered when validating an
2786
+ # `OptimizeToursRequest`.
2787
+ # @!attribute [rw] code
2788
+ # @return [::Integer]
2789
+ # A validation error is defined by the pair (`code`, `display_name`) which
2790
+ # are always present.
2791
+ #
2792
+ # The fields following this section provide more context about the error.
2793
+ #
2794
+ # *MULTIPLE ERRORS*:
2795
+ # When there are multiple errors, the validation process tries to output
2796
+ # several of them. Much like a compiler, this is an imperfect process. Some
2797
+ # validation errors will be "fatal", meaning that they stop the entire
2798
+ # validation process. This is the case for `display_name="UNSPECIFIED"`
2799
+ # errors, among others. Some errors may cause the validation process to skip
2800
+ # other errors.
2801
+ #
2802
+ # *STABILITY*:
2803
+ # `code` and `display_name` should be very stable. But new codes and
2804
+ # display names may appear over time, which may cause a given (invalid)
2805
+ # request to yield a different (`code`, `display_name`) pair because the new
2806
+ # error hid the old one. For example, see "MULTIPLE ERRORS".
2807
+ # @!attribute [rw] display_name
2808
+ # @return [::String]
2809
+ # The error display name.
2810
+ # @!attribute [rw] fields
2811
+ # @return [::Array<::Google::Maps::RouteOptimization::V1::OptimizeToursValidationError::FieldReference>]
2812
+ # An error context may involve 0, 1 (most of the time) or more fields. For
2813
+ # example, referring to vehicle #4 and shipment #2's first pickup can be
2814
+ # done as follows:
2815
+ # ```
2816
+ # fields { name: "vehicles" index: 4}
2817
+ # fields { name: "shipments" index: 2 sub_field \\{name: "pickups" index: 0} }
2818
+ # ```
2819
+ # Note, however, that the cardinality of `fields` should not change for a
2820
+ # given error code.
2821
+ # @!attribute [rw] error_message
2822
+ # @return [::String]
2823
+ # Human-readable string describing the error. There is a 1:1 mapping
2824
+ # between `code` and `error_message` (when code != "UNSPECIFIED").
2825
+ #
2826
+ # *STABILITY*: Not stable: the error message associated to a given `code` may
2827
+ # change (hopefully to clarify it) over time. Please rely on the
2828
+ # `display_name` and `code` instead.
2829
+ # @!attribute [rw] offending_values
2830
+ # @return [::String]
2831
+ # May contain the value(s) of the field(s). This is not always available. You
2832
+ # should absolutely not rely on it and use it only for manual model
2833
+ # debugging.
2834
+ class OptimizeToursValidationError
2835
+ include ::Google::Protobuf::MessageExts
2836
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2837
+
2838
+ # Specifies a context for the validation error. A `FieldReference` always
2839
+ # refers to a given field in this file and follows the same hierarchical
2840
+ # structure. For example, we may specify element #2 of `start_time_windows`
2841
+ # of vehicle #5 using:
2842
+ # ```
2843
+ # name: "vehicles" index: 5 sub_field { name: "end_time_windows" index: 2 }
2844
+ # ```
2845
+ # We however omit top-level entities such as `OptimizeToursRequest` or
2846
+ # `ShipmentModel` to avoid crowding the message.
2847
+ # @!attribute [rw] name
2848
+ # @return [::String]
2849
+ # Name of the field, e.g., "vehicles".
2850
+ # @!attribute [rw] index
2851
+ # @return [::Integer]
2852
+ # Index of the field if repeated.
2853
+ #
2854
+ # Note: The following fields are mutually exclusive: `index`, `key`. If a field in that set is populated, all other fields in the set will automatically be cleared.
2855
+ # @!attribute [rw] key
2856
+ # @return [::String]
2857
+ # Key if the field is a map.
2858
+ #
2859
+ # Note: The following fields are mutually exclusive: `key`, `index`. If a field in that set is populated, all other fields in the set will automatically be cleared.
2860
+ # @!attribute [rw] sub_field
2861
+ # @return [::Google::Maps::RouteOptimization::V1::OptimizeToursValidationError::FieldReference]
2862
+ # Recursively nested sub-field, if needed.
2863
+ class FieldReference
2864
+ include ::Google::Protobuf::MessageExts
2865
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2866
+ end
2867
+ end
2868
+
2869
+ # Specify an input for
2870
+ # [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours].
2871
+ # @!attribute [rw] gcs_source
2872
+ # @return [::Google::Maps::RouteOptimization::V1::GcsSource]
2873
+ # A Google Cloud Storage location. This must be a single object (file).
2874
+ # @!attribute [rw] data_format
2875
+ # @return [::Google::Maps::RouteOptimization::V1::DataFormat]
2876
+ # Required. The input data format.
2877
+ class InputConfig
2878
+ include ::Google::Protobuf::MessageExts
2879
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2880
+ end
2881
+
2882
+ # Specify a destination for
2883
+ # [BatchOptimizeTours][google.maps.routeoptimization.v1.RouteOptimizationService.BatchOptimizeTours]
2884
+ # results.
2885
+ # @!attribute [rw] gcs_destination
2886
+ # @return [::Google::Maps::RouteOptimization::V1::GcsDestination]
2887
+ # The Google Cloud Storage location to write the output to.
2888
+ # @!attribute [rw] data_format
2889
+ # @return [::Google::Maps::RouteOptimization::V1::DataFormat]
2890
+ # Required. The output data format.
2891
+ class OutputConfig
2892
+ include ::Google::Protobuf::MessageExts
2893
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2894
+ end
2895
+
2896
+ # The Google Cloud Storage location where the input file will be read from.
2897
+ # @!attribute [rw] uri
2898
+ # @return [::String]
2899
+ # Required. URI of a Google Cloud Storage object with the format
2900
+ # `gs://bucket/path/to/object`.
2901
+ class GcsSource
2902
+ include ::Google::Protobuf::MessageExts
2903
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2904
+ end
2905
+
2906
+ # The Google Cloud Storage location where the output file(s) will be written
2907
+ # to.
2908
+ # @!attribute [rw] uri
2909
+ # @return [::String]
2910
+ # Required. Google Cloud Storage URI.
2911
+ class GcsDestination
2912
+ include ::Google::Protobuf::MessageExts
2913
+ extend ::Google::Protobuf::MessageExts::ClassMethods
2914
+ end
2915
+
2916
+ # Data formats for input and output files.
2917
+ module DataFormat
2918
+ # Invalid value, format must not be UNSPECIFIED.
2919
+ DATA_FORMAT_UNSPECIFIED = 0
2920
+
2921
+ # JavaScript Object Notation.
2922
+ JSON = 1
2923
+
2924
+ # Protocol Buffers text format. See
2925
+ # https://protobuf.dev/reference/protobuf/textformat-spec/
2926
+ PROTO_TEXT = 2
2927
+ end
2928
+ end
2929
+ end
2930
+ end
2931
+ end