@googlemaps/routeoptimization 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -79,6 +79,8 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ
79
79
  | --------------------------- | --------------------------------- |
80
80
  | batch optimize tours | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routeoptimization/samples/generated/v1/route_optimization.batch_optimize_tours.js) |
81
81
  | optimize tours | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routeoptimization/samples/generated/v1/route_optimization.optimize_tours.js) |
82
+ | optimize tours long running | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routeoptimization/samples/generated/v1/route_optimization.optimize_tours_long_running.js) |
83
+ | optimize tours uri | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routeoptimization/samples/generated/v1/route_optimization.optimize_tours_uri.js) |
82
84
  | maps | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routeoptimization/samples/generated/v1/snippet_metadata_google.maps.routeoptimization.v1.json) |
83
85
 
84
86
 
@@ -117,8 +117,138 @@ service RouteOptimization {
117
117
  metadata_type: "BatchOptimizeToursMetadata"
118
118
  };
119
119
  }
120
+
121
+ // This is a variant of the
122
+ // [OptimizeTours][google.maps.routeoptimization.v1.RouteOptimization.OptimizeTours]
123
+ // method designed for
124
+ // optimizations with large timeout values. It should be preferred over the
125
+ // `OptimizeTours` method for optimizations that take longer than
126
+ // a few minutes.
127
+ //
128
+ // The returned [long-running operation][google.longrunning.Operation] (LRO)
129
+ // will have a name of the format
130
+ // `<parent>/operations/<operation_id>` and can be used to track
131
+ // progress of the computation. The
132
+ // [metadata][google.longrunning.Operation.metadata] field type is
133
+ // [OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursLongRunningMetadata].
134
+ // The [response][google.longrunning.Operation.response] field type is
135
+ // [OptimizeToursResponse][google.maps.routeoptimization.v1.OptimizeToursResponse],
136
+ // if successful.
137
+ //
138
+ // Experimental: See
139
+ // https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request
140
+ // for more details.
141
+ //
142
+ rpc OptimizeToursLongRunning(OptimizeToursRequest)
143
+ returns (google.longrunning.Operation) {
144
+ option (google.api.http) = {
145
+ post: "/v1/{parent=projects/*/locations/*}:optimizeToursLongRunning"
146
+ body: "*"
147
+ additional_bindings {
148
+ post: "/v1/{parent=projects/*}:optimizeToursLongRunning"
149
+ body: "*"
150
+ }
151
+ };
152
+ option (google.longrunning.operation_info) = {
153
+ response_type: "OptimizeToursResponse"
154
+ metadata_type: "OptimizeToursLongRunningMetadata"
155
+ };
156
+ }
157
+
158
+ // This is a variant of the
159
+ // [OptimizeToursLongRunning][google.maps.routeoptimization.v1.RouteOptimization.OptimizeToursLongRunning]
160
+ // method designed for optimizations with large timeout values and large
161
+ // input/output sizes.
162
+ //
163
+ // The client specifies the URI of the `OptimizeToursRequest` stored
164
+ // in Google Cloud Storage and the server writes the `OptimizeToursResponse`
165
+ // to a client-specified Google Cloud Storage URI.
166
+ //
167
+ // This method should be preferred over the `OptimizeTours` method for
168
+ // optimizations that take longer than a few minutes and input/output sizes
169
+ // that are larger than 8MB, though it can be used for shorter and smaller
170
+ // optimizations as well.
171
+ //
172
+ // The returned [long-running operation][google.longrunning.Operation] (LRO)
173
+ // will have a name of the format
174
+ // `<parent>/operations/<operation_id>` and can be used to track
175
+ // progress of the computation. The
176
+ // [metadata][google.longrunning.Operation.metadata] field type is
177
+ // [OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursUriMetadata].
178
+ // The [response][google.longrunning.Operation.response] field type is
179
+ // [OptimizeToursUriResponse][google.maps.routeoptimization.v1.OptimizeToursUriResponse],
180
+ // if successful.
181
+ //
182
+ // Experimental: See
183
+ // https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request
184
+ // for more details.
185
+ rpc OptimizeToursUri(OptimizeToursUriRequest)
186
+ returns (google.longrunning.Operation) {
187
+ option (google.api.http) = {
188
+ post: "/v1/{parent=projects/*/locations/*}:OptimizeToursUri"
189
+ body: "*"
190
+ additional_bindings {
191
+ post: "/v1/{parent=projects/*}:OptimizeToursUri"
192
+ body: "*"
193
+ }
194
+ };
195
+ option (google.longrunning.operation_info) = {
196
+ response_type: "OptimizeToursUriResponse"
197
+ metadata_type: "OptimizeToursUriMetadata"
198
+ };
199
+ }
200
+ }
201
+
202
+ // A Universal Resource Identifier that points to a resource that can be read
203
+ // and written by the Route Optimization API.
204
+ message Uri {
205
+ // The URI of the resource. The resource may not yet exist.
206
+ //
207
+ // The contents of the resource are encoded as either JSON
208
+ // or textproto. Only Google Cloud Storage resources are supported. If the
209
+ // resource is encoded as JSON, the resource name must be suffixed with
210
+ // `.json`. If the resource is encoded as textproto, the resource name must
211
+ // be suffixed with `.txtpb`. For example, a Google Cloud Storage URI to
212
+ // a JSON encoded file might look like: `gs://bucket/path/input/object.json`.
213
+ string uri = 1;
120
214
  }
121
215
 
216
+ // A request used by the `OptimizeToursUri` method.
217
+ message OptimizeToursUriRequest {
218
+ // Required. Target project or location to make a call.
219
+ //
220
+ // Format:
221
+ // * `projects/{project-id}`
222
+ // * `projects/{project-id}/locations/{location-id}`
223
+ //
224
+ // If no location is specified, a region will be chosen automatically.
225
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
226
+
227
+ // Required. The URI of the Cloud Storage object containing the
228
+ // `OptimizeToursRequest`.
229
+ Uri input = 2 [(google.api.field_behavior) = REQUIRED];
230
+
231
+ // Required. The URI of the Cloud Storage object that will contain the
232
+ // `OptimizeToursResponse`.
233
+ Uri output = 3 [(google.api.field_behavior) = REQUIRED];
234
+ }
235
+
236
+ // A response returned by the `OptimizeToursUri` method.
237
+ message OptimizeToursUriResponse {
238
+ // Optional. The URI of the Cloud Storage object containing the
239
+ // `OptimizeToursResponse` encoded as either JSON or textproto. If the object
240
+ // was encoded as JSON, the extension of the object name will be
241
+ // `.json`. If the object was encoded as textproto, the extension of the
242
+ // object name will be `.txtpb`.
243
+ //
244
+ // The `crc32_checksum` of the resource can be used to verify the contents of
245
+ // the resource have not been modified.
246
+ Uri output = 1 [(google.api.field_behavior) = OPTIONAL];
247
+ }
248
+
249
+ // Operation metadata for `OptimizeToursUri` calls.
250
+ message OptimizeToursUriMetadata {}
251
+
122
252
  // Request to batch optimize tours as an asynchronous operation.
123
253
  // Each input file should contain one `OptimizeToursRequest`, and each output
124
254
  // file will contain one `OptimizeToursResponse`. The request contains
@@ -160,6 +290,9 @@ message BatchOptimizeToursResponse {}
160
290
  // Operation metadata for `BatchOptimizeToursRequest` calls.
161
291
  message BatchOptimizeToursMetadata {}
162
292
 
293
+ // Operation metadata for `OptimizeToursLongRunning` calls.
294
+ message OptimizeToursLongRunningMetadata {}
295
+
163
296
  // Request to be given to a tour optimization solver which defines the
164
297
  // shipment model to solve as well as optimization parameters.
165
298
  message OptimizeToursRequest {
@@ -194,6 +327,17 @@ message OptimizeToursRequest {
194
327
  // *IMPORTANT*: not all infeasible shipments are returned here, but only the
195
328
  // ones that are detected as infeasible during preprocessing.
196
329
  DETECT_SOME_INFEASIBLE_SHIPMENTS = 2;
330
+
331
+ // This mode only works if `ShipmentModel.objectives` is not empty. The
332
+ // request is not solved. It is only validated and filled with costs
333
+ // corresponding to the given objectives. Also see the documentation of
334
+ // `ShipmentModel.objectives`. The resulting request is returned as
335
+ // `OptimizeToursResponse.processed_request`.
336
+ //
337
+ // Experimental: See
338
+ // https://developers.google.com/maps/tt/route-optimization/experimental/objectives/make-request
339
+ // for more details.
340
+ TRANSFORM_AND_RETURN_REQUEST = 3;
197
341
  }
198
342
 
199
343
  // Mode defining the behavior of the search, trading off latency versus
@@ -473,6 +617,15 @@ message OptimizeToursResponse {
473
617
  // `solving_mode` is `DEFAULT_SOLVE`.
474
618
  repeated OptimizeToursValidationError validation_errors = 5;
475
619
 
620
+ // In some cases we modify the incoming request before solving it, i.e. adding
621
+ // costs. If solving_mode == TRANSFORM_AND_RETURN_REQUEST, the
622
+ // modified request is returned here.
623
+ //
624
+ // Experimental: See
625
+ // https://developers.google.com/maps/tt/route-optimization/experimental/objectives/make-request
626
+ // for more details.
627
+ OptimizeToursRequest processed_request = 21;
628
+
476
629
  // Duration, distance and usage metrics for this solution.
477
630
  Metrics metrics = 6;
478
631
  }
@@ -485,6 +638,45 @@ message OptimizeToursResponse {
485
638
  // * the unperformed shipment penalties.
486
639
  // * the cost of the global duration of the shipments
487
640
  message ShipmentModel {
641
+ // Objectives replace the cost model completely, and are therefore
642
+ // incompatible with pre-existing costs. Each objective maps to a number of
643
+ // pre-defined costs for, e.g., vehicles, shipments or transition attributes.
644
+ //
645
+ // Experimental: See
646
+ // https://developers.google.com/maps/tt/route-optimization/experimental/objectives/make-request
647
+ // for more details.
648
+ message Objective {
649
+ // The objective type that will be mapped to a set of costs.
650
+ enum Type {
651
+ // A default set of costs will be used, to ensure a reasonable solution.
652
+ // Note: this objective can be used on its own, but will also always be
653
+ // added with weight 1.0, as a baseline, to the objectives specified by
654
+ // the user, if it's not already present.
655
+ DEFAULT = 0;
656
+
657
+ // "MIN" objectives.
658
+ // Minimize the total distance traveled.
659
+ MIN_DISTANCE = 10;
660
+
661
+ // Minimize the total working time, summed over all vehicles.
662
+ MIN_WORKING_TIME = 11;
663
+
664
+ // Same as above but focusing on travel time only.
665
+ MIN_TRAVEL_TIME = 12;
666
+
667
+ // Minimize the number of vehicles used.
668
+ MIN_NUM_VEHICLES = 13;
669
+ }
670
+
671
+ // The type of the objective.
672
+ optional Type type = 1;
673
+
674
+ // How much this objective should count relatively to the others. This can
675
+ // be any non-negative number, weights do not have to sum to 1. Weights
676
+ // default to 1.0.
677
+ optional double weight = 2;
678
+ }
679
+
488
680
  // Specifies a duration and distance matrix from visit and vehicle start
489
681
  // locations to visit and vehicle end locations.
490
682
  message DurationDistanceMatrix {
@@ -550,6 +742,17 @@ message ShipmentModel {
550
742
  // Set of vehicles which can be used to perform visits.
551
743
  repeated Vehicle vehicles = 2;
552
744
 
745
+ // The set of objectives for this model, that we will transform into costs.
746
+ // If not empty, the input model has to be costless.
747
+ // To obtain the modified request, please use `solving_mode` =
748
+ // TRANSFORM_AND_RETURN_REQUEST. Note that the request will not
749
+ // be solved in this case. See corresponding documentation.
750
+ //
751
+ // Experimental: See
752
+ // https://developers.google.com/maps/tt/route-optimization/experimental/objectives/make-request
753
+ // for more details.
754
+ repeated Objective objectives = 17;
755
+
553
756
  // Constrains the maximum number of active vehicles. A vehicle is active if
554
757
  // its route performs at least one shipment. This can be used to limit the
555
758
  // number of routes in the case where there are fewer drivers than
@@ -617,7 +820,6 @@ message ShipmentModel {
617
820
  // }
618
821
  // ```
619
822
  //
620
- //
621
823
  // * There are three locations: locA, locB and locC.
622
824
  // * 1 vehicle starting its route at locA and ending it at locB, using
623
825
  // matrix "fast".
@@ -716,6 +918,10 @@ message ShipmentModel {
716
918
  repeated ShipmentTypeRequirement shipment_type_requirements = 13;
717
919
 
718
920
  // Set of precedence rules which must be enforced in the model.
921
+ //
922
+ // *IMPORTANT*: Use of precedence rules limits the size of problem that can be
923
+ // optimized. Requests using precedence rules that include many shipments may
924
+ // be rejected.
719
925
  repeated PrecedenceRule precedence_rules = 14;
720
926
  }
721
927
 
@@ -804,6 +1010,16 @@ message Shipment {
804
1010
  // response as `visit_label` in the corresponding
805
1011
  // [ShipmentRoute.Visit][google.maps.routeoptimization.v1.ShipmentRoute.Visit].
806
1012
  string label = 11;
1013
+
1014
+ // Specifies whether U-turns should be avoided in driving routes at this
1015
+ // location.
1016
+ // U-turn avoidance is best effort and complete avoidance is not guaranteed.
1017
+ // This is an experimental feature and behavior is subject to change.
1018
+ //
1019
+ // Experimental: See
1020
+ // https://developers.google.com/maps/tt/route-optimization/experimental/u-turn-avoidance/make-request
1021
+ // for more details.
1022
+ optional bool avoid_u_turns = 13;
807
1023
  }
808
1024
 
809
1025
  // When performing a visit, a predefined amount may be added to the vehicle
@@ -958,14 +1174,12 @@ message ShipmentTypeIncompatibility {
958
1174
  // same vehicle.
959
1175
  NOT_PERFORMED_BY_SAME_VEHICLE = 1;
960
1176
 
961
- // For two shipments with incompatible types with the
962
- // `NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY` incompatibility mode:
963
- //
964
- // * If both are pickups only (no deliveries) or deliveries only (no
965
- // pickups), they cannot share the same vehicle at all.
966
- // * If one of the shipments has a delivery and the other a pickup, the two
967
- // shipments can share the same vehicle iff the former shipment is
968
- // delivered before the latter is picked up.
1177
+ // In this mode, two shipments with incompatible types can never be on the
1178
+ // same vehicle at the same time:
1179
+ // * They can share the same vehicle only if one is delivered before the
1180
+ // other is picked up.
1181
+ // * When both shipments are pickups-only (no deliveries) or deliveries-only
1182
+ // (no pickups), they can't share the same vehicle at all.
969
1183
  NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY = 2;
970
1184
  }
971
1185
 
@@ -1054,9 +1268,13 @@ message RouteModifiers {
1054
1268
  message Vehicle {
1055
1269
  // Travel modes which can be used by vehicles.
1056
1270
  //
1057
- // These should be a subset of the Google Maps Platform Routes Preferred API
1058
- // travel modes, see:
1059
- // https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode.
1271
+ // These should be a subset of the Google Maps Platform Routes API travel
1272
+ // modes, see:
1273
+ // https://developers.google.com/maps/documentation/routes/reference/rest/v2/RouteTravelMode
1274
+ //
1275
+ // Note: `WALKING` routes are in beta and might sometimes be missing clear
1276
+ // sidewalks or pedestrian paths. You must display this warning to the user
1277
+ // for all walking routes that you display in your app.
1060
1278
  enum TravelMode {
1061
1279
  // Unspecified travel mode, equivalent to `DRIVING`.
1062
1280
  TRAVEL_MODE_UNSPECIFIED = 0;
@@ -1107,6 +1325,97 @@ message Vehicle {
1107
1325
  optional int64 max = 2;
1108
1326
  }
1109
1327
 
1328
+ // Cost of moving one unit of load during a `Transition`.
1329
+ // For a given load, the cost is the sum of two parts:
1330
+ //
1331
+ // - min(load, `load_threshold`) * `cost_per_unit_below_threshold`
1332
+ // - max(0, load - `load_threshold`) * `cost_per_unit_above_threshold`
1333
+ //
1334
+ // With this cost, solutions prefer to deliver high demands first,
1335
+ // or equivalently pickup high demands last.
1336
+ // For example, if a vehicle has
1337
+ //
1338
+ // load_limit {
1339
+ // key: "weight"
1340
+ // value {
1341
+ // cost_per_kilometer {
1342
+ // load_threshold: 15
1343
+ // cost_per_unit_below_threshold: 2.0
1344
+ // cost_per_unit_above_threshold: 10.0
1345
+ // }
1346
+ // }
1347
+ // }
1348
+ //
1349
+ // and its route is start,pickup,pickup,delivery,delivery,end with
1350
+ // transitions:
1351
+ //
1352
+ // transition { vehicle_load['weight'] { amount: 0 }
1353
+ // travel_distance_meters: 1000.0 }
1354
+ // transition { vehicle_load['weight'] { amount: 10 }
1355
+ // travel_distance_meters: 1000.0 }
1356
+ // transition { vehicle_load['weight'] { amount: 20 }
1357
+ // travel_distance_meters: 1000.0 }
1358
+ // transition { vehicle_load['weight'] { amount: 10 }
1359
+ // travel_distance_meters: 1000.0 }
1360
+ // transition { vehicle_load['weight'] { amount: 0 }
1361
+ // travel_distance_meters: 1000.0 }
1362
+ //
1363
+ // then the cost incurred by this `LoadCost` is
1364
+ // (cost_below * load_below * kilometers + cost_above * load_above * kms)
1365
+ //
1366
+ // - transition 0: 0.0
1367
+ // - transition 1: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
1368
+ // - transition 2: 2.0 * 15 * 1.0 + 10.0 * (20 - 15) * 1.0 = 80.0
1369
+ // - transition 3: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
1370
+ // - transition 4: 0.0
1371
+ //
1372
+ // So the `LoadCost` over the route is 120.0.
1373
+ //
1374
+ // However, if the route is start,pickup,delivery,pickup,delivery,end
1375
+ // with transitions:
1376
+ //
1377
+ // transition { vehicle_load['weight'] { amount: 0 }
1378
+ // travel_distance_meters: 1000.0 }
1379
+ // transition { vehicle_load['weight'] { amount: 10 }
1380
+ // travel_distance_meters: 1000.0 }
1381
+ // transition { vehicle_load['weight'] { amount: 0 }
1382
+ // travel_distance_meters: 1000.0 }
1383
+ // transition { vehicle_load['weight'] { amount: 10 }
1384
+ // travel_distance_meters: 1000.0 }
1385
+ // transition { vehicle_load['weight'] { amount: 0 }
1386
+ // travel_distance_meters: 1000.0 }
1387
+ //
1388
+ // then the cost incurred by this `LoadCost` is
1389
+ //
1390
+ // - transition 0: 0.0
1391
+ // - transition 1: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
1392
+ // - transition 2: 0.0
1393
+ // - transition 3: 2.0 * 10 * 1.0 + 10.0 * 0 * 1.0 = 20.0
1394
+ // - transition 4: 0.0
1395
+ //
1396
+ // Here the `LoadCost` over the route is 40.0.
1397
+ //
1398
+ // `LoadCost` makes solutions with heavy-loaded transitions more expensive.
1399
+ //
1400
+ // Experimental: See
1401
+ // https://developers.google.com/maps/tt/route-optimization/experimental/load-cost/make-request
1402
+ // for more details.
1403
+ message LoadCost {
1404
+ // Amount of load above which the cost of moving a unit of load changes
1405
+ // from cost_per_unit_below_threshold to cost_per_unit_above_threshold.
1406
+ // Must be >= 0.
1407
+ optional int64 load_threshold = 1;
1408
+
1409
+ // Cost of moving a unit of load, for each unit between 0 and threshold.
1410
+ // Must be a finite value, and >= 0.
1411
+ optional double cost_per_unit_below_threshold = 2;
1412
+
1413
+ // Cost of moving a unit of load, for each unit above threshold.
1414
+ // In the special case threshold = 0, this is a fixed cost per unit.
1415
+ // Must be a finite value, and >= 0.
1416
+ optional double cost_per_unit_above_threshold = 3;
1417
+ }
1418
+
1110
1419
  // The maximum acceptable amount of load.
1111
1420
  optional int64 max_load = 1;
1112
1421
 
@@ -1122,6 +1431,8 @@ message Vehicle {
1122
1431
  // * [cost_per_unit_above_soft_max][google.maps.routeoptimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs
1123
1432
  // add up and must be in the same unit as
1124
1433
  // [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost].
1434
+ // Soft limits may only be defined on types that apply to either pickups
1435
+ // only or deliveries only throughout the model.
1125
1436
  double cost_per_unit_above_soft_max = 3;
1126
1437
 
1127
1438
  // The acceptable load interval of the vehicle at the start of the route.
@@ -1129,6 +1440,22 @@ message Vehicle {
1129
1440
 
1130
1441
  // The acceptable load interval of the vehicle at the end of the route.
1131
1442
  Interval end_load_interval = 5;
1443
+
1444
+ // Cost of moving one unit of load over one kilometer for this vehicle.
1445
+ // This can be used as a proxy for fuel consumption: if the load is a weight
1446
+ // (in Newtons), then load*kilometer has the dimension of an energy.
1447
+ //
1448
+ // Experimental: See
1449
+ // https://developers.google.com/maps/tt/route-optimization/experimental/load-cost/make-request
1450
+ // for more details.
1451
+ optional LoadCost cost_per_kilometer = 6;
1452
+
1453
+ // Cost of traveling with a unit of load during one hour for this vehicle.
1454
+ //
1455
+ // Experimental: See
1456
+ // https://developers.google.com/maps/tt/route-optimization/experimental/load-cost/make-request
1457
+ // for more details.
1458
+ optional LoadCost cost_per_traveled_hour = 7;
1132
1459
  }
1133
1460
 
1134
1461
  // A limit defining a maximum duration of the route of a vehicle. It can be
@@ -1544,7 +1871,13 @@ message Waypoint {
1544
1871
  // heading.
1545
1872
  Location location = 1;
1546
1873
 
1547
- // The POI Place ID associated with the waypoint.
1874
+ // The POI place ID associated with the waypoint.
1875
+ //
1876
+ // When using a place ID to specify arrival or departure location of a
1877
+ // VisitRequest, use a place ID that is specific enough to determine a
1878
+ // LatLng location for navigation to the place.
1879
+ // For example, a place ID representing a building is suitable, but a place
1880
+ // ID representing a road is discouraged.
1548
1881
  string place_id = 2;
1549
1882
  }
1550
1883
 
@@ -1555,6 +1888,13 @@ message Waypoint {
1555
1888
  // from the center of the road. This option doesn't work for the 'WALKING'
1556
1889
  // travel mode.
1557
1890
  bool side_of_road = 3 [(google.api.field_behavior) = OPTIONAL];
1891
+
1892
+ // Indicates that the waypoint is meant for vehicles to stop at, where the
1893
+ // intention is to either pick up or drop off. This option works only for the
1894
+ // 'DRIVING' travel mode, and when the 'location_type' is 'location'.
1895
+ //
1896
+ // Experimental: This field's behavior or existence may change in future.
1897
+ bool vehicle_stopover = 4;
1558
1898
  }
1559
1899
 
1560
1900
  // Encapsulates a location (a geographic point, and an optional heading).
@@ -1790,6 +2130,20 @@ message ShipmentRoute {
1790
2130
  // [VisitRequest.label][google.maps.routeoptimization.v1.Shipment.VisitRequest.label],
1791
2131
  // if specified in the `VisitRequest`.
1792
2132
  string visit_label = 8;
2133
+
2134
+ // An opaque token representing information about a visit location.
2135
+ //
2136
+ // This field may be populated in the result routes' visits when
2137
+ // [VisitRequest.avoid_u_turns][google.maps.routeoptimization.v1.Shipment.VisitRequest.avoid_u_turns]
2138
+ // was set to true for this visit or if
2139
+ // [ShipmentModel.avoid_u_turns][google.maps.routeoptimization.v1.ShipmentModel.avoid_u_turns]
2140
+ // was set to true in the request
2141
+ // [OptimizeToursRequest][google.maps.routeoptimization.v1.OptimizeToursRequest].
2142
+ //
2143
+ // Experimental: See
2144
+ // https://developers.google.com/maps/tt/route-optimization/experimental/u-turn-avoidance/make-request
2145
+ // for more details.
2146
+ optional int32 injected_solution_location_token = 13;
1793
2147
  }
1794
2148
 
1795
2149
  // Transition between two events on the route. See the description of
@@ -1963,6 +2317,16 @@ message ShipmentRoute {
1963
2317
  // depending on the context.
1964
2318
  AggregatedMetrics metrics = 12;
1965
2319
 
2320
+ // [VehicleFullness][google.maps.routeoptimization.v1.VehicleFullness] field
2321
+ // for computing how close the capped metrics are to their respective vehicle
2322
+ // limits. Its fields are ratios between a capped metric field (e.g.
2323
+ // [AggregatedMetrics.travel_distance_meters][google.maps.routeoptimization.v1.AggregatedMetrics.travel_distance_meters])
2324
+ // and the related vehicle limit (e.g.
2325
+ // [Vehicle.route_distance_limit][google.maps.routeoptimization.v1.Vehicle.route_distance_limit]).
2326
+ //
2327
+ // Experimental: This field's behavior or existence may change in future.
2328
+ VehicleFullness vehicle_fullness = 20;
2329
+
1966
2330
  // Cost of the route, broken down by cost-related request fields.
1967
2331
  // The keys are proto paths, relative to the input OptimizeToursRequest, e.g.
1968
2332
  // "model.shipments.pickups.cost", and the values are the total cost
@@ -2051,6 +2415,34 @@ message SkippedShipment {
2051
2415
  // The `allowed_vehicle_indices` field of the shipment is not empty and
2052
2416
  // this vehicle does not belong to it.
2053
2417
  VEHICLE_NOT_ALLOWED = 7;
2418
+
2419
+ // The vehicle's `ignore` field is true.
2420
+ //
2421
+ // Experimental: This field's behavior or existence may change in future.
2422
+ VEHICLE_IGNORED = 8;
2423
+
2424
+ // The shipment's `ignore` field is true.
2425
+ //
2426
+ // Experimental: This field's behavior or existence may change in future.
2427
+ SHIPMENT_IGNORED = 9;
2428
+
2429
+ // The shipment is skipped in the `injected_solution_constraint`.
2430
+ //
2431
+ // Experimental: This field's behavior or existence may change in future.
2432
+ SKIPPED_IN_INJECTED_SOLUTION_CONSTRAINT = 10;
2433
+
2434
+ // The vehicle route relaxation specified in the
2435
+ // `injected_solution_constraint` doesn't permit any visit to be inserted.
2436
+ //
2437
+ // Experimental: This field's behavior or existence may change in future.
2438
+ VEHICLE_ROUTE_IS_FULLY_SEQUENCE_CONSTRAINED = 11;
2439
+
2440
+ // The shipment has a zero penalty cost. While this can be useful as an
2441
+ // advanced modelling choice, it may also explain after the fact why a
2442
+ // shipment was skipped.
2443
+ //
2444
+ // Experimental: This field's behavior or existence may change in future.
2445
+ ZERO_PENALTY_COST = 13;
2054
2446
  }
2055
2447
 
2056
2448
  // Refer to the comments of Code.
@@ -2060,6 +2452,15 @@ message SkippedShipment {
2060
2452
  // field provides the index of one relevant vehicle.
2061
2453
  optional int32 example_vehicle_index = 2;
2062
2454
 
2455
+ // Same as
2456
+ // [example_vehicle_index][google.maps.routeoptimization.v1.SkippedShipment.Reason.example_vehicle_index]
2457
+ // except that we provide the list of multiple identified vehicles. This
2458
+ // list is not necessarily exhaustive. This is only filled if
2459
+ // [fill_example_vehicle_indices_in_skipped_reasons][] is true.
2460
+ //
2461
+ // Experimental: This field's behavior or existence may change in future.
2462
+ repeated int32 example_vehicle_indices = 5;
2463
+
2063
2464
  // If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one
2064
2465
  // capacity type that is exceeded.
2065
2466
  string example_exceeded_capacity_type = 3;
@@ -2074,6 +2475,20 @@ message SkippedShipment {
2074
2475
  // specified in the `Shipment`.
2075
2476
  string label = 2;
2076
2477
 
2478
+ // This is a copy of the
2479
+ // [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost],
2480
+ // included here to make it easier to see the severity of a skipped shipment.
2481
+ //
2482
+ // Experimental: This field's behavior or existence may change in future.
2483
+ optional double penalty_cost = 6;
2484
+
2485
+ // Estimated ratio of vehicles that cannot perform this shipment for at least
2486
+ // one of the reasons below.
2487
+ // Note: this is only filled when reasons involve a vehicle.
2488
+ //
2489
+ // Experimental: This field's behavior or existence may change in future.
2490
+ optional double estimated_incompatible_vehicle_ratio = 5;
2491
+
2077
2492
  // A list of reasons that explain why the shipment was skipped. See comment
2078
2493
  // above `Reason`. If we are unable to understand why a shipment was skipped,
2079
2494
  // reasons will not be set.
@@ -2093,6 +2508,18 @@ message AggregatedMetrics {
2093
2508
  // counts once.
2094
2509
  int32 performed_shipment_count = 1;
2095
2510
 
2511
+ // Number of mandatory shipments performed.
2512
+ //
2513
+ // Experimental: This field's behavior or existence may change in future.
2514
+ optional int32 performed_mandatory_shipment_count = 12;
2515
+
2516
+ // The sum of the
2517
+ // [Shipment.penalty_cost][google.maps.routeoptimization.v1.Shipment.penalty_cost]
2518
+ // of the performed shipments.
2519
+ //
2520
+ // Experimental: This field's behavior or existence may change in future.
2521
+ optional double performed_shipment_penalty_cost_sum = 13;
2522
+
2096
2523
  // Total travel duration for a route or a solution.
2097
2524
  google.protobuf.Duration travel_duration = 2;
2098
2525
 
@@ -2129,6 +2556,63 @@ message AggregatedMetrics {
2129
2556
  map<string, ShipmentRoute.VehicleLoad> max_loads = 9;
2130
2557
  }
2131
2558
 
2559
+ // [VehicleFullness][google.maps.routeoptimization.v1.VehicleFullness] is a
2560
+ // metric which computes how full a vehicle is. Each
2561
+ // [VehicleFullness][google.maps.routeoptimization.v1.VehicleFullness] field is
2562
+ // between 0 and 1, computed as the ratio between a capped metric field (e.g.
2563
+ // [AggregatedMetrics.travel_distance_meters][google.maps.routeoptimization.v1.AggregatedMetrics.travel_distance_meters])
2564
+ // and its related vehicle limit (e.g.
2565
+ // [Vehicle.route_distance_limit][google.maps.routeoptimization.v1.Vehicle.route_distance_limit]),
2566
+ // if it exists. Otherwise the fullness ratio stays unset. If the limit is 0,
2567
+ // the field is set to 1. Note: when a route is subject to traffic
2568
+ // infeasibilities, some raw fullness ratios might exceed 1.0, e.g. the vehicle
2569
+ // might exceed its distance limit. In these cases, we cap the fullness values
2570
+ // at 1.0.
2571
+ message VehicleFullness {
2572
+ // Maximum of all other fields in this message.
2573
+ optional double max_fullness = 1;
2574
+
2575
+ // The ratio between
2576
+ // [AggregatedMetrics.travel_distance_meters][google.maps.routeoptimization.v1.AggregatedMetrics.travel_distance_meters]
2577
+ // and
2578
+ // [Vehicle.route_distance_limit][google.maps.routeoptimization.v1.Vehicle.route_distance_limit].
2579
+ // If
2580
+ // [Vehicle.route_distance_limit][google.maps.routeoptimization.v1.Vehicle.route_distance_limit]
2581
+ // is unset, this field will be unset.
2582
+ optional double distance = 2;
2583
+
2584
+ // The ratio between [AggregatedMetrics.travel_duration_seconds][] and
2585
+ // [Vehicle.travel_duration_limit][google.maps.routeoptimization.v1.Vehicle.travel_duration_limit].
2586
+ // If
2587
+ // [Vehicle.travel_duration_limit][google.maps.routeoptimization.v1.Vehicle.travel_duration_limit]
2588
+ // is unset, this field will be unset.
2589
+ optional double travel_duration = 3;
2590
+
2591
+ // The ratio between [AggregatedMetrics.total_duration_seconds][] and
2592
+ // [Vehicle.route_duration_limit][google.maps.routeoptimization.v1.Vehicle.route_duration_limit].
2593
+ // If
2594
+ // [Vehicle.route_duration_limit][google.maps.routeoptimization.v1.Vehicle.route_duration_limit]
2595
+ // is unset, this field will be unset.
2596
+ optional double active_duration = 4;
2597
+
2598
+ // The maximum ratio among all types of [AggregatedMetrics.max_load][] and
2599
+ // their respective
2600
+ // [Vehicle.load_limits][google.maps.routeoptimization.v1.Vehicle.load_limits].
2601
+ // If all
2602
+ // [Vehicle.load_limits][google.maps.routeoptimization.v1.Vehicle.load_limits]
2603
+ // fields are unset, this field will be unset.
2604
+ optional double max_load = 5;
2605
+
2606
+ // The ratio (vehicle_end_time - vehicle_start_time) /
2607
+ // (latest_vehicle_end_time - earliest_vehicle_start_time) for a given
2608
+ // vehicle. If the denominator is not present, it uses
2609
+ // ([ShipmentModel.global_end_time][google.maps.routeoptimization.v1.ShipmentModel.global_end_time]
2610
+ // -
2611
+ // [ShipmentModel.global_start_time][google.maps.routeoptimization.v1.ShipmentModel.global_start_time])
2612
+ // instead.
2613
+ optional double active_span = 6;
2614
+ }
2615
+
2132
2616
  // Solution injected in the request including information about which visits
2133
2617
  // must be constrained and how they must be constrained.
2134
2618
  message InjectedSolutionConstraint {