diff --git a/Optimization/.OwlBot.yaml b/Optimization/.OwlBot.yaml new file mode 100644 index 000000000000..841755baa24f --- /dev/null +++ b/Optimization/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/optimization/v1/.*-php/(.*) + dest: /owl-bot-staging/Optimization/v1/$1 +api-name: Optimization diff --git a/Optimization/.gitattributes b/Optimization/.gitattributes new file mode 100644 index 000000000000..d43b60862bcf --- /dev/null +++ b/Optimization/.gitattributes @@ -0,0 +1,3 @@ +/*.xml.dist export-ignore +/tests export-ignore +/.github export-ignore diff --git a/Optimization/.github/pull_request_template.md b/Optimization/.github/pull_request_template.md new file mode 100644 index 000000000000..7f0c319008a1 --- /dev/null +++ b/Optimization/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `Optimization/src`, and tests in `Optimization/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/Optimization/.repo-metadata.json b/Optimization/.repo-metadata.json new file mode 100644 index 000000000000..a90831a3bbfa --- /dev/null +++ b/Optimization/.repo-metadata.json @@ -0,0 +1,6 @@ +{ + "distribution_name": "google/cloud-optimization", + "release_level": "beta", + "client_documentation": "http://googleapis.github.io/google-cloud-php/#/docs/cloud-optimization/latest", + "library_type": "GAPIC_AUTO" +} diff --git a/Optimization/CODE_OF_CONDUCT.md b/Optimization/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..c3727800341a --- /dev/null +++ b/Optimization/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) \ No newline at end of file diff --git a/Optimization/CONTRIBUTING.md b/Optimization/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/Optimization/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/Optimization/LICENSE b/Optimization/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/Optimization/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/Optimization/README.md b/Optimization/README.md new file mode 100644 index 000000000000..1aa50839d681 --- /dev/null +++ b/Optimization/README.md @@ -0,0 +1,39 @@ +# Google Cloud Optimization for PHP + +> Idiomatic PHP client for [Google Cloud Optimization](https://cloud.google.com/optimization). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-optimization/v/stable)](https://packagist.org/packages/google/cloud-optimization) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-optimization.svg)](https://packagist.org/packages/google/cloud-optimization) + +* [API documentation](http://googleapis.github.io/google-cloud-php/#/docs/cloud-optimization/latest/optimization/readme) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now to install just run: + +```sh +$ composer require google/cloud-optimization +``` + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods) +please see our [gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Version + +This component is considered beta. As such, it should be expected to be mostly +stable and we're working towards a release candidate. We will address issues +and requests with a higher priority. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/optimization/docs). diff --git a/Optimization/SECURITY.md b/Optimization/SECURITY.md new file mode 100644 index 000000000000..8b58ae9c01ae --- /dev/null +++ b/Optimization/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/Optimization/VERSION b/Optimization/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/Optimization/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/Optimization/composer.json b/Optimization/composer.json new file mode 100644 index 000000000000..9417397b3d6d --- /dev/null +++ b/Optimization/composer.json @@ -0,0 +1,36 @@ +{ + "name": "google/cloud-optimization", + "description": "Google Cloud Optimization Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\Optimization\\": "src", + "GPBMetadata\\Google\\Cloud\\Optimization\\": "metadata" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\Optimization\\Tests\\": "tests" + } + }, + "extra": { + "component": { + "id": "cloud-optimization", + "path": "Optimization", + "entry": null, + "target": "googleapis/google-cloud-php-optimization.git" + } + }, + "require": { + "google/gax": "^1.12.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0|^8.0", + "phpdocumentor/reflection": "^3.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/Optimization/metadata/V1/AsyncModel.php b/Optimization/metadata/V1/AsyncModel.php new file mode 100644 index 000000000000..9792af5c7a28 Binary files /dev/null and b/Optimization/metadata/V1/AsyncModel.php differ diff --git a/Optimization/metadata/V1/FleetRouting.php b/Optimization/metadata/V1/FleetRouting.php new file mode 100644 index 000000000000..a90cdd5c24f2 Binary files /dev/null and b/Optimization/metadata/V1/FleetRouting.php differ diff --git a/Optimization/owlbot.py b/Optimization/owlbot.py new file mode 100644 index 000000000000..97230876f635 --- /dev/null +++ b/Optimization/owlbot.py @@ -0,0 +1,97 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/Optimization").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main(src=src, dest=dest) + +# document and utilize apiEndpoint instead of serviceAddress +s.replace( + "**/Gapic/*GapicClient.php", + r"'serviceAddress' =>", + r"'apiEndpoint' =>") +s.replace( + "**/Gapic/*GapicClient.php", + r"@type string \$serviceAddress\n\s+\*\s+The address", + r"""@type string $serviceAddress + * **Deprecated**. This option will be removed in a future major release. Please + * utilize the `$apiEndpoint` option instead. + * @type string $apiEndpoint + * The address""") +s.replace( + "**/Gapic/*GapicClient.php", + r"\$transportConfig, and any \$serviceAddress", + r"$transportConfig, and any `$apiEndpoint`") + +### [START] protoc backwards compatibility fixes + +# roll back to private properties. +s.replace( + "src/**/V*/**/*.php", + r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", + r"""Generated from protobuf field \1 + */ + private $""") + +# prevent proto messages from being marked final +s.replace( + "src/**/V*/**/*.php", + r"final class", + r"class") + +# Replace "Unwrapped" with "Value" for method names. +s.replace( + "src/**/V*/**/*.php", + r"public function ([s|g]\w{3,})Unwrapped", + r"public function \1Value" +) + +### [END] protoc backwards compatibility fixes + +# fix relative cloud.google.com links +s.replace( + "src/**/V*/**/*.php", + r"(.{0,})\]\((/.{0,})\)", + r"\1](https://cloud.google.com\2)" +) + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Gapic/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=80']) \ No newline at end of file diff --git a/Optimization/phpunit.xml.dist b/Optimization/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Optimization/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Optimization/src/V1/AggregatedMetrics.php b/Optimization/src/V1/AggregatedMetrics.php new file mode 100644 index 000000000000..bb97bbe4e0dd --- /dev/null +++ b/Optimization/src/V1/AggregatedMetrics.php @@ -0,0 +1,512 @@ +google.cloud.optimization.v1.AggregatedMetrics + */ +class AggregatedMetrics extends \Google\Protobuf\Internal\Message +{ + /** + * Number of shipments performed. Note that a pickup and delivery pair only + * counts once. + * + * Generated from protobuf field int32 performed_shipment_count = 1; + */ + private $performed_shipment_count = 0; + /** + * Total travel duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 2; + */ + private $travel_duration = null; + /** + * Total wait duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 3; + */ + private $wait_duration = null; + /** + * Total delay duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + */ + private $delay_duration = null; + /** + * Total break duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + */ + private $break_duration = null; + /** + * Total visit duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration visit_duration = 6; + */ + private $visit_duration = null; + /** + * The total duration should be equal to the sum of all durations above. + * For routes, it also corresponds to [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time] - + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + */ + private $total_duration = null; + /** + * Total travel distance for a route or a solution. + * + * Generated from protobuf field double travel_distance_meters = 8; + */ + private $travel_distance_meters = 0.0; + /** + * Maximum load achieved over the entire route (resp. solution), for each of + * the quantities on this route (resp. solution), computed as the maximum over + * all + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * (resp. + * [ShipmentRoute.metrics.max_loads][google.cloud.optimization.v1.AggregatedMetrics.max_loads]. + * + * Generated from protobuf field map max_loads = 9; + */ + private $max_loads; + /** + * Deprecated: Use [ShipmentRoute.route_costs][] and [OptimizeToursResponse.Metrics.costs][] instead. + * + * Generated from protobuf field map costs = 10 [deprecated = true]; + * @deprecated + */ + private $costs; + /** + * Deprecated: Use [ShipmentRoute.route_total_cost][] and [OptimizeToursResponse.Metrics.total_cost][] instead. + * + * Generated from protobuf field double total_cost = 11 [deprecated = true]; + * @deprecated + */ + protected $total_cost = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $performed_shipment_count + * Number of shipments performed. Note that a pickup and delivery pair only + * counts once. + * @type \Google\Protobuf\Duration $travel_duration + * Total travel duration for a route or a solution. + * @type \Google\Protobuf\Duration $wait_duration + * Total wait duration for a route or a solution. + * @type \Google\Protobuf\Duration $delay_duration + * Total delay duration for a route or a solution. + * @type \Google\Protobuf\Duration $break_duration + * Total break duration for a route or a solution. + * @type \Google\Protobuf\Duration $visit_duration + * Total visit duration for a route or a solution. + * @type \Google\Protobuf\Duration $total_duration + * The total duration should be equal to the sum of all durations above. + * For routes, it also corresponds to [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time] - + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * @type float $travel_distance_meters + * Total travel distance for a route or a solution. + * @type array|\Google\Protobuf\Internal\MapField $max_loads + * Maximum load achieved over the entire route (resp. solution), for each of + * the quantities on this route (resp. solution), computed as the maximum over + * all + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * (resp. + * [ShipmentRoute.metrics.max_loads][google.cloud.optimization.v1.AggregatedMetrics.max_loads]. + * @type array|\Google\Protobuf\Internal\MapField $costs + * Deprecated: Use [ShipmentRoute.route_costs][] and [OptimizeToursResponse.Metrics.costs][] instead. + * @type float $total_cost + * Deprecated: Use [ShipmentRoute.route_total_cost][] and [OptimizeToursResponse.Metrics.total_cost][] instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Number of shipments performed. Note that a pickup and delivery pair only + * counts once. + * + * Generated from protobuf field int32 performed_shipment_count = 1; + * @return int + */ + public function getPerformedShipmentCount() + { + return $this->performed_shipment_count; + } + + /** + * Number of shipments performed. Note that a pickup and delivery pair only + * counts once. + * + * Generated from protobuf field int32 performed_shipment_count = 1; + * @param int $var + * @return $this + */ + public function setPerformedShipmentCount($var) + { + GPBUtil::checkInt32($var); + $this->performed_shipment_count = $var; + + return $this; + } + + /** + * Total travel duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTravelDuration() + { + return $this->travel_duration; + } + + public function hasTravelDuration() + { + return isset($this->travel_duration); + } + + public function clearTravelDuration() + { + unset($this->travel_duration); + } + + /** + * Total travel duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTravelDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->travel_duration = $var; + + return $this; + } + + /** + * Total wait duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getWaitDuration() + { + return $this->wait_duration; + } + + public function hasWaitDuration() + { + return isset($this->wait_duration); + } + + public function clearWaitDuration() + { + unset($this->wait_duration); + } + + /** + * Total wait duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setWaitDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->wait_duration = $var; + + return $this; + } + + /** + * Total delay duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getDelayDuration() + { + return $this->delay_duration; + } + + public function hasDelayDuration() + { + return isset($this->delay_duration); + } + + public function clearDelayDuration() + { + unset($this->delay_duration); + } + + /** + * Total delay duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDelayDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->delay_duration = $var; + + return $this; + } + + /** + * Total break duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getBreakDuration() + { + return $this->break_duration; + } + + public function hasBreakDuration() + { + return isset($this->break_duration); + } + + public function clearBreakDuration() + { + unset($this->break_duration); + } + + /** + * Total break duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->break_duration = $var; + + return $this; + } + + /** + * Total visit duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration visit_duration = 6; + * @return \Google\Protobuf\Duration|null + */ + public function getVisitDuration() + { + return $this->visit_duration; + } + + public function hasVisitDuration() + { + return isset($this->visit_duration); + } + + public function clearVisitDuration() + { + unset($this->visit_duration); + } + + /** + * Total visit duration for a route or a solution. + * + * Generated from protobuf field .google.protobuf.Duration visit_duration = 6; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setVisitDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->visit_duration = $var; + + return $this; + } + + /** + * The total duration should be equal to the sum of all durations above. + * For routes, it also corresponds to [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time] - + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getTotalDuration() + { + return $this->total_duration; + } + + public function hasTotalDuration() + { + return isset($this->total_duration); + } + + public function clearTotalDuration() + { + unset($this->total_duration); + } + + /** + * The total duration should be equal to the sum of all durations above. + * For routes, it also corresponds to [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time] - + * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTotalDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->total_duration = $var; + + return $this; + } + + /** + * Total travel distance for a route or a solution. + * + * Generated from protobuf field double travel_distance_meters = 8; + * @return float + */ + public function getTravelDistanceMeters() + { + return $this->travel_distance_meters; + } + + /** + * Total travel distance for a route or a solution. + * + * Generated from protobuf field double travel_distance_meters = 8; + * @param float $var + * @return $this + */ + public function setTravelDistanceMeters($var) + { + GPBUtil::checkDouble($var); + $this->travel_distance_meters = $var; + + return $this; + } + + /** + * Maximum load achieved over the entire route (resp. solution), for each of + * the quantities on this route (resp. solution), computed as the maximum over + * all + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * (resp. + * [ShipmentRoute.metrics.max_loads][google.cloud.optimization.v1.AggregatedMetrics.max_loads]. + * + * Generated from protobuf field map max_loads = 9; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMaxLoads() + { + return $this->max_loads; + } + + /** + * Maximum load achieved over the entire route (resp. solution), for each of + * the quantities on this route (resp. solution), computed as the maximum over + * all + * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] + * (resp. + * [ShipmentRoute.metrics.max_loads][google.cloud.optimization.v1.AggregatedMetrics.max_loads]. + * + * Generated from protobuf field map max_loads = 9; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMaxLoads($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\VehicleLoad::class); + $this->max_loads = $arr; + + return $this; + } + + /** + * Deprecated: Use [ShipmentRoute.route_costs][] and [OptimizeToursResponse.Metrics.costs][] instead. + * + * Generated from protobuf field map costs = 10 [deprecated = true]; + * @return \Google\Protobuf\Internal\MapField + * @deprecated + */ + public function getCosts() + { + @trigger_error('costs is deprecated.', E_USER_DEPRECATED); + return $this->costs; + } + + /** + * Deprecated: Use [ShipmentRoute.route_costs][] and [OptimizeToursResponse.Metrics.costs][] instead. + * + * Generated from protobuf field map costs = 10 [deprecated = true]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + * @deprecated + */ + public function setCosts($var) + { + @trigger_error('costs is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->costs = $arr; + + return $this; + } + + /** + * Deprecated: Use [ShipmentRoute.route_total_cost][] and [OptimizeToursResponse.Metrics.total_cost][] instead. + * + * Generated from protobuf field double total_cost = 11 [deprecated = true]; + * @return float + * @deprecated + */ + public function getTotalCost() + { + @trigger_error('total_cost is deprecated.', E_USER_DEPRECATED); + return $this->total_cost; + } + + /** + * Deprecated: Use [ShipmentRoute.route_total_cost][] and [OptimizeToursResponse.Metrics.total_cost][] instead. + * + * Generated from protobuf field double total_cost = 11 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setTotalCost($var) + { + @trigger_error('total_cost is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkDouble($var); + $this->total_cost = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/AsyncModelMetadata.php b/Optimization/src/V1/AsyncModelMetadata.php new file mode 100644 index 000000000000..ea3a6723a51d --- /dev/null +++ b/Optimization/src/V1/AsyncModelMetadata.php @@ -0,0 +1,193 @@ +google.cloud.optimization.v1.AsyncModelMetadata + */ +class AsyncModelMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the current operation. + * + * Generated from protobuf field .google.cloud.optimization.v1.AsyncModelMetadata.State state = 1; + */ + private $state = 0; + /** + * A message providing more details about the current state of the operation. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + */ + private $state_message = ''; + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + */ + private $create_time = null; + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + private $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the current operation. + * @type string $state_message + * A message providing more details about the current state of the operation. + * For example, the error message if the operation is failed. + * @type \Google\Protobuf\Timestamp $create_time + * The creation time of the operation. + * @type \Google\Protobuf\Timestamp $update_time + * The last update time of the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * The state of the current operation. + * + * Generated from protobuf field .google.cloud.optimization.v1.AsyncModelMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the current operation. + * + * Generated from protobuf field .google.cloud.optimization.v1.AsyncModelMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\AsyncModelMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * A message providing more details about the current state of the operation. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * A message providing more details about the current state of the operation. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/AsyncModelMetadata/State.php b/Optimization/src/V1/AsyncModelMetadata/State.php new file mode 100644 index 000000000000..8af7d3def9d2 --- /dev/null +++ b/Optimization/src/V1/AsyncModelMetadata/State.php @@ -0,0 +1,76 @@ +google.cloud.optimization.v1.AsyncModelMetadata.State + */ +class State +{ + /** + * The default value. This value is used if the state is omitted. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The operation completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The operation was cancelled. + * + * Generated from protobuf enum CANCELLED = 3; + */ + const CANCELLED = 3; + /** + * The operation has failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::CANCELLED => 'CANCELLED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/BatchOptimizeToursRequest.php b/Optimization/src/V1/BatchOptimizeToursRequest.php new file mode 100644 index 000000000000..ba94ed120875 --- /dev/null +++ b/Optimization/src/V1/BatchOptimizeToursRequest.php @@ -0,0 +1,117 @@ +google.cloud.optimization.v1.BatchOptimizeToursRequest + */ +class BatchOptimizeToursRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $parent = ''; + /** + * Required. Input/Output information each purchase model, such as file paths and data + * formats. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BatchOptimizeToursRequest.AsyncModelConfig model_configs = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $model_configs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * @type \Google\Cloud\Optimization\V1\BatchOptimizeToursRequest\AsyncModelConfig[]|\Google\Protobuf\Internal\RepeatedField $model_configs + * Required. Input/Output information each purchase model, such as file paths and data + * formats. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Input/Output information each purchase model, such as file paths and data + * formats. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BatchOptimizeToursRequest.AsyncModelConfig model_configs = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModelConfigs() + { + return $this->model_configs; + } + + /** + * Required. Input/Output information each purchase model, such as file paths and data + * formats. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BatchOptimizeToursRequest.AsyncModelConfig model_configs = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Optimization\V1\BatchOptimizeToursRequest\AsyncModelConfig[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModelConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\BatchOptimizeToursRequest\AsyncModelConfig::class); + $this->model_configs = $arr; + + return $this; + } + +} + diff --git a/Optimization/src/V1/BatchOptimizeToursRequest/AsyncModelConfig.php b/Optimization/src/V1/BatchOptimizeToursRequest/AsyncModelConfig.php new file mode 100644 index 000000000000..d79231b70eac --- /dev/null +++ b/Optimization/src/V1/BatchOptimizeToursRequest/AsyncModelConfig.php @@ -0,0 +1,222 @@ +google.cloud.optimization.v1.BatchOptimizeToursRequest.AsyncModelConfig + */ +class AsyncModelConfig extends \Google\Protobuf\Internal\Message +{ + /** + * User defined model name, can be used as alias by users to keep track of + * models. + * + * Generated from protobuf field string display_name = 1; + */ + private $display_name = ''; + /** + * Required. Information about the input model. + * + * Generated from protobuf field .google.cloud.optimization.v1.InputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $input_config = null; + /** + * Required. The desired output location information. + * + * Generated from protobuf field .google.cloud.optimization.v1.OutputConfig output_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $output_config = null; + /** + * If this is set, the model will be solved in the checkpoint mode. In this + * mode, the input model can have a deadline longer than 30 mins without the + * risk of interruption. The model will be solved in multiple short-running + * stages. Each stage generates an intermediate checkpoint + * and stores it in the user's Cloud Storage buckets. The checkpoint + * mode should be preferred over + * allow_large_deadline_despite_interruption_risk since it prevents the risk + * of interruption. + * + * Generated from protobuf field bool enable_checkpoints = 4; + */ + private $enable_checkpoints = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * User defined model name, can be used as alias by users to keep track of + * models. + * @type \Google\Cloud\Optimization\V1\InputConfig $input_config + * Required. Information about the input model. + * @type \Google\Cloud\Optimization\V1\OutputConfig $output_config + * Required. The desired output location information. + * @type bool $enable_checkpoints + * If this is set, the model will be solved in the checkpoint mode. In this + * mode, the input model can have a deadline longer than 30 mins without the + * risk of interruption. The model will be solved in multiple short-running + * stages. Each stage generates an intermediate checkpoint + * and stores it in the user's Cloud Storage buckets. The checkpoint + * mode should be preferred over + * allow_large_deadline_despite_interruption_risk since it prevents the risk + * of interruption. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * User defined model name, can be used as alias by users to keep track of + * models. + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User defined model name, can be used as alias by users to keep track of + * models. + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. Information about the input model. + * + * Generated from protobuf field .google.cloud.optimization.v1.InputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Optimization\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. Information about the input model. + * + * Generated from protobuf field .google.cloud.optimization.v1.InputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Optimization\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Required. The desired output location information. + * + * Generated from protobuf field .google.cloud.optimization.v1.OutputConfig output_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Optimization\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. The desired output location information. + * + * Generated from protobuf field .google.cloud.optimization.v1.OutputConfig output_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Optimization\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + + /** + * If this is set, the model will be solved in the checkpoint mode. In this + * mode, the input model can have a deadline longer than 30 mins without the + * risk of interruption. The model will be solved in multiple short-running + * stages. Each stage generates an intermediate checkpoint + * and stores it in the user's Cloud Storage buckets. The checkpoint + * mode should be preferred over + * allow_large_deadline_despite_interruption_risk since it prevents the risk + * of interruption. + * + * Generated from protobuf field bool enable_checkpoints = 4; + * @return bool + */ + public function getEnableCheckpoints() + { + return $this->enable_checkpoints; + } + + /** + * If this is set, the model will be solved in the checkpoint mode. In this + * mode, the input model can have a deadline longer than 30 mins without the + * risk of interruption. The model will be solved in multiple short-running + * stages. Each stage generates an intermediate checkpoint + * and stores it in the user's Cloud Storage buckets. The checkpoint + * mode should be preferred over + * allow_large_deadline_despite_interruption_risk since it prevents the risk + * of interruption. + * + * Generated from protobuf field bool enable_checkpoints = 4; + * @param bool $var + * @return $this + */ + public function setEnableCheckpoints($var) + { + GPBUtil::checkBool($var); + $this->enable_checkpoints = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/BatchOptimizeToursResponse.php b/Optimization/src/V1/BatchOptimizeToursResponse.php new file mode 100644 index 000000000000..bafba7b88603 --- /dev/null +++ b/Optimization/src/V1/BatchOptimizeToursResponse.php @@ -0,0 +1,34 @@ +google.cloud.optimization.v1.BatchOptimizeToursResponse + */ +class BatchOptimizeToursResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + +} + diff --git a/Optimization/src/V1/BreakRule.php b/Optimization/src/V1/BreakRule.php new file mode 100644 index 000000000000..9bdce865e94e --- /dev/null +++ b/Optimization/src/V1/BreakRule.php @@ -0,0 +1,113 @@ +google.cloud.optimization.v1.BreakRule + */ +class BreakRule extends \Google\Protobuf\Internal\Message +{ + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.BreakRequest break_requests = 1; + */ + private $break_requests; + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.FrequencyConstraint frequency_constraints = 2; + */ + private $frequency_constraints; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\BreakRule\BreakRequest[]|\Google\Protobuf\Internal\RepeatedField $break_requests + * Sequence of breaks. See the `BreakRequest` message. + * @type \Google\Cloud\Optimization\V1\BreakRule\FrequencyConstraint[]|\Google\Protobuf\Internal\RepeatedField $frequency_constraints + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.BreakRequest break_requests = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBreakRequests() + { + return $this->break_requests; + } + + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.BreakRequest break_requests = 1; + * @param \Google\Cloud\Optimization\V1\BreakRule\BreakRequest[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBreakRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\BreakRule\BreakRequest::class); + $this->break_requests = $arr; + + return $this; + } + + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.FrequencyConstraint frequency_constraints = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrequencyConstraints() + { + return $this->frequency_constraints; + } + + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.BreakRule.FrequencyConstraint frequency_constraints = 2; + * @param \Google\Cloud\Optimization\V1\BreakRule\FrequencyConstraint[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrequencyConstraints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\BreakRule\FrequencyConstraint::class); + $this->frequency_constraints = $arr; + + return $this; + } + +} + diff --git a/Optimization/src/V1/BreakRule/BreakRequest.php b/Optimization/src/V1/BreakRule/BreakRequest.php new file mode 100644 index 000000000000..b94ad6687673 --- /dev/null +++ b/Optimization/src/V1/BreakRule/BreakRequest.php @@ -0,0 +1,170 @@ +google.cloud.optimization.v1.BreakRule.BreakRequest + */ +class BreakRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $earliest_start_time = null; + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $latest_start_time = null; + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $min_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $earliest_start_time + * Required. Lower bound (inclusive) on the start of the break. + * @type \Google\Protobuf\Timestamp $latest_start_time + * Required. Upper bound (inclusive) on the start of the break. + * @type \Google\Protobuf\Duration $min_duration + * Required. Minimum duration of the break. Must be positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEarliestStartTime() + { + return $this->earliest_start_time; + } + + public function hasEarliestStartTime() + { + return isset($this->earliest_start_time); + } + + public function clearEarliestStartTime() + { + unset($this->earliest_start_time); + } + + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEarliestStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->earliest_start_time = $var; + + return $this; + } + + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLatestStartTime() + { + return $this->latest_start_time; + } + + public function hasLatestStartTime() + { + return isset($this->latest_start_time); + } + + public function clearLatestStartTime() + { + unset($this->latest_start_time); + } + + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLatestStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->latest_start_time = $var; + + return $this; + } + + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinDuration() + { + return $this->min_duration; + } + + public function hasMinDuration() + { + return isset($this->min_duration); + } + + public function clearMinDuration() + { + unset($this->min_duration); + } + + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_duration = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/BreakRule/FrequencyConstraint.php b/Optimization/src/V1/BreakRule/FrequencyConstraint.php new file mode 100644 index 000000000000..893d94656ed7 --- /dev/null +++ b/Optimization/src/V1/BreakRule/FrequencyConstraint.php @@ -0,0 +1,164 @@ +google.cloud.optimization.v1.BreakRule.FrequencyConstraint + */ +class FrequencyConstraint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $min_break_duration = null; + /** + * Required. Maximum allowed span of any interval of time in the route that does not + * include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $max_inter_break_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $min_break_duration + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * @type \Google\Protobuf\Duration $max_inter_break_duration + * Required. Maximum allowed span of any interval of time in the route that does not + * include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinBreakDuration() + { + return $this->min_break_duration; + } + + public function hasMinBreakDuration() + { + return isset($this->min_break_duration); + } + + public function clearMinBreakDuration() + { + unset($this->min_break_duration); + } + + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_break_duration = $var; + + return $this; + } + + /** + * Required. Maximum allowed span of any interval of time in the route that does not + * include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxInterBreakDuration() + { + return $this->max_inter_break_duration; + } + + public function hasMaxInterBreakDuration() + { + return isset($this->max_inter_break_duration); + } + + public function clearMaxInterBreakDuration() + { + unset($this->max_inter_break_duration); + } + + /** + * Required. Maximum allowed span of any interval of time in the route that does not + * include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxInterBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->max_inter_break_duration = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/CapacityQuantity.php b/Optimization/src/V1/CapacityQuantity.php new file mode 100644 index 000000000000..ae4099afe677 --- /dev/null +++ b/Optimization/src/V1/CapacityQuantity.php @@ -0,0 +1,87 @@ +google.cloud.optimization.v1.CapacityQuantity + */ +class CapacityQuantity extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * Generated from protobuf field int64 value = 2; + */ + private $value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * @type int|string $value + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 value = 2; + * @return int|string + */ + public function getValue() + { + return $this->value; + } + + /** + * Generated from protobuf field int64 value = 2; + * @param int|string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkInt64($var); + $this->value = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/CapacityQuantityInterval.php b/Optimization/src/V1/CapacityQuantityInterval.php new file mode 100644 index 000000000000..b95b850cf273 --- /dev/null +++ b/Optimization/src/V1/CapacityQuantityInterval.php @@ -0,0 +1,134 @@ +google.cloud.optimization.v1.CapacityQuantityInterval + */ +class CapacityQuantityInterval extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string type = 1; + */ + private $type = ''; + /** + * Generated from protobuf field optional int64 min_value = 2; + */ + private $min_value = null; + /** + * Generated from protobuf field optional int64 max_value = 3; + */ + private $max_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * @type int|string $min_value + * @type int|string $max_value + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Generated from protobuf field optional int64 min_value = 2; + * @return int|string + */ + public function getMinValue() + { + return isset($this->min_value) ? $this->min_value : 0; + } + + public function hasMinValue() + { + return isset($this->min_value); + } + + public function clearMinValue() + { + unset($this->min_value); + } + + /** + * Generated from protobuf field optional int64 min_value = 2; + * @param int|string $var + * @return $this + */ + public function setMinValue($var) + { + GPBUtil::checkInt64($var); + $this->min_value = $var; + + return $this; + } + + /** + * Generated from protobuf field optional int64 max_value = 3; + * @return int|string + */ + public function getMaxValue() + { + return isset($this->max_value) ? $this->max_value : 0; + } + + public function hasMaxValue() + { + return isset($this->max_value); + } + + public function clearMaxValue() + { + unset($this->max_value); + } + + /** + * Generated from protobuf field optional int64 max_value = 3; + * @param int|string $var + * @return $this + */ + public function setMaxValue($var) + { + GPBUtil::checkInt64($var); + $this->max_value = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/DataFormat.php b/Optimization/src/V1/DataFormat.php new file mode 100644 index 000000000000..9e77bfe52a85 --- /dev/null +++ b/Optimization/src/V1/DataFormat.php @@ -0,0 +1,61 @@ +google.cloud.optimization.v1.DataFormat + */ +class DataFormat +{ + /** + * Default value. + * + * Generated from protobuf enum DATA_FORMAT_UNSPECIFIED = 0; + */ + const DATA_FORMAT_UNSPECIFIED = 0; + /** + * Input data in json format. + * + * Generated from protobuf enum JSON = 1; + */ + const JSON = 1; + /** + * Input data in string format. + * + * Generated from protobuf enum STRING = 2; + */ + const STRING = 2; + + private static $valueToName = [ + self::DATA_FORMAT_UNSPECIFIED => 'DATA_FORMAT_UNSPECIFIED', + self::JSON => 'JSON', + self::STRING => 'STRING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/Optimization/src/V1/DistanceLimit.php b/Optimization/src/V1/DistanceLimit.php new file mode 100644 index 000000000000..7819f33b096c --- /dev/null +++ b/Optimization/src/V1/DistanceLimit.php @@ -0,0 +1,216 @@ +google.cloud.optimization.v1.DistanceLimit + */ +class DistanceLimit extends \Google\Protobuf\Internal\Message +{ + /** + * A hard limit constraining the distance to be at most max_meters. The limit + * must be nonnegative. + * + * Generated from protobuf field optional int64 max_meters = 1; + */ + private $max_meters = null; + /** + * A soft limit not enforcing a maximum distance limit, but when violated + * results in a cost which adds up to other costs defined in the model, + * with the same unit. + * If defined soft_max_meters must be less than max_meters and must be + * nonnegative. + * + * Generated from protobuf field optional int64 soft_max_meters = 2; + */ + private $soft_max_meters = null; + /** + * Cost per kilometer incurred if `soft_max_meters` limit is violated. The + * additional cost is 0 if the distance is under the limit, otherwise the + * formula used to compute the cost is the following: + * ``` + * (distance_meters - soft_max_meters) / 1000.0 * + * cost_per_kilometer_above_soft_max. + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_kilometer_above_soft_max = 3; + */ + private $cost_per_kilometer_above_soft_max = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $max_meters + * A hard limit constraining the distance to be at most max_meters. The limit + * must be nonnegative. + * @type int|string $soft_max_meters + * A soft limit not enforcing a maximum distance limit, but when violated + * results in a cost which adds up to other costs defined in the model, + * with the same unit. + * If defined soft_max_meters must be less than max_meters and must be + * nonnegative. + * @type float $cost_per_kilometer_above_soft_max + * Cost per kilometer incurred if `soft_max_meters` limit is violated. The + * additional cost is 0 if the distance is under the limit, otherwise the + * formula used to compute the cost is the following: + * ``` + * (distance_meters - soft_max_meters) / 1000.0 * + * cost_per_kilometer_above_soft_max. + * ``` + * The cost must be nonnegative. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A hard limit constraining the distance to be at most max_meters. The limit + * must be nonnegative. + * + * Generated from protobuf field optional int64 max_meters = 1; + * @return int|string + */ + public function getMaxMeters() + { + return isset($this->max_meters) ? $this->max_meters : 0; + } + + public function hasMaxMeters() + { + return isset($this->max_meters); + } + + public function clearMaxMeters() + { + unset($this->max_meters); + } + + /** + * A hard limit constraining the distance to be at most max_meters. The limit + * must be nonnegative. + * + * Generated from protobuf field optional int64 max_meters = 1; + * @param int|string $var + * @return $this + */ + public function setMaxMeters($var) + { + GPBUtil::checkInt64($var); + $this->max_meters = $var; + + return $this; + } + + /** + * A soft limit not enforcing a maximum distance limit, but when violated + * results in a cost which adds up to other costs defined in the model, + * with the same unit. + * If defined soft_max_meters must be less than max_meters and must be + * nonnegative. + * + * Generated from protobuf field optional int64 soft_max_meters = 2; + * @return int|string + */ + public function getSoftMaxMeters() + { + return isset($this->soft_max_meters) ? $this->soft_max_meters : 0; + } + + public function hasSoftMaxMeters() + { + return isset($this->soft_max_meters); + } + + public function clearSoftMaxMeters() + { + unset($this->soft_max_meters); + } + + /** + * A soft limit not enforcing a maximum distance limit, but when violated + * results in a cost which adds up to other costs defined in the model, + * with the same unit. + * If defined soft_max_meters must be less than max_meters and must be + * nonnegative. + * + * Generated from protobuf field optional int64 soft_max_meters = 2; + * @param int|string $var + * @return $this + */ + public function setSoftMaxMeters($var) + { + GPBUtil::checkInt64($var); + $this->soft_max_meters = $var; + + return $this; + } + + /** + * Cost per kilometer incurred if `soft_max_meters` limit is violated. The + * additional cost is 0 if the distance is under the limit, otherwise the + * formula used to compute the cost is the following: + * ``` + * (distance_meters - soft_max_meters) / 1000.0 * + * cost_per_kilometer_above_soft_max. + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_kilometer_above_soft_max = 3; + * @return float + */ + public function getCostPerKilometerAboveSoftMax() + { + return isset($this->cost_per_kilometer_above_soft_max) ? $this->cost_per_kilometer_above_soft_max : 0.0; + } + + public function hasCostPerKilometerAboveSoftMax() + { + return isset($this->cost_per_kilometer_above_soft_max); + } + + public function clearCostPerKilometerAboveSoftMax() + { + unset($this->cost_per_kilometer_above_soft_max); + } + + /** + * Cost per kilometer incurred if `soft_max_meters` limit is violated. The + * additional cost is 0 if the distance is under the limit, otherwise the + * formula used to compute the cost is the following: + * ``` + * (distance_meters - soft_max_meters) / 1000.0 * + * cost_per_kilometer_above_soft_max. + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_kilometer_above_soft_max = 3; + * @param float $var + * @return $this + */ + public function setCostPerKilometerAboveSoftMax($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_kilometer_above_soft_max = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/FleetRoutingClient.php b/Optimization/src/V1/FleetRoutingClient.php new file mode 100644 index 000000000000..057a434d2d45 --- /dev/null +++ b/Optimization/src/V1/FleetRoutingClient.php @@ -0,0 +1,34 @@ +_simpleRequest('/google.cloud.optimization.v1.FleetRouting/OptimizeTours', + $argument, + ['\Google\Cloud\Optimization\V1\OptimizeToursResponse', 'decode'], + $metadata, $options); + } + + /** + * Optimizes vehicle tours for one or more `OptimizeToursRequest` + * messages as a batch. + * + * This method is a Long Running Operation (LRO). The inputs for optimization + * (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse` + * messages) are read/written from/to Cloud Storage in user-specified + * format. Like the `OptimizeTours` method, each `OptimizeToursRequest` + * contains a `ShipmentModel` and returns an `OptimizeToursResponse` + * containing `ShipmentRoute`s, which are a set of routes to be performed by + * vehicles minimizing the overall cost. + * @param \Google\Cloud\Optimization\V1\BatchOptimizeToursRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function BatchOptimizeTours(\Google\Cloud\Optimization\V1\BatchOptimizeToursRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.optimization.v1.FleetRouting/BatchOptimizeTours', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/Optimization/src/V1/Gapic/FleetRoutingGapicClient.php b/Optimization/src/V1/Gapic/FleetRoutingGapicClient.php new file mode 100644 index 000000000000..edb76be7769b --- /dev/null +++ b/Optimization/src/V1/Gapic/FleetRoutingGapicClient.php @@ -0,0 +1,678 @@ +batchOptimizeTours($parent, $modelConfigs); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $fleetRoutingClient->resumeOperation($operationName, 'batchOptimizeTours'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $fleetRoutingClient->close(); + * } + * ``` + */ +class FleetRoutingGapicClient +{ + use GapicClientTrait; + + /** + * The name of the service. + */ + const SERVICE_NAME = 'google.cloud.optimization.v1.FleetRouting'; + + /** + * The default address of the service. + */ + const SERVICE_ADDRESS = 'cloudoptimization.googleapis.com'; + + /** + * The default port of the service. + */ + const DEFAULT_SERVICE_PORT = 443; + + /** + * The name of the code generator, to be included in the agent header. + */ + const CODEGEN_NAME = 'gapic'; + + /** + * The default scopes required by the service. + */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => + self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => + __DIR__ . '/../resources/fleet_routing_client_config.json', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/fleet_routing_descriptor_config.php', + 'gcpApiConfigPath' => + __DIR__ . '/../resources/fleet_routing_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . + '/../resources/fleet_routing_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse( + $operationName, + $this->getOperationsClient(), + $options + ); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $serviceAddress + * **Deprecated**. This option will be removed in a future major release. Please + * utilize the `$apiEndpoint` option instead. + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'cloudoptimization.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $serviceAddress setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Optimizes vehicle tours for one or more `OptimizeToursRequest` + * messages as a batch. + * + * This method is a Long Running Operation (LRO). The inputs for optimization + * (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse` + * messages) are read/written from/to Cloud Storage in user-specified + * format. Like the `OptimizeTours` method, each `OptimizeToursRequest` + * contains a `ShipmentModel` and returns an `OptimizeToursResponse` + * containing `ShipmentRoute`s, which are a set of routes to be performed by + * vehicles minimizing the overall cost. + * + * Sample code: + * ``` + * $fleetRoutingClient = new FleetRoutingClient(); + * try { + * $parent = 'parent'; + * $modelConfigs = []; + * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $fleetRoutingClient->resumeOperation($operationName, 'batchOptimizeTours'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $fleetRoutingClient->close(); + * } + * ``` + * + * @param string $parent Required. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @param AsyncModelConfig[] $modelConfigs Required. Input/Output information each purchase model, such as file paths and data + * formats. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function batchOptimizeTours( + $parent, + $modelConfigs, + array $optionalArgs = [] + ) { + $request = new BatchOptimizeToursRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setModelConfigs($modelConfigs); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'BatchOptimizeTours', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Sends an `OptimizeToursRequest` containing a `ShipmentModel` and returns an + * `OptimizeToursResponse` containing `ShipmentRoute`s, which are a set of + * routes to be performed by vehicles minimizing the overall cost. + * + * A `ShipmentModel` model consists mainly of `Shipment`s that need to be + * carried out and `Vehicle`s that can be used to transport the `Shipment`s. + * The `ShipmentRoute`s assign `Shipment`s to `Vehicle`s. More specifically, + * they assign a series of `Visit`s to each vehicle, where a `Visit` + * corresponds to a `VisitRequest`, which is a pickup or delivery for a + * `Shipment`. + * + * The goal is to provide an assignment of `ShipmentRoute`s to `Vehicle`s that + * minimizes the total cost where cost has many components defined in the + * `ShipmentModel`. + * + * Sample code: + * ``` + * $fleetRoutingClient = new FleetRoutingClient(); + * try { + * $parent = 'parent'; + * $response = $fleetRoutingClient->optimizeTours($parent); + * } finally { + * $fleetRoutingClient->close(); + * } + * ``` + * + * @param string $parent Required. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @param array $optionalArgs { + * Optional. + * + * @type Duration $timeout + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * @type ShipmentModel $model + * Shipment model to solve. + * @type int $solvingMode + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * For allowed values, use constants defined on {@see \Google\Cloud\Optimization\V1\OptimizeToursRequest\SolvingMode} + * @type int $maxValidationErrors + * Truncates the number of validation errors returned. Those 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. + * @type int $searchMode + * Search mode used to solve the request. + * For allowed values, use constants defined on {@see \Google\Cloud\Optimization\V1\OptimizeToursRequest\SearchMode} + * @type ShipmentRoute[] $injectedFirstSolutionRoutes + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * + * The solution must satisfy some basic validity assumptions: + * + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] is empty or + * its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * @type InjectedSolutionConstraint $injectedSolutionConstraint + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * @type ShipmentRoute[] $refreshDetailsRoutes + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * @type bool $interpretInjectedSolutionsUsingLabels + * If true: + * + * * uses [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] instead of [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] to + * match skipped shipments in the injected solution with request + * shipments. + * + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * + * If true, labels in the following categories must appear at most once in + * their category: + * + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] in the injected solution + * does not correspond to a request shipment, the `SkippedShipment` is removed + * from the solution. + * + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * + * NOTE: The caller must ensure that each [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] + * (resp. [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely identifies a vehicle (resp. shipment) + * entity used across the two relevant requests: the past request that + * produced the `OptimizeToursResponse` used in the injected solution and the + * current request that includes the injected solution. The uniqueness checks + * described above are not enough to guarantee this requirement. + * @type bool $considerRoadTraffic + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] field. + * @type bool $populatePolylines + * If true, polylines will be populated in response `ShipmentRoute`s. + * @type bool $populateTransitionPolylines + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * @type bool $allowLargeDeadlineDespiteInterruptionRisk + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * @type bool $useGeodesicDistances + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * @type float $geodesicMetersPerSecond + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * @type string $label + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * @type bool $populateTravelStepPolylines + * Deprecated: Use [OptimizeToursRequest.populate_transition_polylines][] instead. + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. Note that in this case, the polylines will + * also be populated in the deprecated `travel_steps`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Optimization\V1\OptimizeToursResponse + * + * @throws ApiException if the remote call fails + */ + public function optimizeTours($parent, array $optionalArgs = []) + { + $request = new OptimizeToursRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['timeout'])) { + $request->setTimeout($optionalArgs['timeout']); + } + + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + if (isset($optionalArgs['solvingMode'])) { + $request->setSolvingMode($optionalArgs['solvingMode']); + } + + if (isset($optionalArgs['maxValidationErrors'])) { + $request->setMaxValidationErrors( + $optionalArgs['maxValidationErrors'] + ); + } + + if (isset($optionalArgs['searchMode'])) { + $request->setSearchMode($optionalArgs['searchMode']); + } + + if (isset($optionalArgs['injectedFirstSolutionRoutes'])) { + $request->setInjectedFirstSolutionRoutes( + $optionalArgs['injectedFirstSolutionRoutes'] + ); + } + + if (isset($optionalArgs['injectedSolutionConstraint'])) { + $request->setInjectedSolutionConstraint( + $optionalArgs['injectedSolutionConstraint'] + ); + } + + if (isset($optionalArgs['refreshDetailsRoutes'])) { + $request->setRefreshDetailsRoutes( + $optionalArgs['refreshDetailsRoutes'] + ); + } + + if (isset($optionalArgs['interpretInjectedSolutionsUsingLabels'])) { + $request->setInterpretInjectedSolutionsUsingLabels( + $optionalArgs['interpretInjectedSolutionsUsingLabels'] + ); + } + + if (isset($optionalArgs['considerRoadTraffic'])) { + $request->setConsiderRoadTraffic( + $optionalArgs['considerRoadTraffic'] + ); + } + + if (isset($optionalArgs['populatePolylines'])) { + $request->setPopulatePolylines($optionalArgs['populatePolylines']); + } + + if (isset($optionalArgs['populateTransitionPolylines'])) { + $request->setPopulateTransitionPolylines( + $optionalArgs['populateTransitionPolylines'] + ); + } + + if (isset($optionalArgs['allowLargeDeadlineDespiteInterruptionRisk'])) { + $request->setAllowLargeDeadlineDespiteInterruptionRisk( + $optionalArgs['allowLargeDeadlineDespiteInterruptionRisk'] + ); + } + + if (isset($optionalArgs['useGeodesicDistances'])) { + $request->setUseGeodesicDistances( + $optionalArgs['useGeodesicDistances'] + ); + } + + if (isset($optionalArgs['geodesicMetersPerSecond'])) { + $request->setGeodesicMetersPerSecond( + $optionalArgs['geodesicMetersPerSecond'] + ); + } + + if (isset($optionalArgs['label'])) { + $request->setLabel($optionalArgs['label']); + } + + if (isset($optionalArgs['populateTravelStepPolylines'])) { + $request->setPopulateTravelStepPolylines( + $optionalArgs['populateTravelStepPolylines'] + ); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'OptimizeTours', + OptimizeToursResponse::class, + $optionalArgs, + $request + )->wait(); + } +} diff --git a/Optimization/src/V1/GcsDestination.php b/Optimization/src/V1/GcsDestination.php new file mode 100644 index 000000000000..9c9d993880b2 --- /dev/null +++ b/Optimization/src/V1/GcsDestination.php @@ -0,0 +1,67 @@ +google.cloud.optimization.v1.GcsDestination + */ +class GcsDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. URI of the Google Cloud Storage location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/GcsSource.php b/Optimization/src/V1/GcsSource.php new file mode 100644 index 000000000000..2d630bfe970e --- /dev/null +++ b/Optimization/src/V1/GcsSource.php @@ -0,0 +1,67 @@ +google.cloud.optimization.v1.GcsSource + */ +class GcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. URI of the Google Cloud Storage location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. URI of the Google Cloud Storage location. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/InjectedSolutionConstraint.php b/Optimization/src/V1/InjectedSolutionConstraint.php new file mode 100644 index 000000000000..2a62c4539081 --- /dev/null +++ b/Optimization/src/V1/InjectedSolutionConstraint.php @@ -0,0 +1,156 @@ +google.cloud.optimization.v1.InjectedSolutionConstraint + */ +class InjectedSolutionConstraint extends \Google\Protobuf\Internal\Message +{ + /** + * Routes of the solution to inject. Some routes may be omitted from the + * original solution. The routes and skipped shipments must satisfy the basic + * validity assumptions listed for `injected_first_solution_routes`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + */ + private $routes; + /** + * Skipped shipments of the solution to inject. Some may be omitted from the + * original solution. See the `routes` field. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 2; + */ + private $skipped_shipments; + /** + * For zero or more groups of vehicles, specifies when and how much to relax + * constraints. If this field is empty, all non-empty vehicle routes are + * fully constrained. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation constraint_relaxations = 3; + */ + private $constraint_relaxations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\ShipmentRoute[]|\Google\Protobuf\Internal\RepeatedField $routes + * Routes of the solution to inject. Some routes may be omitted from the + * original solution. The routes and skipped shipments must satisfy the basic + * validity assumptions listed for `injected_first_solution_routes`. + * @type \Google\Cloud\Optimization\V1\SkippedShipment[]|\Google\Protobuf\Internal\RepeatedField $skipped_shipments + * Skipped shipments of the solution to inject. Some may be omitted from the + * original solution. See the `routes` field. + * @type \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation[]|\Google\Protobuf\Internal\RepeatedField $constraint_relaxations + * For zero or more groups of vehicles, specifies when and how much to relax + * constraints. If this field is empty, all non-empty vehicle routes are + * fully constrained. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Routes of the solution to inject. Some routes may be omitted from the + * original solution. The routes and skipped shipments must satisfy the basic + * validity assumptions listed for `injected_first_solution_routes`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Routes of the solution to inject. Some routes may be omitted from the + * original solution. The routes and skipped shipments must satisfy the basic + * validity assumptions listed for `injected_first_solution_routes`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute::class); + $this->routes = $arr; + + return $this; + } + + /** + * Skipped shipments of the solution to inject. Some may be omitted from the + * original solution. See the `routes` field. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSkippedShipments() + { + return $this->skipped_shipments; + } + + /** + * Skipped shipments of the solution to inject. Some may be omitted from the + * original solution. See the `routes` field. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 2; + * @param \Google\Cloud\Optimization\V1\SkippedShipment[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSkippedShipments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\SkippedShipment::class); + $this->skipped_shipments = $arr; + + return $this; + } + + /** + * For zero or more groups of vehicles, specifies when and how much to relax + * constraints. If this field is empty, all non-empty vehicle routes are + * fully constrained. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation constraint_relaxations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConstraintRelaxations() + { + return $this->constraint_relaxations; + } + + /** + * For zero or more groups of vehicles, specifies when and how much to relax + * constraints. If this field is empty, all non-empty vehicle routes are + * fully constrained. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation constraint_relaxations = 3; + * @param \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConstraintRelaxations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation::class); + $this->constraint_relaxations = $arr; + + return $this; + } + +} + diff --git a/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation.php b/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation.php new file mode 100644 index 000000000000..ac6e0c6d988c --- /dev/null +++ b/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation.php @@ -0,0 +1,145 @@ +google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation + */ +class ConstraintRelaxation extends \Google\Protobuf\Internal\Message +{ + /** + * All the visit constraint relaxations that will apply to visits on + * routes with vehicles in `vehicle_indices`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation relaxations = 1; + */ + private $relaxations; + /** + * Specifies the vehicle indices to which the visit constraint + * `relaxations` apply. If empty, this is considered the default and the + * `relaxations` apply to all vehicles that are not specified in other + * `constraint_relaxations`. There can be at most one default, i.e., at + * most one constraint relaxation field is allowed empty + * `vehicle_indices`. A vehicle index can only be listed once, even within + * several `constraint_relaxations`. + * A vehicle index is mapped the same as [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index], if + * `interpret_injected_solutions_using_labels` is true (see `fields` + * comment). + * + * Generated from protobuf field repeated int32 vehicle_indices = 2; + */ + private $vehicle_indices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation\Relaxation[]|\Google\Protobuf\Internal\RepeatedField $relaxations + * All the visit constraint relaxations that will apply to visits on + * routes with vehicles in `vehicle_indices`. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $vehicle_indices + * Specifies the vehicle indices to which the visit constraint + * `relaxations` apply. If empty, this is considered the default and the + * `relaxations` apply to all vehicles that are not specified in other + * `constraint_relaxations`. There can be at most one default, i.e., at + * most one constraint relaxation field is allowed empty + * `vehicle_indices`. A vehicle index can only be listed once, even within + * several `constraint_relaxations`. + * A vehicle index is mapped the same as [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index], if + * `interpret_injected_solutions_using_labels` is true (see `fields` + * comment). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * All the visit constraint relaxations that will apply to visits on + * routes with vehicles in `vehicle_indices`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation relaxations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRelaxations() + { + return $this->relaxations; + } + + /** + * All the visit constraint relaxations that will apply to visits on + * routes with vehicles in `vehicle_indices`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation relaxations = 1; + * @param \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation\Relaxation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRelaxations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation\Relaxation::class); + $this->relaxations = $arr; + + return $this; + } + + /** + * Specifies the vehicle indices to which the visit constraint + * `relaxations` apply. If empty, this is considered the default and the + * `relaxations` apply to all vehicles that are not specified in other + * `constraint_relaxations`. There can be at most one default, i.e., at + * most one constraint relaxation field is allowed empty + * `vehicle_indices`. A vehicle index can only be listed once, even within + * several `constraint_relaxations`. + * A vehicle index is mapped the same as [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index], if + * `interpret_injected_solutions_using_labels` is true (see `fields` + * comment). + * + * Generated from protobuf field repeated int32 vehicle_indices = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVehicleIndices() + { + return $this->vehicle_indices; + } + + /** + * Specifies the vehicle indices to which the visit constraint + * `relaxations` apply. If empty, this is considered the default and the + * `relaxations` apply to all vehicles that are not specified in other + * `constraint_relaxations`. There can be at most one default, i.e., at + * most one constraint relaxation field is allowed empty + * `vehicle_indices`. A vehicle index can only be listed once, even within + * several `constraint_relaxations`. + * A vehicle index is mapped the same as [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index], if + * `interpret_injected_solutions_using_labels` is true (see `fields` + * comment). + * + * Generated from protobuf field repeated int32 vehicle_indices = 2; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVehicleIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->vehicle_indices = $arr; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php b/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php new file mode 100644 index 000000000000..2327619d768a --- /dev/null +++ b/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php @@ -0,0 +1,202 @@ += relaxations(i).threshold_time` AND + * * `j + 1 >= relaxations(i).threshold_visit_count` + * Similarly, the vehicle start is relaxed to `relaxations(i).level` if it + * satisfies: + * * `vehicle_start_time >= relaxations(i).threshold_time` AND + * * `relaxations(i).threshold_visit_count == 0` + * and the vehicle end is relaxed to `relaxations(i).level` if it satisfies: + * * `vehicle_end_time >= relaxations(i).threshold_time` AND + * * `route.visits_size() + 1 >= relaxations(i).threshold_visit_count` + * To apply a relaxation level if a visit meets the `threshold_visit_count` + * OR the `threshold_time` add two `relaxations` with the same `level`: + * one with only `threshold_visit_count` set and the other with only + * `threshold_time` set. If a visit satisfies the conditions of multiple + * `relaxations`, the most relaxed level applies. As a result, from the + * vehicle start through the route visits in order to the vehicle end, the + * relaxation level becomes more relaxed: i.e., the relaxation level is + * non-decreasing as the route progresses. + * The timing and sequence of route visits that do not satisfy the + * threshold conditions of any `relaxations` are fully constrained + * and no visits may be inserted into these sequences. Also, if a + * vehicle start or end does not satisfy the conditions of any + * relaxation the time is fixed, unless the vehicle is empty. + * + * Generated from protobuf message google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation + */ +class Relaxation extends \Google\Protobuf\Internal\Message +{ + /** + * The constraint relaxation level that applies when the conditions + * at or after `threshold_time` AND at least `threshold_visit_count` are + * satified. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level level = 1; + */ + private $level = 0; + /** + * The time at or after which the relaxation `level` may be applied. + * + * Generated from protobuf field .google.protobuf.Timestamp threshold_time = 2; + */ + private $threshold_time = null; + /** + * The number of visits at or after which the relaxation `level` may be + * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be + * applied directly at the vehicle start. + * If it is `route.visits_size() + 1`, the `level` may only be applied to + * the vehicle end. If it is more than `route.visits_size() + 1`, + * `level` is not applied at all for that route. + * + * Generated from protobuf field int32 threshold_visit_count = 3; + */ + private $threshold_visit_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $level + * The constraint relaxation level that applies when the conditions + * at or after `threshold_time` AND at least `threshold_visit_count` are + * satified. + * @type \Google\Protobuf\Timestamp $threshold_time + * The time at or after which the relaxation `level` may be applied. + * @type int $threshold_visit_count + * The number of visits at or after which the relaxation `level` may be + * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be + * applied directly at the vehicle start. + * If it is `route.visits_size() + 1`, the `level` may only be applied to + * the vehicle end. If it is more than `route.visits_size() + 1`, + * `level` is not applied at all for that route. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The constraint relaxation level that applies when the conditions + * at or after `threshold_time` AND at least `threshold_visit_count` are + * satified. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level level = 1; + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * The constraint relaxation level that applies when the conditions + * at or after `threshold_time` AND at least `threshold_visit_count` are + * satified. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level level = 1; + * @param int $var + * @return $this + */ + public function setLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint\ConstraintRelaxation\Relaxation\Level::class); + $this->level = $var; + + return $this; + } + + /** + * The time at or after which the relaxation `level` may be applied. + * + * Generated from protobuf field .google.protobuf.Timestamp threshold_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getThresholdTime() + { + return $this->threshold_time; + } + + public function hasThresholdTime() + { + return isset($this->threshold_time); + } + + public function clearThresholdTime() + { + unset($this->threshold_time); + } + + /** + * The time at or after which the relaxation `level` may be applied. + * + * Generated from protobuf field .google.protobuf.Timestamp threshold_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setThresholdTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->threshold_time = $var; + + return $this; + } + + /** + * The number of visits at or after which the relaxation `level` may be + * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be + * applied directly at the vehicle start. + * If it is `route.visits_size() + 1`, the `level` may only be applied to + * the vehicle end. If it is more than `route.visits_size() + 1`, + * `level` is not applied at all for that route. + * + * Generated from protobuf field int32 threshold_visit_count = 3; + * @return int + */ + public function getThresholdVisitCount() + { + return $this->threshold_visit_count; + } + + /** + * The number of visits at or after which the relaxation `level` may be + * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be + * applied directly at the vehicle start. + * If it is `route.visits_size() + 1`, the `level` may only be applied to + * the vehicle end. If it is more than `route.visits_size() + 1`, + * `level` is not applied at all for that route. + * + * Generated from protobuf field int32 threshold_visit_count = 3; + * @param int $var + * @return $this + */ + public function setThresholdVisitCount($var) + { + GPBUtil::checkInt32($var); + $this->threshold_visit_count = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation/Level.php b/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation/Level.php new file mode 100644 index 000000000000..f0441fab7fe9 --- /dev/null +++ b/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation/Level.php @@ -0,0 +1,80 @@ +google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level + */ +class Level +{ + /** + * Implicit default relaxation level: no constraints are relaxed, + * i.e., all visits are fully constrained. + * This value must not be explicly used in `level`. + * + * Generated from protobuf enum LEVEL_UNSPECIFIED = 0; + */ + const LEVEL_UNSPECIFIED = 0; + /** + * Visit start times and vehicle start/end times will be relaxed, but + * each visit remains bound to the same vehicle and the visit sequence + * must be observed: no visit can be inserted between them or before + * them. + * + * Generated from protobuf enum RELAX_VISIT_TIMES_AFTER_THRESHOLD = 1; + */ + const 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. + * + * Generated from protobuf enum RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD = 2; + */ + const RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD = 2; + /** + * Same as `RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD`, but the + * vehicle is also relaxed: visits are completely free at or after the + * threshold time and can potentially become unperformed. + * + * Generated from protobuf enum RELAX_ALL_AFTER_THRESHOLD = 3; + */ + const RELAX_ALL_AFTER_THRESHOLD = 3; + + private static $valueToName = [ + self::LEVEL_UNSPECIFIED => 'LEVEL_UNSPECIFIED', + self::RELAX_VISIT_TIMES_AFTER_THRESHOLD => 'RELAX_VISIT_TIMES_AFTER_THRESHOLD', + self::RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD => 'RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD', + self::RELAX_ALL_AFTER_THRESHOLD => 'RELAX_ALL_AFTER_THRESHOLD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/InputConfig.php b/Optimization/src/V1/InputConfig.php new file mode 100644 index 000000000000..05cdd837c471 --- /dev/null +++ b/Optimization/src/V1/InputConfig.php @@ -0,0 +1,112 @@ +google.cloud.optimization.v1.InputConfig + */ +class InputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The input data format that used to store the model in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + */ + private $data_format = 0; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\GcsSource $gcs_source + * The Google Cloud Storage location to read the input from. This must be a + * single file. + * @type int $data_format + * The input data format that used to store the model in Cloud Storage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location to read the input from. This must be a + * single file. + * + * Generated from protobuf field .google.cloud.optimization.v1.GcsSource gcs_source = 1; + * @return \Google\Cloud\Optimization\V1\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + public function hasGcsSource() + { + return $this->hasOneof(1); + } + + /** + * The Google Cloud Storage location to read the input from. This must be a + * single file. + * + * Generated from protobuf field .google.cloud.optimization.v1.GcsSource gcs_source = 1; + * @param \Google\Cloud\Optimization\V1\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\GcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The input data format that used to store the model in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + * @return int + */ + public function getDataFormat() + { + return $this->data_format; + } + + /** + * The input data format that used to store the model in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + * @param int $var + * @return $this + */ + public function setDataFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\DataFormat::class); + $this->data_format = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/Optimization/src/V1/Location.php b/Optimization/src/V1/Location.php new file mode 100644 index 000000000000..d75aa1d056f4 --- /dev/null +++ b/Optimization/src/V1/Location.php @@ -0,0 +1,133 @@ +google.cloud.optimization.v1.Location + */ +class Location extends \Google\Protobuf\Internal\Message +{ + /** + * The waypoint's geographic coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + */ + private $lat_lng = null; + /** + * The compass heading associated with the direction of the flow of traffic. + * This value is used to specify the side of the road to use for pickup and + * drop-off. Heading values can be from 0 to 360, where 0 specifies a heading + * of due North, 90 specifies a heading of due East, etc. + * + * Generated from protobuf field optional int32 heading = 2; + */ + private $heading = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\LatLng $lat_lng + * The waypoint's geographic coordinates. + * @type int $heading + * The compass heading associated with the direction of the flow of traffic. + * This value is used to specify the side of the road to use for pickup and + * drop-off. Heading values can be from 0 to 360, where 0 specifies a heading + * of due North, 90 specifies a heading of due East, etc. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The waypoint's geographic coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + * @return \Google\Type\LatLng|null + */ + public function getLatLng() + { + return $this->lat_lng; + } + + public function hasLatLng() + { + return isset($this->lat_lng); + } + + public function clearLatLng() + { + unset($this->lat_lng); + } + + /** + * The waypoint's geographic coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setLatLng($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->lat_lng = $var; + + return $this; + } + + /** + * The compass heading associated with the direction of the flow of traffic. + * This value is used to specify the side of the road to use for pickup and + * drop-off. Heading values can be from 0 to 360, where 0 specifies a heading + * of due North, 90 specifies a heading of due East, etc. + * + * Generated from protobuf field optional int32 heading = 2; + * @return int + */ + public function getHeading() + { + return isset($this->heading) ? $this->heading : 0; + } + + public function hasHeading() + { + return isset($this->heading); + } + + public function clearHeading() + { + unset($this->heading); + } + + /** + * The compass heading associated with the direction of the flow of traffic. + * This value is used to specify the side of the road to use for pickup and + * drop-off. Heading values can be from 0 to 360, where 0 specifies a heading + * of due North, 90 specifies a heading of due East, etc. + * + * Generated from protobuf field optional int32 heading = 2; + * @param int $var + * @return $this + */ + public function setHeading($var) + { + GPBUtil::checkInt32($var); + $this->heading = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/OptimizeToursRequest.php b/Optimization/src/V1/OptimizeToursRequest.php new file mode 100644 index 000000000000..c9e6689fd330 --- /dev/null +++ b/Optimization/src/V1/OptimizeToursRequest.php @@ -0,0 +1,1153 @@ +google.cloud.optimization.v1.OptimizeToursRequest + */ +class OptimizeToursRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $parent = ''; + /** + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 2; + */ + private $timeout = null; + /** + * Shipment model to solve. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentModel model = 3; + */ + private $model = null; + /** + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode solving_mode = 4; + */ + private $solving_mode = 0; + /** + * Truncates the number of validation errors returned. Those 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. + * + * Generated from protobuf field optional int32 max_validation_errors = 5; + */ + private $max_validation_errors = null; + /** + * Search mode used to solve the request. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SearchMode search_mode = 6; + */ + private $search_mode = 0; + /** + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * The solution must satisfy some basic validity assumptions: + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] is empty or + * its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute injected_first_solution_routes = 7; + */ + private $injected_first_solution_routes; + /** + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint injected_solution_constraint = 8; + */ + private $injected_solution_constraint = null; + /** + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute refresh_details_routes = 9; + */ + private $refresh_details_routes; + /** + * If true: + * * uses [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] instead of [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] to + * match skipped shipments in the injected solution with request + * shipments. + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * If true, labels in the following categories must appear at most once in + * their category: + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] in the injected solution + * does not correspond to a request shipment, the `SkippedShipment` is removed + * from the solution. + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * NOTE: The caller must ensure that each [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] + * (resp. [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely identifies a vehicle (resp. shipment) + * entity used across the two relevant requests: the past request that + * produced the `OptimizeToursResponse` used in the injected solution and the + * current request that includes the injected solution. The uniqueness checks + * described above are not enough to guarantee this requirement. + * + * Generated from protobuf field bool interpret_injected_solutions_using_labels = 10; + */ + private $interpret_injected_solutions_using_labels = false; + /** + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] field. + * + * Generated from protobuf field bool consider_road_traffic = 11; + */ + private $consider_road_traffic = false; + /** + * If true, polylines will be populated in response `ShipmentRoute`s. + * + * Generated from protobuf field bool populate_polylines = 12; + */ + private $populate_polylines = false; + /** + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_transition_polylines = 13; + */ + private $populate_transition_polylines = false; + /** + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * + * Generated from protobuf field bool allow_large_deadline_despite_interruption_risk = 14; + */ + private $allow_large_deadline_despite_interruption_risk = false; + /** + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * + * Generated from protobuf field bool use_geodesic_distances = 15; + */ + private $use_geodesic_distances = false; + /** + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * + * Generated from protobuf field optional double geodesic_meters_per_second = 16; + */ + private $geodesic_meters_per_second = null; + /** + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * + * Generated from protobuf field string label = 17; + */ + private $label = ''; + /** + * Deprecated: Use [OptimizeToursRequest.populate_transition_polylines][] instead. + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. Note that in this case, the polylines will + * also be populated in the deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_travel_step_polylines = 20 [deprecated = true]; + * @deprecated + */ + protected $populate_travel_step_polylines = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * @type \Google\Protobuf\Duration $timeout + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * @type \Google\Cloud\Optimization\V1\ShipmentModel $model + * Shipment model to solve. + * @type int $solving_mode + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * @type int $max_validation_errors + * Truncates the number of validation errors returned. Those 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. + * @type int $search_mode + * Search mode used to solve the request. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute[]|\Google\Protobuf\Internal\RepeatedField $injected_first_solution_routes + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * The solution must satisfy some basic validity assumptions: + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] is empty or + * its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * @type \Google\Cloud\Optimization\V1\InjectedSolutionConstraint $injected_solution_constraint + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute[]|\Google\Protobuf\Internal\RepeatedField $refresh_details_routes + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * @type bool $interpret_injected_solutions_using_labels + * If true: + * * uses [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] instead of [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] to + * match skipped shipments in the injected solution with request + * shipments. + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * If true, labels in the following categories must appear at most once in + * their category: + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] in the injected solution + * does not correspond to a request shipment, the `SkippedShipment` is removed + * from the solution. + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * NOTE: The caller must ensure that each [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] + * (resp. [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely identifies a vehicle (resp. shipment) + * entity used across the two relevant requests: the past request that + * produced the `OptimizeToursResponse` used in the injected solution and the + * current request that includes the injected solution. The uniqueness checks + * described above are not enough to guarantee this requirement. + * @type bool $consider_road_traffic + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] field. + * @type bool $populate_polylines + * If true, polylines will be populated in response `ShipmentRoute`s. + * @type bool $populate_transition_polylines + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * @type bool $allow_large_deadline_despite_interruption_risk + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * @type bool $use_geodesic_distances + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * @type float $geodesic_meters_per_second + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * @type string $label + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * @type bool $populate_travel_step_polylines + * Deprecated: Use [OptimizeToursRequest.populate_transition_polylines][] instead. + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. Note that in this case, the polylines will + * also be populated in the deprecated `travel_steps`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * If this timeout is set, the server returns a response before the timeout + * period has elapsed or the server deadline for synchronous requests is + * reached, whichever is sooner. + * For asynchronous requests, the server will generate a solution (if + * possible) before the timeout has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * Shipment model to solve. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentModel model = 3; + * @return \Google\Cloud\Optimization\V1\ShipmentModel|null + */ + public function getModel() + { + return $this->model; + } + + public function hasModel() + { + return isset($this->model); + } + + public function clearModel() + { + unset($this->model); + } + + /** + * Shipment model to solve. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentModel model = 3; + * @param \Google\Cloud\Optimization\V1\ShipmentModel $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentModel::class); + $this->model = $var; + + return $this; + } + + /** + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode solving_mode = 4; + * @return int + */ + public function getSolvingMode() + { + return $this->solving_mode; + } + + /** + * By default, the solving mode is `DEFAULT_SOLVE` (0). + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode solving_mode = 4; + * @param int $var + * @return $this + */ + public function setSolvingMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\OptimizeToursRequest\SolvingMode::class); + $this->solving_mode = $var; + + return $this; + } + + /** + * Truncates the number of validation errors returned. Those 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. + * + * Generated from protobuf field optional int32 max_validation_errors = 5; + * @return int + */ + public function getMaxValidationErrors() + { + return isset($this->max_validation_errors) ? $this->max_validation_errors : 0; + } + + public function hasMaxValidationErrors() + { + return isset($this->max_validation_errors); + } + + public function clearMaxValidationErrors() + { + unset($this->max_validation_errors); + } + + /** + * Truncates the number of validation errors returned. Those 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. + * + * Generated from protobuf field optional int32 max_validation_errors = 5; + * @param int $var + * @return $this + */ + public function setMaxValidationErrors($var) + { + GPBUtil::checkInt32($var); + $this->max_validation_errors = $var; + + return $this; + } + + /** + * Search mode used to solve the request. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SearchMode search_mode = 6; + * @return int + */ + public function getSearchMode() + { + return $this->search_mode; + } + + /** + * Search mode used to solve the request. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SearchMode search_mode = 6; + * @param int $var + * @return $this + */ + public function setSearchMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\OptimizeToursRequest\SearchMode::class); + $this->search_mode = $var; + + return $this; + } + + /** + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * The solution must satisfy some basic validity assumptions: + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] is empty or + * its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute injected_first_solution_routes = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInjectedFirstSolutionRoutes() + { + return $this->injected_first_solution_routes; + } + + /** + * Guide the optimization algorithm in finding a first solution that is + * similar to a previous solution. + * The model is constrained when the first solution is built. + * Any shipments not performed on a route are implicitly skipped in the first + * solution, but they may be performed in successive solutions. + * The solution must satisfy some basic validity assumptions: + * * for all routes, `vehicle_index` must be in range and not be duplicated. + * * for all visits, `shipment_index` and `visit_request_index` must be + * in range. + * * a shipment may only be referenced on one route. + * * the pickup of a pickup-delivery shipment must be performed before + * the delivery. + * * no more than one pickup alternative or delivery alternative of + * a shipment may be performed. + * * for all routes, times are increasing (i.e., `vehicle_start_time + * <= visits[0].start_time <= visits[1].start_time ... + * <= vehicle_end_time`). + * * a shipment may only be performed on a vehicle that is allowed. A + * vehicle is allowed if [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] is empty or + * its `vehicle_index` is included in + * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute injected_first_solution_routes = 7; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInjectedFirstSolutionRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute::class); + $this->injected_first_solution_routes = $arr; + + return $this; + } + + /** + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint injected_solution_constraint = 8; + * @return \Google\Cloud\Optimization\V1\InjectedSolutionConstraint|null + */ + public function getInjectedSolutionConstraint() + { + return $this->injected_solution_constraint; + } + + public function hasInjectedSolutionConstraint() + { + return isset($this->injected_solution_constraint); + } + + public function clearInjectedSolutionConstraint() + { + unset($this->injected_solution_constraint); + } + + /** + * Constrain the optimization algorithm to find a final solution that is + * similar to a previous solution. For example, this may be used to freeze + * portions of routes which have already been completed or which are to be + * completed but must not be modified. + * If the injected solution is not feasible, a validation error is not + * necessarily returned and an error indicating infeasibility may be returned + * instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint injected_solution_constraint = 8; + * @param \Google\Cloud\Optimization\V1\InjectedSolutionConstraint $var + * @return $this + */ + public function setInjectedSolutionConstraint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\InjectedSolutionConstraint::class); + $this->injected_solution_constraint = $var; + + return $this; + } + + /** + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute refresh_details_routes = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRefreshDetailsRoutes() + { + return $this->refresh_details_routes; + } + + /** + * If non-empty, the given routes will be refreshed, without modifying their + * underlying sequence of visits or travel times: only other details will be + * updated. This does not solve the model. + * As of 2020/11, this only populates the polylines of non-empty routes and + * requires that `populate_polylines` is true. + * The `route_polyline` fields of the passed-in routes may be inconsistent + * with route `transitions`. + * This field must not be used together with `injected_first_solution_routes` + * or `injected_solution_constraint`. + * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. + * Polylines are still populated between all visits in all non-empty routes + * regardless of whether the related shipments or vehicles are ignored. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute refresh_details_routes = 9; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRefreshDetailsRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute::class); + $this->refresh_details_routes = $arr; + + return $this; + } + + /** + * If true: + * * uses [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] instead of [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] to + * match skipped shipments in the injected solution with request + * shipments. + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * If true, labels in the following categories must appear at most once in + * their category: + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] in the injected solution + * does not correspond to a request shipment, the `SkippedShipment` is removed + * from the solution. + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * NOTE: The caller must ensure that each [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] + * (resp. [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely identifies a vehicle (resp. shipment) + * entity used across the two relevant requests: the past request that + * produced the `OptimizeToursResponse` used in the injected solution and the + * current request that includes the injected solution. The uniqueness checks + * described above are not enough to guarantee this requirement. + * + * Generated from protobuf field bool interpret_injected_solutions_using_labels = 10; + * @return bool + */ + public function getInterpretInjectedSolutionsUsingLabels() + { + return $this->interpret_injected_solutions_using_labels; + } + + /** + * If true: + * * uses [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] instead of `vehicle_index` to + * match routes in an injected solution with vehicles in the request; + * reuses the mapping of original [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to new + * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] to update + * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] + * if non-empty, but the mapping must be unambiguous (i.e., multiple + * `ShipmentRoute`s must not share the same original `vehicle_index`). + * * uses [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] instead of `shipment_index` + * to match visits in an injected solution with shipments in the request; + * * uses [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] instead of [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] to + * match skipped shipments in the injected solution with request + * shipments. + * This interpretation applies to the `injected_first_solution_routes`, + * `injected_solution_constraint`, and `refresh_details_routes` fields. + * It can be used when shipment or vehicle indices in the request have + * changed since the solution was created, perhaps because shipments or + * vehicles have been removed from or added to the request. + * If true, labels in the following categories must appear at most once in + * their category: + * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the request; + * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the request; + * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; + * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in + * the injected solution (except pickup/delivery visit pairs, whose + * `shipment_label` must appear twice). + * If a `vehicle_label` in the injected solution does not correspond to a + * request vehicle, the corresponding route is removed from the solution + * along with its visits. If a `shipment_label` in the injected solution does + * not correspond to a request shipment, the corresponding visit is removed + * from the solution. If a [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] in the injected solution + * does not correspond to a request shipment, the `SkippedShipment` is removed + * from the solution. + * Removing route visits or entire routes from an injected solution may + * have an effect on the implied constraints, which may lead to change in + * solution, validation errors, or infeasibility. + * NOTE: The caller must ensure that each [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] + * (resp. [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely identifies a vehicle (resp. shipment) + * entity used across the two relevant requests: the past request that + * produced the `OptimizeToursResponse` used in the injected solution and the + * current request that includes the injected solution. The uniqueness checks + * described above are not enough to guarantee this requirement. + * + * Generated from protobuf field bool interpret_injected_solutions_using_labels = 10; + * @param bool $var + * @return $this + */ + public function setInterpretInjectedSolutionsUsingLabels($var) + { + GPBUtil::checkBool($var); + $this->interpret_injected_solutions_using_labels = $var; + + return $this; + } + + /** + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] field. + * + * Generated from protobuf field bool consider_road_traffic = 11; + * @return bool + */ + public function getConsiderRoadTraffic() + { + return $this->consider_road_traffic; + } + + /** + * Consider traffic estimation in calculating `ShipmentRoute` fields + * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], + * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], + * and `vehicle_end_time`; in setting the + * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] field, and in calculating the + * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] field. + * + * Generated from protobuf field bool consider_road_traffic = 11; + * @param bool $var + * @return $this + */ + public function setConsiderRoadTraffic($var) + { + GPBUtil::checkBool($var); + $this->consider_road_traffic = $var; + + return $this; + } + + /** + * If true, polylines will be populated in response `ShipmentRoute`s. + * + * Generated from protobuf field bool populate_polylines = 12; + * @return bool + */ + public function getPopulatePolylines() + { + return $this->populate_polylines; + } + + /** + * If true, polylines will be populated in response `ShipmentRoute`s. + * + * Generated from protobuf field bool populate_polylines = 12; + * @param bool $var + * @return $this + */ + public function setPopulatePolylines($var) + { + GPBUtil::checkBool($var); + $this->populate_polylines = $var; + + return $this; + } + + /** + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_transition_polylines = 13; + * @return bool + */ + public function getPopulateTransitionPolylines() + { + return $this->populate_transition_polylines; + } + + /** + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. + * Note that in this case, the polylines will also be populated in the + * deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_transition_polylines = 13; + * @param bool $var + * @return $this + */ + public function setPopulateTransitionPolylines($var) + { + GPBUtil::checkBool($var); + $this->populate_transition_polylines = $var; + + return $this; + } + + /** + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * + * Generated from protobuf field bool allow_large_deadline_despite_interruption_risk = 14; + * @return bool + */ + public function getAllowLargeDeadlineDespiteInterruptionRisk() + { + return $this->allow_large_deadline_despite_interruption_risk; + } + + /** + * If this is set, then the request can have a deadline + * (see https://grpc.io/blog/deadlines) of up to 60 minutes. + * Otherwise, the maximum deadline is only 30 minutes. + * Note that long-lived requests have a significantly larger (but still small) + * risk of interruption. + * + * Generated from protobuf field bool allow_large_deadline_despite_interruption_risk = 14; + * @param bool $var + * @return $this + */ + public function setAllowLargeDeadlineDespiteInterruptionRisk($var) + { + GPBUtil::checkBool($var); + $this->allow_large_deadline_despite_interruption_risk = $var; + + return $this; + } + + /** + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * + * Generated from protobuf field bool use_geodesic_distances = 15; + * @return bool + */ + public function getUseGeodesicDistances() + { + return $this->use_geodesic_distances; + } + + /** + * If true, travel distances will be computed using geodesic distances instead + * of Google Maps distances, and travel times will be computed using geodesic + * distances with a speed defined by `geodesic_meters_per_second`. + * + * Generated from protobuf field bool use_geodesic_distances = 15; + * @param bool $var + * @return $this + */ + public function setUseGeodesicDistances($var) + { + GPBUtil::checkBool($var); + $this->use_geodesic_distances = $var; + + return $this; + } + + /** + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * + * Generated from protobuf field optional double geodesic_meters_per_second = 16; + * @return float + */ + public function getGeodesicMetersPerSecond() + { + return isset($this->geodesic_meters_per_second) ? $this->geodesic_meters_per_second : 0.0; + } + + public function hasGeodesicMetersPerSecond() + { + return isset($this->geodesic_meters_per_second); + } + + public function clearGeodesicMetersPerSecond() + { + unset($this->geodesic_meters_per_second); + } + + /** + * When `use_geodesic_distances` is true, this field must be set and defines + * the speed applied to compute travel times. Its value must be at least 1.0 + * meters/seconds. + * + * Generated from protobuf field optional double geodesic_meters_per_second = 16; + * @param float $var + * @return $this + */ + public function setGeodesicMetersPerSecond($var) + { + GPBUtil::checkDouble($var); + $this->geodesic_meters_per_second = $var; + + return $this; + } + + /** + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * + * Generated from protobuf field string label = 17; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Label that may be used to identify this request, reported back in the + * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. + * + * Generated from protobuf field string label = 17; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * Deprecated: Use [OptimizeToursRequest.populate_transition_polylines][] instead. + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. Note that in this case, the polylines will + * also be populated in the deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_travel_step_polylines = 20 [deprecated = true]; + * @return bool + * @deprecated + */ + public function getPopulateTravelStepPolylines() + { + @trigger_error('populate_travel_step_polylines is deprecated.', E_USER_DEPRECATED); + return $this->populate_travel_step_polylines; + } + + /** + * Deprecated: Use [OptimizeToursRequest.populate_transition_polylines][] instead. + * If true, polylines will be populated in response + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. Note that in this case, the polylines will + * also be populated in the deprecated `travel_steps`. + * + * Generated from protobuf field bool populate_travel_step_polylines = 20 [deprecated = true]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setPopulateTravelStepPolylines($var) + { + @trigger_error('populate_travel_step_polylines is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->populate_travel_step_polylines = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/OptimizeToursRequest/SearchMode.php b/Optimization/src/V1/OptimizeToursRequest/SearchMode.php new file mode 100644 index 000000000000..6c75d081c0a5 --- /dev/null +++ b/Optimization/src/V1/OptimizeToursRequest/SearchMode.php @@ -0,0 +1,63 @@ +google.cloud.optimization.v1.OptimizeToursRequest.SearchMode + */ +class SearchMode +{ + /** + * Unspecified search mode, equivalent to `RETURN_FAST`. + * + * Generated from protobuf enum SEARCH_MODE_UNSPECIFIED = 0; + */ + const SEARCH_MODE_UNSPECIFIED = 0; + /** + * Stop the search after finding the first good solution. + * + * Generated from protobuf enum RETURN_FAST = 1; + */ + const RETURN_FAST = 1; + /** + * Spend all the available time to search for better solutions. + * + * Generated from protobuf enum CONSUME_ALL_AVAILABLE_TIME = 2; + */ + const CONSUME_ALL_AVAILABLE_TIME = 2; + + private static $valueToName = [ + self::SEARCH_MODE_UNSPECIFIED => 'SEARCH_MODE_UNSPECIFIED', + self::RETURN_FAST => 'RETURN_FAST', + self::CONSUME_ALL_AVAILABLE_TIME => 'CONSUME_ALL_AVAILABLE_TIME', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/OptimizeToursRequest/SolvingMode.php b/Optimization/src/V1/OptimizeToursRequest/SolvingMode.php new file mode 100644 index 000000000000..d4f975c0e2cd --- /dev/null +++ b/Optimization/src/V1/OptimizeToursRequest/SolvingMode.php @@ -0,0 +1,72 @@ +google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode + */ +class SolvingMode +{ + /** + * Solve the model. + * + * Generated from protobuf enum DEFAULT_SOLVE = 0; + */ + const DEFAULT_SOLVE = 0; + /** + * Only validates the model without solving it: populates as many + * [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] + * as possible. + * + * Generated from protobuf enum VALIDATE_ONLY = 1; + */ + const VALIDATE_ONLY = 1; + /** + * Only populates + * [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). + * *IMPORTANT*: not all infeasible shipments are returned here, but only the + * ones that are detected as infeasible as a preprocessing. + * + * Generated from protobuf enum DETECT_SOME_INFEASIBLE_SHIPMENTS = 2; + */ + const DETECT_SOME_INFEASIBLE_SHIPMENTS = 2; + + private static $valueToName = [ + self::DEFAULT_SOLVE => 'DEFAULT_SOLVE', + self::VALIDATE_ONLY => 'VALIDATE_ONLY', + self::DETECT_SOME_INFEASIBLE_SHIPMENTS => 'DETECT_SOME_INFEASIBLE_SHIPMENTS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/OptimizeToursResponse.php b/Optimization/src/V1/OptimizeToursResponse.php new file mode 100644 index 000000000000..addd837fb9f3 --- /dev/null +++ b/Optimization/src/V1/OptimizeToursResponse.php @@ -0,0 +1,282 @@ +google.cloud.optimization.v1.OptimizeToursResponse + */ +class OptimizeToursResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Routes computed for each vehicle; the i-th route corresponds to the i-th + * vehicle in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + */ + private $routes; + /** + * Copy of the [OptimizeToursRequest.label][google.cloud.optimization.v1.OptimizeToursRequest.label], if a label was specified in the + * request. + * + * Generated from protobuf field string request_label = 3; + */ + private $request_label = ''; + /** + * The list of all shipments skipped. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 4; + */ + private $skipped_shipments; + /** + * List of all the validation errors that we were able to detect + * independently. See the "MULTIPLE ERRORS" explanation for the + * [OptimizeToursValidationError][google.cloud.optimization.v1.OptimizeToursValidationError] message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError validation_errors = 5; + */ + private $validation_errors; + /** + * Duration, distance and usage metrics for this solution. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursResponse.Metrics metrics = 6; + */ + private $metrics = null; + /** + * Deprecated: Use [Metrics.total_cost][] instead. + * Total cost of the solution. This takes into account all costs: costs per + * per hour and travel hour, fixed vehicle costs, unperformed shipment penalty + * costs, global duration cost, etc. + * + * Generated from protobuf field double total_cost = 2 [deprecated = true]; + * @deprecated + */ + protected $total_cost = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\ShipmentRoute[]|\Google\Protobuf\Internal\RepeatedField $routes + * Routes computed for each vehicle; the i-th route corresponds to the i-th + * vehicle in the model. + * @type string $request_label + * Copy of the [OptimizeToursRequest.label][google.cloud.optimization.v1.OptimizeToursRequest.label], if a label was specified in the + * request. + * @type \Google\Cloud\Optimization\V1\SkippedShipment[]|\Google\Protobuf\Internal\RepeatedField $skipped_shipments + * The list of all shipments skipped. + * @type \Google\Cloud\Optimization\V1\OptimizeToursValidationError[]|\Google\Protobuf\Internal\RepeatedField $validation_errors + * List of all the validation errors that we were able to detect + * independently. See the "MULTIPLE ERRORS" explanation for the + * [OptimizeToursValidationError][google.cloud.optimization.v1.OptimizeToursValidationError] message. + * @type \Google\Cloud\Optimization\V1\OptimizeToursResponse\Metrics $metrics + * Duration, distance and usage metrics for this solution. + * @type float $total_cost + * Deprecated: Use [Metrics.total_cost][] instead. + * Total cost of the solution. This takes into account all costs: costs per + * per hour and travel hour, fixed vehicle costs, unperformed shipment penalty + * costs, global duration cost, etc. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Routes computed for each vehicle; the i-th route corresponds to the i-th + * vehicle in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Routes computed for each vehicle; the i-th route corresponds to the i-th + * vehicle in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute routes = 1; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute::class); + $this->routes = $arr; + + return $this; + } + + /** + * Copy of the [OptimizeToursRequest.label][google.cloud.optimization.v1.OptimizeToursRequest.label], if a label was specified in the + * request. + * + * Generated from protobuf field string request_label = 3; + * @return string + */ + public function getRequestLabel() + { + return $this->request_label; + } + + /** + * Copy of the [OptimizeToursRequest.label][google.cloud.optimization.v1.OptimizeToursRequest.label], if a label was specified in the + * request. + * + * Generated from protobuf field string request_label = 3; + * @param string $var + * @return $this + */ + public function setRequestLabel($var) + { + GPBUtil::checkString($var, True); + $this->request_label = $var; + + return $this; + } + + /** + * The list of all shipments skipped. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSkippedShipments() + { + return $this->skipped_shipments; + } + + /** + * The list of all shipments skipped. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment skipped_shipments = 4; + * @param \Google\Cloud\Optimization\V1\SkippedShipment[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSkippedShipments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\SkippedShipment::class); + $this->skipped_shipments = $arr; + + return $this; + } + + /** + * List of all the validation errors that we were able to detect + * independently. See the "MULTIPLE ERRORS" explanation for the + * [OptimizeToursValidationError][google.cloud.optimization.v1.OptimizeToursValidationError] message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError validation_errors = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValidationErrors() + { + return $this->validation_errors; + } + + /** + * List of all the validation errors that we were able to detect + * independently. See the "MULTIPLE ERRORS" explanation for the + * [OptimizeToursValidationError][google.cloud.optimization.v1.OptimizeToursValidationError] message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError validation_errors = 5; + * @param \Google\Cloud\Optimization\V1\OptimizeToursValidationError[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValidationErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\OptimizeToursValidationError::class); + $this->validation_errors = $arr; + + return $this; + } + + /** + * Duration, distance and usage metrics for this solution. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursResponse.Metrics metrics = 6; + * @return \Google\Cloud\Optimization\V1\OptimizeToursResponse\Metrics|null + */ + public function getMetrics() + { + return $this->metrics; + } + + public function hasMetrics() + { + return isset($this->metrics); + } + + public function clearMetrics() + { + unset($this->metrics); + } + + /** + * Duration, distance and usage metrics for this solution. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursResponse.Metrics metrics = 6; + * @param \Google\Cloud\Optimization\V1\OptimizeToursResponse\Metrics $var + * @return $this + */ + public function setMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\OptimizeToursResponse\Metrics::class); + $this->metrics = $var; + + return $this; + } + + /** + * Deprecated: Use [Metrics.total_cost][] instead. + * Total cost of the solution. This takes into account all costs: costs per + * per hour and travel hour, fixed vehicle costs, unperformed shipment penalty + * costs, global duration cost, etc. + * + * Generated from protobuf field double total_cost = 2 [deprecated = true]; + * @return float + * @deprecated + */ + public function getTotalCost() + { + @trigger_error('total_cost is deprecated.', E_USER_DEPRECATED); + return $this->total_cost; + } + + /** + * Deprecated: Use [Metrics.total_cost][] instead. + * Total cost of the solution. This takes into account all costs: costs per + * per hour and travel hour, fixed vehicle costs, unperformed shipment penalty + * costs, global duration cost, etc. + * + * Generated from protobuf field double total_cost = 2 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setTotalCost($var) + { + @trigger_error('total_cost is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkDouble($var); + $this->total_cost = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/OptimizeToursResponse/Metrics.php b/Optimization/src/V1/OptimizeToursResponse/Metrics.php new file mode 100644 index 000000000000..dc41164e8ff3 --- /dev/null +++ b/Optimization/src/V1/OptimizeToursResponse/Metrics.php @@ -0,0 +1,354 @@ +google.cloud.optimization.v1.OptimizeToursResponse.Metrics + */ +class Metrics extends \Google\Protobuf\Internal\Message +{ + /** + * Aggregated over the routes. Each metric is the sum (or max, for loads) + * over all [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics] fields of the same name. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1; + */ + private $aggregated_route_metrics = null; + /** + * Number of mandatory shipments skipped. + * + * Generated from protobuf field int32 skipped_mandatory_shipment_count = 2; + */ + private $skipped_mandatory_shipment_count = 0; + /** + * Number of vehicles used. Note: if a vehicle route is empty and + * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] is true, the vehicle is considered + * used. + * + * Generated from protobuf field int32 used_vehicle_count = 3; + */ + private $used_vehicle_count = 0; + /** + * The earliest start time for a used vehicle, computed as the minimum over + * all used vehicles of [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_vehicle_start_time = 4; + */ + private $earliest_vehicle_start_time = null; + /** + * The latest end time for a used vehicle, computed as the maximum over all + * used vehicles of [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_vehicle_end_time = 5; + */ + private $latest_vehicle_end_time = null; + /** + * Cost of the solution, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, + * e.g. "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole + * solution. In other words, costs["model.shipments.pickups.cost"] is the + * sum of all pickup costs over the solution. All costs defined in the model + * are reported in detail here with the exception of costs related to + * TransitionAttributes that are only reported in an aggregated way as of + * 2022/01. + * + * Generated from protobuf field map costs = 10; + */ + private $costs; + /** + * Total cost of the solution. The sum of all values in the costs map. + * + * Generated from protobuf field double total_cost = 6; + */ + private $total_cost = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\AggregatedMetrics $aggregated_route_metrics + * Aggregated over the routes. Each metric is the sum (or max, for loads) + * over all [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics] fields of the same name. + * @type int $skipped_mandatory_shipment_count + * Number of mandatory shipments skipped. + * @type int $used_vehicle_count + * Number of vehicles used. Note: if a vehicle route is empty and + * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] is true, the vehicle is considered + * used. + * @type \Google\Protobuf\Timestamp $earliest_vehicle_start_time + * The earliest start time for a used vehicle, computed as the minimum over + * all used vehicles of [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * @type \Google\Protobuf\Timestamp $latest_vehicle_end_time + * The latest end time for a used vehicle, computed as the maximum over all + * used vehicles of [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time]. + * @type array|\Google\Protobuf\Internal\MapField $costs + * Cost of the solution, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, + * e.g. "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole + * solution. In other words, costs["model.shipments.pickups.cost"] is the + * sum of all pickup costs over the solution. All costs defined in the model + * are reported in detail here with the exception of costs related to + * TransitionAttributes that are only reported in an aggregated way as of + * 2022/01. + * @type float $total_cost + * Total cost of the solution. The sum of all values in the costs map. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Aggregated over the routes. Each metric is the sum (or max, for loads) + * over all [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics] fields of the same name. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1; + * @return \Google\Cloud\Optimization\V1\AggregatedMetrics|null + */ + public function getAggregatedRouteMetrics() + { + return $this->aggregated_route_metrics; + } + + public function hasAggregatedRouteMetrics() + { + return isset($this->aggregated_route_metrics); + } + + public function clearAggregatedRouteMetrics() + { + unset($this->aggregated_route_metrics); + } + + /** + * Aggregated over the routes. Each metric is the sum (or max, for loads) + * over all [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics] fields of the same name. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1; + * @param \Google\Cloud\Optimization\V1\AggregatedMetrics $var + * @return $this + */ + public function setAggregatedRouteMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\AggregatedMetrics::class); + $this->aggregated_route_metrics = $var; + + return $this; + } + + /** + * Number of mandatory shipments skipped. + * + * Generated from protobuf field int32 skipped_mandatory_shipment_count = 2; + * @return int + */ + public function getSkippedMandatoryShipmentCount() + { + return $this->skipped_mandatory_shipment_count; + } + + /** + * Number of mandatory shipments skipped. + * + * Generated from protobuf field int32 skipped_mandatory_shipment_count = 2; + * @param int $var + * @return $this + */ + public function setSkippedMandatoryShipmentCount($var) + { + GPBUtil::checkInt32($var); + $this->skipped_mandatory_shipment_count = $var; + + return $this; + } + + /** + * Number of vehicles used. Note: if a vehicle route is empty and + * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] is true, the vehicle is considered + * used. + * + * Generated from protobuf field int32 used_vehicle_count = 3; + * @return int + */ + public function getUsedVehicleCount() + { + return $this->used_vehicle_count; + } + + /** + * Number of vehicles used. Note: if a vehicle route is empty and + * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] is true, the vehicle is considered + * used. + * + * Generated from protobuf field int32 used_vehicle_count = 3; + * @param int $var + * @return $this + */ + public function setUsedVehicleCount($var) + { + GPBUtil::checkInt32($var); + $this->used_vehicle_count = $var; + + return $this; + } + + /** + * The earliest start time for a used vehicle, computed as the minimum over + * all used vehicles of [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_vehicle_start_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEarliestVehicleStartTime() + { + return $this->earliest_vehicle_start_time; + } + + public function hasEarliestVehicleStartTime() + { + return isset($this->earliest_vehicle_start_time); + } + + public function clearEarliestVehicleStartTime() + { + unset($this->earliest_vehicle_start_time); + } + + /** + * The earliest start time for a used vehicle, computed as the minimum over + * all used vehicles of [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_vehicle_start_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEarliestVehicleStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->earliest_vehicle_start_time = $var; + + return $this; + } + + /** + * The latest end time for a used vehicle, computed as the maximum over all + * used vehicles of [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_vehicle_end_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLatestVehicleEndTime() + { + return $this->latest_vehicle_end_time; + } + + public function hasLatestVehicleEndTime() + { + return isset($this->latest_vehicle_end_time); + } + + public function clearLatestVehicleEndTime() + { + unset($this->latest_vehicle_end_time); + } + + /** + * The latest end time for a used vehicle, computed as the maximum over all + * used vehicles of [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time]. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_vehicle_end_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLatestVehicleEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->latest_vehicle_end_time = $var; + + return $this; + } + + /** + * Cost of the solution, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, + * e.g. "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole + * solution. In other words, costs["model.shipments.pickups.cost"] is the + * sum of all pickup costs over the solution. All costs defined in the model + * are reported in detail here with the exception of costs related to + * TransitionAttributes that are only reported in an aggregated way as of + * 2022/01. + * + * Generated from protobuf field map costs = 10; + * @return \Google\Protobuf\Internal\MapField + */ + public function getCosts() + { + return $this->costs; + } + + /** + * Cost of the solution, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, + * e.g. "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole + * solution. In other words, costs["model.shipments.pickups.cost"] is the + * sum of all pickup costs over the solution. All costs defined in the model + * are reported in detail here with the exception of costs related to + * TransitionAttributes that are only reported in an aggregated way as of + * 2022/01. + * + * Generated from protobuf field map costs = 10; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setCosts($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->costs = $arr; + + return $this; + } + + /** + * Total cost of the solution. The sum of all values in the costs map. + * + * Generated from protobuf field double total_cost = 6; + * @return float + */ + public function getTotalCost() + { + return $this->total_cost; + } + + /** + * Total cost of the solution. The sum of all values in the costs map. + * + * Generated from protobuf field double total_cost = 6; + * @param float $var + * @return $this + */ + public function setTotalCost($var) + { + GPBUtil::checkDouble($var); + $this->total_cost = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/OptimizeToursValidationError.php b/Optimization/src/V1/OptimizeToursValidationError.php new file mode 100644 index 000000000000..64be399e396a --- /dev/null +++ b/Optimization/src/V1/OptimizeToursValidationError.php @@ -0,0 +1,1139 @@ +google.cloud.optimization.v1.OptimizeToursValidationError + */ +class OptimizeToursValidationError extends \Google\Protobuf\Internal\Message +{ + /** + * A validation error is defined by the pair (`code`, `display_name`) which + * are always present. + * Other fields (below) provide more context about the error. + * *MULTIPLE ERRORS*: + * When there are multiple errors, the validation process tries to output + * several of them. Much like a compiler, this is an imperfect process. Some + * validation errors will be "fatal", meaning that they stop the entire + * validation process. This is the case for `display_name="UNSPECIFIED"` + * errors, among others. Some may cause the validation process to skip other + * errors. + * *STABILITY*: + * `code` and `display_name` should be very stable. But new codes and + * display names may appear over time, which may cause a given (invalid) + * request to yield a different (`code`, `display_name`) pair because the new + * error hid the old one (see "MULTIPLE ERRORS"). + * *REFERENCE*: A list of all (code, name) pairs: + * * UNSPECIFIED = 0; + * * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within + * the deadline. + * * REQUEST_OPTIONS_ERROR = 12; + * * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201; + * * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203; + * * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204; + * * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205; + * * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206; + * * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE + * = 1207; + * * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208; + * * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211; + * * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212; + * * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217; + * * INJECTED_SOLUTION_ERROR = 20; + * * INJECTED_SOLUTION_MISSING_LABEL = 2000; + * * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001; + * * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002; + * * SHIPMENT_MODEL_ERROR = 22; + * * SHIPMENT_MODEL_TOO_LARGE = 2200; + * * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202; + * * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204; + * * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205; + * * INDEX_ERROR = 24; + * * TAG_ERROR = 26; + * * TIME_WINDOW_ERROR = 28; + * * TIME_WINDOW_INVALID_START_TIME = 2800; + * * TIME_WINDOW_INVALID_END_TIME = 2801; + * * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802; + * * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803; + * * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804; + * * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME + * = 2808; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809; + * * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME + * = 2810; + * * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811; + * * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813; + * * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815; + * * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS + * = 2817; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818; + * * TRANSITION_ATTRIBUTES_ERROR = 30; + * * TRANSITION_ATTRIBUTES_INVALID_COST = 3000; + * * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001; + * * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002; + * * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004; + * * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006; + * * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009; + * * AMOUNT_ERROR = 31; + * * AMOUNT_NEGATIVE_VALUE = 3100; + * * LOAD_LIMIT_ERROR = 33; + * * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303; + * * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304; + * * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305; + * * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306; + * * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307; + * * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308; + * * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309; + * * INTERVAL_ERROR = 34; + * * INTERVAL_MIN_EXCEEDS_MAX = 3401; + * * INTERVAL_NEGATIVE_MIN = 3402; + * * INTERVAL_NEGATIVE_MAX = 3403; + * * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404; + * * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405; + * * DISTANCE_LIMIT_ERROR = 36; + * * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601; + * * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602; + * * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603; + * * DISTANCE_LIMIT_NEGATIVE_MAX = 3604; + * * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605; + * * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606; + * * DURATION_LIMIT_ERROR = 38; + * * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800; + * * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801; + * * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802; + * * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803; + * * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805; + * * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR + * = 3807; + * * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX + * = 3808; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809; + * * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811; + * * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE + * = 3812; + * * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813; + * * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION + * = 3815; + * * SHIPMENT_ERROR = 40; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4001; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003; + * * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004; + * * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005; + * * SHIPMENT_INVALID_PENALTY_COST = 4006; + * * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007; + * * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010; + * * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011; + * * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012; + * * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013; + * * SHIPMENT_DETOUR_WITHOUT_PICKUP_AND_DELIVERY = 4014; + * * VEHICLE_ERROR = 42; + * * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200; + * * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201; + * * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202; + * * VEHICLE_EMPTY_START_TAG = 4203; + * * VEHICLE_DUPLICATE_START_TAG = 4204; + * * VEHICLE_EMPTY_END_TAG = 4205; + * * VEHICLE_DUPLICATE_END_TAG = 4206; + * * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207; + * * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208; + * * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209; + * * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210; + * * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211; + * * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212; + * * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213; + * * VEHICLE_LAST_SHIPMENT_IGNORED = 4214; + * * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215; + * * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216; + * * VEHICLE_INVALID_COST_PER_KILOMETER = 4217; + * * VEHICLE_INVALID_COST_PER_HOUR = 4218; + * * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219; + * * VEHICLE_INVALID_FIXED_COST = 4220; + * * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221; + * * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222; + * * VISIT_REQUEST_ERROR = 44; + * * VISIT_REQUEST_EMPTY_TAG = 4400; + * * VISIT_REQUEST_DUPLICATE_TAG = 4401; + * * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404; + * * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405; + * * PRECEDENCE_ERROR = 46; + * * BREAK_ERROR = 48; + * * BREAK_RULE_EMPTY = 4800; + * * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801; + * * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802; + * * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803; + * * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804; + * * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805; + * * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806; + * * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807; + * * BREAK_REQUEST_NON_SCHEDULABLE = 4808; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4812; + * * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813; + * * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814; + * * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815; + * * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50; + * * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001; + * * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002; + * * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003; + * * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004; + * * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005; + * * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001; + * * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002; + * * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003; + * * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009; + * * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010; + * * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011; + * * VEHICLE_OPERATOR_ERROR = 54; + * * VEHICLE_OPERATOR_EMPTY_TYPE = 5400; + * * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401; + * * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402; + * * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403; + * * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404; + * * DURATION_SECONDS_MATRIX_ERROR = 56; + * * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600; + * * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601; + * * GRAPH_ARC_ERROR = 58; + * * GRAPH_ARC_DURATION_NEGATIVE_OR_NAN = 5800; + * * GRAPH_ARC_DURATION_EXCEEDS_GLOBAL_DURATION = 5801; + * + * Generated from protobuf field int32 code = 1; + */ + private $code = 0; + /** + * The error display name. + * + * Generated from protobuf field string display_name = 2; + */ + private $display_name = ''; + /** + * An error context may involve 0, 1 (most of the time) or more fields. For + * example, referring to vehicle #4 and shipment #2's first pickup can be + * done as follows: + * ``` + * fields { name: "vehicles" index: 4} + * fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} } + * ``` + * Note, however, that the cardinality of `fields` should not change for a + * given error code. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference fields = 3; + */ + private $fields; + /** + * Human-readable string describing the error. There is a 1:1 mapping + * between `code` and `error_message` (when code != "UNSPECIFIED"). + * *STABILITY*: Not stable: the error message associated to a given `code` may + * change (hopefully to clarify it) over time. Please rely on the + * `display_name` and `code` instead. + * + * Generated from protobuf field string error_message = 4; + */ + private $error_message = ''; + /** + * May contain the value(s) of the field(s). This is not always available. You + * should absolutely not rely on it and use it only for manual model + * debugging. + * + * Generated from protobuf field string offending_values = 5; + */ + private $offending_values = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * A validation error is defined by the pair (`code`, `display_name`) which + * are always present. + * Other fields (below) provide more context about the error. + * *MULTIPLE ERRORS*: + * When there are multiple errors, the validation process tries to output + * several of them. Much like a compiler, this is an imperfect process. Some + * validation errors will be "fatal", meaning that they stop the entire + * validation process. This is the case for `display_name="UNSPECIFIED"` + * errors, among others. Some may cause the validation process to skip other + * errors. + * *STABILITY*: + * `code` and `display_name` should be very stable. But new codes and + * display names may appear over time, which may cause a given (invalid) + * request to yield a different (`code`, `display_name`) pair because the new + * error hid the old one (see "MULTIPLE ERRORS"). + * *REFERENCE*: A list of all (code, name) pairs: + * * UNSPECIFIED = 0; + * * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within + * the deadline. + * * REQUEST_OPTIONS_ERROR = 12; + * * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201; + * * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203; + * * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204; + * * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205; + * * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206; + * * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE + * = 1207; + * * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208; + * * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211; + * * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212; + * * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217; + * * INJECTED_SOLUTION_ERROR = 20; + * * INJECTED_SOLUTION_MISSING_LABEL = 2000; + * * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001; + * * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002; + * * SHIPMENT_MODEL_ERROR = 22; + * * SHIPMENT_MODEL_TOO_LARGE = 2200; + * * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202; + * * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204; + * * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205; + * * INDEX_ERROR = 24; + * * TAG_ERROR = 26; + * * TIME_WINDOW_ERROR = 28; + * * TIME_WINDOW_INVALID_START_TIME = 2800; + * * TIME_WINDOW_INVALID_END_TIME = 2801; + * * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802; + * * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803; + * * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804; + * * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME + * = 2808; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809; + * * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME + * = 2810; + * * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811; + * * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813; + * * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815; + * * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS + * = 2817; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818; + * * TRANSITION_ATTRIBUTES_ERROR = 30; + * * TRANSITION_ATTRIBUTES_INVALID_COST = 3000; + * * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001; + * * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002; + * * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004; + * * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006; + * * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009; + * * AMOUNT_ERROR = 31; + * * AMOUNT_NEGATIVE_VALUE = 3100; + * * LOAD_LIMIT_ERROR = 33; + * * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303; + * * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304; + * * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305; + * * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306; + * * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307; + * * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308; + * * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309; + * * INTERVAL_ERROR = 34; + * * INTERVAL_MIN_EXCEEDS_MAX = 3401; + * * INTERVAL_NEGATIVE_MIN = 3402; + * * INTERVAL_NEGATIVE_MAX = 3403; + * * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404; + * * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405; + * * DISTANCE_LIMIT_ERROR = 36; + * * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601; + * * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602; + * * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603; + * * DISTANCE_LIMIT_NEGATIVE_MAX = 3604; + * * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605; + * * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606; + * * DURATION_LIMIT_ERROR = 38; + * * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800; + * * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801; + * * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802; + * * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803; + * * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805; + * * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR + * = 3807; + * * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX + * = 3808; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809; + * * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811; + * * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE + * = 3812; + * * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813; + * * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION + * = 3815; + * * SHIPMENT_ERROR = 40; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4001; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003; + * * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004; + * * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005; + * * SHIPMENT_INVALID_PENALTY_COST = 4006; + * * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007; + * * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010; + * * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011; + * * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012; + * * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013; + * * SHIPMENT_DETOUR_WITHOUT_PICKUP_AND_DELIVERY = 4014; + * * VEHICLE_ERROR = 42; + * * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200; + * * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201; + * * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202; + * * VEHICLE_EMPTY_START_TAG = 4203; + * * VEHICLE_DUPLICATE_START_TAG = 4204; + * * VEHICLE_EMPTY_END_TAG = 4205; + * * VEHICLE_DUPLICATE_END_TAG = 4206; + * * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207; + * * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208; + * * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209; + * * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210; + * * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211; + * * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212; + * * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213; + * * VEHICLE_LAST_SHIPMENT_IGNORED = 4214; + * * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215; + * * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216; + * * VEHICLE_INVALID_COST_PER_KILOMETER = 4217; + * * VEHICLE_INVALID_COST_PER_HOUR = 4218; + * * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219; + * * VEHICLE_INVALID_FIXED_COST = 4220; + * * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221; + * * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222; + * * VISIT_REQUEST_ERROR = 44; + * * VISIT_REQUEST_EMPTY_TAG = 4400; + * * VISIT_REQUEST_DUPLICATE_TAG = 4401; + * * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404; + * * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405; + * * PRECEDENCE_ERROR = 46; + * * BREAK_ERROR = 48; + * * BREAK_RULE_EMPTY = 4800; + * * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801; + * * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802; + * * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803; + * * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804; + * * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805; + * * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806; + * * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807; + * * BREAK_REQUEST_NON_SCHEDULABLE = 4808; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4812; + * * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813; + * * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814; + * * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815; + * * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50; + * * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001; + * * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002; + * * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003; + * * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004; + * * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005; + * * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001; + * * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002; + * * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003; + * * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009; + * * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010; + * * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011; + * * VEHICLE_OPERATOR_ERROR = 54; + * * VEHICLE_OPERATOR_EMPTY_TYPE = 5400; + * * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401; + * * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402; + * * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403; + * * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404; + * * DURATION_SECONDS_MATRIX_ERROR = 56; + * * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600; + * * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601; + * * GRAPH_ARC_ERROR = 58; + * * GRAPH_ARC_DURATION_NEGATIVE_OR_NAN = 5800; + * * GRAPH_ARC_DURATION_EXCEEDS_GLOBAL_DURATION = 5801; + * @type string $display_name + * The error display name. + * @type \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference[]|\Google\Protobuf\Internal\RepeatedField $fields + * An error context may involve 0, 1 (most of the time) or more fields. For + * example, referring to vehicle #4 and shipment #2's first pickup can be + * done as follows: + * ``` + * fields { name: "vehicles" index: 4} + * fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} } + * ``` + * Note, however, that the cardinality of `fields` should not change for a + * given error code. + * @type string $error_message + * Human-readable string describing the error. There is a 1:1 mapping + * between `code` and `error_message` (when code != "UNSPECIFIED"). + * *STABILITY*: Not stable: the error message associated to a given `code` may + * change (hopefully to clarify it) over time. Please rely on the + * `display_name` and `code` instead. + * @type string $offending_values + * May contain the value(s) of the field(s). This is not always available. You + * should absolutely not rely on it and use it only for manual model + * debugging. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A validation error is defined by the pair (`code`, `display_name`) which + * are always present. + * Other fields (below) provide more context about the error. + * *MULTIPLE ERRORS*: + * When there are multiple errors, the validation process tries to output + * several of them. Much like a compiler, this is an imperfect process. Some + * validation errors will be "fatal", meaning that they stop the entire + * validation process. This is the case for `display_name="UNSPECIFIED"` + * errors, among others. Some may cause the validation process to skip other + * errors. + * *STABILITY*: + * `code` and `display_name` should be very stable. But new codes and + * display names may appear over time, which may cause a given (invalid) + * request to yield a different (`code`, `display_name`) pair because the new + * error hid the old one (see "MULTIPLE ERRORS"). + * *REFERENCE*: A list of all (code, name) pairs: + * * UNSPECIFIED = 0; + * * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within + * the deadline. + * * REQUEST_OPTIONS_ERROR = 12; + * * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201; + * * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203; + * * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204; + * * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205; + * * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206; + * * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE + * = 1207; + * * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208; + * * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211; + * * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212; + * * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217; + * * INJECTED_SOLUTION_ERROR = 20; + * * INJECTED_SOLUTION_MISSING_LABEL = 2000; + * * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001; + * * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002; + * * SHIPMENT_MODEL_ERROR = 22; + * * SHIPMENT_MODEL_TOO_LARGE = 2200; + * * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202; + * * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204; + * * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205; + * * INDEX_ERROR = 24; + * * TAG_ERROR = 26; + * * TIME_WINDOW_ERROR = 28; + * * TIME_WINDOW_INVALID_START_TIME = 2800; + * * TIME_WINDOW_INVALID_END_TIME = 2801; + * * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802; + * * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803; + * * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804; + * * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME + * = 2808; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809; + * * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME + * = 2810; + * * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811; + * * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813; + * * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815; + * * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS + * = 2817; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818; + * * TRANSITION_ATTRIBUTES_ERROR = 30; + * * TRANSITION_ATTRIBUTES_INVALID_COST = 3000; + * * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001; + * * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002; + * * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004; + * * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006; + * * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009; + * * AMOUNT_ERROR = 31; + * * AMOUNT_NEGATIVE_VALUE = 3100; + * * LOAD_LIMIT_ERROR = 33; + * * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303; + * * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304; + * * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305; + * * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306; + * * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307; + * * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308; + * * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309; + * * INTERVAL_ERROR = 34; + * * INTERVAL_MIN_EXCEEDS_MAX = 3401; + * * INTERVAL_NEGATIVE_MIN = 3402; + * * INTERVAL_NEGATIVE_MAX = 3403; + * * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404; + * * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405; + * * DISTANCE_LIMIT_ERROR = 36; + * * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601; + * * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602; + * * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603; + * * DISTANCE_LIMIT_NEGATIVE_MAX = 3604; + * * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605; + * * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606; + * * DURATION_LIMIT_ERROR = 38; + * * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800; + * * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801; + * * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802; + * * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803; + * * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805; + * * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR + * = 3807; + * * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX + * = 3808; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809; + * * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811; + * * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE + * = 3812; + * * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813; + * * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION + * = 3815; + * * SHIPMENT_ERROR = 40; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4001; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003; + * * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004; + * * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005; + * * SHIPMENT_INVALID_PENALTY_COST = 4006; + * * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007; + * * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010; + * * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011; + * * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012; + * * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013; + * * SHIPMENT_DETOUR_WITHOUT_PICKUP_AND_DELIVERY = 4014; + * * VEHICLE_ERROR = 42; + * * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200; + * * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201; + * * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202; + * * VEHICLE_EMPTY_START_TAG = 4203; + * * VEHICLE_DUPLICATE_START_TAG = 4204; + * * VEHICLE_EMPTY_END_TAG = 4205; + * * VEHICLE_DUPLICATE_END_TAG = 4206; + * * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207; + * * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208; + * * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209; + * * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210; + * * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211; + * * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212; + * * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213; + * * VEHICLE_LAST_SHIPMENT_IGNORED = 4214; + * * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215; + * * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216; + * * VEHICLE_INVALID_COST_PER_KILOMETER = 4217; + * * VEHICLE_INVALID_COST_PER_HOUR = 4218; + * * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219; + * * VEHICLE_INVALID_FIXED_COST = 4220; + * * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221; + * * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222; + * * VISIT_REQUEST_ERROR = 44; + * * VISIT_REQUEST_EMPTY_TAG = 4400; + * * VISIT_REQUEST_DUPLICATE_TAG = 4401; + * * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404; + * * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405; + * * PRECEDENCE_ERROR = 46; + * * BREAK_ERROR = 48; + * * BREAK_RULE_EMPTY = 4800; + * * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801; + * * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802; + * * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803; + * * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804; + * * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805; + * * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806; + * * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807; + * * BREAK_REQUEST_NON_SCHEDULABLE = 4808; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4812; + * * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813; + * * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814; + * * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815; + * * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50; + * * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001; + * * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002; + * * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003; + * * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004; + * * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005; + * * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001; + * * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002; + * * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003; + * * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009; + * * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010; + * * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011; + * * VEHICLE_OPERATOR_ERROR = 54; + * * VEHICLE_OPERATOR_EMPTY_TYPE = 5400; + * * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401; + * * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402; + * * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403; + * * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404; + * * DURATION_SECONDS_MATRIX_ERROR = 56; + * * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600; + * * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601; + * * GRAPH_ARC_ERROR = 58; + * * GRAPH_ARC_DURATION_NEGATIVE_OR_NAN = 5800; + * * GRAPH_ARC_DURATION_EXCEEDS_GLOBAL_DURATION = 5801; + * + * Generated from protobuf field int32 code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * A validation error is defined by the pair (`code`, `display_name`) which + * are always present. + * Other fields (below) provide more context about the error. + * *MULTIPLE ERRORS*: + * When there are multiple errors, the validation process tries to output + * several of them. Much like a compiler, this is an imperfect process. Some + * validation errors will be "fatal", meaning that they stop the entire + * validation process. This is the case for `display_name="UNSPECIFIED"` + * errors, among others. Some may cause the validation process to skip other + * errors. + * *STABILITY*: + * `code` and `display_name` should be very stable. But new codes and + * display names may appear over time, which may cause a given (invalid) + * request to yield a different (`code`, `display_name`) pair because the new + * error hid the old one (see "MULTIPLE ERRORS"). + * *REFERENCE*: A list of all (code, name) pairs: + * * UNSPECIFIED = 0; + * * VALIDATION_TIMEOUT_ERROR = 10; Validation couldn't be completed within + * the deadline. + * * REQUEST_OPTIONS_ERROR = 12; + * * REQUEST_OPTIONS_INVALID_SOLVING_MODE = 1201; + * * REQUEST_OPTIONS_INVALID_MAX_VALIDATION_ERRORS = 1203; + * * REQUEST_OPTIONS_INVALID_GEODESIC_METERS_PER_SECOND = 1204; + * * REQUEST_OPTIONS_GEODESIC_METERS_PER_SECOND_TOO_SMALL = 1205; + * * REQUEST_OPTIONS_MISSING_GEODESIC_METERS_PER_SECOND = 1206; + * * REQUEST_OPTIONS_POPULATE_PATHFINDER_TRIPS_AND_GEODESIC_DISTANCE + * = 1207; + * * REQUEST_OPTIONS_COST_MODEL_OPTIONS_AND_GEODESIC_DISTANCE = 1208; + * * REQUEST_OPTIONS_TRAVEL_MODE_INCOMPATIBLE_WITH_TRAFFIC = 1211; + * * REQUEST_OPTIONS_MULTIPLE_TRAFFIC_FLAVORS = 1212; + * * REQUEST_OPTIONS_INVALID_TRAFFIC_FLAVOR = 1213; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITHOUT_GLOBAL_START_TIME = 1214; + * * REQUEST_OPTIONS_TRAFFIC_ENABLED_WITH_PRECEDENCES = 1215; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_MODE_INVALID = 1216; + * * REQUEST_OPTIONS_TRAFFIC_PREFILL_ENABLED_WITHOUT_TRAFFIC = 1217; + * * INJECTED_SOLUTION_ERROR = 20; + * * INJECTED_SOLUTION_MISSING_LABEL = 2000; + * * INJECTED_SOLUTION_DUPLICATE_LABEL = 2001; + * * INJECTED_SOLUTION_AMBIGUOUS_INDEX = 2002; + * * SHIPMENT_MODEL_ERROR = 22; + * * SHIPMENT_MODEL_TOO_LARGE = 2200; + * * SHIPMENT_MODEL_TOO_MANY_CAPACITY_TYPES = 2201; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_NEGATIVE_OR_NAN = 2202; + * * SHIPMENT_MODEL_GLOBAL_END_TIME_TOO_LARGE_OR_NAN = 2203; + * * SHIPMENT_MODEL_GLOBAL_START_TIME_AFTER_GLOBAL_END_TIME = 2204; + * * SHIPMENT_MODEL_GLOBAL_DURATION_TOO_LONG = 2205; + * * INDEX_ERROR = 24; + * * TAG_ERROR = 26; + * * TIME_WINDOW_ERROR = 28; + * * TIME_WINDOW_INVALID_START_TIME = 2800; + * * TIME_WINDOW_INVALID_END_TIME = 2801; + * * TIME_WINDOW_INVALID_SOFT_START_TIME = 2802; + * * TIME_WINDOW_INVALID_SOFT_END_TIME = 2803; + * * TIME_WINDOW_OUTSIDE_GLOBAL_TIME_WINDOW = 2804; + * * TIME_WINDOW_START_TIME_AFTER_END_TIME = 2805; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_BEFORE_SOFT_START_TIME = 2806; + * * TIME_WINDOW_INVALID_COST_PER_HOUR_AFTER_SOFT_END_TIME = 2807; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_WITHOUT_SOFT_START_TIME + * = 2808; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_WITHOUT_SOFT_END_TIME = 2809; + * * TIME_WINDOW_SOFT_START_TIME_WITHOUT_COST_BEFORE_SOFT_START_TIME + * = 2810; + * * TIME_WINDOW_SOFT_END_TIME_WITHOUT_COST_AFTER_SOFT_END_TIME = 2811; + * * TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS = 2812; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813; + * * TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814; + * * TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815; + * * TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816; + * * TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS + * = 2817; + * * TIME_WINDOW_COST_AFTER_SOFT_END_TIME_SET_AND_MULTIPLE_WINDOWS = 2818; + * * TRANSITION_ATTRIBUTES_ERROR = 30; + * * TRANSITION_ATTRIBUTES_INVALID_COST = 3000; + * * TRANSITION_ATTRIBUTES_INVALID_COST_PER_KILOMETER = 3001; + * * TRANSITION_ATTRIBUTES_DUPLICATE_TAG_PAIR = 3002; + * * TRANSITION_ATTRIBUTES_DISTANCE_LIMIT_MAX_METERS_UNSUPPORTED = 3003; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_SOURCE_TAGS = 3004; + * * TRANSITION_ATTRIBUTES_CONFLICTING_SOURCE_TAGS_FIELDS = 3005; + * * TRANSITION_ATTRIBUTES_UNSPECIFIED_DESTINATION_TAGS = 3006; + * * TRANSITION_ATTRIBUTES_CONFLICTING_DESTINATION_TAGS_FIELDS = 3007; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_NEGATIVE_OR_NAN = 3008; + * * TRANSITION_ATTRIBUTES_DELAY_DURATION_EXCEEDS_GLOBAL_DURATION = 3009; + * * AMOUNT_ERROR = 31; + * * AMOUNT_NEGATIVE_VALUE = 3100; + * * LOAD_LIMIT_ERROR = 33; + * * LOAD_LIMIT_INVALID_COST_ABOVE_SOFT_MAX = 3303; + * * LOAD_LIMIT_SOFT_MAX_WITHOUT_COST_ABOVE_SOFT_MAX = 3304; + * * LOAD_LIMIT_COST_ABOVE_SOFT_MAX_WITHOUT_SOFT_MAX = 3305; + * * LOAD_LIMIT_NEGATIVE_SOFT_MAX = 3306; + * * LOAD_LIMIT_MIXED_DEMAND_TYPE = 3307; + * * LOAD_LIMIT_MAX_LOAD_NEGATIVE_VALUE = 3308; + * * LOAD_LIMIT_SOFT_MAX_ABOVE_MAX = 3309; + * * INTERVAL_ERROR = 34; + * * INTERVAL_MIN_EXCEEDS_MAX = 3401; + * * INTERVAL_NEGATIVE_MIN = 3402; + * * INTERVAL_NEGATIVE_MAX = 3403; + * * INTERVAL_MIN_EXCEEDS_CAPACITY = 3404; + * * INTERVAL_MAX_EXCEEDS_CAPACITY = 3405; + * * DISTANCE_LIMIT_ERROR = 36; + * * DISTANCE_LIMIT_INVALID_COST_AFTER_SOFT_MAX = 3601; + * * DISTANCE_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3602; + * * DISTANCE_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3603; + * * DISTANCE_LIMIT_NEGATIVE_MAX = 3604; + * * DISTANCE_LIMIT_NEGATIVE_SOFT_MAX = 3605; + * * DISTANCE_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3606; + * * DURATION_LIMIT_ERROR = 38; + * * DURATION_LIMIT_MAX_DURATION_NEGATIVE_OR_NAN = 3800; + * * DURATION_LIMIT_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3801; + * * DURATION_LIMIT_INVALID_COST_PER_HOUR_AFTER_SOFT_MAX = 3802; + * * DURATION_LIMIT_SOFT_MAX_WITHOUT_COST_AFTER_SOFT_MAX = 3803; + * * DURATION_LIMIT_COST_AFTER_SOFT_MAX_WITHOUT_SOFT_MAX = 3804; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_NEGATIVE_OR_NAN = 3805; + * * DURATION_LIMIT_INVALID_COST_AFTER_QUADRATIC_SOFT_MAX = 3806; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_COST_PER_SQUARE_HOUR + * = 3807; + * * DURATION_LIMIT_COST_PER_SQUARE_HOUR_WITHOUT_QUADRATIC_SOFT_MAX + * = 3808; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_WITHOUT_MAX = 3809; + * * DURATION_LIMIT_SOFT_MAX_LARGER_THAN_MAX = 3810; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_LARGER_THAN_MAX = 3811; + * * DURATION_LIMIT_DIFF_BETWEEN_MAX_AND_QUADRATIC_SOFT_MAX_TOO_LARGE + * = 3812; + * * DURATION_LIMIT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3813; + * * DURATION_LIMIT_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION = 3814; + * * DURATION_LIMIT_QUADRATIC_SOFT_MAX_DURATION_EXCEEDS_GLOBAL_DURATION + * = 3815; + * * SHIPMENT_ERROR = 40; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_NEGATIVE_OR_NAN = 4000; + * * SHIPMENT_PD_ABSOLUTE_DETOUR_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4001; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_NEGATIVE_OR_NAN = 4002; + * * SHIPMENT_PD_TIME_LIMIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4003; + * * SHIPMENT_EMPTY_SHIPMENT_TYPE = 4004; + * * SHIPMENT_NO_PICKUP_NO_DELIVERY = 4005; + * * SHIPMENT_INVALID_PENALTY_COST = 4006; + * * SHIPMENT_ALLOWED_VEHICLE_INDEX_OUT_OF_BOUNDS = 4007; + * * SHIPMENT_DUPLICATE_ALLOWED_VEHICLE_INDEX = 4008; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITHOUT_INDEX = 4009; + * * SHIPMENT_INCONSISTENT_COST_FOR_VEHICLE_SIZE_WITH_INDEX = 4010; + * * SHIPMENT_INVALID_COST_FOR_VEHICLE = 4011; + * * SHIPMENT_COST_FOR_VEHICLE_INDEX_OUT_OF_BOUNDS = 4012; + * * SHIPMENT_DUPLICATE_COST_FOR_VEHICLE_INDEX = 4013; + * * SHIPMENT_DETOUR_WITHOUT_PICKUP_AND_DELIVERY = 4014; + * * VEHICLE_ERROR = 42; + * * VEHICLE_EMPTY_REQUIRED_OPERATOR_TYPE = 4200; + * * VEHICLE_DUPLICATE_REQUIRED_OPERATOR_TYPE = 4201; + * * VEHICLE_NO_OPERATOR_WITH_REQUIRED_OPERATOR_TYPE = 4202; + * * VEHICLE_EMPTY_START_TAG = 4203; + * * VEHICLE_DUPLICATE_START_TAG = 4204; + * * VEHICLE_EMPTY_END_TAG = 4205; + * * VEHICLE_DUPLICATE_END_TAG = 4206; + * * VEHICLE_EXTRA_VISIT_DURATION_NEGATIVE_OR_NAN = 4207; + * * VEHICLE_EXTRA_VISIT_DURATION_EXCEEDS_GLOBAL_DURATION = 4208; + * * VEHICLE_EXTRA_VISIT_DURATION_EMPTY_KEY = 4209; + * * VEHICLE_FIRST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4210; + * * VEHICLE_FIRST_SHIPMENT_IGNORED = 4211; + * * VEHICLE_FIRST_SHIPMENT_NOT_BOUND = 4212; + * * VEHICLE_LAST_SHIPMENT_INDEX_OUT_OF_BOUNDS = 4213; + * * VEHICLE_LAST_SHIPMENT_IGNORED = 4214; + * * VEHICLE_LAST_SHIPMENT_NOT_BOUND = 4215; + * * VEHICLE_IGNORED_WITH_USED_IF_ROUTE_IS_EMPTY = 4216; + * * VEHICLE_INVALID_COST_PER_KILOMETER = 4217; + * * VEHICLE_INVALID_COST_PER_HOUR = 4218; + * * VEHICLE_INVALID_COST_PER_TRAVELED_HOUR = 4219; + * * VEHICLE_INVALID_FIXED_COST = 4220; + * * VEHICLE_INVALID_TRAVEL_DURATION_MULTIPLE = 4221; + * * VEHICLE_MINIMUM_DURATION_LONGER_THAN_DURATION_LIMIT = 4222; + * * VISIT_REQUEST_ERROR = 44; + * * VISIT_REQUEST_EMPTY_TAG = 4400; + * * VISIT_REQUEST_DUPLICATE_TAG = 4401; + * * VISIT_REQUEST_DURATION_NEGATIVE_OR_NAN = 4404; + * * VISIT_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4405; + * * PRECEDENCE_ERROR = 46; + * * BREAK_ERROR = 48; + * * BREAK_RULE_EMPTY = 4800; + * * BREAK_REQUEST_UNSPECIFIED_DURATION = 4801; + * * BREAK_REQUEST_UNSPECIFIED_EARLIEST_START_TIME = 4802; + * * BREAK_REQUEST_UNSPECIFIED_LATEST_START_TIME = 4803; + * * BREAK_REQUEST_DURATION_NEGATIVE_OR_NAN = 4804; = 4804; + * * BREAK_REQUEST_LATEST_START_TIME_BEFORE_EARLIEST_START_TIME = 4805; + * * BREAK_REQUEST_EARLIEST_START_TIME_BEFORE_GLOBAL_START_TIME = 4806; + * * BREAK_REQUEST_LATEST_END_TIME_AFTER_GLOBAL_END_TIME = 4807; + * * BREAK_REQUEST_NON_SCHEDULABLE = 4808; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_NEGATIVE_OR_NAN = 4809; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_NEGATIVE_OR_NAN = 4810; + * * BREAK_FREQUENCY_MIN_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION = 4811; + * * BREAK_FREQUENCY_MAX_INTER_BREAK_DURATION_EXCEEDS_GLOBAL_DURATION + * = 4812; + * * BREAK_REQUEST_DURATION_EXCEEDS_GLOBAL_DURATION = 4813; + * * BREAK_FREQUENCY_MISSING_MAX_INTER_BREAK_DURATION = 4814; + * * BREAK_FREQUENCY_MISSING_MIN_BREAK_DURATION = 4815; + * * SHIPMENT_TYPE_INCOMPATIBILITY_ERROR = 50; + * * SHIPMENT_TYPE_INCOMPATIBILITY_EMPTY_TYPE = 5001; + * * SHIPMENT_TYPE_INCOMPATIBILITY_LESS_THAN_TWO_TYPES = 5002; + * * SHIPMENT_TYPE_INCOMPATIBILITY_DUPLICATE_TYPE = 5003; + * * SHIPMENT_TYPE_INCOMPATIBILITY_INVALID_INCOMPATIBILITY_MODE = 5004; + * * SHIPMENT_TYPE_INCOMPATIBILITY_TOO_MANY_INCOMPATIBILITIES = 5005; + * * SHIPMENT_TYPE_REQUIREMENT_ERROR = 52; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE = 52001; + * * SHIPMENT_TYPE_REQUIREMENT_NO_DEPENDENT_TYPE = 52002; + * * SHIPMENT_TYPE_REQUIREMENT_INVALID_REQUIREMENT_MODE = 52003; + * * SHIPMENT_TYPE_REQUIREMENT_TOO_MANY_REQUIREMENTS = 52004; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_REQUIRED_TYPE = 52005; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_REQUIRED_TYPE = 52006; + * * SHIPMENT_TYPE_REQUIREMENT_NO_REQUIRED_TYPE_FOUND = 52007; + * * SHIPMENT_TYPE_REQUIREMENT_EMPTY_DEPENDENT_TYPE = 52008; + * * SHIPMENT_TYPE_REQUIREMENT_DUPLICATE_DEPENDENT_TYPE = 52009; + * * SHIPMENT_TYPE_REQUIREMENT_SELF_DEPENDENT_TYPE = 52010; + * * SHIPMENT_TYPE_REQUIREMENT_GRAPH_HAS_CYCLES = 52011; + * * VEHICLE_OPERATOR_ERROR = 54; + * * VEHICLE_OPERATOR_EMPTY_TYPE = 5400; + * * VEHICLE_OPERATOR_MULTIPLE_START_TIME_WINDOWS = 5401; + * * VEHICLE_OPERATOR_SOFT_START_TIME_WINDOW = 5402; + * * VEHICLE_OPERATOR_MULTIPLE_END_TIME_WINDOWS = 5403; + * * VEHICLE_OPERATOR_SOFT_END_TIME_WINDOW = 5404; + * * DURATION_SECONDS_MATRIX_ERROR = 56; + * * DURATION_SECONDS_MATRIX_DURATION_NEGATIVE_OR_NAN = 5600; + * * DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION = 5601; + * * GRAPH_ARC_ERROR = 58; + * * GRAPH_ARC_DURATION_NEGATIVE_OR_NAN = 5800; + * * GRAPH_ARC_DURATION_EXCEEDS_GLOBAL_DURATION = 5801; + * + * Generated from protobuf field int32 code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkInt32($var); + $this->code = $var; + + return $this; + } + + /** + * The error display name. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The error display name. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * An error context may involve 0, 1 (most of the time) or more fields. For + * example, referring to vehicle #4 and shipment #2's first pickup can be + * done as follows: + * ``` + * fields { name: "vehicles" index: 4} + * fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} } + * ``` + * Note, however, that the cardinality of `fields` should not change for a + * given error code. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference fields = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFields() + { + return $this->fields; + } + + /** + * An error context may involve 0, 1 (most of the time) or more fields. For + * example, referring to vehicle #4 and shipment #2's first pickup can be + * done as follows: + * ``` + * fields { name: "vehicles" index: 4} + * fields { name: "shipments" index: 2 sub_field {name: "pickups" index: 0} } + * ``` + * Note, however, that the cardinality of `fields` should not change for a + * given error code. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference fields = 3; + * @param \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference::class); + $this->fields = $arr; + + return $this; + } + + /** + * Human-readable string describing the error. There is a 1:1 mapping + * between `code` and `error_message` (when code != "UNSPECIFIED"). + * *STABILITY*: Not stable: the error message associated to a given `code` may + * change (hopefully to clarify it) over time. Please rely on the + * `display_name` and `code` instead. + * + * Generated from protobuf field string error_message = 4; + * @return string + */ + public function getErrorMessage() + { + return $this->error_message; + } + + /** + * Human-readable string describing the error. There is a 1:1 mapping + * between `code` and `error_message` (when code != "UNSPECIFIED"). + * *STABILITY*: Not stable: the error message associated to a given `code` may + * change (hopefully to clarify it) over time. Please rely on the + * `display_name` and `code` instead. + * + * Generated from protobuf field string error_message = 4; + * @param string $var + * @return $this + */ + public function setErrorMessage($var) + { + GPBUtil::checkString($var, True); + $this->error_message = $var; + + return $this; + } + + /** + * May contain the value(s) of the field(s). This is not always available. You + * should absolutely not rely on it and use it only for manual model + * debugging. + * + * Generated from protobuf field string offending_values = 5; + * @return string + */ + public function getOffendingValues() + { + return $this->offending_values; + } + + /** + * May contain the value(s) of the field(s). This is not always available. You + * should absolutely not rely on it and use it only for manual model + * debugging. + * + * Generated from protobuf field string offending_values = 5; + * @param string $var + * @return $this + */ + public function setOffendingValues($var) + { + GPBUtil::checkString($var, True); + $this->offending_values = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/OptimizeToursValidationError/FieldReference.php b/Optimization/src/V1/OptimizeToursValidationError/FieldReference.php new file mode 100644 index 000000000000..52b93165f70c --- /dev/null +++ b/Optimization/src/V1/OptimizeToursValidationError/FieldReference.php @@ -0,0 +1,195 @@ +google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference + */ +class FieldReference extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the field, e.g., "vehicles". + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * Recursively nested sub-field, if needed. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference sub_field = 3; + */ + private $sub_field = null; + protected $index_or_key; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the field, e.g., "vehicles". + * @type int $index + * Index of the field if repeated. + * @type string $key + * Key if the field is a map. + * @type \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference $sub_field + * Recursively nested sub-field, if needed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Name of the field, e.g., "vehicles". + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the field, e.g., "vehicles". + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Index of the field if repeated. + * + * Generated from protobuf field int32 index = 2; + * @return int + */ + public function getIndex() + { + return $this->readOneof(2); + } + + public function hasIndex() + { + return $this->hasOneof(2); + } + + /** + * Index of the field if repeated. + * + * Generated from protobuf field int32 index = 2; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Key if the field is a map. + * + * Generated from protobuf field string key = 4; + * @return string + */ + public function getKey() + { + return $this->readOneof(4); + } + + public function hasKey() + { + return $this->hasOneof(4); + } + + /** + * Key if the field is a map. + * + * Generated from protobuf field string key = 4; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Recursively nested sub-field, if needed. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference sub_field = 3; + * @return \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference|null + */ + public function getSubField() + { + return $this->sub_field; + } + + public function hasSubField() + { + return isset($this->sub_field); + } + + public function clearSubField() + { + unset($this->sub_field); + } + + /** + * Recursively nested sub-field, if needed. + * + * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference sub_field = 3; + * @param \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference $var + * @return $this + */ + public function setSubField($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\OptimizeToursValidationError\FieldReference::class); + $this->sub_field = $var; + + return $this; + } + + /** + * @return string + */ + public function getIndexOrKey() + { + return $this->whichOneof("index_or_key"); + } + +} + + diff --git a/Optimization/src/V1/OutputConfig.php b/Optimization/src/V1/OutputConfig.php new file mode 100644 index 000000000000..1f1f07a5106a --- /dev/null +++ b/Optimization/src/V1/OutputConfig.php @@ -0,0 +1,109 @@ +google.cloud.optimization.v1.OutputConfig + */ +class OutputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The output data format that used to store the results in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + */ + private $data_format = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\GcsDestination $gcs_destination + * The Google Cloud Storage location to write the output to. + * @type int $data_format + * The output data format that used to store the results in Cloud Storage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\AsyncModel::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location to write the output to. + * + * Generated from protobuf field .google.cloud.optimization.v1.GcsDestination gcs_destination = 1; + * @return \Google\Cloud\Optimization\V1\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(1); + } + + public function hasGcsDestination() + { + return $this->hasOneof(1); + } + + /** + * The Google Cloud Storage location to write the output to. + * + * Generated from protobuf field .google.cloud.optimization.v1.GcsDestination gcs_destination = 1; + * @param \Google\Cloud\Optimization\V1\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\GcsDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The output data format that used to store the results in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + * @return int + */ + public function getDataFormat() + { + return $this->data_format; + } + + /** + * The output data format that used to store the results in Cloud Storage. + * + * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; + * @param int $var + * @return $this + */ + public function setDataFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\DataFormat::class); + $this->data_format = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/Optimization/src/V1/Shipment.php b/Optimization/src/V1/Shipment.php new file mode 100644 index 000000000000..808028a76ce1 --- /dev/null +++ b/Optimization/src/V1/Shipment.php @@ -0,0 +1,838 @@ +google.cloud.optimization.v1.Shipment + */ +class Shipment extends \Google\Protobuf\Internal\Message +{ + /** + * Set of pickup alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the deliveries. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1; + */ + private $pickups; + /** + * Set of delivery alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the pickups. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2; + */ + private $deliveries; + /** + * Load demands of the shipment (for example weight, volume, number of + * pallets etc). The keys in the map should be identifiers describing the type + * of the corresponding load, ideally also including the units. + * For example: "weight_kg", "volume_gallons", "pallet_count", etc. + * If a given key does not appear in the map, the corresponding load is + * considered as null. + * + * Generated from protobuf field map load_demands = 14; + */ + private $load_demands; + /** + * If the shipment is not completed, this penalty is added to the overall + * cost of the routes. A shipment is considered completed if one of its pickup + * and delivery alternatives is visited. The cost may be expressed in the + * same unit used for all other cost-related fields in the model and must be + * positive. + * *IMPORTANT*: If this penalty is not specified, it is considered infinite, + * i.e. the shipment must be completed. + * + * Generated from protobuf field optional double penalty_cost = 4; + */ + private $penalty_cost = null; + /** + * The set of vehicles that may perform this shipment. If empty, all vehicles + * may perform it. Vehicles are given by their index in the `ShipmentModel`'s + * `vehicles` list. + * + * Generated from protobuf field repeated int32 allowed_vehicle_indices = 5; + */ + private $allowed_vehicle_indices; + /** + * Specifies the cost that is incurred when this shipment is delivered by each + * vehicle. If specified, it must have EITHER: + * * the same number of elements as `costs_per_vehicle_indices`. + * `costs_per_vehicle[i]` corresponds to vehicle + * `costs_per_vehicle_indices[i]` of the model. + * * the same number of elements as there are vehicles in the model. The + * i-th element corresponds to vehicle #i of the model. + * These costs must be in the same unit as `penalty_cost` and must not be + * negative. Leave this field empty, if there are no such costs. + * + * Generated from protobuf field repeated double costs_per_vehicle = 6; + */ + private $costs_per_vehicle; + /** + * Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty, + * it must have the same number of elements as `costs_per_vehicle`. A vehicle + * index may not be specified more than once. If a vehicle is excluded from + * `costs_per_vehicle_indices`, its cost is zero. + * + * Generated from protobuf field repeated int32 costs_per_vehicle_indices = 7; + */ + private $costs_per_vehicle_indices; + /** + * Specifies the maximum relative detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_relative_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field optional double pickup_to_delivery_relative_detour_limit = 8; + */ + private $pickup_to_delivery_relative_detour_limit = null; + /** + * Specifies the maximum absolute detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_absolute_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * t + pickup_to_delivery_absolute_detour_limit + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9; + */ + private $pickup_to_delivery_absolute_detour_limit = null; + /** + * Specifies the maximum duration from start of pickup to start of delivery of + * a shipment. If specified, it must be nonnegative, and the shipment must + * contain at least a pickup and a delivery. This does not depend on which + * alternatives are selected for pickup and delivery, nor on vehicle speed. + * This can be specified alongside maximum detour constraints: the solution + * will respect both specifications. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_time_limit = 10; + */ + private $pickup_to_delivery_time_limit = null; + /** + * Non-empty string specifying a "type" for this shipment. + * This feature can be used to define incompatibilities or requirements + * between `shipment_types` (see `shipment_type_incompatibilities` and + * `shipment_type_requirements` in `ShipmentModel`). + * Differs from `visit_types` which is specified for a single visit: All + * pickup/deliveries belonging to the same shipment share the same + * `shipment_type`. + * + * Generated from protobuf field string shipment_type = 11; + */ + private $shipment_type = ''; + /** + * Specifies a label for this shipment. This label is reported in the response + * in the `shipment_label` of the corresponding [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 12; + */ + private $label = ''; + /** + * If true, skip this shipment, but don't apply a `penalty_cost`. + * Ignoring a shipment results in a validation error when there are any + * `shipment_type_requirements` in the model. + * Ignoring a shipment that is performed in `injected_first_solution_routes` + * or `injected_solution_constraint` is permitted; the solver removes the + * related pickup/delivery visits from the performing route. + * `precedence_rules` that reference ignored shipments will also be ignored. + * + * Generated from protobuf field bool ignore = 13; + */ + private $ignore = false; + /** + * Deprecated: Use [Shipment.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true]; + * @deprecated + */ + private $demands; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\Shipment\VisitRequest[]|\Google\Protobuf\Internal\RepeatedField $pickups + * Set of pickup alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the deliveries. + * @type \Google\Cloud\Optimization\V1\Shipment\VisitRequest[]|\Google\Protobuf\Internal\RepeatedField $deliveries + * Set of delivery alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the pickups. + * @type array|\Google\Protobuf\Internal\MapField $load_demands + * Load demands of the shipment (for example weight, volume, number of + * pallets etc). The keys in the map should be identifiers describing the type + * of the corresponding load, ideally also including the units. + * For example: "weight_kg", "volume_gallons", "pallet_count", etc. + * If a given key does not appear in the map, the corresponding load is + * considered as null. + * @type float $penalty_cost + * If the shipment is not completed, this penalty is added to the overall + * cost of the routes. A shipment is considered completed if one of its pickup + * and delivery alternatives is visited. The cost may be expressed in the + * same unit used for all other cost-related fields in the model and must be + * positive. + * *IMPORTANT*: If this penalty is not specified, it is considered infinite, + * i.e. the shipment must be completed. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $allowed_vehicle_indices + * The set of vehicles that may perform this shipment. If empty, all vehicles + * may perform it. Vehicles are given by their index in the `ShipmentModel`'s + * `vehicles` list. + * @type float[]|\Google\Protobuf\Internal\RepeatedField $costs_per_vehicle + * Specifies the cost that is incurred when this shipment is delivered by each + * vehicle. If specified, it must have EITHER: + * * the same number of elements as `costs_per_vehicle_indices`. + * `costs_per_vehicle[i]` corresponds to vehicle + * `costs_per_vehicle_indices[i]` of the model. + * * the same number of elements as there are vehicles in the model. The + * i-th element corresponds to vehicle #i of the model. + * These costs must be in the same unit as `penalty_cost` and must not be + * negative. Leave this field empty, if there are no such costs. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $costs_per_vehicle_indices + * Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty, + * it must have the same number of elements as `costs_per_vehicle`. A vehicle + * index may not be specified more than once. If a vehicle is excluded from + * `costs_per_vehicle_indices`, its cost is zero. + * @type float $pickup_to_delivery_relative_detour_limit + * Specifies the maximum relative detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_relative_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * @type \Google\Protobuf\Duration $pickup_to_delivery_absolute_detour_limit + * Specifies the maximum absolute detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_absolute_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * t + pickup_to_delivery_absolute_detour_limit + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * @type \Google\Protobuf\Duration $pickup_to_delivery_time_limit + * Specifies the maximum duration from start of pickup to start of delivery of + * a shipment. If specified, it must be nonnegative, and the shipment must + * contain at least a pickup and a delivery. This does not depend on which + * alternatives are selected for pickup and delivery, nor on vehicle speed. + * This can be specified alongside maximum detour constraints: the solution + * will respect both specifications. + * @type string $shipment_type + * Non-empty string specifying a "type" for this shipment. + * This feature can be used to define incompatibilities or requirements + * between `shipment_types` (see `shipment_type_incompatibilities` and + * `shipment_type_requirements` in `ShipmentModel`). + * Differs from `visit_types` which is specified for a single visit: All + * pickup/deliveries belonging to the same shipment share the same + * `shipment_type`. + * @type string $label + * Specifies a label for this shipment. This label is reported in the response + * in the `shipment_label` of the corresponding [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * @type bool $ignore + * If true, skip this shipment, but don't apply a `penalty_cost`. + * Ignoring a shipment results in a validation error when there are any + * `shipment_type_requirements` in the model. + * Ignoring a shipment that is performed in `injected_first_solution_routes` + * or `injected_solution_constraint` is permitted; the solver removes the + * related pickup/delivery visits from the performing route. + * `precedence_rules` that reference ignored shipments will also be ignored. + * @type \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $demands + * Deprecated: Use [Shipment.load_demands][] instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Set of pickup alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the deliveries. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPickups() + { + return $this->pickups; + } + + /** + * Set of pickup alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the deliveries. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1; + * @param \Google\Cloud\Optimization\V1\Shipment\VisitRequest[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPickups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\VisitRequest::class); + $this->pickups = $arr; + + return $this; + } + + /** + * Set of delivery alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the pickups. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeliveries() + { + return $this->deliveries; + } + + /** + * Set of delivery alternatives associated to the shipment. If not specified, + * the vehicle only needs to visit a location corresponding to the pickups. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2; + * @param \Google\Cloud\Optimization\V1\Shipment\VisitRequest[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeliveries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\VisitRequest::class); + $this->deliveries = $arr; + + return $this; + } + + /** + * Load demands of the shipment (for example weight, volume, number of + * pallets etc). The keys in the map should be identifiers describing the type + * of the corresponding load, ideally also including the units. + * For example: "weight_kg", "volume_gallons", "pallet_count", etc. + * If a given key does not appear in the map, the corresponding load is + * considered as null. + * + * Generated from protobuf field map load_demands = 14; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLoadDemands() + { + return $this->load_demands; + } + + /** + * Load demands of the shipment (for example weight, volume, number of + * pallets etc). The keys in the map should be identifiers describing the type + * of the corresponding load, ideally also including the units. + * For example: "weight_kg", "volume_gallons", "pallet_count", etc. + * If a given key does not appear in the map, the corresponding load is + * considered as null. + * + * Generated from protobuf field map load_demands = 14; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLoadDemands($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\Load::class); + $this->load_demands = $arr; + + return $this; + } + + /** + * If the shipment is not completed, this penalty is added to the overall + * cost of the routes. A shipment is considered completed if one of its pickup + * and delivery alternatives is visited. The cost may be expressed in the + * same unit used for all other cost-related fields in the model and must be + * positive. + * *IMPORTANT*: If this penalty is not specified, it is considered infinite, + * i.e. the shipment must be completed. + * + * Generated from protobuf field optional double penalty_cost = 4; + * @return float + */ + public function getPenaltyCost() + { + return isset($this->penalty_cost) ? $this->penalty_cost : 0.0; + } + + public function hasPenaltyCost() + { + return isset($this->penalty_cost); + } + + public function clearPenaltyCost() + { + unset($this->penalty_cost); + } + + /** + * If the shipment is not completed, this penalty is added to the overall + * cost of the routes. A shipment is considered completed if one of its pickup + * and delivery alternatives is visited. The cost may be expressed in the + * same unit used for all other cost-related fields in the model and must be + * positive. + * *IMPORTANT*: If this penalty is not specified, it is considered infinite, + * i.e. the shipment must be completed. + * + * Generated from protobuf field optional double penalty_cost = 4; + * @param float $var + * @return $this + */ + public function setPenaltyCost($var) + { + GPBUtil::checkDouble($var); + $this->penalty_cost = $var; + + return $this; + } + + /** + * The set of vehicles that may perform this shipment. If empty, all vehicles + * may perform it. Vehicles are given by their index in the `ShipmentModel`'s + * `vehicles` list. + * + * Generated from protobuf field repeated int32 allowed_vehicle_indices = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowedVehicleIndices() + { + return $this->allowed_vehicle_indices; + } + + /** + * The set of vehicles that may perform this shipment. If empty, all vehicles + * may perform it. Vehicles are given by their index in the `ShipmentModel`'s + * `vehicles` list. + * + * Generated from protobuf field repeated int32 allowed_vehicle_indices = 5; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowedVehicleIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->allowed_vehicle_indices = $arr; + + return $this; + } + + /** + * Specifies the cost that is incurred when this shipment is delivered by each + * vehicle. If specified, it must have EITHER: + * * the same number of elements as `costs_per_vehicle_indices`. + * `costs_per_vehicle[i]` corresponds to vehicle + * `costs_per_vehicle_indices[i]` of the model. + * * the same number of elements as there are vehicles in the model. The + * i-th element corresponds to vehicle #i of the model. + * These costs must be in the same unit as `penalty_cost` and must not be + * negative. Leave this field empty, if there are no such costs. + * + * Generated from protobuf field repeated double costs_per_vehicle = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCostsPerVehicle() + { + return $this->costs_per_vehicle; + } + + /** + * Specifies the cost that is incurred when this shipment is delivered by each + * vehicle. If specified, it must have EITHER: + * * the same number of elements as `costs_per_vehicle_indices`. + * `costs_per_vehicle[i]` corresponds to vehicle + * `costs_per_vehicle_indices[i]` of the model. + * * the same number of elements as there are vehicles in the model. The + * i-th element corresponds to vehicle #i of the model. + * These costs must be in the same unit as `penalty_cost` and must not be + * negative. Leave this field empty, if there are no such costs. + * + * Generated from protobuf field repeated double costs_per_vehicle = 6; + * @param float[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCostsPerVehicle($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->costs_per_vehicle = $arr; + + return $this; + } + + /** + * Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty, + * it must have the same number of elements as `costs_per_vehicle`. A vehicle + * index may not be specified more than once. If a vehicle is excluded from + * `costs_per_vehicle_indices`, its cost is zero. + * + * Generated from protobuf field repeated int32 costs_per_vehicle_indices = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCostsPerVehicleIndices() + { + return $this->costs_per_vehicle_indices; + } + + /** + * Indices of the vehicles to which `costs_per_vehicle` applies. If non-empty, + * it must have the same number of elements as `costs_per_vehicle`. A vehicle + * index may not be specified more than once. If a vehicle is excluded from + * `costs_per_vehicle_indices`, its cost is zero. + * + * Generated from protobuf field repeated int32 costs_per_vehicle_indices = 7; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCostsPerVehicleIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->costs_per_vehicle_indices = $arr; + + return $this; + } + + /** + * Specifies the maximum relative detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_relative_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field optional double pickup_to_delivery_relative_detour_limit = 8; + * @return float + */ + public function getPickupToDeliveryRelativeDetourLimit() + { + return isset($this->pickup_to_delivery_relative_detour_limit) ? $this->pickup_to_delivery_relative_detour_limit : 0.0; + } + + public function hasPickupToDeliveryRelativeDetourLimit() + { + return isset($this->pickup_to_delivery_relative_detour_limit); + } + + public function clearPickupToDeliveryRelativeDetourLimit() + { + unset($this->pickup_to_delivery_relative_detour_limit); + } + + /** + * Specifies the maximum relative detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_relative_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field optional double pickup_to_delivery_relative_detour_limit = 8; + * @param float $var + * @return $this + */ + public function setPickupToDeliveryRelativeDetourLimit($var) + { + GPBUtil::checkDouble($var); + $this->pickup_to_delivery_relative_detour_limit = $var; + + return $this; + } + + /** + * Specifies the maximum absolute detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_absolute_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * t + pickup_to_delivery_absolute_detour_limit + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9; + * @return \Google\Protobuf\Duration|null + */ + public function getPickupToDeliveryAbsoluteDetourLimit() + { + return $this->pickup_to_delivery_absolute_detour_limit; + } + + public function hasPickupToDeliveryAbsoluteDetourLimit() + { + return isset($this->pickup_to_delivery_absolute_detour_limit); + } + + public function clearPickupToDeliveryAbsoluteDetourLimit() + { + unset($this->pickup_to_delivery_absolute_detour_limit); + } + + /** + * Specifies the maximum absolute detour time compared to the shortest path + * from pickup to delivery. If specified, it must be nonnegative, and the + * shipment must contain at least a pickup and a delivery. + * For example, let t be the shortest time taken to go from the selected + * pickup alternative directly to the selected delivery alternative. Then + * setting `pickup_to_delivery_absolute_detour_limit` enforces: + * ``` + * start_time(delivery) - start_time(pickup) <= + * t + pickup_to_delivery_absolute_detour_limit + * ``` + * If both relative and absolute limits are specified on the same shipment, + * the more constraining limit is used for each possible pickup/delivery pair. + * As of 2017/10, detours are only supported when travel durations do not + * depend on vehicles. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setPickupToDeliveryAbsoluteDetourLimit($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->pickup_to_delivery_absolute_detour_limit = $var; + + return $this; + } + + /** + * Specifies the maximum duration from start of pickup to start of delivery of + * a shipment. If specified, it must be nonnegative, and the shipment must + * contain at least a pickup and a delivery. This does not depend on which + * alternatives are selected for pickup and delivery, nor on vehicle speed. + * This can be specified alongside maximum detour constraints: the solution + * will respect both specifications. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_time_limit = 10; + * @return \Google\Protobuf\Duration|null + */ + public function getPickupToDeliveryTimeLimit() + { + return $this->pickup_to_delivery_time_limit; + } + + public function hasPickupToDeliveryTimeLimit() + { + return isset($this->pickup_to_delivery_time_limit); + } + + public function clearPickupToDeliveryTimeLimit() + { + unset($this->pickup_to_delivery_time_limit); + } + + /** + * Specifies the maximum duration from start of pickup to start of delivery of + * a shipment. If specified, it must be nonnegative, and the shipment must + * contain at least a pickup and a delivery. This does not depend on which + * alternatives are selected for pickup and delivery, nor on vehicle speed. + * This can be specified alongside maximum detour constraints: the solution + * will respect both specifications. + * + * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_time_limit = 10; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setPickupToDeliveryTimeLimit($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->pickup_to_delivery_time_limit = $var; + + return $this; + } + + /** + * Non-empty string specifying a "type" for this shipment. + * This feature can be used to define incompatibilities or requirements + * between `shipment_types` (see `shipment_type_incompatibilities` and + * `shipment_type_requirements` in `ShipmentModel`). + * Differs from `visit_types` which is specified for a single visit: All + * pickup/deliveries belonging to the same shipment share the same + * `shipment_type`. + * + * Generated from protobuf field string shipment_type = 11; + * @return string + */ + public function getShipmentType() + { + return $this->shipment_type; + } + + /** + * Non-empty string specifying a "type" for this shipment. + * This feature can be used to define incompatibilities or requirements + * between `shipment_types` (see `shipment_type_incompatibilities` and + * `shipment_type_requirements` in `ShipmentModel`). + * Differs from `visit_types` which is specified for a single visit: All + * pickup/deliveries belonging to the same shipment share the same + * `shipment_type`. + * + * Generated from protobuf field string shipment_type = 11; + * @param string $var + * @return $this + */ + public function setShipmentType($var) + { + GPBUtil::checkString($var, True); + $this->shipment_type = $var; + + return $this; + } + + /** + * Specifies a label for this shipment. This label is reported in the response + * in the `shipment_label` of the corresponding [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 12; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Specifies a label for this shipment. This label is reported in the response + * in the `shipment_label` of the corresponding [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 12; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * If true, skip this shipment, but don't apply a `penalty_cost`. + * Ignoring a shipment results in a validation error when there are any + * `shipment_type_requirements` in the model. + * Ignoring a shipment that is performed in `injected_first_solution_routes` + * or `injected_solution_constraint` is permitted; the solver removes the + * related pickup/delivery visits from the performing route. + * `precedence_rules` that reference ignored shipments will also be ignored. + * + * Generated from protobuf field bool ignore = 13; + * @return bool + */ + public function getIgnore() + { + return $this->ignore; + } + + /** + * If true, skip this shipment, but don't apply a `penalty_cost`. + * Ignoring a shipment results in a validation error when there are any + * `shipment_type_requirements` in the model. + * Ignoring a shipment that is performed in `injected_first_solution_routes` + * or `injected_solution_constraint` is permitted; the solver removes the + * related pickup/delivery visits from the performing route. + * `precedence_rules` that reference ignored shipments will also be ignored. + * + * Generated from protobuf field bool ignore = 13; + * @param bool $var + * @return $this + */ + public function setIgnore($var) + { + GPBUtil::checkBool($var); + $this->ignore = $var; + + return $this; + } + + /** + * Deprecated: Use [Shipment.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getDemands() + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + return $this->demands; + } + + /** + * Deprecated: Use [Shipment.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setDemands($var) + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->demands = $arr; + + return $this; + } + +} + diff --git a/Optimization/src/V1/Shipment/Load.php b/Optimization/src/V1/Shipment/Load.php new file mode 100644 index 000000000000..3c96c5d3e625 --- /dev/null +++ b/Optimization/src/V1/Shipment/Load.php @@ -0,0 +1,78 @@ +google.cloud.optimization.v1.Shipment.Load + */ +class Load extends \Google\Protobuf\Internal\Message +{ + /** + * The amount by which the load of the vehicle performing the corresponding + * visit will vary. Since it is an integer, users are advised to choose an + * appropriate unit to avoid loss of precision. Must be ≥ 0. + * + * Generated from protobuf field int64 amount = 2; + */ + private $amount = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $amount + * The amount by which the load of the vehicle performing the corresponding + * visit will vary. Since it is an integer, users are advised to choose an + * appropriate unit to avoid loss of precision. Must be ≥ 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The amount by which the load of the vehicle performing the corresponding + * visit will vary. Since it is an integer, users are advised to choose an + * appropriate unit to avoid loss of precision. Must be ≥ 0. + * + * Generated from protobuf field int64 amount = 2; + * @return int|string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * The amount by which the load of the vehicle performing the corresponding + * visit will vary. Since it is an integer, users are advised to choose an + * appropriate unit to avoid loss of precision. Must be ≥ 0. + * + * Generated from protobuf field int64 amount = 2; + * @param int|string $var + * @return $this + */ + public function setAmount($var) + { + GPBUtil::checkInt64($var); + $this->amount = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/Shipment/VisitRequest.php b/Optimization/src/V1/Shipment/VisitRequest.php new file mode 100644 index 000000000000..5a8df92cd002 --- /dev/null +++ b/Optimization/src/V1/Shipment/VisitRequest.php @@ -0,0 +1,636 @@ +google.cloud.optimization.v1.Shipment.VisitRequest + */ +class VisitRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The geo-location where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng arrival_location = 1; + */ + private $arrival_location = null; + /** + * The waypoint where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint arrival_waypoint = 2; + */ + private $arrival_waypoint = null; + /** + * The geo-location where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. + * If the shipment model has duration distance matrices, + * `departure_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng departure_location = 3; + */ + private $departure_location = null; + /** + * The waypoint where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. + * If the shipment model has duration distance matrices, + * `departure_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint departure_waypoint = 4; + */ + private $departure_waypoint = null; + /** + * Specifies tags attached to the visit request. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string tags = 5; + */ + private $tags; + /** + * Time windows which constrain the arrival time at a visit. + * Note that a vehicle may depart outside of the arrival time window, i.e. + * arrival time + duration do not need to be inside a time window. This can + * result in waiting time if the vehicle arrives before + * [TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time]. + * The absence of `TimeWindow` means that the vehicle can perform this visit + * at any time. + * Time windows must be disjoint, i.e. no time window must overlap with or + * be adjacent to another, and they must be in increasing order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only + * be set if there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow time_windows = 6; + */ + private $time_windows; + /** + * Duration of the visit, i.e. time spent by the vehicle between arrival + * and departure (to be added to the possible waiting time; see + * `time_windows`). + * + * Generated from protobuf field .google.protobuf.Duration duration = 7; + */ + private $duration = null; + /** + * Cost to service this visit request on a vehicle route. This can be used + * to pay different costs for each alternative pickup or delivery of a + * shipment. This cost must be in the same unit as `Shipment.penalty_cost` + * and must not be negative. + * + * Generated from protobuf field double cost = 8; + */ + private $cost = 0.0; + /** + * Load demands of this visit request. This is just like + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] field, except that it only applies to this + * [VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest] instead of the whole [Shipment][google.cloud.optimization.v1.Shipment]. + * The demands listed here are added to the demands listed in + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]. + * + * Generated from protobuf field map load_demands = 12; + */ + private $load_demands; + /** + * Specifies the types of the visit. This may be used to allocate additional + * time required for a vehicle to complete this visit (see + * [Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]). + * A type can only appear once. + * + * Generated from protobuf field repeated string visit_types = 10; + */ + private $visit_types; + /** + * Specifies a label for this `VisitRequest`. This label is reported in the + * response as `visit_label` in the corresponding [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 11; + */ + private $label = ''; + /** + * Deprecated: Use [VisitRequest.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 9 [deprecated = true]; + * @deprecated + */ + private $demands; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\LatLng $arrival_location + * The geo-location where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_location` must not be specified. + * @type \Google\Cloud\Optimization\V1\Waypoint $arrival_waypoint + * The waypoint where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_waypoint` must not be specified. + * @type \Google\Type\LatLng $departure_location + * The geo-location where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. + * If the shipment model has duration distance matrices, + * `departure_location` must not be specified. + * @type \Google\Cloud\Optimization\V1\Waypoint $departure_waypoint + * The waypoint where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. + * If the shipment model has duration distance matrices, + * `departure_waypoint` must not be specified. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $tags + * Specifies tags attached to the visit request. + * Empty or duplicate strings are not allowed. + * @type \Google\Cloud\Optimization\V1\TimeWindow[]|\Google\Protobuf\Internal\RepeatedField $time_windows + * Time windows which constrain the arrival time at a visit. + * Note that a vehicle may depart outside of the arrival time window, i.e. + * arrival time + duration do not need to be inside a time window. This can + * result in waiting time if the vehicle arrives before + * [TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time]. + * The absence of `TimeWindow` means that the vehicle can perform this visit + * at any time. + * Time windows must be disjoint, i.e. no time window must overlap with or + * be adjacent to another, and they must be in increasing order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only + * be set if there is a single time window. + * @type \Google\Protobuf\Duration $duration + * Duration of the visit, i.e. time spent by the vehicle between arrival + * and departure (to be added to the possible waiting time; see + * `time_windows`). + * @type float $cost + * Cost to service this visit request on a vehicle route. This can be used + * to pay different costs for each alternative pickup or delivery of a + * shipment. This cost must be in the same unit as `Shipment.penalty_cost` + * and must not be negative. + * @type array|\Google\Protobuf\Internal\MapField $load_demands + * Load demands of this visit request. This is just like + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] field, except that it only applies to this + * [VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest] instead of the whole [Shipment][google.cloud.optimization.v1.Shipment]. + * The demands listed here are added to the demands listed in + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $visit_types + * Specifies the types of the visit. This may be used to allocate additional + * time required for a vehicle to complete this visit (see + * [Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]). + * A type can only appear once. + * @type string $label + * Specifies a label for this `VisitRequest`. This label is reported in the + * response as `visit_label` in the corresponding [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * @type \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $demands + * Deprecated: Use [VisitRequest.load_demands][] instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The geo-location where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng arrival_location = 1; + * @return \Google\Type\LatLng|null + */ + public function getArrivalLocation() + { + return $this->arrival_location; + } + + public function hasArrivalLocation() + { + return isset($this->arrival_location); + } + + public function clearArrivalLocation() + { + unset($this->arrival_location); + } + + /** + * The geo-location where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng arrival_location = 1; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setArrivalLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->arrival_location = $var; + + return $this; + } + + /** + * The waypoint where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint arrival_waypoint = 2; + * @return \Google\Cloud\Optimization\V1\Waypoint|null + */ + public function getArrivalWaypoint() + { + return $this->arrival_waypoint; + } + + public function hasArrivalWaypoint() + { + return isset($this->arrival_waypoint); + } + + public function clearArrivalWaypoint() + { + unset($this->arrival_waypoint); + } + + /** + * The waypoint where the vehicle arrives when performing this + * `VisitRequest`. If the shipment model has duration distance matrices, + * `arrival_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint arrival_waypoint = 2; + * @param \Google\Cloud\Optimization\V1\Waypoint $var + * @return $this + */ + public function setArrivalWaypoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Waypoint::class); + $this->arrival_waypoint = $var; + + return $this; + } + + /** + * The geo-location where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. + * If the shipment model has duration distance matrices, + * `departure_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng departure_location = 3; + * @return \Google\Type\LatLng|null + */ + public function getDepartureLocation() + { + return $this->departure_location; + } + + public function hasDepartureLocation() + { + return isset($this->departure_location); + } + + public function clearDepartureLocation() + { + unset($this->departure_location); + } + + /** + * The geo-location where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. + * If the shipment model has duration distance matrices, + * `departure_location` must not be specified. + * + * Generated from protobuf field .google.type.LatLng departure_location = 3; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setDepartureLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->departure_location = $var; + + return $this; + } + + /** + * The waypoint where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. + * If the shipment model has duration distance matrices, + * `departure_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint departure_waypoint = 4; + * @return \Google\Cloud\Optimization\V1\Waypoint|null + */ + public function getDepartureWaypoint() + { + return $this->departure_waypoint; + } + + public function hasDepartureWaypoint() + { + return isset($this->departure_waypoint); + } + + public function clearDepartureWaypoint() + { + unset($this->departure_waypoint); + } + + /** + * The waypoint where the vehicle departs after completing this + * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. + * If the shipment model has duration distance matrices, + * `departure_waypoint` must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint departure_waypoint = 4; + * @param \Google\Cloud\Optimization\V1\Waypoint $var + * @return $this + */ + public function setDepartureWaypoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Waypoint::class); + $this->departure_waypoint = $var; + + return $this; + } + + /** + * Specifies tags attached to the visit request. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string tags = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Specifies tags attached to the visit request. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string tags = 5; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Time windows which constrain the arrival time at a visit. + * Note that a vehicle may depart outside of the arrival time window, i.e. + * arrival time + duration do not need to be inside a time window. This can + * result in waiting time if the vehicle arrives before + * [TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time]. + * The absence of `TimeWindow` means that the vehicle can perform this visit + * at any time. + * Time windows must be disjoint, i.e. no time window must overlap with or + * be adjacent to another, and they must be in increasing order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only + * be set if there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow time_windows = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimeWindows() + { + return $this->time_windows; + } + + /** + * Time windows which constrain the arrival time at a visit. + * Note that a vehicle may depart outside of the arrival time window, i.e. + * arrival time + duration do not need to be inside a time window. This can + * result in waiting time if the vehicle arrives before + * [TimeWindow.start_time][google.cloud.optimization.v1.TimeWindow.start_time]. + * The absence of `TimeWindow` means that the vehicle can perform this visit + * at any time. + * Time windows must be disjoint, i.e. no time window must overlap with or + * be adjacent to another, and they must be in increasing order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only + * be set if there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow time_windows = 6; + * @param \Google\Cloud\Optimization\V1\TimeWindow[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimeWindows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\TimeWindow::class); + $this->time_windows = $arr; + + return $this; + } + + /** + * Duration of the visit, i.e. time spent by the vehicle between arrival + * and departure (to be added to the possible waiting time; see + * `time_windows`). + * + * Generated from protobuf field .google.protobuf.Duration duration = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of the visit, i.e. time spent by the vehicle between arrival + * and departure (to be added to the possible waiting time; see + * `time_windows`). + * + * Generated from protobuf field .google.protobuf.Duration duration = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * Cost to service this visit request on a vehicle route. This can be used + * to pay different costs for each alternative pickup or delivery of a + * shipment. This cost must be in the same unit as `Shipment.penalty_cost` + * and must not be negative. + * + * Generated from protobuf field double cost = 8; + * @return float + */ + public function getCost() + { + return $this->cost; + } + + /** + * Cost to service this visit request on a vehicle route. This can be used + * to pay different costs for each alternative pickup or delivery of a + * shipment. This cost must be in the same unit as `Shipment.penalty_cost` + * and must not be negative. + * + * Generated from protobuf field double cost = 8; + * @param float $var + * @return $this + */ + public function setCost($var) + { + GPBUtil::checkDouble($var); + $this->cost = $var; + + return $this; + } + + /** + * Load demands of this visit request. This is just like + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] field, except that it only applies to this + * [VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest] instead of the whole [Shipment][google.cloud.optimization.v1.Shipment]. + * The demands listed here are added to the demands listed in + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]. + * + * Generated from protobuf field map load_demands = 12; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLoadDemands() + { + return $this->load_demands; + } + + /** + * Load demands of this visit request. This is just like + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] field, except that it only applies to this + * [VisitRequest][google.cloud.optimization.v1.Shipment.VisitRequest] instead of the whole [Shipment][google.cloud.optimization.v1.Shipment]. + * The demands listed here are added to the demands listed in + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands]. + * + * Generated from protobuf field map load_demands = 12; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLoadDemands($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\Load::class); + $this->load_demands = $arr; + + return $this; + } + + /** + * Specifies the types of the visit. This may be used to allocate additional + * time required for a vehicle to complete this visit (see + * [Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]). + * A type can only appear once. + * + * Generated from protobuf field repeated string visit_types = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVisitTypes() + { + return $this->visit_types; + } + + /** + * Specifies the types of the visit. This may be used to allocate additional + * time required for a vehicle to complete this visit (see + * [Vehicle.extra_visit_duration_for_visit_type][google.cloud.optimization.v1.Vehicle.extra_visit_duration_for_visit_type]). + * A type can only appear once. + * + * Generated from protobuf field repeated string visit_types = 10; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVisitTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->visit_types = $arr; + + return $this; + } + + /** + * Specifies a label for this `VisitRequest`. This label is reported in the + * response as `visit_label` in the corresponding [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 11; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Specifies a label for this `VisitRequest`. This label is reported in the + * response as `visit_label` in the corresponding [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit]. + * + * Generated from protobuf field string label = 11; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * Deprecated: Use [VisitRequest.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 9 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getDemands() + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + return $this->demands; + } + + /** + * Deprecated: Use [VisitRequest.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 9 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setDemands($var) + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->demands = $arr; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentModel.php b/Optimization/src/V1/ShipmentModel.php new file mode 100644 index 000000000000..beb6cf12e599 --- /dev/null +++ b/Optimization/src/V1/ShipmentModel.php @@ -0,0 +1,1049 @@ +google.cloud.optimization.v1.ShipmentModel + */ +class ShipmentModel extends \Google\Protobuf\Internal\Message +{ + /** + * Set of shipments which must be performed in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment shipments = 1; + */ + private $shipments; + /** + * Set of vehicles which can be used to perform visits. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Vehicle vehicles = 2; + */ + private $vehicles; + /** + * Constrains the maximum number of active vehicles. A vehicle is active if + * its route performs at least one shipment. This can be used to limit the + * number of routes in the case where there are fewer drivers than + * vehicles and that the fleet of vehicles is heterogeneous. The optimization + * will then select the best subset of vehicles to use. + * Must be strictly positive. + * + * Generated from protobuf field optional int32 max_active_vehicles = 4; + */ + private $max_active_vehicles = null; + /** + * Global start and end time of the model: no times outside of this range + * can be considered valid. + * The model's time span must be less than a year, i.e. the `global_end_time` + * and the `global_start_time` must be within 31536000 seconds of each other. + * When using `cost_per_*hour` fields, you might want to set this window to a + * smaller interval to increase performance (eg. if you model a single day, + * you should set the global time limits to that day). + * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used + * as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_start_time = 5; + */ + private $global_start_time = null; + /** + * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) + * is used as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_end_time = 6; + */ + private $global_end_time = null; + /** + * The "global duration" of the overall plan is the difference between the + * earliest effective start time and the latest effective end time of + * all vehicles. Users can assign a cost per hour to that quantity to try + * and optimize for earliest job completion, for example. This cost must be in + * the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double global_duration_cost_per_hour = 7; + */ + private $global_duration_cost_per_hour = 0.0; + /** + * Specifies duration and distance matrices used in the model. If this field + * is empty, Google Maps or geodesic distances will be used instead, depending + * on the value of the `use_geodesic_distances` field. If it is not empty, + * `use_geodesic_distances` cannot be true and neither + * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` + * can be empty. + * Usage examples: + * * There are two locations: locA and locB. + * * 1 vehicle starting its route at locA and ending it at locA. + * * 1 pickup visit request at locB. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locA" } + * shipments { pickups { tags: "locB" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_dst_tags: "locA" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrices { + * rows { # from: locA + * durations { seconds: 0 } meters: 0 # to: locA + * durations { seconds: 100 } meters: 1000 # to: locB + * } + * rows { # from: locB + * durations { seconds: 102 } meters: 990 # to: locA + * durations { seconds: 0 } meters: 0 # to: locB + * } + * } + * } + * ``` + * * There are three locations: locA, locB and locC. + * * 1 vehicle starting its route at locA and ending it at locB, using + * matrix "fast". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "slow". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "fast". + * * 1 pickup visit request at locC. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } + * shipments { pickups { tags: "locC" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_src_tags: "locC" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrix_dst_tags: "locC" + * duration_distance_matrices { + * vehicle_start_tag: "fast" + * rows { # from: locA + * durations { seconds: 1000 } meters: 2000 # to: locB + * durations { seconds: 600 } meters: 1000 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 700 } meters: 1200 # to: locC + * } + * rows { # from: locC + * durations { seconds: 702 } meters: 1190 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * duration_distance_matrices { + * vehicle_start_tag: "slow" + * rows { # from: locA + * durations { seconds: 1800 } meters: 2001 # to: locB + * durations { seconds: 900 } meters: 1002 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 1000 } meters: 1202 # to: locC + * } + * rows { # from: locC + * durations { seconds: 1001 } meters: 1195 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * } + * ``` + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; + */ + private $duration_distance_matrices; + /** + * Tags defining the sources of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j)` defines durations and distances + * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits + * in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_src_tags = 9; + */ + private $duration_distance_matrix_src_tags; + /** + * Tags defining the destinations of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j).durations(k)` (resp. + * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration + * (resp. the distance) of the travel from visits with tag + * `duration_distance_matrix_src_tags(j)` to visits with tag + * `duration_distance_matrix_dst_tags(k)` in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_dst_tags = 10; + */ + private $duration_distance_matrix_dst_tags; + /** + * Transition attributes added to the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; + */ + private $transition_attributes; + /** + * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; + */ + private $shipment_type_incompatibilities; + /** + * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; + */ + private $shipment_type_requirements; + /** + * Set of precedence rules which must be enforced in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; + */ + private $precedence_rules; + /** + * Deprecated: No longer used. + * Set of break rules used in the model. + * Each vehicle specifies the `BreakRule` that applies to it via the + * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; + * @deprecated + */ + private $break_rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\Shipment[]|\Google\Protobuf\Internal\RepeatedField $shipments + * Set of shipments which must be performed in the model. + * @type \Google\Cloud\Optimization\V1\Vehicle[]|\Google\Protobuf\Internal\RepeatedField $vehicles + * Set of vehicles which can be used to perform visits. + * @type int $max_active_vehicles + * Constrains the maximum number of active vehicles. A vehicle is active if + * its route performs at least one shipment. This can be used to limit the + * number of routes in the case where there are fewer drivers than + * vehicles and that the fleet of vehicles is heterogeneous. The optimization + * will then select the best subset of vehicles to use. + * Must be strictly positive. + * @type \Google\Protobuf\Timestamp $global_start_time + * Global start and end time of the model: no times outside of this range + * can be considered valid. + * The model's time span must be less than a year, i.e. the `global_end_time` + * and the `global_start_time` must be within 31536000 seconds of each other. + * When using `cost_per_*hour` fields, you might want to set this window to a + * smaller interval to increase performance (eg. if you model a single day, + * you should set the global time limits to that day). + * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used + * as default. + * @type \Google\Protobuf\Timestamp $global_end_time + * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) + * is used as default. + * @type float $global_duration_cost_per_hour + * The "global duration" of the overall plan is the difference between the + * earliest effective start time and the latest effective end time of + * all vehicles. Users can assign a cost per hour to that quantity to try + * and optimize for earliest job completion, for example. This cost must be in + * the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * @type \Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix[]|\Google\Protobuf\Internal\RepeatedField $duration_distance_matrices + * Specifies duration and distance matrices used in the model. If this field + * is empty, Google Maps or geodesic distances will be used instead, depending + * on the value of the `use_geodesic_distances` field. If it is not empty, + * `use_geodesic_distances` cannot be true and neither + * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` + * can be empty. + * Usage examples: + * * There are two locations: locA and locB. + * * 1 vehicle starting its route at locA and ending it at locA. + * * 1 pickup visit request at locB. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locA" } + * shipments { pickups { tags: "locB" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_dst_tags: "locA" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrices { + * rows { # from: locA + * durations { seconds: 0 } meters: 0 # to: locA + * durations { seconds: 100 } meters: 1000 # to: locB + * } + * rows { # from: locB + * durations { seconds: 102 } meters: 990 # to: locA + * durations { seconds: 0 } meters: 0 # to: locB + * } + * } + * } + * ``` + * * There are three locations: locA, locB and locC. + * * 1 vehicle starting its route at locA and ending it at locB, using + * matrix "fast". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "slow". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "fast". + * * 1 pickup visit request at locC. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } + * shipments { pickups { tags: "locC" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_src_tags: "locC" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrix_dst_tags: "locC" + * duration_distance_matrices { + * vehicle_start_tag: "fast" + * rows { # from: locA + * durations { seconds: 1000 } meters: 2000 # to: locB + * durations { seconds: 600 } meters: 1000 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 700 } meters: 1200 # to: locC + * } + * rows { # from: locC + * durations { seconds: 702 } meters: 1190 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * duration_distance_matrices { + * vehicle_start_tag: "slow" + * rows { # from: locA + * durations { seconds: 1800 } meters: 2001 # to: locB + * durations { seconds: 900 } meters: 1002 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 1000 } meters: 1202 # to: locC + * } + * rows { # from: locC + * durations { seconds: 1001 } meters: 1195 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * } + * ``` + * @type string[]|\Google\Protobuf\Internal\RepeatedField $duration_distance_matrix_src_tags + * Tags defining the sources of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j)` defines durations and distances + * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits + * in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $duration_distance_matrix_dst_tags + * Tags defining the destinations of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j).durations(k)` (resp. + * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration + * (resp. the distance) of the travel from visits with tag + * `duration_distance_matrix_src_tags(j)` to visits with tag + * `duration_distance_matrix_dst_tags(k)` in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * @type \Google\Cloud\Optimization\V1\TransitionAttributes[]|\Google\Protobuf\Internal\RepeatedField $transition_attributes + * Transition attributes added to the model. + * @type \Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility[]|\Google\Protobuf\Internal\RepeatedField $shipment_type_incompatibilities + * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). + * @type \Google\Cloud\Optimization\V1\ShipmentTypeRequirement[]|\Google\Protobuf\Internal\RepeatedField $shipment_type_requirements + * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). + * @type \Google\Cloud\Optimization\V1\ShipmentModel\PrecedenceRule[]|\Google\Protobuf\Internal\RepeatedField $precedence_rules + * Set of precedence rules which must be enforced in the model. + * @type \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule[]|\Google\Protobuf\Internal\RepeatedField $break_rules + * Deprecated: No longer used. + * Set of break rules used in the model. + * Each vehicle specifies the `BreakRule` that applies to it via the + * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Set of shipments which must be performed in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment shipments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShipments() + { + return $this->shipments; + } + + /** + * Set of shipments which must be performed in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Shipment shipments = 1; + * @param \Google\Cloud\Optimization\V1\Shipment[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShipments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment::class); + $this->shipments = $arr; + + return $this; + } + + /** + * Set of vehicles which can be used to perform visits. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Vehicle vehicles = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVehicles() + { + return $this->vehicles; + } + + /** + * Set of vehicles which can be used to perform visits. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.Vehicle vehicles = 2; + * @param \Google\Cloud\Optimization\V1\Vehicle[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVehicles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Vehicle::class); + $this->vehicles = $arr; + + return $this; + } + + /** + * Constrains the maximum number of active vehicles. A vehicle is active if + * its route performs at least one shipment. This can be used to limit the + * number of routes in the case where there are fewer drivers than + * vehicles and that the fleet of vehicles is heterogeneous. The optimization + * will then select the best subset of vehicles to use. + * Must be strictly positive. + * + * Generated from protobuf field optional int32 max_active_vehicles = 4; + * @return int + */ + public function getMaxActiveVehicles() + { + return isset($this->max_active_vehicles) ? $this->max_active_vehicles : 0; + } + + public function hasMaxActiveVehicles() + { + return isset($this->max_active_vehicles); + } + + public function clearMaxActiveVehicles() + { + unset($this->max_active_vehicles); + } + + /** + * Constrains the maximum number of active vehicles. A vehicle is active if + * its route performs at least one shipment. This can be used to limit the + * number of routes in the case where there are fewer drivers than + * vehicles and that the fleet of vehicles is heterogeneous. The optimization + * will then select the best subset of vehicles to use. + * Must be strictly positive. + * + * Generated from protobuf field optional int32 max_active_vehicles = 4; + * @param int $var + * @return $this + */ + public function setMaxActiveVehicles($var) + { + GPBUtil::checkInt32($var); + $this->max_active_vehicles = $var; + + return $this; + } + + /** + * Global start and end time of the model: no times outside of this range + * can be considered valid. + * The model's time span must be less than a year, i.e. the `global_end_time` + * and the `global_start_time` must be within 31536000 seconds of each other. + * When using `cost_per_*hour` fields, you might want to set this window to a + * smaller interval to increase performance (eg. if you model a single day, + * you should set the global time limits to that day). + * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used + * as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_start_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getGlobalStartTime() + { + return $this->global_start_time; + } + + public function hasGlobalStartTime() + { + return isset($this->global_start_time); + } + + public function clearGlobalStartTime() + { + unset($this->global_start_time); + } + + /** + * Global start and end time of the model: no times outside of this range + * can be considered valid. + * The model's time span must be less than a year, i.e. the `global_end_time` + * and the `global_start_time` must be within 31536000 seconds of each other. + * When using `cost_per_*hour` fields, you might want to set this window to a + * smaller interval to increase performance (eg. if you model a single day, + * you should set the global time limits to that day). + * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used + * as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_start_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setGlobalStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->global_start_time = $var; + + return $this; + } + + /** + * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) + * is used as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_end_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getGlobalEndTime() + { + return $this->global_end_time; + } + + public function hasGlobalEndTime() + { + return isset($this->global_end_time); + } + + public function clearGlobalEndTime() + { + unset($this->global_end_time); + } + + /** + * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) + * is used as default. + * + * Generated from protobuf field .google.protobuf.Timestamp global_end_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setGlobalEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->global_end_time = $var; + + return $this; + } + + /** + * The "global duration" of the overall plan is the difference between the + * earliest effective start time and the latest effective end time of + * all vehicles. Users can assign a cost per hour to that quantity to try + * and optimize for earliest job completion, for example. This cost must be in + * the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double global_duration_cost_per_hour = 7; + * @return float + */ + public function getGlobalDurationCostPerHour() + { + return $this->global_duration_cost_per_hour; + } + + /** + * The "global duration" of the overall plan is the difference between the + * earliest effective start time and the latest effective end time of + * all vehicles. Users can assign a cost per hour to that quantity to try + * and optimize for earliest job completion, for example. This cost must be in + * the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double global_duration_cost_per_hour = 7; + * @param float $var + * @return $this + */ + public function setGlobalDurationCostPerHour($var) + { + GPBUtil::checkDouble($var); + $this->global_duration_cost_per_hour = $var; + + return $this; + } + + /** + * Specifies duration and distance matrices used in the model. If this field + * is empty, Google Maps or geodesic distances will be used instead, depending + * on the value of the `use_geodesic_distances` field. If it is not empty, + * `use_geodesic_distances` cannot be true and neither + * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` + * can be empty. + * Usage examples: + * * There are two locations: locA and locB. + * * 1 vehicle starting its route at locA and ending it at locA. + * * 1 pickup visit request at locB. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locA" } + * shipments { pickups { tags: "locB" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_dst_tags: "locA" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrices { + * rows { # from: locA + * durations { seconds: 0 } meters: 0 # to: locA + * durations { seconds: 100 } meters: 1000 # to: locB + * } + * rows { # from: locB + * durations { seconds: 102 } meters: 990 # to: locA + * durations { seconds: 0 } meters: 0 # to: locB + * } + * } + * } + * ``` + * * There are three locations: locA, locB and locC. + * * 1 vehicle starting its route at locA and ending it at locB, using + * matrix "fast". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "slow". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "fast". + * * 1 pickup visit request at locC. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } + * shipments { pickups { tags: "locC" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_src_tags: "locC" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrix_dst_tags: "locC" + * duration_distance_matrices { + * vehicle_start_tag: "fast" + * rows { # from: locA + * durations { seconds: 1000 } meters: 2000 # to: locB + * durations { seconds: 600 } meters: 1000 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 700 } meters: 1200 # to: locC + * } + * rows { # from: locC + * durations { seconds: 702 } meters: 1190 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * duration_distance_matrices { + * vehicle_start_tag: "slow" + * rows { # from: locA + * durations { seconds: 1800 } meters: 2001 # to: locB + * durations { seconds: 900 } meters: 1002 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 1000 } meters: 1202 # to: locC + * } + * rows { # from: locC + * durations { seconds: 1001 } meters: 1195 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * } + * ``` + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDurationDistanceMatrices() + { + return $this->duration_distance_matrices; + } + + /** + * Specifies duration and distance matrices used in the model. If this field + * is empty, Google Maps or geodesic distances will be used instead, depending + * on the value of the `use_geodesic_distances` field. If it is not empty, + * `use_geodesic_distances` cannot be true and neither + * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` + * can be empty. + * Usage examples: + * * There are two locations: locA and locB. + * * 1 vehicle starting its route at locA and ending it at locA. + * * 1 pickup visit request at locB. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locA" } + * shipments { pickups { tags: "locB" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_dst_tags: "locA" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrices { + * rows { # from: locA + * durations { seconds: 0 } meters: 0 # to: locA + * durations { seconds: 100 } meters: 1000 # to: locB + * } + * rows { # from: locB + * durations { seconds: 102 } meters: 990 # to: locA + * durations { seconds: 0 } meters: 0 # to: locB + * } + * } + * } + * ``` + * * There are three locations: locA, locB and locC. + * * 1 vehicle starting its route at locA and ending it at locB, using + * matrix "fast". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "slow". + * * 1 vehicle starting its route at locB and ending it at locB, using + * matrix "fast". + * * 1 pickup visit request at locC. + * ``` + * model { + * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } + * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } + * shipments { pickups { tags: "locC" } } + * duration_distance_matrix_src_tags: "locA" + * duration_distance_matrix_src_tags: "locB" + * duration_distance_matrix_src_tags: "locC" + * duration_distance_matrix_dst_tags: "locB" + * duration_distance_matrix_dst_tags: "locC" + * duration_distance_matrices { + * vehicle_start_tag: "fast" + * rows { # from: locA + * durations { seconds: 1000 } meters: 2000 # to: locB + * durations { seconds: 600 } meters: 1000 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 700 } meters: 1200 # to: locC + * } + * rows { # from: locC + * durations { seconds: 702 } meters: 1190 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * duration_distance_matrices { + * vehicle_start_tag: "slow" + * rows { # from: locA + * durations { seconds: 1800 } meters: 2001 # to: locB + * durations { seconds: 900 } meters: 1002 # to: locC + * } + * rows { # from: locB + * durations { seconds: 0 } meters: 0 # to: locB + * durations { seconds: 1000 } meters: 1202 # to: locC + * } + * rows { # from: locC + * durations { seconds: 1001 } meters: 1195 # to: locB + * durations { seconds: 0 } meters: 0 # to: locC + * } + * } + * } + * ``` + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; + * @param \Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDurationDistanceMatrices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix::class); + $this->duration_distance_matrices = $arr; + + return $this; + } + + /** + * Tags defining the sources of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j)` defines durations and distances + * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits + * in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_src_tags = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDurationDistanceMatrixSrcTags() + { + return $this->duration_distance_matrix_src_tags; + } + + /** + * Tags defining the sources of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j)` defines durations and distances + * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits + * in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_src_tags = 9; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDurationDistanceMatrixSrcTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->duration_distance_matrix_src_tags = $arr; + + return $this; + } + + /** + * Tags defining the destinations of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j).durations(k)` (resp. + * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration + * (resp. the distance) of the travel from visits with tag + * `duration_distance_matrix_src_tags(j)` to visits with tag + * `duration_distance_matrix_dst_tags(k)` in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_dst_tags = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDurationDistanceMatrixDstTags() + { + return $this->duration_distance_matrix_dst_tags; + } + + /** + * Tags defining the destinations of the duration and distance matrices; + * `duration_distance_matrices(i).rows(j).durations(k)` (resp. + * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration + * (resp. the distance) of the travel from visits with tag + * `duration_distance_matrix_src_tags(j)` to visits with tag + * `duration_distance_matrix_dst_tags(k)` in matrix i. + * Tags correspond to + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. + * A given `VisitRequest` or `Vehicle` must match exactly one tag in this + * field. Note that a `Vehicle`'s source, destination and matrix tags may be + * the same; similarly a `VisitRequest`'s source and destination tags may be + * the same. All tags must be different and cannot be empty strings. If this + * field is not empty, then `duration_distance_matrices` must not be empty. + * + * Generated from protobuf field repeated string duration_distance_matrix_dst_tags = 10; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDurationDistanceMatrixDstTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->duration_distance_matrix_dst_tags = $arr; + + return $this; + } + + /** + * Transition attributes added to the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitionAttributes() + { + return $this->transition_attributes; + } + + /** + * Transition attributes added to the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; + * @param \Google\Cloud\Optimization\V1\TransitionAttributes[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitionAttributes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\TransitionAttributes::class); + $this->transition_attributes = $arr; + + return $this; + } + + /** + * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShipmentTypeIncompatibilities() + { + return $this->shipment_type_incompatibilities; + } + + /** + * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; + * @param \Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShipmentTypeIncompatibilities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility::class); + $this->shipment_type_incompatibilities = $arr; + + return $this; + } + + /** + * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShipmentTypeRequirements() + { + return $this->shipment_type_requirements; + } + + /** + * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; + * @param \Google\Cloud\Optimization\V1\ShipmentTypeRequirement[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShipmentTypeRequirements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentTypeRequirement::class); + $this->shipment_type_requirements = $arr; + + return $this; + } + + /** + * Set of precedence rules which must be enforced in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPrecedenceRules() + { + return $this->precedence_rules; + } + + /** + * Set of precedence rules which must be enforced in the model. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; + * @param \Google\Cloud\Optimization\V1\ShipmentModel\PrecedenceRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPrecedenceRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\PrecedenceRule::class); + $this->precedence_rules = $arr; + + return $this; + } + + /** + * Deprecated: No longer used. + * Set of break rules used in the model. + * Each vehicle specifies the `BreakRule` that applies to it via the + * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getBreakRules() + { + @trigger_error('break_rules is deprecated.', E_USER_DEPRECATED); + return $this->break_rules; + } + + /** + * Deprecated: No longer used. + * Set of break rules used in the model. + * Each vehicle specifies the `BreakRule` that applies to it via the + * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setBreakRules($var) + { + @trigger_error('break_rules is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule::class); + $this->break_rules = $arr; + + return $this; + } + +} + diff --git a/Optimization/src/V1/ShipmentModel/BreakRule.php b/Optimization/src/V1/ShipmentModel/BreakRule.php new file mode 100644 index 000000000000..e3ff3fb30b43 --- /dev/null +++ b/Optimization/src/V1/ShipmentModel/BreakRule.php @@ -0,0 +1,116 @@ +google.cloud.optimization.v1.ShipmentModel.BreakRule + */ +class BreakRule extends \Google\Protobuf\Internal\Message +{ + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; + */ + private $break_requests; + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; + */ + private $frequency_constraints; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\BreakRequest[]|\Google\Protobuf\Internal\RepeatedField $break_requests + * Sequence of breaks. See the `BreakRequest` message. + * @type \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\FrequencyConstraint[]|\Google\Protobuf\Internal\RepeatedField $frequency_constraints + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBreakRequests() + { + return $this->break_requests; + } + + /** + * Sequence of breaks. See the `BreakRequest` message. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; + * @param \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\BreakRequest[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBreakRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\BreakRequest::class); + $this->break_requests = $arr; + + return $this; + } + + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrequencyConstraints() + { + return $this->frequency_constraints; + } + + /** + * Several `FrequencyConstraint` may apply. They must all be satisfied by + * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; + * @param \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\FrequencyConstraint[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrequencyConstraints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\BreakRule\FrequencyConstraint::class); + $this->frequency_constraints = $arr; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentModel/BreakRule/BreakRequest.php b/Optimization/src/V1/ShipmentModel/BreakRule/BreakRequest.php new file mode 100644 index 000000000000..4d4a719150d3 --- /dev/null +++ b/Optimization/src/V1/ShipmentModel/BreakRule/BreakRequest.php @@ -0,0 +1,170 @@ +google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest + */ +class BreakRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $earliest_start_time = null; + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $latest_start_time = null; + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $min_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $earliest_start_time + * Required. Lower bound (inclusive) on the start of the break. + * @type \Google\Protobuf\Timestamp $latest_start_time + * Required. Upper bound (inclusive) on the start of the break. + * @type \Google\Protobuf\Duration $min_duration + * Required. Minimum duration of the break. Must be positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEarliestStartTime() + { + return $this->earliest_start_time; + } + + public function hasEarliestStartTime() + { + return isset($this->earliest_start_time); + } + + public function clearEarliestStartTime() + { + unset($this->earliest_start_time); + } + + /** + * Required. Lower bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEarliestStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->earliest_start_time = $var; + + return $this; + } + + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLatestStartTime() + { + return $this->latest_start_time; + } + + public function hasLatestStartTime() + { + return isset($this->latest_start_time); + } + + public function clearLatestStartTime() + { + unset($this->latest_start_time); + } + + /** + * Required. Upper bound (inclusive) on the start of the break. + * + * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLatestStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->latest_start_time = $var; + + return $this; + } + + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinDuration() + { + return $this->min_duration; + } + + public function hasMinDuration() + { + return isset($this->min_duration); + } + + public function clearMinDuration() + { + unset($this->min_duration); + } + + /** + * Required. Minimum duration of the break. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_duration = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentModel/BreakRule/FrequencyConstraint.php b/Optimization/src/V1/ShipmentModel/BreakRule/FrequencyConstraint.php new file mode 100644 index 000000000000..58ef5a55f5d2 --- /dev/null +++ b/Optimization/src/V1/ShipmentModel/BreakRule/FrequencyConstraint.php @@ -0,0 +1,164 @@ +google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint + */ +class FrequencyConstraint extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $min_break_duration = null; + /** + * Required. Maximum allowed span of any interval of time in the route that does not + * include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $max_inter_break_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $min_break_duration + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * @type \Google\Protobuf\Duration $max_inter_break_duration + * Required. Maximum allowed span of any interval of time in the route that does not + * include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMinBreakDuration() + { + return $this->min_break_duration; + } + + public function hasMinBreakDuration() + { + return isset($this->min_break_duration); + } + + public function clearMinBreakDuration() + { + unset($this->min_break_duration); + } + + /** + * Required. Minimum break duration for this constraint. Nonnegative. + * See description of `FrequencyConstraint`. + * + * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_break_duration = $var; + + return $this; + } + + /** + * Required. Maximum allowed span of any interval of time in the route that does not + * include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxInterBreakDuration() + { + return $this->max_inter_break_duration; + } + + public function hasMaxInterBreakDuration() + { + return isset($this->max_inter_break_duration); + } + + public function clearMaxInterBreakDuration() + { + unset($this->max_inter_break_duration); + } + + /** + * Required. Maximum allowed span of any interval of time in the route that does not + * include at least partially a break of `duration >= + * min_break_duration`. Must be positive. + * + * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxInterBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->max_inter_break_duration = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix.php b/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix.php new file mode 100644 index 000000000000..8ec2e83a5b30 --- /dev/null +++ b/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix.php @@ -0,0 +1,131 @@ +google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix + */ +class DurationDistanceMatrix extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the rows of the duration and distance matrix. It must have as + * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; + */ + private $rows; + /** + * Tag defining to which vehicles this duration and distance matrix applies. + * If empty, this applies to all vehicles, and there can only be a single + * matrix. + * Each vehicle start must match exactly one matrix, i.e. exactly one of + * their `start_tags` field must match the `vehicle_start_tag` of a matrix + * (and of that matrix only). + * All matrices must have a different `vehicle_start_tag`. + * + * Generated from protobuf field string vehicle_start_tag = 2; + */ + private $vehicle_start_tag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix\Row[]|\Google\Protobuf\Internal\RepeatedField $rows + * Specifies the rows of the duration and distance matrix. It must have as + * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. + * @type string $vehicle_start_tag + * Tag defining to which vehicles this duration and distance matrix applies. + * If empty, this applies to all vehicles, and there can only be a single + * matrix. + * Each vehicle start must match exactly one matrix, i.e. exactly one of + * their `start_tags` field must match the `vehicle_start_tag` of a matrix + * (and of that matrix only). + * All matrices must have a different `vehicle_start_tag`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the rows of the duration and distance matrix. It must have as + * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRows() + { + return $this->rows; + } + + /** + * Specifies the rows of the duration and distance matrix. It must have as + * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; + * @param \Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix\Row[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentModel\DurationDistanceMatrix\Row::class); + $this->rows = $arr; + + return $this; + } + + /** + * Tag defining to which vehicles this duration and distance matrix applies. + * If empty, this applies to all vehicles, and there can only be a single + * matrix. + * Each vehicle start must match exactly one matrix, i.e. exactly one of + * their `start_tags` field must match the `vehicle_start_tag` of a matrix + * (and of that matrix only). + * All matrices must have a different `vehicle_start_tag`. + * + * Generated from protobuf field string vehicle_start_tag = 2; + * @return string + */ + public function getVehicleStartTag() + { + return $this->vehicle_start_tag; + } + + /** + * Tag defining to which vehicles this duration and distance matrix applies. + * If empty, this applies to all vehicles, and there can only be a single + * matrix. + * Each vehicle start must match exactly one matrix, i.e. exactly one of + * their `start_tags` field must match the `vehicle_start_tag` of a matrix + * (and of that matrix only). + * All matrices must have a different `vehicle_start_tag`. + * + * Generated from protobuf field string vehicle_start_tag = 2; + * @param string $var + * @return $this + */ + public function setVehicleStartTag($var) + { + GPBUtil::checkString($var, True); + $this->vehicle_start_tag = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix/Row.php b/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix/Row.php new file mode 100644 index 000000000000..e997b5d093f9 --- /dev/null +++ b/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix/Row.php @@ -0,0 +1,114 @@ +google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row + */ +class Row extends \Google\Protobuf\Internal\Message +{ + /** + * Duration values for a given row. It must have as many elements as + * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. + * + * Generated from protobuf field repeated .google.protobuf.Duration durations = 1; + */ + private $durations; + /** + * Distance values for a given row. If no costs or constraints refer to + * distances in the model, this can be left empty; otherwise it must have + * as many elements as `durations`. + * + * Generated from protobuf field repeated double meters = 2; + */ + private $meters; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration[]|\Google\Protobuf\Internal\RepeatedField $durations + * Duration values for a given row. It must have as many elements as + * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. + * @type float[]|\Google\Protobuf\Internal\RepeatedField $meters + * Distance values for a given row. If no costs or constraints refer to + * distances in the model, this can be left empty; otherwise it must have + * as many elements as `durations`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Duration values for a given row. It must have as many elements as + * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. + * + * Generated from protobuf field repeated .google.protobuf.Duration durations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDurations() + { + return $this->durations; + } + + /** + * Duration values for a given row. It must have as many elements as + * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. + * + * Generated from protobuf field repeated .google.protobuf.Duration durations = 1; + * @param \Google\Protobuf\Duration[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDurations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); + $this->durations = $arr; + + return $this; + } + + /** + * Distance values for a given row. If no costs or constraints refer to + * distances in the model, this can be left empty; otherwise it must have + * as many elements as `durations`. + * + * Generated from protobuf field repeated double meters = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMeters() + { + return $this->meters; + } + + /** + * Distance values for a given row. If no costs or constraints refer to + * distances in the model, this can be left empty; otherwise it must have + * as many elements as `durations`. + * + * Generated from protobuf field repeated double meters = 2; + * @param float[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMeters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->meters = $arr; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentModel/PrecedenceRule.php b/Optimization/src/V1/ShipmentModel/PrecedenceRule.php new file mode 100644 index 000000000000..509b6c74d8b0 --- /dev/null +++ b/Optimization/src/V1/ShipmentModel/PrecedenceRule.php @@ -0,0 +1,241 @@ +google.cloud.optimization.v1.ShipmentModel.PrecedenceRule + */ +class PrecedenceRule extends \Google\Protobuf\Internal\Message +{ + /** + * Shipment index of the "first" event. This field must be specified. + * + * Generated from protobuf field optional int32 first_index = 1; + */ + private $first_index = null; + /** + * Indicates if the "first" event is a delivery. + * + * Generated from protobuf field bool first_is_delivery = 3; + */ + private $first_is_delivery = false; + /** + * Shipment index of the "second" event. This field must be specified. + * + * Generated from protobuf field optional int32 second_index = 2; + */ + private $second_index = null; + /** + * Indicates if the "second" event is a delivery. + * + * Generated from protobuf field bool second_is_delivery = 4; + */ + private $second_is_delivery = false; + /** + * The offset between the "first" and "second" event. It can be negative. + * + * Generated from protobuf field .google.protobuf.Duration offset_duration = 5; + */ + private $offset_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $first_index + * Shipment index of the "first" event. This field must be specified. + * @type bool $first_is_delivery + * Indicates if the "first" event is a delivery. + * @type int $second_index + * Shipment index of the "second" event. This field must be specified. + * @type bool $second_is_delivery + * Indicates if the "second" event is a delivery. + * @type \Google\Protobuf\Duration $offset_duration + * The offset between the "first" and "second" event. It can be negative. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Shipment index of the "first" event. This field must be specified. + * + * Generated from protobuf field optional int32 first_index = 1; + * @return int + */ + public function getFirstIndex() + { + return isset($this->first_index) ? $this->first_index : 0; + } + + public function hasFirstIndex() + { + return isset($this->first_index); + } + + public function clearFirstIndex() + { + unset($this->first_index); + } + + /** + * Shipment index of the "first" event. This field must be specified. + * + * Generated from protobuf field optional int32 first_index = 1; + * @param int $var + * @return $this + */ + public function setFirstIndex($var) + { + GPBUtil::checkInt32($var); + $this->first_index = $var; + + return $this; + } + + /** + * Indicates if the "first" event is a delivery. + * + * Generated from protobuf field bool first_is_delivery = 3; + * @return bool + */ + public function getFirstIsDelivery() + { + return $this->first_is_delivery; + } + + /** + * Indicates if the "first" event is a delivery. + * + * Generated from protobuf field bool first_is_delivery = 3; + * @param bool $var + * @return $this + */ + public function setFirstIsDelivery($var) + { + GPBUtil::checkBool($var); + $this->first_is_delivery = $var; + + return $this; + } + + /** + * Shipment index of the "second" event. This field must be specified. + * + * Generated from protobuf field optional int32 second_index = 2; + * @return int + */ + public function getSecondIndex() + { + return isset($this->second_index) ? $this->second_index : 0; + } + + public function hasSecondIndex() + { + return isset($this->second_index); + } + + public function clearSecondIndex() + { + unset($this->second_index); + } + + /** + * Shipment index of the "second" event. This field must be specified. + * + * Generated from protobuf field optional int32 second_index = 2; + * @param int $var + * @return $this + */ + public function setSecondIndex($var) + { + GPBUtil::checkInt32($var); + $this->second_index = $var; + + return $this; + } + + /** + * Indicates if the "second" event is a delivery. + * + * Generated from protobuf field bool second_is_delivery = 4; + * @return bool + */ + public function getSecondIsDelivery() + { + return $this->second_is_delivery; + } + + /** + * Indicates if the "second" event is a delivery. + * + * Generated from protobuf field bool second_is_delivery = 4; + * @param bool $var + * @return $this + */ + public function setSecondIsDelivery($var) + { + GPBUtil::checkBool($var); + $this->second_is_delivery = $var; + + return $this; + } + + /** + * The offset between the "first" and "second" event. It can be negative. + * + * Generated from protobuf field .google.protobuf.Duration offset_duration = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getOffsetDuration() + { + return $this->offset_duration; + } + + public function hasOffsetDuration() + { + return isset($this->offset_duration); + } + + public function clearOffsetDuration() + { + unset($this->offset_duration); + } + + /** + * The offset between the "first" and "second" event. It can be negative. + * + * Generated from protobuf field .google.protobuf.Duration offset_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setOffsetDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->offset_duration = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentRoute.php b/Optimization/src/V1/ShipmentRoute.php new file mode 100644 index 000000000000..50c75bbc29bf --- /dev/null +++ b/Optimization/src/V1/ShipmentRoute.php @@ -0,0 +1,914 @@ + + * | TRANSITION[i] | VISIT[i] | + * | | | + * | * TRAVEL: the vehicle moves from | PERFORM the visit: | + * | VISIT[i-1].departure_location to | | + * | VISIT[i].arrival_location, which | * Spend some time: | + * | takes a given travel duration | the "visit duration". | + * | and distance | | + * | | * Load or unload | + * | * BREAKS: the driver may have | some quantities from the | + * | breaks (e.g. lunch break). | vehicle: the "demand". | + * | | | + * | * WAIT: the driver/vehicle does | | + * | nothing. This can happen for | | + * | many reasons, for example when | | + * | the vehicle reaches the next | | + * | event's destination before the | | + * | start of its time window | | + * | | | + * | * DELAY: *right before* the next | | + * | arrival. E.g. the vehicle and/or | | + * | driver spends time unloading. | | + * | | | + * ---+-------------------------------------+-----------------------------+--> + * ^ ^ ^ + * V[i-1].end V[i].start V[i].end + * ``` + * Lastly, here is how the TRAVEL, BREAKS, DELAY and WAIT can be arranged + * during a transition. + * * They don't overlap. + * * The DELAY is unique and *must* be a contiguous period of time right + * before the next visit (or vehicle end). Thus, it suffice to know the + * delay duration to know its start and end time. + * * The BREAKS are contiguous, non-overlapping periods of time. The + * response specifies the start time and duration of each break. + * * TRAVEL and WAIT are "preemptable": they can be interrupted several times + * during this transition. Clients can assume that travel happens "as soon as + * possible" and that "wait" fills the remaining time. + * A (complex) example: + * ``` + * TRANSITION[i] + * --++-----+-----------------------------------------------------------++--> + * || | | | | | | || + * || T | B | T | | B | | D || + * || r | r | r | W | r | W | e || + * || a | e | a | a | e | a | l || + * || v | a | v | i | a | i | a || + * || e | k | e | t | k | t | y || + * || l | | l | | | | || + * || | | | | | | || + * --++-----------------------------------------------------------------++--> + * ``` + * + * Generated from protobuf message google.cloud.optimization.v1.ShipmentRoute + */ +class ShipmentRoute extends \Google\Protobuf\Internal\Message +{ + /** + * Vehicle performing the route, identified by its index in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 vehicle_index = 1; + */ + private $vehicle_index = 0; + /** + * Label of the vehicle performing this route, equal to + * `ShipmentModel.vehicles(vehicle_index).label`, if specified. + * + * Generated from protobuf field string vehicle_label = 2; + */ + private $vehicle_label = ''; + /** + * Time at which the vehicle starts its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_start_time = 5; + */ + private $vehicle_start_time = null; + /** + * Time at which the vehicle finishes its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_end_time = 6; + */ + private $vehicle_end_time = null; + /** + * Ordered sequence of visits representing a route. + * visits[i] is the i-th visit in the route. + * If this field is empty, the vehicle is considered as unused. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Visit visits = 7; + */ + private $visits; + /** + * Ordered list of transitions for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Transition transitions = 8; + */ + private $transitions; + /** + * When + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * is set to true, this field indicates that inconsistencies in route timings + * are predicted using traffic-based travel duration estimates. There may be + * insufficient time to complete traffic-adjusted travel, delays, and breaks + * between visits, before the first visit, or after the last visit, while + * still satisfying the visit and vehicle time windows. For example, + * ```start_time(previous_visit) + duration(previous_visit) + + * travel_duration(previous_visit, next_visit) > start_time(next_visit)``` + * Arrival at next_visit will likely happen later than its current + * time window due the increased estimate of travel time + * `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break + * may be forced to overlap with a visit due to an increase in travel time + * estimates and visit or break time window restrictions. + * + * Generated from protobuf field bool has_traffic_infeasibilities = 9; + */ + private $has_traffic_infeasibilities = false; + /** + * The encoded polyline representation of the route. + * This field is only populated if + * [OptimizeToursRequest.populate_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 10; + */ + private $route_polyline = null; + /** + * Breaks scheduled for the vehicle performing this route. + * The `breaks` sequence represents time intervals, each starting at the + * corresponding `start_time` and lasting `duration` seconds. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Break breaks = 11; + */ + private $breaks; + /** + * Duration, distance and load metrics for this route. The fields of + * [AggregatedMetrics][google.cloud.optimization.v1.AggregatedMetrics] are summed over all [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] or + * [ShipmentRoute.visits][google.cloud.optimization.v1.ShipmentRoute.visits], depending on the context. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics metrics = 12; + */ + private $metrics = null; + /** + * Cost of the route, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. + * "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole route. + * In other words, costs["model.shipments.pickups.cost"] is the sum of all + * pickup costs over the route. All costs defined in the model are reported in + * detail here with the exception of costs related to TransitionAttributes + * that are only reported in an aggregated way as of 2022/01. + * + * Generated from protobuf field map route_costs = 17; + */ + private $route_costs; + /** + * Total cost of the route. The sum of all costs in the cost map. + * + * Generated from protobuf field double route_total_cost = 18; + */ + private $route_total_cost = 0.0; + /** + * Deprecated: Use [ShipmentRoute.Transition.loads][] instead. + * Vehicle loads upon arrival at its end location, for each + * type specified in [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or demands. Exception: we omit + * loads for quantity types unconstrained by intervals and that don't have any + * non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity end_loads = 13 [deprecated = true]; + * @deprecated + */ + private $end_loads; + /** + * Deprecated: Use [ShipmentRoute.Transition][] instead. + * Ordered list of travel steps for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.TravelStep travel_steps = 14 [deprecated = true]; + * @deprecated + */ + private $travel_steps; + /** + * Deprecated: No longer used. + * This field will only be populated at the + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit] level. + * Extra detour time due to the shipments visited on the route. + * It is equal to `vehicle_end_time` - `vehicle_start_time` - travel duration + * from the vehicle's start_location to its `end_location`. + * + * Generated from protobuf field .google.protobuf.Duration vehicle_detour = 15 [deprecated = true]; + * @deprecated + */ + protected $vehicle_detour = null; + /** + * Deprecated: Use [ShipmentRoute.Transition.delay_duration][] instead. + * Delay occurring before the vehicle end. See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_vehicle_end = 16 [deprecated = true]; + * @deprecated + */ + protected $delay_before_vehicle_end = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $vehicle_index + * Vehicle performing the route, identified by its index in the source + * `ShipmentModel`. + * @type string $vehicle_label + * Label of the vehicle performing this route, equal to + * `ShipmentModel.vehicles(vehicle_index).label`, if specified. + * @type \Google\Protobuf\Timestamp $vehicle_start_time + * Time at which the vehicle starts its route. + * @type \Google\Protobuf\Timestamp $vehicle_end_time + * Time at which the vehicle finishes its route. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\Visit[]|\Google\Protobuf\Internal\RepeatedField $visits + * Ordered sequence of visits representing a route. + * visits[i] is the i-th visit in the route. + * If this field is empty, the vehicle is considered as unused. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\Transition[]|\Google\Protobuf\Internal\RepeatedField $transitions + * Ordered list of transitions for the route. + * @type bool $has_traffic_infeasibilities + * When + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * is set to true, this field indicates that inconsistencies in route timings + * are predicted using traffic-based travel duration estimates. There may be + * insufficient time to complete traffic-adjusted travel, delays, and breaks + * between visits, before the first visit, or after the last visit, while + * still satisfying the visit and vehicle time windows. For example, + * ```start_time(previous_visit) + duration(previous_visit) + + * travel_duration(previous_visit, next_visit) > start_time(next_visit)``` + * Arrival at next_visit will likely happen later than its current + * time window due the increased estimate of travel time + * `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break + * may be forced to overlap with a visit due to an increase in travel time + * estimates and visit or break time window restrictions. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $route_polyline + * The encoded polyline representation of the route. + * This field is only populated if + * [OptimizeToursRequest.populate_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_polylines] + * is set to true. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\PBBreak[]|\Google\Protobuf\Internal\RepeatedField $breaks + * Breaks scheduled for the vehicle performing this route. + * The `breaks` sequence represents time intervals, each starting at the + * corresponding `start_time` and lasting `duration` seconds. + * @type \Google\Cloud\Optimization\V1\AggregatedMetrics $metrics + * Duration, distance and load metrics for this route. The fields of + * [AggregatedMetrics][google.cloud.optimization.v1.AggregatedMetrics] are summed over all [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] or + * [ShipmentRoute.visits][google.cloud.optimization.v1.ShipmentRoute.visits], depending on the context. + * @type array|\Google\Protobuf\Internal\MapField $route_costs + * Cost of the route, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. + * "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole route. + * In other words, costs["model.shipments.pickups.cost"] is the sum of all + * pickup costs over the route. All costs defined in the model are reported in + * detail here with the exception of costs related to TransitionAttributes + * that are only reported in an aggregated way as of 2022/01. + * @type float $route_total_cost + * Total cost of the route. The sum of all costs in the cost map. + * @type \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $end_loads + * Deprecated: Use [ShipmentRoute.Transition.loads][] instead. + * Vehicle loads upon arrival at its end location, for each + * type specified in [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or demands. Exception: we omit + * loads for quantity types unconstrained by intervals and that don't have any + * non-zero demand on the route. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\TravelStep[]|\Google\Protobuf\Internal\RepeatedField $travel_steps + * Deprecated: Use [ShipmentRoute.Transition][] instead. + * Ordered list of travel steps for the route. + * @type \Google\Protobuf\Duration $vehicle_detour + * Deprecated: No longer used. + * This field will only be populated at the + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit] level. + * Extra detour time due to the shipments visited on the route. + * It is equal to `vehicle_end_time` - `vehicle_start_time` - travel duration + * from the vehicle's start_location to its `end_location`. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\Delay $delay_before_vehicle_end + * Deprecated: Use [ShipmentRoute.Transition.delay_duration][] instead. + * Delay occurring before the vehicle end. See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Vehicle performing the route, identified by its index in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 vehicle_index = 1; + * @return int + */ + public function getVehicleIndex() + { + return $this->vehicle_index; + } + + /** + * Vehicle performing the route, identified by its index in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 vehicle_index = 1; + * @param int $var + * @return $this + */ + public function setVehicleIndex($var) + { + GPBUtil::checkInt32($var); + $this->vehicle_index = $var; + + return $this; + } + + /** + * Label of the vehicle performing this route, equal to + * `ShipmentModel.vehicles(vehicle_index).label`, if specified. + * + * Generated from protobuf field string vehicle_label = 2; + * @return string + */ + public function getVehicleLabel() + { + return $this->vehicle_label; + } + + /** + * Label of the vehicle performing this route, equal to + * `ShipmentModel.vehicles(vehicle_index).label`, if specified. + * + * Generated from protobuf field string vehicle_label = 2; + * @param string $var + * @return $this + */ + public function setVehicleLabel($var) + { + GPBUtil::checkString($var, True); + $this->vehicle_label = $var; + + return $this; + } + + /** + * Time at which the vehicle starts its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_start_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getVehicleStartTime() + { + return $this->vehicle_start_time; + } + + public function hasVehicleStartTime() + { + return isset($this->vehicle_start_time); + } + + public function clearVehicleStartTime() + { + unset($this->vehicle_start_time); + } + + /** + * Time at which the vehicle starts its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_start_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setVehicleStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->vehicle_start_time = $var; + + return $this; + } + + /** + * Time at which the vehicle finishes its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_end_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getVehicleEndTime() + { + return $this->vehicle_end_time; + } + + public function hasVehicleEndTime() + { + return isset($this->vehicle_end_time); + } + + public function clearVehicleEndTime() + { + unset($this->vehicle_end_time); + } + + /** + * Time at which the vehicle finishes its route. + * + * Generated from protobuf field .google.protobuf.Timestamp vehicle_end_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setVehicleEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->vehicle_end_time = $var; + + return $this; + } + + /** + * Ordered sequence of visits representing a route. + * visits[i] is the i-th visit in the route. + * If this field is empty, the vehicle is considered as unused. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Visit visits = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVisits() + { + return $this->visits; + } + + /** + * Ordered sequence of visits representing a route. + * visits[i] is the i-th visit in the route. + * If this field is empty, the vehicle is considered as unused. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Visit visits = 7; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\Visit[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVisits($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\Visit::class); + $this->visits = $arr; + + return $this; + } + + /** + * Ordered list of transitions for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Transition transitions = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitions() + { + return $this->transitions; + } + + /** + * Ordered list of transitions for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Transition transitions = 8; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\Transition[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\Transition::class); + $this->transitions = $arr; + + return $this; + } + + /** + * When + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * is set to true, this field indicates that inconsistencies in route timings + * are predicted using traffic-based travel duration estimates. There may be + * insufficient time to complete traffic-adjusted travel, delays, and breaks + * between visits, before the first visit, or after the last visit, while + * still satisfying the visit and vehicle time windows. For example, + * ```start_time(previous_visit) + duration(previous_visit) + + * travel_duration(previous_visit, next_visit) > start_time(next_visit)``` + * Arrival at next_visit will likely happen later than its current + * time window due the increased estimate of travel time + * `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break + * may be forced to overlap with a visit due to an increase in travel time + * estimates and visit or break time window restrictions. + * + * Generated from protobuf field bool has_traffic_infeasibilities = 9; + * @return bool + */ + public function getHasTrafficInfeasibilities() + { + return $this->has_traffic_infeasibilities; + } + + /** + * When + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * is set to true, this field indicates that inconsistencies in route timings + * are predicted using traffic-based travel duration estimates. There may be + * insufficient time to complete traffic-adjusted travel, delays, and breaks + * between visits, before the first visit, or after the last visit, while + * still satisfying the visit and vehicle time windows. For example, + * ```start_time(previous_visit) + duration(previous_visit) + + * travel_duration(previous_visit, next_visit) > start_time(next_visit)``` + * Arrival at next_visit will likely happen later than its current + * time window due the increased estimate of travel time + * `travel_duration(previous_visit, next_visit)` due to traffic. Also, a break + * may be forced to overlap with a visit due to an increase in travel time + * estimates and visit or break time window restrictions. + * + * Generated from protobuf field bool has_traffic_infeasibilities = 9; + * @param bool $var + * @return $this + */ + public function setHasTrafficInfeasibilities($var) + { + GPBUtil::checkBool($var); + $this->has_traffic_infeasibilities = $var; + + return $this; + } + + /** + * The encoded polyline representation of the route. + * This field is only populated if + * [OptimizeToursRequest.populate_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 10; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline|null + */ + public function getRoutePolyline() + { + return $this->route_polyline; + } + + public function hasRoutePolyline() + { + return isset($this->route_polyline); + } + + public function clearRoutePolyline() + { + unset($this->route_polyline); + } + + /** + * The encoded polyline representation of the route. + * This field is only populated if + * [OptimizeToursRequest.populate_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 10; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $var + * @return $this + */ + public function setRoutePolyline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline::class); + $this->route_polyline = $var; + + return $this; + } + + /** + * Breaks scheduled for the vehicle performing this route. + * The `breaks` sequence represents time intervals, each starting at the + * corresponding `start_time` and lasting `duration` seconds. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Break breaks = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBreaks() + { + return $this->breaks; + } + + /** + * Breaks scheduled for the vehicle performing this route. + * The `breaks` sequence represents time intervals, each starting at the + * corresponding `start_time` and lasting `duration` seconds. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.Break breaks = 11; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\PBBreak[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBreaks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\PBBreak::class); + $this->breaks = $arr; + + return $this; + } + + /** + * Duration, distance and load metrics for this route. The fields of + * [AggregatedMetrics][google.cloud.optimization.v1.AggregatedMetrics] are summed over all [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] or + * [ShipmentRoute.visits][google.cloud.optimization.v1.ShipmentRoute.visits], depending on the context. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics metrics = 12; + * @return \Google\Cloud\Optimization\V1\AggregatedMetrics|null + */ + public function getMetrics() + { + return $this->metrics; + } + + public function hasMetrics() + { + return isset($this->metrics); + } + + public function clearMetrics() + { + unset($this->metrics); + } + + /** + * Duration, distance and load metrics for this route. The fields of + * [AggregatedMetrics][google.cloud.optimization.v1.AggregatedMetrics] are summed over all [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] or + * [ShipmentRoute.visits][google.cloud.optimization.v1.ShipmentRoute.visits], depending on the context. + * + * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics metrics = 12; + * @param \Google\Cloud\Optimization\V1\AggregatedMetrics $var + * @return $this + */ + public function setMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\AggregatedMetrics::class); + $this->metrics = $var; + + return $this; + } + + /** + * Cost of the route, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. + * "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole route. + * In other words, costs["model.shipments.pickups.cost"] is the sum of all + * pickup costs over the route. All costs defined in the model are reported in + * detail here with the exception of costs related to TransitionAttributes + * that are only reported in an aggregated way as of 2022/01. + * + * Generated from protobuf field map route_costs = 17; + * @return \Google\Protobuf\Internal\MapField + */ + public function getRouteCosts() + { + return $this->route_costs; + } + + /** + * Cost of the route, broken down by cost-related request fields. + * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. + * "model.shipments.pickups.cost", and the values are the total cost + * generated by the corresponding cost field, aggregated over the whole route. + * In other words, costs["model.shipments.pickups.cost"] is the sum of all + * pickup costs over the route. All costs defined in the model are reported in + * detail here with the exception of costs related to TransitionAttributes + * that are only reported in an aggregated way as of 2022/01. + * + * Generated from protobuf field map route_costs = 17; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setRouteCosts($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::DOUBLE); + $this->route_costs = $arr; + + return $this; + } + + /** + * Total cost of the route. The sum of all costs in the cost map. + * + * Generated from protobuf field double route_total_cost = 18; + * @return float + */ + public function getRouteTotalCost() + { + return $this->route_total_cost; + } + + /** + * Total cost of the route. The sum of all costs in the cost map. + * + * Generated from protobuf field double route_total_cost = 18; + * @param float $var + * @return $this + */ + public function setRouteTotalCost($var) + { + GPBUtil::checkDouble($var); + $this->route_total_cost = $var; + + return $this; + } + + /** + * Deprecated: Use [ShipmentRoute.Transition.loads][] instead. + * Vehicle loads upon arrival at its end location, for each + * type specified in [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or demands. Exception: we omit + * loads for quantity types unconstrained by intervals and that don't have any + * non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity end_loads = 13 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getEndLoads() + { + @trigger_error('end_loads is deprecated.', E_USER_DEPRECATED); + return $this->end_loads; + } + + /** + * Deprecated: Use [ShipmentRoute.Transition.loads][] instead. + * Vehicle loads upon arrival at its end location, for each + * type specified in [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], + * `start_load_intervals`, `end_load_intervals` or demands. Exception: we omit + * loads for quantity types unconstrained by intervals and that don't have any + * non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity end_loads = 13 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setEndLoads($var) + { + @trigger_error('end_loads is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->end_loads = $arr; + + return $this; + } + + /** + * Deprecated: Use [ShipmentRoute.Transition][] instead. + * Ordered list of travel steps for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.TravelStep travel_steps = 14 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getTravelSteps() + { + @trigger_error('travel_steps is deprecated.', E_USER_DEPRECATED); + return $this->travel_steps; + } + + /** + * Deprecated: Use [ShipmentRoute.Transition][] instead. + * Ordered list of travel steps for the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.ShipmentRoute.TravelStep travel_steps = 14 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\TravelStep[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setTravelSteps($var) + { + @trigger_error('travel_steps is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\TravelStep::class); + $this->travel_steps = $arr; + + return $this; + } + + /** + * Deprecated: No longer used. + * This field will only be populated at the + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit] level. + * Extra detour time due to the shipments visited on the route. + * It is equal to `vehicle_end_time` - `vehicle_start_time` - travel duration + * from the vehicle's start_location to its `end_location`. + * + * Generated from protobuf field .google.protobuf.Duration vehicle_detour = 15 [deprecated = true]; + * @return \Google\Protobuf\Duration|null + * @deprecated + */ + public function getVehicleDetour() + { + @trigger_error('vehicle_detour is deprecated.', E_USER_DEPRECATED); + return $this->vehicle_detour; + } + + public function hasVehicleDetour() + { + @trigger_error('vehicle_detour is deprecated.', E_USER_DEPRECATED); + return isset($this->vehicle_detour); + } + + public function clearVehicleDetour() + { + @trigger_error('vehicle_detour is deprecated.', E_USER_DEPRECATED); + unset($this->vehicle_detour); + } + + /** + * Deprecated: No longer used. + * This field will only be populated at the + * [ShipmentRoute.Visit][google.cloud.optimization.v1.ShipmentRoute.Visit] level. + * Extra detour time due to the shipments visited on the route. + * It is equal to `vehicle_end_time` - `vehicle_start_time` - travel duration + * from the vehicle's start_location to its `end_location`. + * + * Generated from protobuf field .google.protobuf.Duration vehicle_detour = 15 [deprecated = true]; + * @param \Google\Protobuf\Duration $var + * @return $this + * @deprecated + */ + public function setVehicleDetour($var) + { + @trigger_error('vehicle_detour is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->vehicle_detour = $var; + + return $this; + } + + /** + * Deprecated: Use [ShipmentRoute.Transition.delay_duration][] instead. + * Delay occurring before the vehicle end. See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_vehicle_end = 16 [deprecated = true]; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\Delay|null + * @deprecated + */ + public function getDelayBeforeVehicleEnd() + { + @trigger_error('delay_before_vehicle_end is deprecated.', E_USER_DEPRECATED); + return $this->delay_before_vehicle_end; + } + + public function hasDelayBeforeVehicleEnd() + { + @trigger_error('delay_before_vehicle_end is deprecated.', E_USER_DEPRECATED); + return isset($this->delay_before_vehicle_end); + } + + public function clearDelayBeforeVehicleEnd() + { + @trigger_error('delay_before_vehicle_end is deprecated.', E_USER_DEPRECATED); + unset($this->delay_before_vehicle_end); + } + + /** + * Deprecated: Use [ShipmentRoute.Transition.delay_duration][] instead. + * Delay occurring before the vehicle end. See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_vehicle_end = 16 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\Delay $var + * @return $this + * @deprecated + */ + public function setDelayBeforeVehicleEnd($var) + { + @trigger_error('delay_before_vehicle_end is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\Delay::class); + $this->delay_before_vehicle_end = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/ShipmentRoute/Delay.php b/Optimization/src/V1/ShipmentRoute/Delay.php new file mode 100644 index 000000000000..42063593ce5b --- /dev/null +++ b/Optimization/src/V1/ShipmentRoute/Delay.php @@ -0,0 +1,124 @@ +google.cloud.optimization.v1.ShipmentRoute.Delay + */ +class Delay extends \Google\Protobuf\Internal\Message +{ + /** + * Start of the delay. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + private $start_time = null; + /** + * Duration of the delay. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + private $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Start of the delay. + * @type \Google\Protobuf\Duration $duration + * Duration of the delay. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Start of the delay. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start of the delay. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Duration of the delay. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of the delay. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentRoute/EncodedPolyline.php b/Optimization/src/V1/ShipmentRoute/EncodedPolyline.php new file mode 100644 index 000000000000..441e0efb6cc6 --- /dev/null +++ b/Optimization/src/V1/ShipmentRoute/EncodedPolyline.php @@ -0,0 +1,71 @@ +google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline + */ +class EncodedPolyline extends \Google\Protobuf\Internal\Message +{ + /** + * String representing encoded points of the polyline. + * + * Generated from protobuf field string points = 1; + */ + private $points = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $points + * String representing encoded points of the polyline. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * String representing encoded points of the polyline. + * + * Generated from protobuf field string points = 1; + * @return string + */ + public function getPoints() + { + return $this->points; + } + + /** + * String representing encoded points of the polyline. + * + * Generated from protobuf field string points = 1; + * @param string $var + * @return $this + */ + public function setPoints($var) + { + GPBUtil::checkString($var, True); + $this->points = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentRoute/PBBreak.php b/Optimization/src/V1/ShipmentRoute/PBBreak.php new file mode 100644 index 000000000000..8e137a3a492e --- /dev/null +++ b/Optimization/src/V1/ShipmentRoute/PBBreak.php @@ -0,0 +1,122 @@ +google.cloud.optimization.v1.ShipmentRoute.Break + */ +class PBBreak extends \Google\Protobuf\Internal\Message +{ + /** + * Start time of a break. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + private $start_time = null; + /** + * Duration of a break. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + private $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Start time of a break. + * @type \Google\Protobuf\Duration $duration + * Duration of a break. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Start time of a break. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start time of a break. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Duration of a break. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of a break. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentRoute/Transition.php b/Optimization/src/V1/ShipmentRoute/Transition.php new file mode 100644 index 000000000000..d59cbcd3238f --- /dev/null +++ b/Optimization/src/V1/ShipmentRoute/Transition.php @@ -0,0 +1,598 @@ +google.cloud.optimization.v1.ShipmentRoute.Transition + */ +class Transition extends \Google\Protobuf\Internal\Message +{ + /** + * Travel duration during this transition. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 1; + */ + private $travel_duration = null; + /** + * Distance traveled during the transition. + * + * Generated from protobuf field double travel_distance_meters = 2; + */ + private $travel_distance_meters = 0.0; + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic] + * [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a `Transition`, this + * boolean is set to true. This may be temporary (rare hiccup in the + * realtime traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + */ + private $traffic_info_unavailable = false; + /** + * Sum of the delay durations applied to this transition. If any, the delay + * starts exactly `delay_duration` seconds before the next event (visit or + * vehicle end). See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + */ + private $delay_duration = null; + /** + * Sum of the duration of the breaks occurring during this transition, if + * any. Details about each break's start time and duration are stored in + * [ShipmentRoute.breaks][google.cloud.optimization.v1.ShipmentRoute.breaks]. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + */ + private $break_duration = null; + /** + * Time spent waiting during this transition. Wait duration corresponds to + * idle time and does not include break time. Also note that this wait time + * may be split into several non-contiguous intervals. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 6; + */ + private $wait_duration = null; + /** + * Total duration of the transition, provided for convenience. It is equal + * to: + * * next visit `start_time` (or `vehicle_end_time` if this is the last + * transition) - this transition's `start_time`; + * * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following + * additionally holds: `total_duration = travel_duration + delay_duration + * + break_duration + wait_duration`. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + */ + private $total_duration = null; + /** + * Start time of this transition. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + */ + private $start_time = null; + /** + * The encoded polyline representation of the route followed during the + * transition. + * This field is only populated if [populate_transition_polylines] + * [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 9; + */ + private $route_polyline = null; + /** + * Vehicle loads during this transition, for each type that either appears + * in this vehicle's [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits], or that have non-zero + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] on some shipment performed on this route. + * The loads during the first transition are the starting loads of the + * vehicle route. Then, after each visit, the visit's `load_demands` are + * either added or subtracted to get the next transition's loads, depending + * on whether the visit was a pickup or a delivery. + * + * Generated from protobuf field map vehicle_loads = 11; + */ + private $vehicle_loads; + /** + * Deprecated: Use [Transition.vehicle_loads][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity loads = 10 [deprecated = true]; + * @deprecated + */ + private $loads; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $travel_duration + * Travel duration during this transition. + * @type float $travel_distance_meters + * Distance traveled during the transition. + * @type bool $traffic_info_unavailable + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic] + * [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a `Transition`, this + * boolean is set to true. This may be temporary (rare hiccup in the + * realtime traffic servers) or permanent (no data for this location). + * @type \Google\Protobuf\Duration $delay_duration + * Sum of the delay durations applied to this transition. If any, the delay + * starts exactly `delay_duration` seconds before the next event (visit or + * vehicle end). See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * @type \Google\Protobuf\Duration $break_duration + * Sum of the duration of the breaks occurring during this transition, if + * any. Details about each break's start time and duration are stored in + * [ShipmentRoute.breaks][google.cloud.optimization.v1.ShipmentRoute.breaks]. + * @type \Google\Protobuf\Duration $wait_duration + * Time spent waiting during this transition. Wait duration corresponds to + * idle time and does not include break time. Also note that this wait time + * may be split into several non-contiguous intervals. + * @type \Google\Protobuf\Duration $total_duration + * Total duration of the transition, provided for convenience. It is equal + * to: + * * next visit `start_time` (or `vehicle_end_time` if this is the last + * transition) - this transition's `start_time`; + * * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following + * additionally holds: `total_duration = travel_duration + delay_duration + * + break_duration + wait_duration`. + * @type \Google\Protobuf\Timestamp $start_time + * Start time of this transition. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $route_polyline + * The encoded polyline representation of the route followed during the + * transition. + * This field is only populated if [populate_transition_polylines] + * [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * is set to true. + * @type array|\Google\Protobuf\Internal\MapField $vehicle_loads + * Vehicle loads during this transition, for each type that either appears + * in this vehicle's [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits], or that have non-zero + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] on some shipment performed on this route. + * The loads during the first transition are the starting loads of the + * vehicle route. Then, after each visit, the visit's `load_demands` are + * either added or subtracted to get the next transition's loads, depending + * on whether the visit was a pickup or a delivery. + * @type \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $loads + * Deprecated: Use [Transition.vehicle_loads][] instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Travel duration during this transition. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getTravelDuration() + { + return $this->travel_duration; + } + + public function hasTravelDuration() + { + return isset($this->travel_duration); + } + + public function clearTravelDuration() + { + unset($this->travel_duration); + } + + /** + * Travel duration during this transition. + * + * Generated from protobuf field .google.protobuf.Duration travel_duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTravelDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->travel_duration = $var; + + return $this; + } + + /** + * Distance traveled during the transition. + * + * Generated from protobuf field double travel_distance_meters = 2; + * @return float + */ + public function getTravelDistanceMeters() + { + return $this->travel_distance_meters; + } + + /** + * Distance traveled during the transition. + * + * Generated from protobuf field double travel_distance_meters = 2; + * @param float $var + * @return $this + */ + public function setTravelDistanceMeters($var) + { + GPBUtil::checkDouble($var); + $this->travel_distance_meters = $var; + + return $this; + } + + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic] + * [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a `Transition`, this + * boolean is set to true. This may be temporary (rare hiccup in the + * realtime traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + * @return bool + */ + public function getTrafficInfoUnavailable() + { + return $this->traffic_info_unavailable; + } + + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic] + * [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a `Transition`, this + * boolean is set to true. This may be temporary (rare hiccup in the + * realtime traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + * @param bool $var + * @return $this + */ + public function setTrafficInfoUnavailable($var) + { + GPBUtil::checkBool($var); + $this->traffic_info_unavailable = $var; + + return $this; + } + + /** + * Sum of the delay durations applied to this transition. If any, the delay + * starts exactly `delay_duration` seconds before the next event (visit or + * vehicle end). See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getDelayDuration() + { + return $this->delay_duration; + } + + public function hasDelayDuration() + { + return isset($this->delay_duration); + } + + public function clearDelayDuration() + { + unset($this->delay_duration); + } + + /** + * Sum of the delay durations applied to this transition. If any, the delay + * starts exactly `delay_duration` seconds before the next event (visit or + * vehicle end). See + * [TransitionAttributes.delay][google.cloud.optimization.v1.TransitionAttributes.delay]. + * + * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDelayDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->delay_duration = $var; + + return $this; + } + + /** + * Sum of the duration of the breaks occurring during this transition, if + * any. Details about each break's start time and duration are stored in + * [ShipmentRoute.breaks][google.cloud.optimization.v1.ShipmentRoute.breaks]. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getBreakDuration() + { + return $this->break_duration; + } + + public function hasBreakDuration() + { + return isset($this->break_duration); + } + + public function clearBreakDuration() + { + unset($this->break_duration); + } + + /** + * Sum of the duration of the breaks occurring during this transition, if + * any. Details about each break's start time and duration are stored in + * [ShipmentRoute.breaks][google.cloud.optimization.v1.ShipmentRoute.breaks]. + * + * Generated from protobuf field .google.protobuf.Duration break_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->break_duration = $var; + + return $this; + } + + /** + * Time spent waiting during this transition. Wait duration corresponds to + * idle time and does not include break time. Also note that this wait time + * may be split into several non-contiguous intervals. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 6; + * @return \Google\Protobuf\Duration|null + */ + public function getWaitDuration() + { + return $this->wait_duration; + } + + public function hasWaitDuration() + { + return isset($this->wait_duration); + } + + public function clearWaitDuration() + { + unset($this->wait_duration); + } + + /** + * Time spent waiting during this transition. Wait duration corresponds to + * idle time and does not include break time. Also note that this wait time + * may be split into several non-contiguous intervals. + * + * Generated from protobuf field .google.protobuf.Duration wait_duration = 6; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setWaitDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->wait_duration = $var; + + return $this; + } + + /** + * Total duration of the transition, provided for convenience. It is equal + * to: + * * next visit `start_time` (or `vehicle_end_time` if this is the last + * transition) - this transition's `start_time`; + * * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following + * additionally holds: `total_duration = travel_duration + delay_duration + * + break_duration + wait_duration`. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getTotalDuration() + { + return $this->total_duration; + } + + public function hasTotalDuration() + { + return isset($this->total_duration); + } + + public function clearTotalDuration() + { + unset($this->total_duration); + } + + /** + * Total duration of the transition, provided for convenience. It is equal + * to: + * * next visit `start_time` (or `vehicle_end_time` if this is the last + * transition) - this transition's `start_time`; + * * if `ShipmentRoute.has_traffic_infeasibilities` is false, the following + * additionally holds: `total_duration = travel_duration + delay_duration + * + break_duration + wait_duration`. + * + * Generated from protobuf field .google.protobuf.Duration total_duration = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTotalDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->total_duration = $var; + + return $this; + } + + /** + * Start time of this transition. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start time of this transition. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The encoded polyline representation of the route followed during the + * transition. + * This field is only populated if [populate_transition_polylines] + * [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 9; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline|null + */ + public function getRoutePolyline() + { + return $this->route_polyline; + } + + public function hasRoutePolyline() + { + return isset($this->route_polyline); + } + + public function clearRoutePolyline() + { + unset($this->route_polyline); + } + + /** + * The encoded polyline representation of the route followed during the + * transition. + * This field is only populated if [populate_transition_polylines] + * [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 9; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $var + * @return $this + */ + public function setRoutePolyline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline::class); + $this->route_polyline = $var; + + return $this; + } + + /** + * Vehicle loads during this transition, for each type that either appears + * in this vehicle's [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits], or that have non-zero + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] on some shipment performed on this route. + * The loads during the first transition are the starting loads of the + * vehicle route. Then, after each visit, the visit's `load_demands` are + * either added or subtracted to get the next transition's loads, depending + * on whether the visit was a pickup or a delivery. + * + * Generated from protobuf field map vehicle_loads = 11; + * @return \Google\Protobuf\Internal\MapField + */ + public function getVehicleLoads() + { + return $this->vehicle_loads; + } + + /** + * Vehicle loads during this transition, for each type that either appears + * in this vehicle's [Vehicle.load_limits][google.cloud.optimization.v1.Vehicle.load_limits], or that have non-zero + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] on some shipment performed on this route. + * The loads during the first transition are the starting loads of the + * vehicle route. Then, after each visit, the visit's `load_demands` are + * either added or subtracted to get the next transition's loads, depending + * on whether the visit was a pickup or a delivery. + * + * Generated from protobuf field map vehicle_loads = 11; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setVehicleLoads($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\ShipmentRoute\VehicleLoad::class); + $this->vehicle_loads = $arr; + + return $this; + } + + /** + * Deprecated: Use [Transition.vehicle_loads][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity loads = 10 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getLoads() + { + @trigger_error('loads is deprecated.', E_USER_DEPRECATED); + return $this->loads; + } + + /** + * Deprecated: Use [Transition.vehicle_loads][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity loads = 10 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setLoads($var) + { + @trigger_error('loads is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->loads = $arr; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentRoute/TravelStep.php b/Optimization/src/V1/ShipmentRoute/TravelStep.php new file mode 100644 index 000000000000..12b20ac635da --- /dev/null +++ b/Optimization/src/V1/ShipmentRoute/TravelStep.php @@ -0,0 +1,232 @@ +google.cloud.optimization.v1.ShipmentRoute.TravelStep + */ +class TravelStep extends \Google\Protobuf\Internal\Message +{ + /** + * Duration of the travel step. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + */ + private $duration = null; + /** + * Distance traveled during the step. + * + * Generated from protobuf field double distance_meters = 2; + */ + private $distance_meters = 0.0; + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a TravelStep, this boolean + * is set to true. This may be temporary (rare hiccup in the realtime + * traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + */ + private $traffic_info_unavailable = false; + /** + * The encoded polyline representation of the route followed during the + * step. + * This field is only populated if + * [OptimizeToursRequest.populate_travel_step_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_travel_step_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 4; + */ + private $route_polyline = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $duration + * Duration of the travel step. + * @type float $distance_meters + * Distance traveled during the step. + * @type bool $traffic_info_unavailable + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a TravelStep, this boolean + * is set to true. This may be temporary (rare hiccup in the realtime + * traffic servers) or permanent (no data for this location). + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $route_polyline + * The encoded polyline representation of the route followed during the + * step. + * This field is only populated if + * [OptimizeToursRequest.populate_travel_step_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_travel_step_polylines] + * is set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Duration of the travel step. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of the travel step. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * Distance traveled during the step. + * + * Generated from protobuf field double distance_meters = 2; + * @return float + */ + public function getDistanceMeters() + { + return $this->distance_meters; + } + + /** + * Distance traveled during the step. + * + * Generated from protobuf field double distance_meters = 2; + * @param float $var + * @return $this + */ + public function setDistanceMeters($var) + { + GPBUtil::checkDouble($var); + $this->distance_meters = $var; + + return $this; + } + + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a TravelStep, this boolean + * is set to true. This may be temporary (rare hiccup in the realtime + * traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + * @return bool + */ + public function getTrafficInfoUnavailable() + { + return $this->traffic_info_unavailable; + } + + /** + * When traffic is requested via + * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], + * and the traffic info couldn't be retrieved for a TravelStep, this boolean + * is set to true. This may be temporary (rare hiccup in the realtime + * traffic servers) or permanent (no data for this location). + * + * Generated from protobuf field bool traffic_info_unavailable = 3; + * @param bool $var + * @return $this + */ + public function setTrafficInfoUnavailable($var) + { + GPBUtil::checkBool($var); + $this->traffic_info_unavailable = $var; + + return $this; + } + + /** + * The encoded polyline representation of the route followed during the + * step. + * This field is only populated if + * [OptimizeToursRequest.populate_travel_step_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_travel_step_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 4; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline|null + */ + public function getRoutePolyline() + { + return $this->route_polyline; + } + + public function hasRoutePolyline() + { + return isset($this->route_polyline); + } + + public function clearRoutePolyline() + { + unset($this->route_polyline); + } + + /** + * The encoded polyline representation of the route followed during the + * step. + * This field is only populated if + * [OptimizeToursRequest.populate_travel_step_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_travel_step_polylines] + * is set to true. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 4; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline $var + * @return $this + */ + public function setRoutePolyline($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\EncodedPolyline::class); + $this->route_polyline = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentRoute/VehicleLoad.php b/Optimization/src/V1/ShipmentRoute/VehicleLoad.php new file mode 100644 index 000000000000..7d007fd6aad5 --- /dev/null +++ b/Optimization/src/V1/ShipmentRoute/VehicleLoad.php @@ -0,0 +1,73 @@ +google.cloud.optimization.v1.ShipmentRoute.VehicleLoad + */ +class VehicleLoad extends \Google\Protobuf\Internal\Message +{ + /** + * The amount of load on the vehicle, for the given type. The unit of load + * is usually indicated by the type. See [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads]. + * + * Generated from protobuf field int64 amount = 1; + */ + private $amount = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $amount + * The amount of load on the vehicle, for the given type. The unit of load + * is usually indicated by the type. See [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The amount of load on the vehicle, for the given type. The unit of load + * is usually indicated by the type. See [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads]. + * + * Generated from protobuf field int64 amount = 1; + * @return int|string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * The amount of load on the vehicle, for the given type. The unit of load + * is usually indicated by the type. See [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads]. + * + * Generated from protobuf field int64 amount = 1; + * @param int|string $var + * @return $this + */ + public function setAmount($var) + { + GPBUtil::checkInt64($var); + $this->amount = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentRoute/Visit.php b/Optimization/src/V1/ShipmentRoute/Visit.php new file mode 100644 index 000000000000..437c096a072c --- /dev/null +++ b/Optimization/src/V1/ShipmentRoute/Visit.php @@ -0,0 +1,576 @@ +google.cloud.optimization.v1.ShipmentRoute.Visit + */ +class Visit extends \Google\Protobuf\Internal\Message +{ + /** + * Index of the `shipments` field in the source [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. + * + * Generated from protobuf field int32 shipment_index = 1; + */ + private $shipment_index = 0; + /** + * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it + * corresponds to a delivery. + * + * Generated from protobuf field bool is_pickup = 2; + */ + private $is_pickup = false; + /** + * Index of `VisitRequest` in either the pickup or delivery field of the + * `Shipment` (see `is_pickup`). + * + * Generated from protobuf field int32 visit_request_index = 3; + */ + private $visit_request_index = 0; + /** + * Time at which the visit starts. Note that the vehicle may arrive earlier + * than this at the visit location. Times are consistent with the + * `ShipmentModel`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + */ + private $start_time = null; + /** + * Total visit load demand as the sum of the shipment and the visit request + * `load_demands`. The values are negative if the visit is a delivery. + * Demands are reported for the same types as the + * [Transition.loads][google.cloud.optimization.v1.ShipmentRoute.Transition] + * (see this field). + * + * Generated from protobuf field map load_demands = 11; + */ + private $load_demands; + /** + * Extra detour time due to the shipments visited on the route before the + * visit and to the potential waiting time induced by time windows. + * If the visit is a delivery, the detour is computed from the corresponding + * pickup visit and is equal to: + * ``` + * start_time(delivery) - start_time(pickup) + * - (duration(pickup) + travel duration from the pickup location + * to the delivery location). + * ``` + * Otherwise, it is computed from the vehicle `start_location` and is equal + * to: + * ``` + * start_time - vehicle_start_time - travel duration from + * the vehicle's `start_location` to the visit. + * ``` + * + * Generated from protobuf field .google.protobuf.Duration detour = 6; + */ + private $detour = null; + /** + * Copy of the corresponding `Shipment.label`, if specified in the + * `Shipment`. + * + * Generated from protobuf field string shipment_label = 7; + */ + private $shipment_label = ''; + /** + * Copy of the corresponding + * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], + * if specified in the `VisitRequest`. + * + * Generated from protobuf field string visit_label = 8; + */ + private $visit_label = ''; + /** + * Deprecated: Use [ShipmentRoute.Transition.loads][] instead. + * Vehicle loads upon arrival at the visit location, for each + * type specified in [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], `start_load_intervals`, + * `end_load_intervals` or `demands`. + * Exception: we omit loads for quantity types unconstrained by intervals + * and that don't have any non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity arrival_loads = 9 [deprecated = true]; + * @deprecated + */ + private $arrival_loads; + /** + * Deprecated: Use [ShipmentRoute.Transition.delay_duration][] instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_start = 10 [deprecated = true]; + * @deprecated + */ + protected $delay_before_start = null; + /** + * Deprecated: Use [Visit.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 5 [deprecated = true]; + * @deprecated + */ + private $demands; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $shipment_index + * Index of the `shipments` field in the source [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. + * @type bool $is_pickup + * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it + * corresponds to a delivery. + * @type int $visit_request_index + * Index of `VisitRequest` in either the pickup or delivery field of the + * `Shipment` (see `is_pickup`). + * @type \Google\Protobuf\Timestamp $start_time + * Time at which the visit starts. Note that the vehicle may arrive earlier + * than this at the visit location. Times are consistent with the + * `ShipmentModel`. + * @type array|\Google\Protobuf\Internal\MapField $load_demands + * Total visit load demand as the sum of the shipment and the visit request + * `load_demands`. The values are negative if the visit is a delivery. + * Demands are reported for the same types as the + * [Transition.loads][google.cloud.optimization.v1.ShipmentRoute.Transition] + * (see this field). + * @type \Google\Protobuf\Duration $detour + * Extra detour time due to the shipments visited on the route before the + * visit and to the potential waiting time induced by time windows. + * If the visit is a delivery, the detour is computed from the corresponding + * pickup visit and is equal to: + * ``` + * start_time(delivery) - start_time(pickup) + * - (duration(pickup) + travel duration from the pickup location + * to the delivery location). + * ``` + * Otherwise, it is computed from the vehicle `start_location` and is equal + * to: + * ``` + * start_time - vehicle_start_time - travel duration from + * the vehicle's `start_location` to the visit. + * ``` + * @type string $shipment_label + * Copy of the corresponding `Shipment.label`, if specified in the + * `Shipment`. + * @type string $visit_label + * Copy of the corresponding + * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], + * if specified in the `VisitRequest`. + * @type \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $arrival_loads + * Deprecated: Use [ShipmentRoute.Transition.loads][] instead. + * Vehicle loads upon arrival at the visit location, for each + * type specified in [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], `start_load_intervals`, + * `end_load_intervals` or `demands`. + * Exception: we omit loads for quantity types unconstrained by intervals + * and that don't have any non-zero demand on the route. + * @type \Google\Cloud\Optimization\V1\ShipmentRoute\Delay $delay_before_start + * Deprecated: Use [ShipmentRoute.Transition.delay_duration][] instead. + * @type \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $demands + * Deprecated: Use [Visit.load_demands][] instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Index of the `shipments` field in the source [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. + * + * Generated from protobuf field int32 shipment_index = 1; + * @return int + */ + public function getShipmentIndex() + { + return $this->shipment_index; + } + + /** + * Index of the `shipments` field in the source [ShipmentModel][google.cloud.optimization.v1.ShipmentModel]. + * + * Generated from protobuf field int32 shipment_index = 1; + * @param int $var + * @return $this + */ + public function setShipmentIndex($var) + { + GPBUtil::checkInt32($var); + $this->shipment_index = $var; + + return $this; + } + + /** + * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it + * corresponds to a delivery. + * + * Generated from protobuf field bool is_pickup = 2; + * @return bool + */ + public function getIsPickup() + { + return $this->is_pickup; + } + + /** + * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it + * corresponds to a delivery. + * + * Generated from protobuf field bool is_pickup = 2; + * @param bool $var + * @return $this + */ + public function setIsPickup($var) + { + GPBUtil::checkBool($var); + $this->is_pickup = $var; + + return $this; + } + + /** + * Index of `VisitRequest` in either the pickup or delivery field of the + * `Shipment` (see `is_pickup`). + * + * Generated from protobuf field int32 visit_request_index = 3; + * @return int + */ + public function getVisitRequestIndex() + { + return $this->visit_request_index; + } + + /** + * Index of `VisitRequest` in either the pickup or delivery field of the + * `Shipment` (see `is_pickup`). + * + * Generated from protobuf field int32 visit_request_index = 3; + * @param int $var + * @return $this + */ + public function setVisitRequestIndex($var) + { + GPBUtil::checkInt32($var); + $this->visit_request_index = $var; + + return $this; + } + + /** + * Time at which the visit starts. Note that the vehicle may arrive earlier + * than this at the visit location. Times are consistent with the + * `ShipmentModel`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time at which the visit starts. Note that the vehicle may arrive earlier + * than this at the visit location. Times are consistent with the + * `ShipmentModel`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Total visit load demand as the sum of the shipment and the visit request + * `load_demands`. The values are negative if the visit is a delivery. + * Demands are reported for the same types as the + * [Transition.loads][google.cloud.optimization.v1.ShipmentRoute.Transition] + * (see this field). + * + * Generated from protobuf field map load_demands = 11; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLoadDemands() + { + return $this->load_demands; + } + + /** + * Total visit load demand as the sum of the shipment and the visit request + * `load_demands`. The values are negative if the visit is a delivery. + * Demands are reported for the same types as the + * [Transition.loads][google.cloud.optimization.v1.ShipmentRoute.Transition] + * (see this field). + * + * Generated from protobuf field map load_demands = 11; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLoadDemands($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Shipment\Load::class); + $this->load_demands = $arr; + + return $this; + } + + /** + * Extra detour time due to the shipments visited on the route before the + * visit and to the potential waiting time induced by time windows. + * If the visit is a delivery, the detour is computed from the corresponding + * pickup visit and is equal to: + * ``` + * start_time(delivery) - start_time(pickup) + * - (duration(pickup) + travel duration from the pickup location + * to the delivery location). + * ``` + * Otherwise, it is computed from the vehicle `start_location` and is equal + * to: + * ``` + * start_time - vehicle_start_time - travel duration from + * the vehicle's `start_location` to the visit. + * ``` + * + * Generated from protobuf field .google.protobuf.Duration detour = 6; + * @return \Google\Protobuf\Duration|null + */ + public function getDetour() + { + return $this->detour; + } + + public function hasDetour() + { + return isset($this->detour); + } + + public function clearDetour() + { + unset($this->detour); + } + + /** + * Extra detour time due to the shipments visited on the route before the + * visit and to the potential waiting time induced by time windows. + * If the visit is a delivery, the detour is computed from the corresponding + * pickup visit and is equal to: + * ``` + * start_time(delivery) - start_time(pickup) + * - (duration(pickup) + travel duration from the pickup location + * to the delivery location). + * ``` + * Otherwise, it is computed from the vehicle `start_location` and is equal + * to: + * ``` + * start_time - vehicle_start_time - travel duration from + * the vehicle's `start_location` to the visit. + * ``` + * + * Generated from protobuf field .google.protobuf.Duration detour = 6; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDetour($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->detour = $var; + + return $this; + } + + /** + * Copy of the corresponding `Shipment.label`, if specified in the + * `Shipment`. + * + * Generated from protobuf field string shipment_label = 7; + * @return string + */ + public function getShipmentLabel() + { + return $this->shipment_label; + } + + /** + * Copy of the corresponding `Shipment.label`, if specified in the + * `Shipment`. + * + * Generated from protobuf field string shipment_label = 7; + * @param string $var + * @return $this + */ + public function setShipmentLabel($var) + { + GPBUtil::checkString($var, True); + $this->shipment_label = $var; + + return $this; + } + + /** + * Copy of the corresponding + * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], + * if specified in the `VisitRequest`. + * + * Generated from protobuf field string visit_label = 8; + * @return string + */ + public function getVisitLabel() + { + return $this->visit_label; + } + + /** + * Copy of the corresponding + * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], + * if specified in the `VisitRequest`. + * + * Generated from protobuf field string visit_label = 8; + * @param string $var + * @return $this + */ + public function setVisitLabel($var) + { + GPBUtil::checkString($var, True); + $this->visit_label = $var; + + return $this; + } + + /** + * Deprecated: Use [ShipmentRoute.Transition.loads][] instead. + * Vehicle loads upon arrival at the visit location, for each + * type specified in [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], `start_load_intervals`, + * `end_load_intervals` or `demands`. + * Exception: we omit loads for quantity types unconstrained by intervals + * and that don't have any non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity arrival_loads = 9 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getArrivalLoads() + { + @trigger_error('arrival_loads is deprecated.', E_USER_DEPRECATED); + return $this->arrival_loads; + } + + /** + * Deprecated: Use [ShipmentRoute.Transition.loads][] instead. + * Vehicle loads upon arrival at the visit location, for each + * type specified in [Vehicle.capacities][google.cloud.optimization.v1.Vehicle.capacities], `start_load_intervals`, + * `end_load_intervals` or `demands`. + * Exception: we omit loads for quantity types unconstrained by intervals + * and that don't have any non-zero demand on the route. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity arrival_loads = 9 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setArrivalLoads($var) + { + @trigger_error('arrival_loads is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->arrival_loads = $arr; + + return $this; + } + + /** + * Deprecated: Use [ShipmentRoute.Transition.delay_duration][] instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_start = 10 [deprecated = true]; + * @return \Google\Cloud\Optimization\V1\ShipmentRoute\Delay|null + * @deprecated + */ + public function getDelayBeforeStart() + { + @trigger_error('delay_before_start is deprecated.', E_USER_DEPRECATED); + return $this->delay_before_start; + } + + public function hasDelayBeforeStart() + { + @trigger_error('delay_before_start is deprecated.', E_USER_DEPRECATED); + return isset($this->delay_before_start); + } + + public function clearDelayBeforeStart() + { + @trigger_error('delay_before_start is deprecated.', E_USER_DEPRECATED); + unset($this->delay_before_start); + } + + /** + * Deprecated: Use [ShipmentRoute.Transition.delay_duration][] instead. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.Delay delay_before_start = 10 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\ShipmentRoute\Delay $var + * @return $this + * @deprecated + */ + public function setDelayBeforeStart($var) + { + @trigger_error('delay_before_start is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\ShipmentRoute\Delay::class); + $this->delay_before_start = $var; + + return $this; + } + + /** + * Deprecated: Use [Visit.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 5 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getDemands() + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + return $this->demands; + } + + /** + * Deprecated: Use [Visit.load_demands][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity demands = 5 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setDemands($var) + { + @trigger_error('demands is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->demands = $arr; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/ShipmentTypeIncompatibility.php b/Optimization/src/V1/ShipmentTypeIncompatibility.php new file mode 100644 index 000000000000..7e6ddeaea991 --- /dev/null +++ b/Optimization/src/V1/ShipmentTypeIncompatibility.php @@ -0,0 +1,107 @@ +google.cloud.optimization.v1.ShipmentTypeIncompatibility + */ +class ShipmentTypeIncompatibility extends \Google\Protobuf\Internal\Message +{ + /** + * List of incompatible types. Two shipments having different `shipment_types` + * among those listed are "incompatible". + * + * Generated from protobuf field repeated string types = 1; + */ + private $types; + /** + * Mode applied to the incompatibility. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode incompatibility_mode = 2; + */ + private $incompatibility_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $types + * List of incompatible types. Two shipments having different `shipment_types` + * among those listed are "incompatible". + * @type int $incompatibility_mode + * Mode applied to the incompatibility. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * List of incompatible types. Two shipments having different `shipment_types` + * among those listed are "incompatible". + * + * Generated from protobuf field repeated string types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTypes() + { + return $this->types; + } + + /** + * List of incompatible types. Two shipments having different `shipment_types` + * among those listed are "incompatible". + * + * Generated from protobuf field repeated string types = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->types = $arr; + + return $this; + } + + /** + * Mode applied to the incompatibility. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode incompatibility_mode = 2; + * @return int + */ + public function getIncompatibilityMode() + { + return $this->incompatibility_mode; + } + + /** + * Mode applied to the incompatibility. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode incompatibility_mode = 2; + * @param int $var + * @return $this + */ + public function setIncompatibilityMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\ShipmentTypeIncompatibility\IncompatibilityMode::class); + $this->incompatibility_mode = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/ShipmentTypeIncompatibility/IncompatibilityMode.php b/Optimization/src/V1/ShipmentTypeIncompatibility/IncompatibilityMode.php new file mode 100644 index 000000000000..6381eea34906 --- /dev/null +++ b/Optimization/src/V1/ShipmentTypeIncompatibility/IncompatibilityMode.php @@ -0,0 +1,70 @@ +google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode + */ +class IncompatibilityMode +{ + /** + * Unspecified incompatibility mode. This value should never be used. + * + * Generated from protobuf enum INCOMPATIBILITY_MODE_UNSPECIFIED = 0; + */ + const INCOMPATIBILITY_MODE_UNSPECIFIED = 0; + /** + * In this mode, two shipments with incompatible types can never share the + * same vehicle. + * + * Generated from protobuf enum NOT_PERFORMED_BY_SAME_VEHICLE = 1; + */ + const NOT_PERFORMED_BY_SAME_VEHICLE = 1; + /** + * For two shipments with incompatible types with the + * `NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY` incompatibility mode: + * * If both are pickups only (no deliveries) or deliveries only (no + * pickups), they cannot share the same vehicle at all. + * * If one of the shipments has a delivery and the other a pickup, the two + * shipments can share the same vehicle iff the former shipment is + * delivered before the latter is picked up. + * + * Generated from protobuf enum NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY = 2; + */ + const NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY = 2; + + private static $valueToName = [ + self::INCOMPATIBILITY_MODE_UNSPECIFIED => 'INCOMPATIBILITY_MODE_UNSPECIFIED', + self::NOT_PERFORMED_BY_SAME_VEHICLE => 'NOT_PERFORMED_BY_SAME_VEHICLE', + self::NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY => 'NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/ShipmentTypeRequirement.php b/Optimization/src/V1/ShipmentTypeRequirement.php new file mode 100644 index 000000000000..c1c352cb0602 --- /dev/null +++ b/Optimization/src/V1/ShipmentTypeRequirement.php @@ -0,0 +1,156 @@ +google.cloud.optimization.v1.ShipmentTypeRequirement + */ +class ShipmentTypeRequirement extends \Google\Protobuf\Internal\Message +{ + /** + * List of alternative shipment types required by the + * `dependent_shipment_types`. + * + * Generated from protobuf field repeated string required_shipment_type_alternatives = 1; + */ + private $required_shipment_type_alternatives; + /** + * All shipments with a type in the `dependent_shipment_types` field require + * at least one shipment of type `required_shipment_type_alternatives` to be + * visited on the same route. + * NOTE: Chains of requirements such that a `shipment_type` depends on itself + * are not allowed. + * + * Generated from protobuf field repeated string dependent_shipment_types = 2; + */ + private $dependent_shipment_types; + /** + * Mode applied to the requirement. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode requirement_mode = 3; + */ + private $requirement_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $required_shipment_type_alternatives + * List of alternative shipment types required by the + * `dependent_shipment_types`. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $dependent_shipment_types + * All shipments with a type in the `dependent_shipment_types` field require + * at least one shipment of type `required_shipment_type_alternatives` to be + * visited on the same route. + * NOTE: Chains of requirements such that a `shipment_type` depends on itself + * are not allowed. + * @type int $requirement_mode + * Mode applied to the requirement. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * List of alternative shipment types required by the + * `dependent_shipment_types`. + * + * Generated from protobuf field repeated string required_shipment_type_alternatives = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequiredShipmentTypeAlternatives() + { + return $this->required_shipment_type_alternatives; + } + + /** + * List of alternative shipment types required by the + * `dependent_shipment_types`. + * + * Generated from protobuf field repeated string required_shipment_type_alternatives = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequiredShipmentTypeAlternatives($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->required_shipment_type_alternatives = $arr; + + return $this; + } + + /** + * All shipments with a type in the `dependent_shipment_types` field require + * at least one shipment of type `required_shipment_type_alternatives` to be + * visited on the same route. + * NOTE: Chains of requirements such that a `shipment_type` depends on itself + * are not allowed. + * + * Generated from protobuf field repeated string dependent_shipment_types = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDependentShipmentTypes() + { + return $this->dependent_shipment_types; + } + + /** + * All shipments with a type in the `dependent_shipment_types` field require + * at least one shipment of type `required_shipment_type_alternatives` to be + * visited on the same route. + * NOTE: Chains of requirements such that a `shipment_type` depends on itself + * are not allowed. + * + * Generated from protobuf field repeated string dependent_shipment_types = 2; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDependentShipmentTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->dependent_shipment_types = $arr; + + return $this; + } + + /** + * Mode applied to the requirement. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode requirement_mode = 3; + * @return int + */ + public function getRequirementMode() + { + return $this->requirement_mode; + } + + /** + * Mode applied to the requirement. + * + * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode requirement_mode = 3; + * @param int $var + * @return $this + */ + public function setRequirementMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\ShipmentTypeRequirement\RequirementMode::class); + $this->requirement_mode = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/ShipmentTypeRequirement/RequirementMode.php b/Optimization/src/V1/ShipmentTypeRequirement/RequirementMode.php new file mode 100644 index 000000000000..219e0f72f335 --- /dev/null +++ b/Optimization/src/V1/ShipmentTypeRequirement/RequirementMode.php @@ -0,0 +1,78 @@ +google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode + */ +class RequirementMode +{ + /** + * Unspecified requirement mode. This value should never be used. + * + * Generated from protobuf enum REQUIREMENT_MODE_UNSPECIFIED = 0; + */ + const REQUIREMENT_MODE_UNSPECIFIED = 0; + /** + * In this mode, all "dependent" shipments must share the same vehicle as at + * least one of their "required" shipments. + * + * Generated from protobuf enum PERFORMED_BY_SAME_VEHICLE = 1; + */ + const PERFORMED_BY_SAME_VEHICLE = 1; + /** + * With the `IN_SAME_VEHICLE_AT_PICKUP_TIME` mode, all "dependent" + * shipments need to have at least one "required" shipment on their vehicle + * at the time of their pickup. + * A "dependent" shipment pickup must therefore have either: + * * A delivery-only "required" shipment delivered on the route after, or + * * A "required" shipment picked up on the route before it, and if the + * "required" shipment has a delivery, this delivery must be performed + * after the "dependent" shipment's pickup. + * + * Generated from protobuf enum IN_SAME_VEHICLE_AT_PICKUP_TIME = 2; + */ + const IN_SAME_VEHICLE_AT_PICKUP_TIME = 2; + /** + * Same as before, except the "dependent" shipments need to have a + * "required" shipment on their vehicle at the time of their *delivery*. + * + * Generated from protobuf enum IN_SAME_VEHICLE_AT_DELIVERY_TIME = 3; + */ + const IN_SAME_VEHICLE_AT_DELIVERY_TIME = 3; + + private static $valueToName = [ + self::REQUIREMENT_MODE_UNSPECIFIED => 'REQUIREMENT_MODE_UNSPECIFIED', + self::PERFORMED_BY_SAME_VEHICLE => 'PERFORMED_BY_SAME_VEHICLE', + self::IN_SAME_VEHICLE_AT_PICKUP_TIME => 'IN_SAME_VEHICLE_AT_PICKUP_TIME', + self::IN_SAME_VEHICLE_AT_DELIVERY_TIME => 'IN_SAME_VEHICLE_AT_DELIVERY_TIME', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/SkippedShipment.php b/Optimization/src/V1/SkippedShipment.php new file mode 100644 index 000000000000..2f211e75a08c --- /dev/null +++ b/Optimization/src/V1/SkippedShipment.php @@ -0,0 +1,149 @@ +google.cloud.optimization.v1.SkippedShipment + */ +class SkippedShipment extends \Google\Protobuf\Internal\Message +{ + /** + * The index corresponds to the index of the shipment in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 index = 1; + */ + private $index = 0; + /** + * Copy of the corresponding [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified in the + * `Shipment`. + * + * Generated from protobuf field string label = 2; + */ + private $label = ''; + /** + * A list of reasons that explain why the shipment was skipped. See comment + * above `Reason`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment.Reason reasons = 3; + */ + private $reasons; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $index + * The index corresponds to the index of the shipment in the source + * `ShipmentModel`. + * @type string $label + * Copy of the corresponding [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified in the + * `Shipment`. + * @type \Google\Cloud\Optimization\V1\SkippedShipment\Reason[]|\Google\Protobuf\Internal\RepeatedField $reasons + * A list of reasons that explain why the shipment was skipped. See comment + * above `Reason`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The index corresponds to the index of the shipment in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 index = 1; + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * The index corresponds to the index of the shipment in the source + * `ShipmentModel`. + * + * Generated from protobuf field int32 index = 1; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->index = $var; + + return $this; + } + + /** + * Copy of the corresponding [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified in the + * `Shipment`. + * + * Generated from protobuf field string label = 2; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Copy of the corresponding [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified in the + * `Shipment`. + * + * Generated from protobuf field string label = 2; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * A list of reasons that explain why the shipment was skipped. See comment + * above `Reason`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment.Reason reasons = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReasons() + { + return $this->reasons; + } + + /** + * A list of reasons that explain why the shipment was skipped. See comment + * above `Reason`. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.SkippedShipment.Reason reasons = 3; + * @param \Google\Cloud\Optimization\V1\SkippedShipment\Reason[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReasons($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\SkippedShipment\Reason::class); + $this->reasons = $arr; + + return $this; + } + +} + diff --git a/Optimization/src/V1/SkippedShipment/Reason.php b/Optimization/src/V1/SkippedShipment/Reason.php new file mode 100644 index 000000000000..15347c3f689b --- /dev/null +++ b/Optimization/src/V1/SkippedShipment/Reason.php @@ -0,0 +1,179 @@ +google.cloud.optimization.v1.SkippedShipment.Reason + */ +class Reason extends \Google\Protobuf\Internal\Message +{ + /** + * Refer to the comments of Code. + * + * Generated from protobuf field .google.cloud.optimization.v1.SkippedShipment.Reason.Code code = 1; + */ + private $code = 0; + /** + * If the reason is related to a shipment-vehicle incompatibility, this + * field provides the index of one relevant vehicle. + * + * Generated from protobuf field optional int32 example_vehicle_index = 2; + */ + private $example_vehicle_index = null; + /** + * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one + * capacity type that is exceeded. + * + * Generated from protobuf field string example_exceeded_capacity_type = 3; + */ + private $example_exceeded_capacity_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Refer to the comments of Code. + * @type int $example_vehicle_index + * If the reason is related to a shipment-vehicle incompatibility, this + * field provides the index of one relevant vehicle. + * @type string $example_exceeded_capacity_type + * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one + * capacity type that is exceeded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Refer to the comments of Code. + * + * Generated from protobuf field .google.cloud.optimization.v1.SkippedShipment.Reason.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Refer to the comments of Code. + * + * Generated from protobuf field .google.cloud.optimization.v1.SkippedShipment.Reason.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\SkippedShipment\Reason\Code::class); + $this->code = $var; + + return $this; + } + + /** + * If the reason is related to a shipment-vehicle incompatibility, this + * field provides the index of one relevant vehicle. + * + * Generated from protobuf field optional int32 example_vehicle_index = 2; + * @return int + */ + public function getExampleVehicleIndex() + { + return isset($this->example_vehicle_index) ? $this->example_vehicle_index : 0; + } + + public function hasExampleVehicleIndex() + { + return isset($this->example_vehicle_index); + } + + public function clearExampleVehicleIndex() + { + unset($this->example_vehicle_index); + } + + /** + * If the reason is related to a shipment-vehicle incompatibility, this + * field provides the index of one relevant vehicle. + * + * Generated from protobuf field optional int32 example_vehicle_index = 2; + * @param int $var + * @return $this + */ + public function setExampleVehicleIndex($var) + { + GPBUtil::checkInt32($var); + $this->example_vehicle_index = $var; + + return $this; + } + + /** + * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one + * capacity type that is exceeded. + * + * Generated from protobuf field string example_exceeded_capacity_type = 3; + * @return string + */ + public function getExampleExceededCapacityType() + { + return $this->example_exceeded_capacity_type; + } + + /** + * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one + * capacity type that is exceeded. + * + * Generated from protobuf field string example_exceeded_capacity_type = 3; + * @param string $var + * @return $this + */ + public function setExampleExceededCapacityType($var) + { + GPBUtil::checkString($var, True); + $this->example_exceeded_capacity_type = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/SkippedShipment/Reason/Code.php b/Optimization/src/V1/SkippedShipment/Reason/Code.php new file mode 100644 index 000000000000..05be99a749b1 --- /dev/null +++ b/Optimization/src/V1/SkippedShipment/Reason/Code.php @@ -0,0 +1,114 @@ +google.cloud.optimization.v1.SkippedShipment.Reason.Code + */ +class Code +{ + /** + * This should never be used. If we are unable to understand why a + * shipment was skipped, we simply return an empty set of reasons. + * + * Generated from protobuf enum CODE_UNSPECIFIED = 0; + */ + const CODE_UNSPECIFIED = 0; + /** + * There is no vehicle in the model making all shipments infeasible. + * + * Generated from protobuf enum NO_VEHICLE = 1; + */ + const NO_VEHICLE = 1; + /** + * The demand of the shipment exceeds a vehicle's capacity for some + * capacity types, one of which is `example_exceeded_capacity_type`. + * + * Generated from protobuf enum DEMAND_EXCEEDS_VEHICLE_CAPACITY = 2; + */ + const DEMAND_EXCEEDS_VEHICLE_CAPACITY = 2; + /** + * The minimum distance necessary to perform this shipment, i.e. from + * the vehicle's `start_location` to the shipment's pickup and/or delivery + * locations and to the vehicle's end location exceeds the vehicle's + * `route_distance_limit`. + * Note that for this computation we use the geodesic distances. + * + * Generated from protobuf enum CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT = 3; + */ + const CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT = 3; + /** + * The minimum time necessary to perform this shipment, including travel + * time, wait time and service time exceeds the vehicle's + * `route_duration_limit`. + * Note: travel time is computed in the best-case scenario, namely as + * geodesic distance x 36 m/s (roughly 130 km/hour). + * + * Generated from protobuf enum CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT = 4; + */ + const CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT = 4; + /** + * Same as above but we only compare minimum travel time and the + * vehicle's `travel_duration_limit`. + * + * Generated from protobuf enum CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT = 5; + */ + const CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT = 5; + /** + * The vehicle cannot perform this shipment in the best-case scenario + * (see `CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT` for time + * computation) if it starts at its earliest start time: the total time + * would make the vehicle end after its latest end time. + * + * Generated from protobuf enum CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS = 6; + */ + const CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS = 6; + /** + * The `allowed_vehicle_indices` field of the shipment is not empty and + * this vehicle does not belong to it. + * + * Generated from protobuf enum VEHICLE_NOT_ALLOWED = 7; + */ + const VEHICLE_NOT_ALLOWED = 7; + + private static $valueToName = [ + self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED', + self::NO_VEHICLE => 'NO_VEHICLE', + self::DEMAND_EXCEEDS_VEHICLE_CAPACITY => 'DEMAND_EXCEEDS_VEHICLE_CAPACITY', + self::CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT => 'CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT', + self::CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT => 'CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT', + self::CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT => 'CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT', + self::CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS => 'CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS', + self::VEHICLE_NOT_ALLOWED => 'VEHICLE_NOT_ALLOWED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/TimeWindow.php b/Optimization/src/V1/TimeWindow.php new file mode 100644 index 000000000000..23f4ca9d581f --- /dev/null +++ b/Optimization/src/V1/TimeWindow.php @@ -0,0 +1,385 @@ +google.cloud.optimization.v1.TimeWindow + */ +class TimeWindow extends \Google\Protobuf\Internal\Message +{ + /** + * The hard time window start time. If unspecified it will be set to + * `ShipmentModel.global_start_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + private $start_time = null; + /** + * The hard time window end time. If unspecified it will be set to + * `ShipmentModel.global_end_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + private $end_time = null; + /** + * The soft start time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_start_time = 3; + */ + private $soft_start_time = null; + /** + * The soft end time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_end_time = 4; + */ + private $soft_end_time = null; + /** + * A cost per hour added to other costs in the model if the event occurs + * before soft_start_time, computed as: + * ``` + * max(0, soft_start_time - t.seconds) + * * cost_per_hour_before_soft_start_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * soft_start_time has been set. + * + * Generated from protobuf field optional double cost_per_hour_before_soft_start_time = 5; + */ + private $cost_per_hour_before_soft_start_time = null; + /** + * A cost per hour added to other costs in the model if the event occurs after + * `soft_end_time`, computed as: + * ``` + * max(0, t.seconds - soft_end_time.seconds) + * * cost_per_hour_after_soft_end_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * `soft_end_time` has been set. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_end_time = 6; + */ + private $cost_per_hour_after_soft_end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * The hard time window start time. If unspecified it will be set to + * `ShipmentModel.global_start_time`. + * @type \Google\Protobuf\Timestamp $end_time + * The hard time window end time. If unspecified it will be set to + * `ShipmentModel.global_end_time`. + * @type \Google\Protobuf\Timestamp $soft_start_time + * The soft start time of the time window. + * @type \Google\Protobuf\Timestamp $soft_end_time + * The soft end time of the time window. + * @type float $cost_per_hour_before_soft_start_time + * A cost per hour added to other costs in the model if the event occurs + * before soft_start_time, computed as: + * ``` + * max(0, soft_start_time - t.seconds) + * * cost_per_hour_before_soft_start_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * soft_start_time has been set. + * @type float $cost_per_hour_after_soft_end_time + * A cost per hour added to other costs in the model if the event occurs after + * `soft_end_time`, computed as: + * ``` + * max(0, t.seconds - soft_end_time.seconds) + * * cost_per_hour_after_soft_end_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * `soft_end_time` has been set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The hard time window start time. If unspecified it will be set to + * `ShipmentModel.global_start_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The hard time window start time. If unspecified it will be set to + * `ShipmentModel.global_start_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The hard time window end time. If unspecified it will be set to + * `ShipmentModel.global_end_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The hard time window end time. If unspecified it will be set to + * `ShipmentModel.global_end_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * The soft start time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_start_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSoftStartTime() + { + return $this->soft_start_time; + } + + public function hasSoftStartTime() + { + return isset($this->soft_start_time); + } + + public function clearSoftStartTime() + { + unset($this->soft_start_time); + } + + /** + * The soft start time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_start_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSoftStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->soft_start_time = $var; + + return $this; + } + + /** + * The soft end time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_end_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSoftEndTime() + { + return $this->soft_end_time; + } + + public function hasSoftEndTime() + { + return isset($this->soft_end_time); + } + + public function clearSoftEndTime() + { + unset($this->soft_end_time); + } + + /** + * The soft end time of the time window. + * + * Generated from protobuf field .google.protobuf.Timestamp soft_end_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSoftEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->soft_end_time = $var; + + return $this; + } + + /** + * A cost per hour added to other costs in the model if the event occurs + * before soft_start_time, computed as: + * ``` + * max(0, soft_start_time - t.seconds) + * * cost_per_hour_before_soft_start_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * soft_start_time has been set. + * + * Generated from protobuf field optional double cost_per_hour_before_soft_start_time = 5; + * @return float + */ + public function getCostPerHourBeforeSoftStartTime() + { + return isset($this->cost_per_hour_before_soft_start_time) ? $this->cost_per_hour_before_soft_start_time : 0.0; + } + + public function hasCostPerHourBeforeSoftStartTime() + { + return isset($this->cost_per_hour_before_soft_start_time); + } + + public function clearCostPerHourBeforeSoftStartTime() + { + unset($this->cost_per_hour_before_soft_start_time); + } + + /** + * A cost per hour added to other costs in the model if the event occurs + * before soft_start_time, computed as: + * ``` + * max(0, soft_start_time - t.seconds) + * * cost_per_hour_before_soft_start_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * soft_start_time has been set. + * + * Generated from protobuf field optional double cost_per_hour_before_soft_start_time = 5; + * @param float $var + * @return $this + */ + public function setCostPerHourBeforeSoftStartTime($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_hour_before_soft_start_time = $var; + + return $this; + } + + /** + * A cost per hour added to other costs in the model if the event occurs after + * `soft_end_time`, computed as: + * ``` + * max(0, t.seconds - soft_end_time.seconds) + * * cost_per_hour_after_soft_end_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * `soft_end_time` has been set. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_end_time = 6; + * @return float + */ + public function getCostPerHourAfterSoftEndTime() + { + return isset($this->cost_per_hour_after_soft_end_time) ? $this->cost_per_hour_after_soft_end_time : 0.0; + } + + public function hasCostPerHourAfterSoftEndTime() + { + return isset($this->cost_per_hour_after_soft_end_time); + } + + public function clearCostPerHourAfterSoftEndTime() + { + unset($this->cost_per_hour_after_soft_end_time); + } + + /** + * A cost per hour added to other costs in the model if the event occurs after + * `soft_end_time`, computed as: + * ``` + * max(0, t.seconds - soft_end_time.seconds) + * * cost_per_hour_after_soft_end_time / 3600, + * t being the time of the event. + * ``` + * This cost must be positive, and the field can only be set if + * `soft_end_time` has been set. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_end_time = 6; + * @param float $var + * @return $this + */ + public function setCostPerHourAfterSoftEndTime($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_hour_after_soft_end_time = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/TransitionAttributes.php b/Optimization/src/V1/TransitionAttributes.php new file mode 100644 index 000000000000..15b2bcb8f036 --- /dev/null +++ b/Optimization/src/V1/TransitionAttributes.php @@ -0,0 +1,400 @@ +google.cloud.optimization.v1.TransitionAttributes + */ +class TransitionAttributes extends \Google\Protobuf\Internal\Message +{ + /** + * Tags defining the set of (src->dst) transitions these attributes apply to. + * A source visit or vehicle start matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags] + * either contains `src_tag` or does not contain `excluded_src_tag` (depending + * on which of these two fields is non-empty). + * + * Generated from protobuf field string src_tag = 1; + */ + private $src_tag = ''; + /** + * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_src_tag = 2; + */ + private $excluded_src_tag = ''; + /** + * A destination visit or vehicle end matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.end_tags][google.cloud.optimization.v1.Vehicle.end_tags] either contains `dst_tag` or does not contain + * `excluded_dst_tag` (depending on which of these two fields is non-empty). + * + * Generated from protobuf field string dst_tag = 3; + */ + private $dst_tag = ''; + /** + * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_dst_tag = 4; + */ + private $excluded_dst_tag = ''; + /** + * Specifies a cost for performing this transition. This is in the same unit + * as all other costs in the model and must not be negative. It is applied on + * top of all other existing costs. + * + * Generated from protobuf field double cost = 5; + */ + private $cost = 0.0; + /** + * Specifies a cost per kilometer applied to the distance traveled while + * performing this transition. It adds up to any + * [Vehicle.cost_per_kilometer][google.cloud.optimization.v1.Vehicle.cost_per_kilometer] specified on vehicles. + * + * Generated from protobuf field double cost_per_kilometer = 6; + */ + private $cost_per_kilometer = 0.0; + /** + * Specifies a limit on the distance traveled while performing this + * transition. + * As of 2021/06, only soft limits are supported. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit distance_limit = 7; + */ + private $distance_limit = null; + /** + * Specifies a delay incurred when performing this transition. + * This delay always occurs *after* finishing the source visit and *before* + * starting the destination visit. + * + * Generated from protobuf field .google.protobuf.Duration delay = 8; + */ + private $delay = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $src_tag + * Tags defining the set of (src->dst) transitions these attributes apply to. + * A source visit or vehicle start matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags] + * either contains `src_tag` or does not contain `excluded_src_tag` (depending + * on which of these two fields is non-empty). + * @type string $excluded_src_tag + * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be + * non-empty. + * @type string $dst_tag + * A destination visit or vehicle end matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.end_tags][google.cloud.optimization.v1.Vehicle.end_tags] either contains `dst_tag` or does not contain + * `excluded_dst_tag` (depending on which of these two fields is non-empty). + * @type string $excluded_dst_tag + * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be + * non-empty. + * @type float $cost + * Specifies a cost for performing this transition. This is in the same unit + * as all other costs in the model and must not be negative. It is applied on + * top of all other existing costs. + * @type float $cost_per_kilometer + * Specifies a cost per kilometer applied to the distance traveled while + * performing this transition. It adds up to any + * [Vehicle.cost_per_kilometer][google.cloud.optimization.v1.Vehicle.cost_per_kilometer] specified on vehicles. + * @type \Google\Cloud\Optimization\V1\DistanceLimit $distance_limit + * Specifies a limit on the distance traveled while performing this + * transition. + * As of 2021/06, only soft limits are supported. + * @type \Google\Protobuf\Duration $delay + * Specifies a delay incurred when performing this transition. + * This delay always occurs *after* finishing the source visit and *before* + * starting the destination visit. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * Tags defining the set of (src->dst) transitions these attributes apply to. + * A source visit or vehicle start matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags] + * either contains `src_tag` or does not contain `excluded_src_tag` (depending + * on which of these two fields is non-empty). + * + * Generated from protobuf field string src_tag = 1; + * @return string + */ + public function getSrcTag() + { + return $this->src_tag; + } + + /** + * Tags defining the set of (src->dst) transitions these attributes apply to. + * A source visit or vehicle start matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags] + * either contains `src_tag` or does not contain `excluded_src_tag` (depending + * on which of these two fields is non-empty). + * + * Generated from protobuf field string src_tag = 1; + * @param string $var + * @return $this + */ + public function setSrcTag($var) + { + GPBUtil::checkString($var, True); + $this->src_tag = $var; + + return $this; + } + + /** + * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_src_tag = 2; + * @return string + */ + public function getExcludedSrcTag() + { + return $this->excluded_src_tag; + } + + /** + * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_src_tag = 2; + * @param string $var + * @return $this + */ + public function setExcludedSrcTag($var) + { + GPBUtil::checkString($var, True); + $this->excluded_src_tag = $var; + + return $this; + } + + /** + * A destination visit or vehicle end matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.end_tags][google.cloud.optimization.v1.Vehicle.end_tags] either contains `dst_tag` or does not contain + * `excluded_dst_tag` (depending on which of these two fields is non-empty). + * + * Generated from protobuf field string dst_tag = 3; + * @return string + */ + public function getDstTag() + { + return $this->dst_tag; + } + + /** + * A destination visit or vehicle end matches iff its + * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] + * or [Vehicle.end_tags][google.cloud.optimization.v1.Vehicle.end_tags] either contains `dst_tag` or does not contain + * `excluded_dst_tag` (depending on which of these two fields is non-empty). + * + * Generated from protobuf field string dst_tag = 3; + * @param string $var + * @return $this + */ + public function setDstTag($var) + { + GPBUtil::checkString($var, True); + $this->dst_tag = $var; + + return $this; + } + + /** + * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_dst_tag = 4; + * @return string + */ + public function getExcludedDstTag() + { + return $this->excluded_dst_tag; + } + + /** + * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be + * non-empty. + * + * Generated from protobuf field string excluded_dst_tag = 4; + * @param string $var + * @return $this + */ + public function setExcludedDstTag($var) + { + GPBUtil::checkString($var, True); + $this->excluded_dst_tag = $var; + + return $this; + } + + /** + * Specifies a cost for performing this transition. This is in the same unit + * as all other costs in the model and must not be negative. It is applied on + * top of all other existing costs. + * + * Generated from protobuf field double cost = 5; + * @return float + */ + public function getCost() + { + return $this->cost; + } + + /** + * Specifies a cost for performing this transition. This is in the same unit + * as all other costs in the model and must not be negative. It is applied on + * top of all other existing costs. + * + * Generated from protobuf field double cost = 5; + * @param float $var + * @return $this + */ + public function setCost($var) + { + GPBUtil::checkDouble($var); + $this->cost = $var; + + return $this; + } + + /** + * Specifies a cost per kilometer applied to the distance traveled while + * performing this transition. It adds up to any + * [Vehicle.cost_per_kilometer][google.cloud.optimization.v1.Vehicle.cost_per_kilometer] specified on vehicles. + * + * Generated from protobuf field double cost_per_kilometer = 6; + * @return float + */ + public function getCostPerKilometer() + { + return $this->cost_per_kilometer; + } + + /** + * Specifies a cost per kilometer applied to the distance traveled while + * performing this transition. It adds up to any + * [Vehicle.cost_per_kilometer][google.cloud.optimization.v1.Vehicle.cost_per_kilometer] specified on vehicles. + * + * Generated from protobuf field double cost_per_kilometer = 6; + * @param float $var + * @return $this + */ + public function setCostPerKilometer($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_kilometer = $var; + + return $this; + } + + /** + * Specifies a limit on the distance traveled while performing this + * transition. + * As of 2021/06, only soft limits are supported. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit distance_limit = 7; + * @return \Google\Cloud\Optimization\V1\DistanceLimit|null + */ + public function getDistanceLimit() + { + return $this->distance_limit; + } + + public function hasDistanceLimit() + { + return isset($this->distance_limit); + } + + public function clearDistanceLimit() + { + unset($this->distance_limit); + } + + /** + * Specifies a limit on the distance traveled while performing this + * transition. + * As of 2021/06, only soft limits are supported. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit distance_limit = 7; + * @param \Google\Cloud\Optimization\V1\DistanceLimit $var + * @return $this + */ + public function setDistanceLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\DistanceLimit::class); + $this->distance_limit = $var; + + return $this; + } + + /** + * Specifies a delay incurred when performing this transition. + * This delay always occurs *after* finishing the source visit and *before* + * starting the destination visit. + * + * Generated from protobuf field .google.protobuf.Duration delay = 8; + * @return \Google\Protobuf\Duration|null + */ + public function getDelay() + { + return $this->delay; + } + + public function hasDelay() + { + return isset($this->delay); + } + + public function clearDelay() + { + unset($this->delay); + } + + /** + * Specifies a delay incurred when performing this transition. + * This delay always occurs *after* finishing the source visit and *before* + * starting the destination visit. + * + * Generated from protobuf field .google.protobuf.Duration delay = 8; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDelay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->delay = $var; + + return $this; + } + +} + diff --git a/Optimization/src/V1/Vehicle.php b/Optimization/src/V1/Vehicle.php new file mode 100644 index 000000000000..2552162251d4 --- /dev/null +++ b/Optimization/src/V1/Vehicle.php @@ -0,0 +1,1493 @@ +google.cloud.optimization.v1.Vehicle + */ +class Vehicle extends \Google\Protobuf\Internal\Message +{ + /** + * The travel mode which affects the roads usable by the vehicle and its + * speed. See also `travel_duration_multiple`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.TravelMode travel_mode = 1; + */ + private $travel_mode = 0; + /** + * Geographic location where the vehicle starts before picking up any + * shipments. If not specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng start_location = 3; + */ + private $start_location = null; + /** + * Waypoint representing a geographic location where the vehicle starts before + * picking up any shipments. If neither `start_waypoint` nor `start_location` + * is specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint start_waypoint = 4; + */ + private $start_waypoint = null; + /** + * Geographic location where the vehicle ends after it has completed its last + * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends + * immediately when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng end_location = 5; + */ + private $end_location = null; + /** + * Waypoint representing a geographic location where the vehicle ends after + * it has completed its last `VisitRequest`. If neither `end_waypoint` nor + * `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately + * when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint end_waypoint = 6; + */ + private $end_waypoint = null; + /** + * Specifies tags attached to the start of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string start_tags = 7; + */ + private $start_tags; + /** + * Specifies tags attached to the end of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string end_tags = 8; + */ + private $end_tags; + /** + * Time windows during which the vehicle may depart its start location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow start_time_windows = 9; + */ + private $start_time_windows; + /** + * Time windows during which the vehicle may arrive at its end location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow end_time_windows = 10; + */ + private $end_time_windows; + /** + * Specifies a multiplicative factor that can be used to increase or decrease + * travel times of this vehicle. For example, setting this to 2.0 means + * that this vehicle is slower and has travel times that are twice what they + * are for standard vehicles. This multiple does not affect visit durations. + * It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are + * specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle + * is standard, and this multiple is considered 1.0. + * WARNING: Travel times will be rounded to the nearest second after this + * multiple is applied but before performing any numerical operations, thus, + * a small multiple may result in a loss of precision. + * See also `extra_visit_duration_for_visit_type` below. + * + * Generated from protobuf field optional double travel_duration_multiple = 11; + */ + private $travel_duration_multiple = null; + /** + * Unloading policy enforced on the vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.UnloadingPolicy unloading_policy = 12; + */ + private $unloading_policy = 0; + /** + * Capacities of the vehicle (weight, volume, # of pallets for example). + * The keys in the map are the identifiers of the type of load, consistent + * with the keys of the + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field. If a given key is absent from this map, the corresponding capacity + * is considered to be limitless. + * + * Generated from protobuf field map load_limits = 30; + */ + private $load_limits; + /** + * Vehicle costs: all costs add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * Cost per hour of the vehicle route. This cost is applied to the total time + * taken by the route, and includes travel time, waiting time, and visit time. + * Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result + * in additional latency. + * + * Generated from protobuf field double cost_per_hour = 16; + */ + private $cost_per_hour = 0.0; + /** + * Cost per traveled hour of the vehicle route. This cost is applied only to + * travel time taken by the route (i.e., that reported in + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]), and excludes waiting time and visit time. + * + * Generated from protobuf field double cost_per_traveled_hour = 17; + */ + private $cost_per_traveled_hour = 0.0; + /** + * Cost per kilometer of the vehicle route. This cost is applied to the + * distance reported in the [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] and does not apply + * to any distance implicitly traveled from the `arrival_location` to the + * `departure_location` of a single `VisitRequest`. + * + * Generated from protobuf field double cost_per_kilometer = 18; + */ + private $cost_per_kilometer = 0.0; + /** + * Fixed cost applied if this vehicle is used to handle a shipment. + * + * Generated from protobuf field double fixed_cost = 19; + */ + private $fixed_cost = 0.0; + /** + * This field only applies to vehicles when their route does not serve any + * shipments. It indicates if the vehicle should be considered as used or not + * in this case. + * If true, the vehicle goes from its start to its end location even if it + * doesn't serve any shipments, and time and distance costs resulting from its + * start --> end travel are taken into account. + * Otherwise, it doesn't travel from its start to its end location, and no + * `break_rule` or delay (from `TransitionAttributes`) are scheduled for this + * vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any + * information except for the vehicle index and label. + * + * Generated from protobuf field bool used_if_route_is_empty = 20; + */ + private $used_if_route_is_empty = false; + /** + * Limit applied to the total duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route duration of a vehicle is the + * difference between its `vehicle_end_time` and `vehicle_start_time`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit route_duration_limit = 21; + */ + private $route_duration_limit = null; + /** + * Limit applied to the travel duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route travel duration is the sum of all its + * [transitions.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration]. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit travel_duration_limit = 22; + */ + private $travel_duration_limit = null; + /** + * Limit applied to the total distance of the vehicle's route. In a given + * `OptimizeToursResponse`, the route distance is the sum of all its + * [transitions.travel_distance_meters][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_distance_meters]. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit route_distance_limit = 23; + */ + private $route_distance_limit = null; + /** + * Specifies a map from visit_types strings to durations. The duration is time + * in addition to + * [VisitRequest.duration][google.cloud.optimization.v1.Shipment.VisitRequest.duration] + * to be taken at visits with the specified `visit_types`. This extra visit + * duration adds cost if `cost_per_hour` is specified. Keys (i.e. + * `visit_types`) cannot be empty strings. + * If a visit request has multiple types, a duration will be added for each + * type in the map. + * + * Generated from protobuf field map extra_visit_duration_for_visit_type = 24; + */ + private $extra_visit_duration_for_visit_type; + /** + * Describes the break schedule to be enforced on this vehicle. + * If empty, no breaks will be scheduled for this vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.BreakRule break_rule = 25; + */ + private $break_rule = null; + /** + * Specifies a label for this vehicle. This label is reported in the response + * as the `vehicle_label` of the corresponding [ShipmentRoute][google.cloud.optimization.v1.ShipmentRoute]. + * + * Generated from protobuf field string label = 27; + */ + private $label = ''; + /** + * If true, `used_if_route_is_empty` must be false, and this vehicle will + * remain unused. + * If a shipment is performed by an ignored vehicle in + * `injected_first_solution_routes`, it is skipped in the first solution but + * is free to be performed in the response. + * If a shipment is performed by an ignored vehicle in + * `injected_solution_constraint` and any related pickup/delivery is + * constrained to remain on the vehicle (i.e., not relaxed to level + * `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response. + * If a shipment has a non-empty `allowed_vehicle_indices` field and all of + * the allowed vehicles are ignored, it is skipped in the response. + * + * Generated from protobuf field bool ignore = 28; + */ + private $ignore = false; + /** + * Deprecated: No longer used. + * Indices in the `break_rule` field in the source + * [ShipmentModel][]. They correspond to break rules enforced on the vehicle. + * As of 2018/03, at most one rule index per vehicle can be specified. + * + * Generated from protobuf field repeated int32 break_rule_indices = 29 [deprecated = true]; + * @deprecated + */ + private $break_rule_indices; + /** + * Deprecated: Use [Vehicle.load_limits][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity capacities = 13 [deprecated = true]; + * @deprecated + */ + private $capacities; + /** + * Deprecated: Use [Vehicle.LoadLimit.start_load_interval][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval start_load_intervals = 14 [deprecated = true]; + * @deprecated + */ + private $start_load_intervals; + /** + * Deprecated: Use [Vehicle.LoadLimit.end_load_interval][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval end_load_intervals = 15 [deprecated = true]; + * @deprecated + */ + private $end_load_intervals; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $travel_mode + * The travel mode which affects the roads usable by the vehicle and its + * speed. See also `travel_duration_multiple`. + * @type \Google\Type\LatLng $start_location + * Geographic location where the vehicle starts before picking up any + * shipments. If not specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_location` + * must not be specified. + * @type \Google\Cloud\Optimization\V1\Waypoint $start_waypoint + * Waypoint representing a geographic location where the vehicle starts before + * picking up any shipments. If neither `start_waypoint` nor `start_location` + * is specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_waypoint` + * must not be specified. + * @type \Google\Type\LatLng $end_location + * Geographic location where the vehicle ends after it has completed its last + * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends + * immediately when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_location` + * must not be specified. + * @type \Google\Cloud\Optimization\V1\Waypoint $end_waypoint + * Waypoint representing a geographic location where the vehicle ends after + * it has completed its last `VisitRequest`. If neither `end_waypoint` nor + * `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately + * when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_waypoint` + * must not be specified. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $start_tags + * Specifies tags attached to the start of the vehicle's route. + * Empty or duplicate strings are not allowed. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $end_tags + * Specifies tags attached to the end of the vehicle's route. + * Empty or duplicate strings are not allowed. + * @type \Google\Cloud\Optimization\V1\TimeWindow[]|\Google\Protobuf\Internal\RepeatedField $start_time_windows + * Time windows during which the vehicle may depart its start location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * @type \Google\Cloud\Optimization\V1\TimeWindow[]|\Google\Protobuf\Internal\RepeatedField $end_time_windows + * Time windows during which the vehicle may arrive at its end location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * @type float $travel_duration_multiple + * Specifies a multiplicative factor that can be used to increase or decrease + * travel times of this vehicle. For example, setting this to 2.0 means + * that this vehicle is slower and has travel times that are twice what they + * are for standard vehicles. This multiple does not affect visit durations. + * It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are + * specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle + * is standard, and this multiple is considered 1.0. + * WARNING: Travel times will be rounded to the nearest second after this + * multiple is applied but before performing any numerical operations, thus, + * a small multiple may result in a loss of precision. + * See also `extra_visit_duration_for_visit_type` below. + * @type int $unloading_policy + * Unloading policy enforced on the vehicle. + * @type array|\Google\Protobuf\Internal\MapField $load_limits + * Capacities of the vehicle (weight, volume, # of pallets for example). + * The keys in the map are the identifiers of the type of load, consistent + * with the keys of the + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field. If a given key is absent from this map, the corresponding capacity + * is considered to be limitless. + * @type float $cost_per_hour + * Vehicle costs: all costs add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * Cost per hour of the vehicle route. This cost is applied to the total time + * taken by the route, and includes travel time, waiting time, and visit time. + * Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result + * in additional latency. + * @type float $cost_per_traveled_hour + * Cost per traveled hour of the vehicle route. This cost is applied only to + * travel time taken by the route (i.e., that reported in + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]), and excludes waiting time and visit time. + * @type float $cost_per_kilometer + * Cost per kilometer of the vehicle route. This cost is applied to the + * distance reported in the [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] and does not apply + * to any distance implicitly traveled from the `arrival_location` to the + * `departure_location` of a single `VisitRequest`. + * @type float $fixed_cost + * Fixed cost applied if this vehicle is used to handle a shipment. + * @type bool $used_if_route_is_empty + * This field only applies to vehicles when their route does not serve any + * shipments. It indicates if the vehicle should be considered as used or not + * in this case. + * If true, the vehicle goes from its start to its end location even if it + * doesn't serve any shipments, and time and distance costs resulting from its + * start --> end travel are taken into account. + * Otherwise, it doesn't travel from its start to its end location, and no + * `break_rule` or delay (from `TransitionAttributes`) are scheduled for this + * vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any + * information except for the vehicle index and label. + * @type \Google\Cloud\Optimization\V1\Vehicle\DurationLimit $route_duration_limit + * Limit applied to the total duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route duration of a vehicle is the + * difference between its `vehicle_end_time` and `vehicle_start_time`. + * @type \Google\Cloud\Optimization\V1\Vehicle\DurationLimit $travel_duration_limit + * Limit applied to the travel duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route travel duration is the sum of all its + * [transitions.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration]. + * @type \Google\Cloud\Optimization\V1\DistanceLimit $route_distance_limit + * Limit applied to the total distance of the vehicle's route. In a given + * `OptimizeToursResponse`, the route distance is the sum of all its + * [transitions.travel_distance_meters][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_distance_meters]. + * @type array|\Google\Protobuf\Internal\MapField $extra_visit_duration_for_visit_type + * Specifies a map from visit_types strings to durations. The duration is time + * in addition to + * [VisitRequest.duration][google.cloud.optimization.v1.Shipment.VisitRequest.duration] + * to be taken at visits with the specified `visit_types`. This extra visit + * duration adds cost if `cost_per_hour` is specified. Keys (i.e. + * `visit_types`) cannot be empty strings. + * If a visit request has multiple types, a duration will be added for each + * type in the map. + * @type \Google\Cloud\Optimization\V1\BreakRule $break_rule + * Describes the break schedule to be enforced on this vehicle. + * If empty, no breaks will be scheduled for this vehicle. + * @type string $label + * Specifies a label for this vehicle. This label is reported in the response + * as the `vehicle_label` of the corresponding [ShipmentRoute][google.cloud.optimization.v1.ShipmentRoute]. + * @type bool $ignore + * If true, `used_if_route_is_empty` must be false, and this vehicle will + * remain unused. + * If a shipment is performed by an ignored vehicle in + * `injected_first_solution_routes`, it is skipped in the first solution but + * is free to be performed in the response. + * If a shipment is performed by an ignored vehicle in + * `injected_solution_constraint` and any related pickup/delivery is + * constrained to remain on the vehicle (i.e., not relaxed to level + * `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response. + * If a shipment has a non-empty `allowed_vehicle_indices` field and all of + * the allowed vehicles are ignored, it is skipped in the response. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $break_rule_indices + * Deprecated: No longer used. + * Indices in the `break_rule` field in the source + * [ShipmentModel][]. They correspond to break rules enforced on the vehicle. + * As of 2018/03, at most one rule index per vehicle can be specified. + * @type \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $capacities + * Deprecated: Use [Vehicle.load_limits][] instead. + * @type \Google\Cloud\Optimization\V1\CapacityQuantityInterval[]|\Google\Protobuf\Internal\RepeatedField $start_load_intervals + * Deprecated: Use [Vehicle.LoadLimit.start_load_interval][] instead. + * @type \Google\Cloud\Optimization\V1\CapacityQuantityInterval[]|\Google\Protobuf\Internal\RepeatedField $end_load_intervals + * Deprecated: Use [Vehicle.LoadLimit.end_load_interval][] instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The travel mode which affects the roads usable by the vehicle and its + * speed. See also `travel_duration_multiple`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.TravelMode travel_mode = 1; + * @return int + */ + public function getTravelMode() + { + return $this->travel_mode; + } + + /** + * The travel mode which affects the roads usable by the vehicle and its + * speed. See also `travel_duration_multiple`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.TravelMode travel_mode = 1; + * @param int $var + * @return $this + */ + public function setTravelMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\Vehicle\TravelMode::class); + $this->travel_mode = $var; + + return $this; + } + + /** + * Geographic location where the vehicle starts before picking up any + * shipments. If not specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng start_location = 3; + * @return \Google\Type\LatLng|null + */ + public function getStartLocation() + { + return $this->start_location; + } + + public function hasStartLocation() + { + return isset($this->start_location); + } + + public function clearStartLocation() + { + unset($this->start_location); + } + + /** + * Geographic location where the vehicle starts before picking up any + * shipments. If not specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng start_location = 3; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setStartLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->start_location = $var; + + return $this; + } + + /** + * Waypoint representing a geographic location where the vehicle starts before + * picking up any shipments. If neither `start_waypoint` nor `start_location` + * is specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint start_waypoint = 4; + * @return \Google\Cloud\Optimization\V1\Waypoint|null + */ + public function getStartWaypoint() + { + return $this->start_waypoint; + } + + public function hasStartWaypoint() + { + return isset($this->start_waypoint); + } + + public function clearStartWaypoint() + { + unset($this->start_waypoint); + } + + /** + * Waypoint representing a geographic location where the vehicle starts before + * picking up any shipments. If neither `start_waypoint` nor `start_location` + * is specified, the vehicle starts at its first pickup. + * If the shipment model has duration and distance matrices, `start_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint start_waypoint = 4; + * @param \Google\Cloud\Optimization\V1\Waypoint $var + * @return $this + */ + public function setStartWaypoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Waypoint::class); + $this->start_waypoint = $var; + + return $this; + } + + /** + * Geographic location where the vehicle ends after it has completed its last + * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends + * immediately when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng end_location = 5; + * @return \Google\Type\LatLng|null + */ + public function getEndLocation() + { + return $this->end_location; + } + + public function hasEndLocation() + { + return isset($this->end_location); + } + + public function clearEndLocation() + { + unset($this->end_location); + } + + /** + * Geographic location where the vehicle ends after it has completed its last + * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends + * immediately when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_location` + * must not be specified. + * + * Generated from protobuf field .google.type.LatLng end_location = 5; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setEndLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->end_location = $var; + + return $this; + } + + /** + * Waypoint representing a geographic location where the vehicle ends after + * it has completed its last `VisitRequest`. If neither `end_waypoint` nor + * `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately + * when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint end_waypoint = 6; + * @return \Google\Cloud\Optimization\V1\Waypoint|null + */ + public function getEndWaypoint() + { + return $this->end_waypoint; + } + + public function hasEndWaypoint() + { + return isset($this->end_waypoint); + } + + public function clearEndWaypoint() + { + unset($this->end_waypoint); + } + + /** + * Waypoint representing a geographic location where the vehicle ends after + * it has completed its last `VisitRequest`. If neither `end_waypoint` nor + * `end_location` is specified, the vehicle's `ShipmentRoute` ends immediately + * when it completes its last `VisitRequest`. + * If the shipment model has duration and distance matrices, `end_waypoint` + * must not be specified. + * + * Generated from protobuf field .google.cloud.optimization.v1.Waypoint end_waypoint = 6; + * @param \Google\Cloud\Optimization\V1\Waypoint $var + * @return $this + */ + public function setEndWaypoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Waypoint::class); + $this->end_waypoint = $var; + + return $this; + } + + /** + * Specifies tags attached to the start of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string start_tags = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartTags() + { + return $this->start_tags; + } + + /** + * Specifies tags attached to the start of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string start_tags = 7; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->start_tags = $arr; + + return $this; + } + + /** + * Specifies tags attached to the end of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string end_tags = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEndTags() + { + return $this->end_tags; + } + + /** + * Specifies tags attached to the end of the vehicle's route. + * Empty or duplicate strings are not allowed. + * + * Generated from protobuf field repeated string end_tags = 8; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEndTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->end_tags = $arr; + + return $this; + } + + /** + * Time windows during which the vehicle may depart its start location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow start_time_windows = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartTimeWindows() + { + return $this->start_time_windows; + } + + /** + * Time windows during which the vehicle may depart its start location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow start_time_windows = 9; + * @param \Google\Cloud\Optimization\V1\TimeWindow[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartTimeWindows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\TimeWindow::class); + $this->start_time_windows = $arr; + + return $this; + } + + /** + * Time windows during which the vehicle may arrive at its end location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow end_time_windows = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEndTimeWindows() + { + return $this->end_time_windows; + } + + /** + * Time windows during which the vehicle may arrive at its end location. + * They must be within the global time limits (see + * [ShipmentModel.global_*][google.cloud.optimization.v1.ShipmentModel.global_start_time] + * fields). If unspecified, there is no limitation besides those global time + * limits. + * Time windows belonging to the same repeated field must be disjoint, i.e. no + * time window can overlap with or be adjacent to another, and they must be in + * chronological order. + * `cost_per_hour_after_soft_end_time` and `soft_end_time` can only be set if + * there is a single time window. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.TimeWindow end_time_windows = 10; + * @param \Google\Cloud\Optimization\V1\TimeWindow[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEndTimeWindows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\TimeWindow::class); + $this->end_time_windows = $arr; + + return $this; + } + + /** + * Specifies a multiplicative factor that can be used to increase or decrease + * travel times of this vehicle. For example, setting this to 2.0 means + * that this vehicle is slower and has travel times that are twice what they + * are for standard vehicles. This multiple does not affect visit durations. + * It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are + * specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle + * is standard, and this multiple is considered 1.0. + * WARNING: Travel times will be rounded to the nearest second after this + * multiple is applied but before performing any numerical operations, thus, + * a small multiple may result in a loss of precision. + * See also `extra_visit_duration_for_visit_type` below. + * + * Generated from protobuf field optional double travel_duration_multiple = 11; + * @return float + */ + public function getTravelDurationMultiple() + { + return isset($this->travel_duration_multiple) ? $this->travel_duration_multiple : 0.0; + } + + public function hasTravelDurationMultiple() + { + return isset($this->travel_duration_multiple); + } + + public function clearTravelDurationMultiple() + { + unset($this->travel_duration_multiple); + } + + /** + * Specifies a multiplicative factor that can be used to increase or decrease + * travel times of this vehicle. For example, setting this to 2.0 means + * that this vehicle is slower and has travel times that are twice what they + * are for standard vehicles. This multiple does not affect visit durations. + * It does affect cost if `cost_per_hour` or `cost_per_traveled_hour` are + * specified. This must be in the range [0.001, 1000.0]. If unset, the vehicle + * is standard, and this multiple is considered 1.0. + * WARNING: Travel times will be rounded to the nearest second after this + * multiple is applied but before performing any numerical operations, thus, + * a small multiple may result in a loss of precision. + * See also `extra_visit_duration_for_visit_type` below. + * + * Generated from protobuf field optional double travel_duration_multiple = 11; + * @param float $var + * @return $this + */ + public function setTravelDurationMultiple($var) + { + GPBUtil::checkDouble($var); + $this->travel_duration_multiple = $var; + + return $this; + } + + /** + * Unloading policy enforced on the vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.UnloadingPolicy unloading_policy = 12; + * @return int + */ + public function getUnloadingPolicy() + { + return $this->unloading_policy; + } + + /** + * Unloading policy enforced on the vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.UnloadingPolicy unloading_policy = 12; + * @param int $var + * @return $this + */ + public function setUnloadingPolicy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Optimization\V1\Vehicle\UnloadingPolicy::class); + $this->unloading_policy = $var; + + return $this; + } + + /** + * Capacities of the vehicle (weight, volume, # of pallets for example). + * The keys in the map are the identifiers of the type of load, consistent + * with the keys of the + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field. If a given key is absent from this map, the corresponding capacity + * is considered to be limitless. + * + * Generated from protobuf field map load_limits = 30; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLoadLimits() + { + return $this->load_limits; + } + + /** + * Capacities of the vehicle (weight, volume, # of pallets for example). + * The keys in the map are the identifiers of the type of load, consistent + * with the keys of the + * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] + * field. If a given key is absent from this map, the corresponding capacity + * is considered to be limitless. + * + * Generated from protobuf field map load_limits = 30; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLoadLimits($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\Vehicle\LoadLimit::class); + $this->load_limits = $arr; + + return $this; + } + + /** + * Vehicle costs: all costs add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * Cost per hour of the vehicle route. This cost is applied to the total time + * taken by the route, and includes travel time, waiting time, and visit time. + * Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result + * in additional latency. + * + * Generated from protobuf field double cost_per_hour = 16; + * @return float + */ + public function getCostPerHour() + { + return $this->cost_per_hour; + } + + /** + * Vehicle costs: all costs add up and must be in the same unit as + * [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * Cost per hour of the vehicle route. This cost is applied to the total time + * taken by the route, and includes travel time, waiting time, and visit time. + * Using `cost_per_hour` instead of just `cost_per_traveled_hour` may result + * in additional latency. + * + * Generated from protobuf field double cost_per_hour = 16; + * @param float $var + * @return $this + */ + public function setCostPerHour($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_hour = $var; + + return $this; + } + + /** + * Cost per traveled hour of the vehicle route. This cost is applied only to + * travel time taken by the route (i.e., that reported in + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]), and excludes waiting time and visit time. + * + * Generated from protobuf field double cost_per_traveled_hour = 17; + * @return float + */ + public function getCostPerTraveledHour() + { + return $this->cost_per_traveled_hour; + } + + /** + * Cost per traveled hour of the vehicle route. This cost is applied only to + * travel time taken by the route (i.e., that reported in + * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]), and excludes waiting time and visit time. + * + * Generated from protobuf field double cost_per_traveled_hour = 17; + * @param float $var + * @return $this + */ + public function setCostPerTraveledHour($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_traveled_hour = $var; + + return $this; + } + + /** + * Cost per kilometer of the vehicle route. This cost is applied to the + * distance reported in the [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] and does not apply + * to any distance implicitly traveled from the `arrival_location` to the + * `departure_location` of a single `VisitRequest`. + * + * Generated from protobuf field double cost_per_kilometer = 18; + * @return float + */ + public function getCostPerKilometer() + { + return $this->cost_per_kilometer; + } + + /** + * Cost per kilometer of the vehicle route. This cost is applied to the + * distance reported in the [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions] and does not apply + * to any distance implicitly traveled from the `arrival_location` to the + * `departure_location` of a single `VisitRequest`. + * + * Generated from protobuf field double cost_per_kilometer = 18; + * @param float $var + * @return $this + */ + public function setCostPerKilometer($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_kilometer = $var; + + return $this; + } + + /** + * Fixed cost applied if this vehicle is used to handle a shipment. + * + * Generated from protobuf field double fixed_cost = 19; + * @return float + */ + public function getFixedCost() + { + return $this->fixed_cost; + } + + /** + * Fixed cost applied if this vehicle is used to handle a shipment. + * + * Generated from protobuf field double fixed_cost = 19; + * @param float $var + * @return $this + */ + public function setFixedCost($var) + { + GPBUtil::checkDouble($var); + $this->fixed_cost = $var; + + return $this; + } + + /** + * This field only applies to vehicles when their route does not serve any + * shipments. It indicates if the vehicle should be considered as used or not + * in this case. + * If true, the vehicle goes from its start to its end location even if it + * doesn't serve any shipments, and time and distance costs resulting from its + * start --> end travel are taken into account. + * Otherwise, it doesn't travel from its start to its end location, and no + * `break_rule` or delay (from `TransitionAttributes`) are scheduled for this + * vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any + * information except for the vehicle index and label. + * + * Generated from protobuf field bool used_if_route_is_empty = 20; + * @return bool + */ + public function getUsedIfRouteIsEmpty() + { + return $this->used_if_route_is_empty; + } + + /** + * This field only applies to vehicles when their route does not serve any + * shipments. It indicates if the vehicle should be considered as used or not + * in this case. + * If true, the vehicle goes from its start to its end location even if it + * doesn't serve any shipments, and time and distance costs resulting from its + * start --> end travel are taken into account. + * Otherwise, it doesn't travel from its start to its end location, and no + * `break_rule` or delay (from `TransitionAttributes`) are scheduled for this + * vehicle. In this case, the vehicle's `ShipmentRoute` doesn't contain any + * information except for the vehicle index and label. + * + * Generated from protobuf field bool used_if_route_is_empty = 20; + * @param bool $var + * @return $this + */ + public function setUsedIfRouteIsEmpty($var) + { + GPBUtil::checkBool($var); + $this->used_if_route_is_empty = $var; + + return $this; + } + + /** + * Limit applied to the total duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route duration of a vehicle is the + * difference between its `vehicle_end_time` and `vehicle_start_time`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit route_duration_limit = 21; + * @return \Google\Cloud\Optimization\V1\Vehicle\DurationLimit|null + */ + public function getRouteDurationLimit() + { + return $this->route_duration_limit; + } + + public function hasRouteDurationLimit() + { + return isset($this->route_duration_limit); + } + + public function clearRouteDurationLimit() + { + unset($this->route_duration_limit); + } + + /** + * Limit applied to the total duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route duration of a vehicle is the + * difference between its `vehicle_end_time` and `vehicle_start_time`. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit route_duration_limit = 21; + * @param \Google\Cloud\Optimization\V1\Vehicle\DurationLimit $var + * @return $this + */ + public function setRouteDurationLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Vehicle\DurationLimit::class); + $this->route_duration_limit = $var; + + return $this; + } + + /** + * Limit applied to the travel duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route travel duration is the sum of all its + * [transitions.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration]. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit travel_duration_limit = 22; + * @return \Google\Cloud\Optimization\V1\Vehicle\DurationLimit|null + */ + public function getTravelDurationLimit() + { + return $this->travel_duration_limit; + } + + public function hasTravelDurationLimit() + { + return isset($this->travel_duration_limit); + } + + public function clearTravelDurationLimit() + { + unset($this->travel_duration_limit); + } + + /** + * Limit applied to the travel duration of the vehicle's route. In a given + * `OptimizeToursResponse`, the route travel duration is the sum of all its + * [transitions.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration]. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit travel_duration_limit = 22; + * @param \Google\Cloud\Optimization\V1\Vehicle\DurationLimit $var + * @return $this + */ + public function setTravelDurationLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Vehicle\DurationLimit::class); + $this->travel_duration_limit = $var; + + return $this; + } + + /** + * Limit applied to the total distance of the vehicle's route. In a given + * `OptimizeToursResponse`, the route distance is the sum of all its + * [transitions.travel_distance_meters][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_distance_meters]. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit route_distance_limit = 23; + * @return \Google\Cloud\Optimization\V1\DistanceLimit|null + */ + public function getRouteDistanceLimit() + { + return $this->route_distance_limit; + } + + public function hasRouteDistanceLimit() + { + return isset($this->route_distance_limit); + } + + public function clearRouteDistanceLimit() + { + unset($this->route_distance_limit); + } + + /** + * Limit applied to the total distance of the vehicle's route. In a given + * `OptimizeToursResponse`, the route distance is the sum of all its + * [transitions.travel_distance_meters][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_distance_meters]. + * + * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit route_distance_limit = 23; + * @param \Google\Cloud\Optimization\V1\DistanceLimit $var + * @return $this + */ + public function setRouteDistanceLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\DistanceLimit::class); + $this->route_distance_limit = $var; + + return $this; + } + + /** + * Specifies a map from visit_types strings to durations. The duration is time + * in addition to + * [VisitRequest.duration][google.cloud.optimization.v1.Shipment.VisitRequest.duration] + * to be taken at visits with the specified `visit_types`. This extra visit + * duration adds cost if `cost_per_hour` is specified. Keys (i.e. + * `visit_types`) cannot be empty strings. + * If a visit request has multiple types, a duration will be added for each + * type in the map. + * + * Generated from protobuf field map extra_visit_duration_for_visit_type = 24; + * @return \Google\Protobuf\Internal\MapField + */ + public function getExtraVisitDurationForVisitType() + { + return $this->extra_visit_duration_for_visit_type; + } + + /** + * Specifies a map from visit_types strings to durations. The duration is time + * in addition to + * [VisitRequest.duration][google.cloud.optimization.v1.Shipment.VisitRequest.duration] + * to be taken at visits with the specified `visit_types`. This extra visit + * duration adds cost if `cost_per_hour` is specified. Keys (i.e. + * `visit_types`) cannot be empty strings. + * If a visit request has multiple types, a duration will be added for each + * type in the map. + * + * Generated from protobuf field map extra_visit_duration_for_visit_type = 24; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setExtraVisitDurationForVisitType($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); + $this->extra_visit_duration_for_visit_type = $arr; + + return $this; + } + + /** + * Describes the break schedule to be enforced on this vehicle. + * If empty, no breaks will be scheduled for this vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.BreakRule break_rule = 25; + * @return \Google\Cloud\Optimization\V1\BreakRule|null + */ + public function getBreakRule() + { + return $this->break_rule; + } + + public function hasBreakRule() + { + return isset($this->break_rule); + } + + public function clearBreakRule() + { + unset($this->break_rule); + } + + /** + * Describes the break schedule to be enforced on this vehicle. + * If empty, no breaks will be scheduled for this vehicle. + * + * Generated from protobuf field .google.cloud.optimization.v1.BreakRule break_rule = 25; + * @param \Google\Cloud\Optimization\V1\BreakRule $var + * @return $this + */ + public function setBreakRule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\BreakRule::class); + $this->break_rule = $var; + + return $this; + } + + /** + * Specifies a label for this vehicle. This label is reported in the response + * as the `vehicle_label` of the corresponding [ShipmentRoute][google.cloud.optimization.v1.ShipmentRoute]. + * + * Generated from protobuf field string label = 27; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Specifies a label for this vehicle. This label is reported in the response + * as the `vehicle_label` of the corresponding [ShipmentRoute][google.cloud.optimization.v1.ShipmentRoute]. + * + * Generated from protobuf field string label = 27; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * If true, `used_if_route_is_empty` must be false, and this vehicle will + * remain unused. + * If a shipment is performed by an ignored vehicle in + * `injected_first_solution_routes`, it is skipped in the first solution but + * is free to be performed in the response. + * If a shipment is performed by an ignored vehicle in + * `injected_solution_constraint` and any related pickup/delivery is + * constrained to remain on the vehicle (i.e., not relaxed to level + * `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response. + * If a shipment has a non-empty `allowed_vehicle_indices` field and all of + * the allowed vehicles are ignored, it is skipped in the response. + * + * Generated from protobuf field bool ignore = 28; + * @return bool + */ + public function getIgnore() + { + return $this->ignore; + } + + /** + * If true, `used_if_route_is_empty` must be false, and this vehicle will + * remain unused. + * If a shipment is performed by an ignored vehicle in + * `injected_first_solution_routes`, it is skipped in the first solution but + * is free to be performed in the response. + * If a shipment is performed by an ignored vehicle in + * `injected_solution_constraint` and any related pickup/delivery is + * constrained to remain on the vehicle (i.e., not relaxed to level + * `RELAX_ALL_AFTER_THRESHOLD`), it is skipped in the response. + * If a shipment has a non-empty `allowed_vehicle_indices` field and all of + * the allowed vehicles are ignored, it is skipped in the response. + * + * Generated from protobuf field bool ignore = 28; + * @param bool $var + * @return $this + */ + public function setIgnore($var) + { + GPBUtil::checkBool($var); + $this->ignore = $var; + + return $this; + } + + /** + * Deprecated: No longer used. + * Indices in the `break_rule` field in the source + * [ShipmentModel][]. They correspond to break rules enforced on the vehicle. + * As of 2018/03, at most one rule index per vehicle can be specified. + * + * Generated from protobuf field repeated int32 break_rule_indices = 29 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getBreakRuleIndices() + { + @trigger_error('break_rule_indices is deprecated.', E_USER_DEPRECATED); + return $this->break_rule_indices; + } + + /** + * Deprecated: No longer used. + * Indices in the `break_rule` field in the source + * [ShipmentModel][]. They correspond to break rules enforced on the vehicle. + * As of 2018/03, at most one rule index per vehicle can be specified. + * + * Generated from protobuf field repeated int32 break_rule_indices = 29 [deprecated = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setBreakRuleIndices($var) + { + @trigger_error('break_rule_indices is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->break_rule_indices = $arr; + + return $this; + } + + /** + * Deprecated: Use [Vehicle.load_limits][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity capacities = 13 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getCapacities() + { + @trigger_error('capacities is deprecated.', E_USER_DEPRECATED); + return $this->capacities; + } + + /** + * Deprecated: Use [Vehicle.load_limits][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantity capacities = 13 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantity[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setCapacities($var) + { + @trigger_error('capacities is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantity::class); + $this->capacities = $arr; + + return $this; + } + + /** + * Deprecated: Use [Vehicle.LoadLimit.start_load_interval][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval start_load_intervals = 14 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getStartLoadIntervals() + { + @trigger_error('start_load_intervals is deprecated.', E_USER_DEPRECATED); + return $this->start_load_intervals; + } + + /** + * Deprecated: Use [Vehicle.LoadLimit.start_load_interval][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval start_load_intervals = 14 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantityInterval[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setStartLoadIntervals($var) + { + @trigger_error('start_load_intervals is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantityInterval::class); + $this->start_load_intervals = $arr; + + return $this; + } + + /** + * Deprecated: Use [Vehicle.LoadLimit.end_load_interval][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval end_load_intervals = 15 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getEndLoadIntervals() + { + @trigger_error('end_load_intervals is deprecated.', E_USER_DEPRECATED); + return $this->end_load_intervals; + } + + /** + * Deprecated: Use [Vehicle.LoadLimit.end_load_interval][] instead. + * + * Generated from protobuf field repeated .google.cloud.optimization.v1.CapacityQuantityInterval end_load_intervals = 15 [deprecated = true]; + * @param \Google\Cloud\Optimization\V1\CapacityQuantityInterval[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setEndLoadIntervals($var) + { + @trigger_error('end_load_intervals is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Optimization\V1\CapacityQuantityInterval::class); + $this->end_load_intervals = $arr; + + return $this; + } + +} + diff --git a/Optimization/src/V1/Vehicle/DurationLimit.php b/Optimization/src/V1/Vehicle/DurationLimit.php new file mode 100644 index 000000000000..48855471aa7c --- /dev/null +++ b/Optimization/src/V1/Vehicle/DurationLimit.php @@ -0,0 +1,357 @@ +google.cloud.optimization.v1.Vehicle.DurationLimit + */ +class DurationLimit extends \Google\Protobuf\Internal\Message +{ + /** + * A hard limit constraining the duration to be at most max_duration. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 1; + */ + private $max_duration = null; + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost. This cost adds up to other costs defined in + * the model, with the same unit. + * If defined, `soft_max_duration` must be nonnegative. If max_duration is + * also defined, `soft_max_duration` must be less than max_duration. + * + * Generated from protobuf field .google.protobuf.Duration soft_max_duration = 2; + */ + private $soft_max_duration = null; + /** + * Cost per hour incurred if the `soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_hour_after_soft_max * (duration - soft_max_duration) + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_max = 3; + */ + private $cost_per_hour_after_soft_max = null; + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost, quadratic in the duration. This cost adds + * up to other costs defined in the model, with the same unit. + * If defined, `quadratic_soft_max_duration` must be nonnegative. If + * `max_duration` is also defined, `quadratic_soft_max_duration` must be + * less than `max_duration`, and the difference must be no larger than one + * day: + * `max_duration - quadratic_soft_max_duration <= 86400 seconds` + * + * Generated from protobuf field .google.protobuf.Duration quadratic_soft_max_duration = 4; + */ + private $quadratic_soft_max_duration = null; + /** + * Cost per square hour incurred if the + * `quadratic_soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_square_hour_after_quadratic_soft_max * + * (duration - quadratic_soft_max_duration)^2 + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_square_hour_after_quadratic_soft_max = 5; + */ + private $cost_per_square_hour_after_quadratic_soft_max = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $max_duration + * A hard limit constraining the duration to be at most max_duration. + * @type \Google\Protobuf\Duration $soft_max_duration + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost. This cost adds up to other costs defined in + * the model, with the same unit. + * If defined, `soft_max_duration` must be nonnegative. If max_duration is + * also defined, `soft_max_duration` must be less than max_duration. + * @type float $cost_per_hour_after_soft_max + * Cost per hour incurred if the `soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_hour_after_soft_max * (duration - soft_max_duration) + * ``` + * The cost must be nonnegative. + * @type \Google\Protobuf\Duration $quadratic_soft_max_duration + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost, quadratic in the duration. This cost adds + * up to other costs defined in the model, with the same unit. + * If defined, `quadratic_soft_max_duration` must be nonnegative. If + * `max_duration` is also defined, `quadratic_soft_max_duration` must be + * less than `max_duration`, and the difference must be no larger than one + * day: + * `max_duration - quadratic_soft_max_duration <= 86400 seconds` + * @type float $cost_per_square_hour_after_quadratic_soft_max + * Cost per square hour incurred if the + * `quadratic_soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_square_hour_after_quadratic_soft_max * + * (duration - quadratic_soft_max_duration)^2 + * ``` + * The cost must be nonnegative. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A hard limit constraining the duration to be at most max_duration. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxDuration() + { + return $this->max_duration; + } + + public function hasMaxDuration() + { + return isset($this->max_duration); + } + + public function clearMaxDuration() + { + unset($this->max_duration); + } + + /** + * A hard limit constraining the duration to be at most max_duration. + * + * Generated from protobuf field .google.protobuf.Duration max_duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->max_duration = $var; + + return $this; + } + + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost. This cost adds up to other costs defined in + * the model, with the same unit. + * If defined, `soft_max_duration` must be nonnegative. If max_duration is + * also defined, `soft_max_duration` must be less than max_duration. + * + * Generated from protobuf field .google.protobuf.Duration soft_max_duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getSoftMaxDuration() + { + return $this->soft_max_duration; + } + + public function hasSoftMaxDuration() + { + return isset($this->soft_max_duration); + } + + public function clearSoftMaxDuration() + { + unset($this->soft_max_duration); + } + + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost. This cost adds up to other costs defined in + * the model, with the same unit. + * If defined, `soft_max_duration` must be nonnegative. If max_duration is + * also defined, `soft_max_duration` must be less than max_duration. + * + * Generated from protobuf field .google.protobuf.Duration soft_max_duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setSoftMaxDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->soft_max_duration = $var; + + return $this; + } + + /** + * Cost per hour incurred if the `soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_hour_after_soft_max * (duration - soft_max_duration) + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_max = 3; + * @return float + */ + public function getCostPerHourAfterSoftMax() + { + return isset($this->cost_per_hour_after_soft_max) ? $this->cost_per_hour_after_soft_max : 0.0; + } + + public function hasCostPerHourAfterSoftMax() + { + return isset($this->cost_per_hour_after_soft_max); + } + + public function clearCostPerHourAfterSoftMax() + { + unset($this->cost_per_hour_after_soft_max); + } + + /** + * Cost per hour incurred if the `soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_hour_after_soft_max * (duration - soft_max_duration) + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_hour_after_soft_max = 3; + * @param float $var + * @return $this + */ + public function setCostPerHourAfterSoftMax($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_hour_after_soft_max = $var; + + return $this; + } + + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost, quadratic in the duration. This cost adds + * up to other costs defined in the model, with the same unit. + * If defined, `quadratic_soft_max_duration` must be nonnegative. If + * `max_duration` is also defined, `quadratic_soft_max_duration` must be + * less than `max_duration`, and the difference must be no larger than one + * day: + * `max_duration - quadratic_soft_max_duration <= 86400 seconds` + * + * Generated from protobuf field .google.protobuf.Duration quadratic_soft_max_duration = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getQuadraticSoftMaxDuration() + { + return $this->quadratic_soft_max_duration; + } + + public function hasQuadraticSoftMaxDuration() + { + return isset($this->quadratic_soft_max_duration); + } + + public function clearQuadraticSoftMaxDuration() + { + unset($this->quadratic_soft_max_duration); + } + + /** + * A soft limit not enforcing a maximum duration limit, but when violated + * makes the route incur a cost, quadratic in the duration. This cost adds + * up to other costs defined in the model, with the same unit. + * If defined, `quadratic_soft_max_duration` must be nonnegative. If + * `max_duration` is also defined, `quadratic_soft_max_duration` must be + * less than `max_duration`, and the difference must be no larger than one + * day: + * `max_duration - quadratic_soft_max_duration <= 86400 seconds` + * + * Generated from protobuf field .google.protobuf.Duration quadratic_soft_max_duration = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setQuadraticSoftMaxDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->quadratic_soft_max_duration = $var; + + return $this; + } + + /** + * Cost per square hour incurred if the + * `quadratic_soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_square_hour_after_quadratic_soft_max * + * (duration - quadratic_soft_max_duration)^2 + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_square_hour_after_quadratic_soft_max = 5; + * @return float + */ + public function getCostPerSquareHourAfterQuadraticSoftMax() + { + return isset($this->cost_per_square_hour_after_quadratic_soft_max) ? $this->cost_per_square_hour_after_quadratic_soft_max : 0.0; + } + + public function hasCostPerSquareHourAfterQuadraticSoftMax() + { + return isset($this->cost_per_square_hour_after_quadratic_soft_max); + } + + public function clearCostPerSquareHourAfterQuadraticSoftMax() + { + unset($this->cost_per_square_hour_after_quadratic_soft_max); + } + + /** + * Cost per square hour incurred if the + * `quadratic_soft_max_duration` threshold is violated. + * The additional cost is 0 if the duration is under the threshold, + * otherwise the cost depends on the duration as follows: + * ``` + * cost_per_square_hour_after_quadratic_soft_max * + * (duration - quadratic_soft_max_duration)^2 + * ``` + * The cost must be nonnegative. + * + * Generated from protobuf field optional double cost_per_square_hour_after_quadratic_soft_max = 5; + * @param float $var + * @return $this + */ + public function setCostPerSquareHourAfterQuadraticSoftMax($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_square_hour_after_quadratic_soft_max = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/Vehicle/LoadLimit.php b/Optimization/src/V1/Vehicle/LoadLimit.php new file mode 100644 index 000000000000..1b8ab7ef4691 --- /dev/null +++ b/Optimization/src/V1/Vehicle/LoadLimit.php @@ -0,0 +1,247 @@ +google.cloud.optimization.v1.Vehicle.LoadLimit + */ +class LoadLimit extends \Google\Protobuf\Internal\Message +{ + /** + * The maximum acceptable amount of load. + * + * Generated from protobuf field optional int64 max_load = 1; + */ + private $max_load = null; + /** + * A soft limit of the load. See [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. + * + * Generated from protobuf field int64 soft_max_load = 2; + */ + private $soft_max_load = 0; + /** + * If the load ever exceeds [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] along this vehicle's route, + * the following cost penalty applies (only once per vehicle): + * (load - [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load]) * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs + * add up and must be in the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double cost_per_unit_above_soft_max = 3; + */ + private $cost_per_unit_above_soft_max = 0.0; + /** + * The acceptable load interval of the vehicle at the start of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval start_load_interval = 4; + */ + private $start_load_interval = null; + /** + * The acceptable load interval of the vehicle at the end of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval end_load_interval = 5; + */ + private $end_load_interval = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $max_load + * The maximum acceptable amount of load. + * @type int|string $soft_max_load + * A soft limit of the load. See [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. + * @type float $cost_per_unit_above_soft_max + * If the load ever exceeds [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] along this vehicle's route, + * the following cost penalty applies (only once per vehicle): + * (load - [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load]) * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs + * add up and must be in the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * @type \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval $start_load_interval + * The acceptable load interval of the vehicle at the start of the route. + * @type \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval $end_load_interval + * The acceptable load interval of the vehicle at the end of the route. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * The maximum acceptable amount of load. + * + * Generated from protobuf field optional int64 max_load = 1; + * @return int|string + */ + public function getMaxLoad() + { + return isset($this->max_load) ? $this->max_load : 0; + } + + public function hasMaxLoad() + { + return isset($this->max_load); + } + + public function clearMaxLoad() + { + unset($this->max_load); + } + + /** + * The maximum acceptable amount of load. + * + * Generated from protobuf field optional int64 max_load = 1; + * @param int|string $var + * @return $this + */ + public function setMaxLoad($var) + { + GPBUtil::checkInt64($var); + $this->max_load = $var; + + return $this; + } + + /** + * A soft limit of the load. See [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. + * + * Generated from protobuf field int64 soft_max_load = 2; + * @return int|string + */ + public function getSoftMaxLoad() + { + return $this->soft_max_load; + } + + /** + * A soft limit of the load. See [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. + * + * Generated from protobuf field int64 soft_max_load = 2; + * @param int|string $var + * @return $this + */ + public function setSoftMaxLoad($var) + { + GPBUtil::checkInt64($var); + $this->soft_max_load = $var; + + return $this; + } + + /** + * If the load ever exceeds [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] along this vehicle's route, + * the following cost penalty applies (only once per vehicle): + * (load - [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load]) * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs + * add up and must be in the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double cost_per_unit_above_soft_max = 3; + * @return float + */ + public function getCostPerUnitAboveSoftMax() + { + return $this->cost_per_unit_above_soft_max; + } + + /** + * If the load ever exceeds [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] along this vehicle's route, + * the following cost penalty applies (only once per vehicle): + * (load - [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load]) * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. All costs + * add up and must be in the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. + * + * Generated from protobuf field double cost_per_unit_above_soft_max = 3; + * @param float $var + * @return $this + */ + public function setCostPerUnitAboveSoftMax($var) + { + GPBUtil::checkDouble($var); + $this->cost_per_unit_above_soft_max = $var; + + return $this; + } + + /** + * The acceptable load interval of the vehicle at the start of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval start_load_interval = 4; + * @return \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval|null + */ + public function getStartLoadInterval() + { + return $this->start_load_interval; + } + + public function hasStartLoadInterval() + { + return isset($this->start_load_interval); + } + + public function clearStartLoadInterval() + { + unset($this->start_load_interval); + } + + /** + * The acceptable load interval of the vehicle at the start of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval start_load_interval = 4; + * @param \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval $var + * @return $this + */ + public function setStartLoadInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval::class); + $this->start_load_interval = $var; + + return $this; + } + + /** + * The acceptable load interval of the vehicle at the end of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval end_load_interval = 5; + * @return \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval|null + */ + public function getEndLoadInterval() + { + return $this->end_load_interval; + } + + public function hasEndLoadInterval() + { + return isset($this->end_load_interval); + } + + public function clearEndLoadInterval() + { + unset($this->end_load_interval); + } + + /** + * The acceptable load interval of the vehicle at the end of the route. + * + * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval end_load_interval = 5; + * @param \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval $var + * @return $this + */ + public function setEndLoadInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Vehicle\LoadLimit\Interval::class); + $this->end_load_interval = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/Vehicle/LoadLimit/Interval.php b/Optimization/src/V1/Vehicle/LoadLimit/Interval.php new file mode 100644 index 000000000000..32ccd6a327f9 --- /dev/null +++ b/Optimization/src/V1/Vehicle/LoadLimit/Interval.php @@ -0,0 +1,124 @@ +google.cloud.optimization.v1.Vehicle.LoadLimit.Interval + */ +class Interval extends \Google\Protobuf\Internal\Message +{ + /** + * A minimum acceptable load. Must be ≥ 0. + * If they're both specified, [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must be ≤ [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field int64 min = 1; + */ + private $min = 0; + /** + * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum + * load is unrestricted by this message. + * If they're both specified, [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must be ≤ [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field optional int64 max = 2; + */ + private $max = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $min + * A minimum acceptable load. Must be ≥ 0. + * If they're both specified, [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must be ≤ [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * @type int|string $max + * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum + * load is unrestricted by this message. + * If they're both specified, [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must be ≤ [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A minimum acceptable load. Must be ≥ 0. + * If they're both specified, [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must be ≤ [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field int64 min = 1; + * @return int|string + */ + public function getMin() + { + return $this->min; + } + + /** + * A minimum acceptable load. Must be ≥ 0. + * If they're both specified, [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must be ≤ [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field int64 min = 1; + * @param int|string $var + * @return $this + */ + public function setMin($var) + { + GPBUtil::checkInt64($var); + $this->min = $var; + + return $this; + } + + /** + * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum + * load is unrestricted by this message. + * If they're both specified, [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must be ≤ [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field optional int64 max = 2; + * @return int|string + */ + public function getMax() + { + return isset($this->max) ? $this->max : 0; + } + + public function hasMax() + { + return isset($this->max); + } + + public function clearMax() + { + unset($this->max); + } + + /** + * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum + * load is unrestricted by this message. + * If they're both specified, [min][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.min] must be ≤ [max][google.cloud.optimization.v1.Vehicle.LoadLimit.Interval.max]. + * + * Generated from protobuf field optional int64 max = 2; + * @param int|string $var + * @return $this + */ + public function setMax($var) + { + GPBUtil::checkInt64($var); + $this->max = $var; + + return $this; + } + +} + + diff --git a/Optimization/src/V1/Vehicle/TravelMode.php b/Optimization/src/V1/Vehicle/TravelMode.php new file mode 100644 index 000000000000..987fbeac90d3 --- /dev/null +++ b/Optimization/src/V1/Vehicle/TravelMode.php @@ -0,0 +1,58 @@ +google.cloud.optimization.v1.Vehicle.TravelMode + */ +class TravelMode +{ + /** + * Unspecified travel mode, equivalent to `DRIVING`. + * + * Generated from protobuf enum TRAVEL_MODE_UNSPECIFIED = 0; + */ + const TRAVEL_MODE_UNSPECIFIED = 0; + /** + * Travel mode corresponding to driving directions (car, ...). + * + * Generated from protobuf enum DRIVING = 1; + */ + const DRIVING = 1; + + private static $valueToName = [ + self::TRAVEL_MODE_UNSPECIFIED => 'TRAVEL_MODE_UNSPECIFIED', + self::DRIVING => 'DRIVING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/Vehicle/UnloadingPolicy.php b/Optimization/src/V1/Vehicle/UnloadingPolicy.php new file mode 100644 index 000000000000..a3765b949bdf --- /dev/null +++ b/Optimization/src/V1/Vehicle/UnloadingPolicy.php @@ -0,0 +1,66 @@ +google.cloud.optimization.v1.Vehicle.UnloadingPolicy + */ +class UnloadingPolicy +{ + /** + * Unspecified unloading policy; deliveries must just occur after their + * corresponding pickups. + * + * Generated from protobuf enum UNLOADING_POLICY_UNSPECIFIED = 0; + */ + const UNLOADING_POLICY_UNSPECIFIED = 0; + /** + * Deliveries must occur in reverse order of pickups + * + * Generated from protobuf enum LAST_IN_FIRST_OUT = 1; + */ + const LAST_IN_FIRST_OUT = 1; + /** + * Deliveries must occur in the same order as pickups + * + * Generated from protobuf enum FIRST_IN_FIRST_OUT = 2; + */ + const FIRST_IN_FIRST_OUT = 2; + + private static $valueToName = [ + self::UNLOADING_POLICY_UNSPECIFIED => 'UNLOADING_POLICY_UNSPECIFIED', + self::LAST_IN_FIRST_OUT => 'LAST_IN_FIRST_OUT', + self::FIRST_IN_FIRST_OUT => 'FIRST_IN_FIRST_OUT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Optimization/src/V1/Waypoint.php b/Optimization/src/V1/Waypoint.php new file mode 100644 index 000000000000..40df3e8a163d --- /dev/null +++ b/Optimization/src/V1/Waypoint.php @@ -0,0 +1,166 @@ +google.cloud.optimization.v1.Waypoint + */ +class Waypoint extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates that the location of this waypoint is meant to have a preference + * for the vehicle to stop at a particular side of road. When you set this + * value, the route will pass through the location so that the vehicle can + * stop at the side of road that the location is biased towards from the + * center of the road. This option works only for the 'DRIVING' travel mode, + * and when the 'location_type' is set to 'location'. + * + * Generated from protobuf field bool side_of_road = 3; + */ + private $side_of_road = false; + protected $location_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Optimization\V1\Location $location + * A point specified using geographic coordinates, including an optional + * heading. + * @type string $place_id + * The POI Place ID associated with the waypoint. + * @type bool $side_of_road + * Indicates that the location of this waypoint is meant to have a preference + * for the vehicle to stop at a particular side of road. When you set this + * value, the route will pass through the location so that the vehicle can + * stop at the side of road that the location is biased towards from the + * center of the road. This option works only for the 'DRIVING' travel mode, + * and when the 'location_type' is set to 'location'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce(); + parent::__construct($data); + } + + /** + * A point specified using geographic coordinates, including an optional + * heading. + * + * Generated from protobuf field .google.cloud.optimization.v1.Location location = 1; + * @return \Google\Cloud\Optimization\V1\Location|null + */ + public function getLocation() + { + return $this->readOneof(1); + } + + public function hasLocation() + { + return $this->hasOneof(1); + } + + /** + * A point specified using geographic coordinates, including an optional + * heading. + * + * Generated from protobuf field .google.cloud.optimization.v1.Location location = 1; + * @param \Google\Cloud\Optimization\V1\Location $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\Location::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The POI Place ID associated with the waypoint. + * + * Generated from protobuf field string place_id = 2; + * @return string + */ + public function getPlaceId() + { + return $this->readOneof(2); + } + + public function hasPlaceId() + { + return $this->hasOneof(2); + } + + /** + * The POI Place ID associated with the waypoint. + * + * Generated from protobuf field string place_id = 2; + * @param string $var + * @return $this + */ + public function setPlaceId($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Indicates that the location of this waypoint is meant to have a preference + * for the vehicle to stop at a particular side of road. When you set this + * value, the route will pass through the location so that the vehicle can + * stop at the side of road that the location is biased towards from the + * center of the road. This option works only for the 'DRIVING' travel mode, + * and when the 'location_type' is set to 'location'. + * + * Generated from protobuf field bool side_of_road = 3; + * @return bool + */ + public function getSideOfRoad() + { + return $this->side_of_road; + } + + /** + * Indicates that the location of this waypoint is meant to have a preference + * for the vehicle to stop at a particular side of road. When you set this + * value, the route will pass through the location so that the vehicle can + * stop at the side of road that the location is biased towards from the + * center of the road. This option works only for the 'DRIVING' travel mode, + * and when the 'location_type' is set to 'location'. + * + * Generated from protobuf field bool side_of_road = 3; + * @param bool $var + * @return $this + */ + public function setSideOfRoad($var) + { + GPBUtil::checkBool($var); + $this->side_of_road = $var; + + return $this; + } + + /** + * @return string + */ + public function getLocationType() + { + return $this->whichOneof("location_type"); + } + +} + diff --git a/Optimization/src/V1/gapic_metadata.json b/Optimization/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..007133ea9599 --- /dev/null +++ b/Optimization/src/V1/gapic_metadata.json @@ -0,0 +1,28 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.optimization.v1", + "libraryPackage": "Google\\Cloud\\Optimization\\V1", + "services": { + "FleetRouting": { + "clients": { + "grpc": { + "libraryClient": "FleetRoutingGapicClient", + "rpcs": { + "BatchOptimizeTours": { + "methods": [ + "batchOptimizeTours" + ] + }, + "OptimizeTours": { + "methods": [ + "optimizeTours" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Optimization/src/V1/resources/fleet_routing_client_config.json b/Optimization/src/V1/resources/fleet_routing_client_config.json new file mode 100644 index 000000000000..b86bf37650c5 --- /dev/null +++ b/Optimization/src/V1/resources/fleet_routing_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.cloud.optimization.v1.FleetRouting": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "retry_policy_2_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 3600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 3600000, + "total_timeout_millis": 3600000 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "BatchOptimizeTours": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "OptimizeTours": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/Optimization/src/V1/resources/fleet_routing_descriptor_config.php b/Optimization/src/V1/resources/fleet_routing_descriptor_config.php new file mode 100644 index 000000000000..c9a4cc908a58 --- /dev/null +++ b/Optimization/src/V1/resources/fleet_routing_descriptor_config.php @@ -0,0 +1,18 @@ + [ + 'google.cloud.optimization.v1.FleetRouting' => [ + 'BatchOptimizeTours' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Optimization\V1\BatchOptimizeToursResponse', + 'metadataReturnType' => '\Google\Cloud\Optimization\V1\AsyncModelMetadata', + 'initialPollDelayMillis' => '30000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '120000', + 'totalPollTimeoutMillis' => '3600000', + ], + ], + ], + ], +]; diff --git a/Optimization/src/V1/resources/fleet_routing_rest_client_config.php b/Optimization/src/V1/resources/fleet_routing_rest_client_config.php new file mode 100644 index 000000000000..8179e6a104d7 --- /dev/null +++ b/Optimization/src/V1/resources/fleet_routing_rest_client_config.php @@ -0,0 +1,65 @@ + [ + 'google.cloud.optimization.v1.FleetRouting' => [ + 'BatchOptimizeTours' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:batchOptimizeTours', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}:batchOptimizeTours', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'OptimizeTours' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:optimizeTours', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}:optimizeTours', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/Optimization/tests/Unit/V1/FleetRoutingClientTest.php b/Optimization/tests/Unit/V1/FleetRoutingClientTest.php new file mode 100644 index 000000000000..e07b1f6f0903 --- /dev/null +++ b/Optimization/tests/Unit/V1/FleetRoutingClientTest.php @@ -0,0 +1,266 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** + * @return FleetRoutingClient + */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new FleetRoutingClient($options); + } + + /** + * @test + */ + public function batchOptimizeToursTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/batchOptimizeToursTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchOptimizeToursResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchOptimizeToursTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $parent = 'parent-995424086'; + $modelConfigs = []; + $response = $client->batchOptimizeTours($parent, $modelConfigs); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.optimization.v1.FleetRouting/BatchOptimizeTours', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualApiRequestObject->getModelConfigs(); + $this->assertProtobufEquals($modelConfigs, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function batchOptimizeToursExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/batchOptimizeToursTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + $modelConfigs = []; + $response = $client->batchOptimizeTours($parent, $modelConfigs); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function optimizeToursTest() + { + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $requestLabel = 'requestLabel1739091268'; + $totalCost = -7.0589032E7; + $expectedResponse = new OptimizeToursResponse(); + $expectedResponse->setRequestLabel($requestLabel); + $expectedResponse->setTotalCost($totalCost); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $response = $client->optimizeTours($parent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.optimization.v1.FleetRouting/OptimizeTours', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function optimizeToursExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + try { + $client->optimizeTours($parent); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index a624d5ae575f..1573fd125250 100644 --- a/composer.json +++ b/composer.json @@ -143,6 +143,7 @@ "google/cloud-network-management": "0.1.4", "google/cloud-network-security": "0.2.0", "google/cloud-notebooks": "0.2.3", + "google/cloud-optimization": "master", "google/cloud-orchestration-airflow": "0.1.3", "google/cloud-org-policy": "0.3.0", "google/cloud-osconfig": "0.5.0", @@ -254,6 +255,7 @@ "GPBMetadata\\Google\\Cloud\\Networkmanagement\\": "NetworkManagement/metadata", "GPBMetadata\\Google\\Cloud\\Networksecurity\\": "NetworkSecurity/metadata", "GPBMetadata\\Google\\Cloud\\Notebooks\\": "Notebooks/metadata", + "GPBMetadata\\Google\\Cloud\\Optimization\\": "Optimization/metadata", "GPBMetadata\\Google\\Cloud\\Orchestration\\Airflow\\Service\\": "OrchestrationAirflow/metadata", "GPBMetadata\\Google\\Cloud\\Orgpolicy\\": [ "OrgPolicy/metadata", @@ -390,6 +392,7 @@ "Google\\Cloud\\NetworkManagement\\": "NetworkManagement/src", "Google\\Cloud\\NetworkSecurity\\": "NetworkSecurity/src", "Google\\Cloud\\Notebooks\\": "Notebooks/src", + "Google\\Cloud\\Optimization\\": "Optimization/src", "Google\\Cloud\\Orchestration\\Airflow\\Service\\": "OrchestrationAirflow/src", "Google\\Cloud\\OrgPolicy\\": [ "OrgPolicy/src", @@ -516,6 +519,7 @@ "Google\\Cloud\\NetworkManagement\\Tests\\": "NetworkManagement/tests", "Google\\Cloud\\NetworkSecurity\\Tests\\": "NetworkSecurity/tests", "Google\\Cloud\\Notebooks\\Tests\\": "Notebooks/tests", + "Google\\Cloud\\Optimization\\Tests\\": "Optimization/tests", "Google\\Cloud\\Orchestration\\Airflow\\Service\\Tests\\": "OrchestrationAirflow/tests", "Google\\Cloud\\OrgPolicy\\Tests\\": "OrgPolicy/tests", "Google\\Cloud\\OsConfig\\Tests\\": "OsConfig/tests", diff --git a/docs/contents/cloud-optimization.json b/docs/contents/cloud-optimization.json new file mode 100644 index 000000000000..8c66eb31b518 --- /dev/null +++ b/docs/contents/cloud-optimization.json @@ -0,0 +1,15 @@ +{ + "title": "Optimization", + "defaultService": "optimization\/readme", + "services": [ + { + "title": "Overview", + "type": "optimization\/readme" + }, + { + "title": "FleetRoutingClient (v1)", + "type": "optimization\/v1\/fleetroutingclient" + } + ], + "pattern": "optimization\/\\w{1,}" +} \ No newline at end of file diff --git a/docs/contents/google-cloud.json b/docs/contents/google-cloud.json index bcd08755ca83..7eb64209cf39 100644 --- a/docs/contents/google-cloud.json +++ b/docs/contents/google-cloud.json @@ -78,6 +78,7 @@ "cloud-network-management", "cloud-network-security", "cloud-notebooks", + "cloud-optimization", "cloud-orchestration-airflow", "cloud-org-policy", "cloud-osconfig", diff --git a/docs/manifest.json b/docs/manifest.json index eb146648bef8..f110f47e1cfd 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -2293,6 +2293,14 @@ "main" ] }, + { + "id": "cloud-optimization", + "name": "google/cloud-optimization", + "defaultService": "optimization/readme", + "versions": [ + "main" + ] + }, { "id": "cloud-orchestration-airflow", "name": "google/cloud-orchestration-airflow",