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