Skip to content

Commit

Permalink
feat: [optimization] added support for walking mode and cost_per_kilo…
Browse files Browse the repository at this point in the history
…meter_below_soft_max (#4620)

* feat: added support for walking mode and cost_per_kilometer_below_soft_max

Clients can now use walking as the travel mode. And clients can set a cost per kilometer bounded by the soft max.

PiperOrigin-RevId: 563199524

Source-Link: googleapis/googleapis@7578999

Source-Link: googleapis/googleapis-gen@ba24bb3
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9wdGltaXphdGlvbi8uT3dsQm90LnlhbWwiLCJoIjoiYmEyNGJiMzc0ZDUwZjEzMzNlYmEzNmNmMjk5ODhhMDU0YmE0ZmZmZiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Sep 7, 2023
1 parent 888a997 commit 083c352
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -122,12 +122,20 @@ message OptimizeToursRequest {
VALIDATE_ONLY = 1;

// Only populates
// [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors]
// or
// [OptimizeToursResponse.skipped_shipments][google.cloud.optimization.v1.OptimizeToursResponse.skipped_shipments],
// and doesn't actually solve the rest of the request (`status` and `routes`
// are unset in the response).
// If infeasibilities in `injected_solution_constraint` routes are detected
// they are populated in the
// [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors]
// field and
// [OptimizeToursResponse.skipped_shipments][google.cloud.optimization.v1.OptimizeToursResponse.skipped_shipments]
// is left empty.
//
// *IMPORTANT*: not all infeasible shipments are returned here, but only the
// ones that are detected as infeasible as a preprocessing.
// ones that are detected as infeasible during preprocessing.
DETECT_SOME_INFEASIBLE_SHIPMENTS = 2;
}

Expand Down Expand Up @@ -165,15 +173,6 @@ message OptimizeToursRequest {
// By default, the solving mode is `DEFAULT_SOLVE` (0).
SolvingMode solving_mode = 4;

// Truncates the number of validation errors returned. These errors are
// typically attached to an INVALID_ARGUMENT error payload as a BadRequest
// error detail (https://cloud.google.com/apis/design/errors#error_details),
// unless solving_mode=VALIDATE_ONLY: see the
// [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors]
// field.
// This defaults to 100 and is capped at 10,000.
optional int32 max_validation_errors = 5;

// Search mode used to solve the request.
SearchMode search_mode = 6;

Expand Down Expand Up @@ -339,6 +338,15 @@ message OptimizeToursRequest {
// meters/seconds.
optional double geodesic_meters_per_second = 16;

// Truncates the number of validation errors returned. These errors are
// typically attached to an INVALID_ARGUMENT error payload as a BadRequest
// error detail (https://cloud.google.com/apis/design/errors#error_details),
// unless solving_mode=VALIDATE_ONLY: see the
// [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors]
// field.
// This defaults to 100 and is capped at 10,000.
optional int32 max_validation_errors = 5;

// Label that may be used to identify this request, reported back in the
// [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label].
string label = 17;
Expand Down Expand Up @@ -1131,6 +1139,9 @@ message Vehicle {

// Travel mode corresponding to driving directions (car, ...).
DRIVING = 1;

// Travel mode corresponding to walking directions.
WALKING = 2;
}

// Policy on how a vehicle can be unloaded. Applies only to shipments having
Expand Down Expand Up @@ -1565,6 +1576,15 @@ message DistanceLimit {
// nonnegative.
optional int64 soft_max_meters = 2;

// Cost per kilometer incurred, increasing up to `soft_max_meters`, with
// formula:
// ```
// min(distance_meters, soft_max_meters) / 1000.0 *
// cost_per_kilometer_below_soft_max.
// ```
// This cost is not supported in `route_distance_limit`.
optional double cost_per_kilometer_below_soft_max = 4;

// Cost per kilometer incurred if distance is above `soft_max_meters` limit.
// The additional cost is 0 if the distance is under the limit, otherwise the
// formula used to compute the cost is the following:
Expand Down Expand Up @@ -2395,7 +2415,8 @@ message InjectedSolutionConstraint {
RELAX_VISIT_TIMES_AFTER_THRESHOLD = 1;

// Same as `RELAX_VISIT_TIMES_AFTER_THRESHOLD`, but the visit sequence
// is also relaxed: visits remain simply bound to their vehicle.
// is also relaxed: visits can only be performed by this vehicle, but
// can potentially become unperformed.
RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD = 2;

// Same as `RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD`, but the
Expand Down Expand Up @@ -2533,6 +2554,7 @@ message OptimizeToursValidationError {
// * INJECTED_SOLUTION_CONCURRENT_SOLUTION_TYPES = 2005;
// * INJECTED_SOLUTION_MORE_THAN_ONE_PER_TYPE = 2006;
// * INJECTED_SOLUTION_REFRESH_WITHOUT_POPULATE = 2008;
// * INJECTED_SOLUTION_CONSTRAINED_ROUTE_PORTION_INFEASIBLE = 2010;
// * SHIPMENT_MODEL_ERROR = 22;
// * SHIPMENT_MODEL_TOO_LARGE = 2200;
// * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201;
Expand Down
30 changes: 20 additions & 10 deletions packages/google-cloud-optimization/protos/protos.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 083c352

Please sign in to comment.