Skip to content

Commit 366f6f1

Browse files
feat: [google-maps-routeoptimization] minor fields and documentation update (googleapis#13083)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: [google-maps-routeoptimization] minor fields and documentation update feat: A new message `RouteModifiers` is added feat: A new field `route_modifiers` is added to message `.google.maps.routeoptimization.v1.Vehicle` feat: A new field `cost_per_kilometer_below_soft_max` is added to message `.google.maps.routeoptimization.v1.DistanceLimit` docs: A comment for method `BatchOptimizeTours` in service `RouteOptimization` is changed docs: A comment for enum value `DEFAULT_SOLVE` in enum `SolvingMode` is changed docs: A comment for field `validation_errors` in message `.google.maps.routeoptimization.v1.OptimizeToursResponse` is changed docs: A comment for message `TimeWindow` is changed docs: A comment for enum value `CODE_UNSPECIFIED` in enum `Code` is changed docs: A comment for field `reasons` in message `.google.maps.routeoptimization.v1.SkippedShipment` is changed docs: A comment for enum value `RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD` in enum `Level` is changed docs: A comment for message `OptimizeToursValidationError` is changed docs: A comment for field `code` in message `.google.maps.routeoptimization.v1.OptimizeToursValidationError` is changed END_COMMIT_OVERRIDE feat: A new message `RouteModifiers` is added feat: A new field `route_modifiers` is added to message `.google.maps.routeoptimization.v1.Vehicle` feat: A new field `cost_per_kilometer_below_soft_max` is added to message `.google.maps.routeoptimization.v1.DistanceLimit` docs: A comment for method `BatchOptimizeTours` in service `RouteOptimization` is changed docs: A comment for enum value `DEFAULT_SOLVE` in enum `SolvingMode` is changed docs: A comment for field `validation_errors` in message `.google.maps.routeoptimization.v1.OptimizeToursResponse` is changed docs: A comment for message `TimeWindow` is changed docs: A comment for enum value `CODE_UNSPECIFIED` in enum `Code` is changed docs: A comment for field `reasons` in message `.google.maps.routeoptimization.v1.SkippedShipment` is changed docs: A comment for enum value `RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD` in enum `Level` is changed docs: A comment for message `OptimizeToursValidationError` is changed docs: A comment for field `code` in message `.google.maps.routeoptimization.v1.OptimizeToursValidationError` is changed PiperOrigin-RevId: 674021227 Source-Link: googleapis/googleapis@a834320 Source-Link: https://github.com/googleapis/googleapis-gen/commit/13dfeeb21d7dd16c6f80f7196e07a2a2ace35eb4 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtcm91dGVvcHRpbWl6YXRpb24vLk93bEJvdC55YW1sIiwiaCI6IjEzZGZlZWIyMWQ3ZGQxNmM2ZjgwZjcxOTZlMDdhMmEyYWNlMzVlYjQifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
1 parent c03c441 commit 366f6f1

8 files changed

Lines changed: 167 additions & 13 deletions

File tree

packages/google-maps-routeoptimization/google/maps/routeoptimization/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
OptimizeToursResponse,
4242
OptimizeToursValidationError,
4343
OutputConfig,
44+
RouteModifiers,
4445
Shipment,
4546
ShipmentModel,
4647
ShipmentRoute,
@@ -71,6 +72,7 @@
7172
"OptimizeToursResponse",
7273
"OptimizeToursValidationError",
7374
"OutputConfig",
75+
"RouteModifiers",
7476
"Shipment",
7577
"ShipmentModel",
7678
"ShipmentRoute",

packages/google-maps-routeoptimization/google/maps/routeoptimization_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
OptimizeToursResponse,
4040
OptimizeToursValidationError,
4141
OutputConfig,
42+
RouteModifiers,
4243
Shipment,
4344
ShipmentModel,
4445
ShipmentRoute,
@@ -69,6 +70,7 @@
6970
"OptimizeToursResponse",
7071
"OptimizeToursValidationError",
7172
"OutputConfig",
73+
"RouteModifiers",
7274
"RouteOptimizationClient",
7375
"Shipment",
7476
"ShipmentModel",

packages/google-maps-routeoptimization/google/maps/routeoptimization_v1/services/route_optimization/async_client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,19 @@ async def batch_optimize_tours(
410410
containing ``ShipmentRoute``\ s, which are a set of routes to be
411411
performed by vehicles minimizing the overall cost.
412412
413+
The user can poll ``operations.get`` to check the status of the
414+
LRO:
415+
416+
If the LRO's ``done`` field is false, then at least one request
417+
is still being processed. Other requests may have completed
418+
successfully and their results are available in GCS.
419+
420+
If the LRO's ``done`` field is true, then all requests have been
421+
processed. Any successfully processed requests will have their
422+
results available in GCS. Any requests that failed will not have
423+
their results available in GCS. If the LRO's ``error`` field is
424+
set, then it contains the error from one of the failed requests.
425+
413426
.. code-block:: python
414427
415428
# This snippet has been automatically generated and should be regarded as a

packages/google-maps-routeoptimization/google/maps/routeoptimization_v1/services/route_optimization/client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,19 @@ def batch_optimize_tours(
812812
containing ``ShipmentRoute``\ s, which are a set of routes to be
813813
performed by vehicles minimizing the overall cost.
814814
815+
The user can poll ``operations.get`` to check the status of the
816+
LRO:
817+
818+
If the LRO's ``done`` field is false, then at least one request
819+
is still being processed. Other requests may have completed
820+
successfully and their results are available in GCS.
821+
822+
If the LRO's ``done`` field is true, then all requests have been
823+
processed. Any successfully processed requests will have their
824+
results available in GCS. Any requests that failed will not have
825+
their results available in GCS. If the LRO's ``error`` field is
826+
set, then it contains the error from one of the failed requests.
827+
815828
.. code-block:: python
816829
817830
# This snippet has been automatically generated and should be regarded as a

packages/google-maps-routeoptimization/google/maps/routeoptimization_v1/services/route_optimization/transports/grpc.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,19 @@ def batch_optimize_tours(
336336
containing ``ShipmentRoute``\ s, which are a set of routes to be
337337
performed by vehicles minimizing the overall cost.
338338
339+
The user can poll ``operations.get`` to check the status of the
340+
LRO:
341+
342+
If the LRO's ``done`` field is false, then at least one request
343+
is still being processed. Other requests may have completed
344+
successfully and their results are available in GCS.
345+
346+
If the LRO's ``done`` field is true, then all requests have been
347+
processed. Any successfully processed requests will have their
348+
results available in GCS. Any requests that failed will not have
349+
their results available in GCS. If the LRO's ``error`` field is
350+
set, then it contains the error from one of the failed requests.
351+
339352
Returns:
340353
Callable[[~.BatchOptimizeToursRequest],
341354
~.Operation]:

packages/google-maps-routeoptimization/google/maps/routeoptimization_v1/services/route_optimization/transports/grpc_asyncio.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,19 @@ def batch_optimize_tours(
343343
containing ``ShipmentRoute``\ s, which are a set of routes to be
344344
performed by vehicles minimizing the overall cost.
345345
346+
The user can poll ``operations.get`` to check the status of the
347+
LRO:
348+
349+
If the LRO's ``done`` field is false, then at least one request
350+
is still being processed. Other requests may have completed
351+
successfully and their results are available in GCS.
352+
353+
If the LRO's ``done`` field is true, then all requests have been
354+
processed. Any successfully processed requests will have their
355+
results available in GCS. Any requests that failed will not have
356+
their results available in GCS. If the LRO's ``error`` field is
357+
set, then it contains the error from one of the failed requests.
358+
346359
Returns:
347360
Callable[[~.BatchOptimizeToursRequest],
348361
Awaitable[~.Operation]]:

packages/google-maps-routeoptimization/google/maps/routeoptimization_v1/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
OptimizeToursResponse,
3131
OptimizeToursValidationError,
3232
OutputConfig,
33+
RouteModifiers,
3334
Shipment,
3435
ShipmentModel,
3536
ShipmentRoute,
@@ -58,6 +59,7 @@
5859
"OptimizeToursResponse",
5960
"OptimizeToursValidationError",
6061
"OutputConfig",
62+
"RouteModifiers",
6163
"Shipment",
6264
"ShipmentModel",
6365
"ShipmentRoute",

packages/google-maps-routeoptimization/google/maps/routeoptimization_v1/types/route_optimization_service.py

Lines changed: 109 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"Shipment",
3636
"ShipmentTypeIncompatibility",
3737
"ShipmentTypeRequirement",
38+
"RouteModifiers",
3839
"Vehicle",
3940
"TimeWindow",
4041
"DistanceLimit",
@@ -382,7 +383,8 @@ class SolvingMode(proto.Enum):
382383
383384
Values:
384385
DEFAULT_SOLVE (0):
385-
Solve the model.
386+
Solve the model. Warnings may be issued in
387+
[OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors].
386388
VALIDATE_ONLY (1):
387389
Only validates the model without solving it: populates as
388390
many
@@ -531,7 +533,8 @@ class OptimizeToursResponse(proto.Message):
531533
detect independently. See the "MULTIPLE ERRORS" explanation
532534
for the
533535
[OptimizeToursValidationError][google.maps.routeoptimization.v1.OptimizeToursValidationError]
534-
message.
536+
message. Instead of errors, this will include warnings in
537+
the case ``solving_mode`` is ``DEFAULT_SOLVE``.
535538
metrics (google.maps.routeoptimization_v1.types.OptimizeToursResponse.Metrics):
536539
Duration, distance and usage metrics for this
537540
solution.
@@ -1524,6 +1527,53 @@ class RequirementMode(proto.Enum):
15241527
)
15251528

15261529

1530+
class RouteModifiers(proto.Message):
1531+
r"""Encapsulates a set of optional conditions to satisfy when
1532+
calculating vehicle routes. This is similar to ``RouteModifiers`` in
1533+
the Google Maps Platform Routes Preferred API; see:
1534+
https://developers.google.com/maps/documentation/routes/reference/rest/v2/RouteModifiers.
1535+
1536+
Attributes:
1537+
avoid_tolls (bool):
1538+
Specifies whether to avoid toll roads where
1539+
reasonable. Preference will be given to routes
1540+
not containing toll roads. Applies only to
1541+
motorized travel modes.
1542+
avoid_highways (bool):
1543+
Specifies whether to avoid highways where
1544+
reasonable. Preference will be given to routes
1545+
not containing highways. Applies only to
1546+
motorized travel modes.
1547+
avoid_ferries (bool):
1548+
Specifies whether to avoid ferries where
1549+
reasonable. Preference will be given to routes
1550+
not containing travel by ferries. Applies only
1551+
to motorized travel modes.
1552+
avoid_indoor (bool):
1553+
Optional. Specifies whether to avoid navigating indoors
1554+
where reasonable. Preference will be given to routes not
1555+
containing indoor navigation. Applies only to the
1556+
``WALKING`` travel mode.
1557+
"""
1558+
1559+
avoid_tolls: bool = proto.Field(
1560+
proto.BOOL,
1561+
number=2,
1562+
)
1563+
avoid_highways: bool = proto.Field(
1564+
proto.BOOL,
1565+
number=3,
1566+
)
1567+
avoid_ferries: bool = proto.Field(
1568+
proto.BOOL,
1569+
number=4,
1570+
)
1571+
avoid_indoor: bool = proto.Field(
1572+
proto.BOOL,
1573+
number=5,
1574+
)
1575+
1576+
15271577
class Vehicle(proto.Message):
15281578
r"""Models a vehicle in a shipment problem. Solving a shipment problem
15291579
will build a route starting from ``start_location`` and ending at
@@ -1542,6 +1592,10 @@ class Vehicle(proto.Message):
15421592
The travel mode which affects the roads usable by the
15431593
vehicle and its speed. See also
15441594
``travel_duration_multiple``.
1595+
route_modifiers (google.maps.routeoptimization_v1.types.RouteModifiers):
1596+
A set of conditions to satisfy that affect
1597+
the way routes are calculated for the given
1598+
vehicle.
15451599
start_location (google.type.latlng_pb2.LatLng):
15461600
Geographic location where the vehicle starts before picking
15471601
up any shipments. If not specified, the vehicle starts at
@@ -1964,6 +2018,11 @@ class DurationLimit(proto.Message):
19642018
number=1,
19652019
enum=TravelMode,
19662020
)
2021+
route_modifiers: "RouteModifiers" = proto.Field(
2022+
proto.MESSAGE,
2023+
number=2,
2024+
message="RouteModifiers",
2025+
)
19672026
start_location: latlng_pb2.LatLng = proto.Field(
19682027
proto.MESSAGE,
19692028
number=3,
@@ -2098,8 +2157,9 @@ class TimeWindow(proto.Message):
20982157
20992158
::
21002159
2101-
0 <= `start_time` <= `soft_start_time` <= `end_time` and
2102-
0 <= `start_time` <= `soft_end_time` <= `end_time`.
2160+
0 <= `start_time` <= `end_time` and
2161+
0 <= `start_time` <= `soft_start_time` and
2162+
0 <= `soft_end_time` <= `end_time`.
21032163
21042164
21052165
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
@@ -2203,6 +2263,18 @@ class DistanceLimit(proto.Message):
22032263
must be nonnegative.
22042264
22052265
This field is a member of `oneof`_ ``_soft_max_meters``.
2266+
cost_per_kilometer_below_soft_max (float):
2267+
Cost per kilometer incurred, increasing up to
2268+
``soft_max_meters``, with formula:
2269+
2270+
::
2271+
2272+
min(distance_meters, soft_max_meters) / 1000.0 *
2273+
cost_per_kilometer_below_soft_max.
2274+
2275+
This cost is not supported in ``route_distance_limit``.
2276+
2277+
This field is a member of `oneof`_ ``_cost_per_kilometer_below_soft_max``.
22062278
cost_per_kilometer_above_soft_max (float):
22072279
Cost per kilometer incurred if distance is above
22082280
``soft_max_meters`` limit. The additional cost is 0 if the
@@ -2229,6 +2301,11 @@ class DistanceLimit(proto.Message):
22292301
number=2,
22302302
optional=True,
22312303
)
2304+
cost_per_kilometer_below_soft_max: float = proto.Field(
2305+
proto.DOUBLE,
2306+
number=4,
2307+
optional=True,
2308+
)
22322309
cost_per_kilometer_above_soft_max: float = proto.Field(
22332310
proto.DOUBLE,
22342311
number=3,
@@ -3056,7 +3133,8 @@ class SkippedShipment(proto.Message):
30563133
if specified in the ``Shipment``.
30573134
reasons (MutableSequence[google.maps.routeoptimization_v1.types.SkippedShipment.Reason]):
30583135
A list of reasons that explain why the shipment was skipped.
3059-
See comment above ``Reason``.
3136+
See comment above ``Reason``. If we are unable to understand
3137+
why a shipment was skipped, reasons will not be set.
30603138
"""
30613139

30623140
class Reason(proto.Message):
@@ -3115,9 +3193,7 @@ class Code(proto.Enum):
31153193
31163194
Values:
31173195
CODE_UNSPECIFIED (0):
3118-
This should never be used. If we are unable
3119-
to understand why a shipment was skipped, we
3120-
simply return an empty set of reasons.
3196+
This should never be used.
31213197
NO_VEHICLE (1):
31223198
There is no vehicle in the model making all
31233199
shipments infeasible.
@@ -3420,8 +3496,8 @@ class Level(proto.Enum):
34203496
or before them.
34213497
RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD (2):
34223498
Same as ``RELAX_VISIT_TIMES_AFTER_THRESHOLD``, but the visit
3423-
sequence is also relaxed: visits remain simply bound to
3424-
their vehicle.
3499+
sequence is also relaxed: visits can only be performed by
3500+
this vehicle, but can potentially become unperformed.
34253501
RELAX_ALL_AFTER_THRESHOLD (3):
34263502
Same as ``RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD``,
34273503
but the vehicle is also relaxed: visits are completely free
@@ -3478,7 +3554,7 @@ class Level(proto.Enum):
34783554

34793555

34803556
class OptimizeToursValidationError(proto.Message):
3481-
r"""Describes an error encountered when validating an
3557+
r"""Describes an error or warning encountered when validating an
34823558
``OptimizeToursRequest``.
34833559
34843560
Attributes:
@@ -3592,8 +3668,10 @@ class OptimizeToursValidationError(proto.Message):
35923668
- TIME_WINDOW_OVERLAPPING_ADJACENT_OR_EARLIER_THAN_PREVIOUS
35933669
= 2812;
35943670
- TIME_WINDOW_START_TIME_AFTER_SOFT_START_TIME = 2813;
3595-
- TIME_WINDOW_SOFT_START_TIME_AFTER_END_TIME = 2814;
3596-
- TIME_WINDOW_START_TIME_AFTER_SOFT_END_TIME = 2815;
3671+
- TIME_WINDOW_SOFT_START_TIME_OUTSIDE_GLOBAL_TIME_WINDOW
3672+
= 2819;
3673+
- TIME_WINDOW_SOFT_END_TIME_OUTSIDE_GLOBAL_TIME_WINDOW =
3674+
2820;
35973675
- TIME_WINDOW_SOFT_END_TIME_AFTER_END_TIME = 2816;
35983676
- TIME_WINDOW_COST_BEFORE_SOFT_START_TIME_SET_AND_MULTIPLE_WINDOWS
35993677
= 2817;
@@ -3754,6 +3832,15 @@ class OptimizeToursValidationError(proto.Message):
37543832
37553833
- PRECEDENCE_ERROR = 46;
37563834
3835+
- PRECEDENCE_RULE_MISSING_FIRST_INDEX = 4600;
3836+
- PRECEDENCE_RULE_MISSING_SECOND_INDEX = 4601;
3837+
- PRECEDENCE_RULE_FIRST_INDEX_OUT_OF_BOUNDS = 4602;
3838+
- PRECEDENCE_RULE_SECOND_INDEX_OUT_OF_BOUNDS = 4603;
3839+
- PRECEDENCE_RULE_DUPLICATE_INDEX = 4604;
3840+
- PRECEDENCE_RULE_INEXISTENT_FIRST_VISIT_REQUEST = 4605;
3841+
- PRECEDENCE_RULE_INEXISTENT_SECOND_VISIT_REQUEST =
3842+
4606;
3843+
37573844
- BREAK_ERROR = 48;
37583845
37593846
- BREAK_RULE_EMPTY = 4800;
@@ -3826,6 +3913,15 @@ class OptimizeToursValidationError(proto.Message):
38263913
5600;
38273914
- DURATION_SECONDS_MATRIX_DURATION_EXCEEDS_GLOBAL_DURATION
38283915
= 5601;
3916+
3917+
- WARNING = 9;
3918+
3919+
- WARNING_INJECTED_FIRST_SOLUTION = 90;
3920+
3921+
- WARNING_INJECTED_FIRST_SOLUTION_INFEASIBLE_SHIPMENTS_REMOVED
3922+
= 9000;
3923+
- WARNING_INJECTED_FIRST_SOLUTION_INFEASIBLE_AFTER_GETTING_TRAVEL_TIMES
3924+
= 9001;
38293925
display_name (str):
38303926
The error display name.
38313927
fields (MutableSequence[google.maps.routeoptimization_v1.types.OptimizeToursValidationError.FieldReference]):

0 commit comments

Comments
 (0)