Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Commit 1761203

Browse files
docs: Add documentation for enums (#103)
* docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: googleapis/googleapis@a391fd1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/0080f830dec37c3384157082bce279e37079ea58 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 6350a2b commit 1761203

File tree

4 files changed

+181
-4
lines changed

4 files changed

+181
-4
lines changed

google/cloud/optimization_v1/services/fleet_routing/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ def sample_batch_optimize_tours():
656656
# Done; return the response.
657657
return response
658658

659-
def __enter__(self):
659+
def __enter__(self) -> "FleetRoutingClient":
660660
return self
661661

662662
def __exit__(self, type, value, traceback):

google/cloud/optimization_v1/types/async_model.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@
3434

3535

3636
class DataFormat(proto.Enum):
37-
r"""Data formats for input and output files."""
37+
r"""Data formats for input and output files.
38+
39+
Values:
40+
DATA_FORMAT_UNSPECIFIED (0):
41+
Default value.
42+
JSON (1):
43+
Input data in json format.
44+
STRING (2):
45+
Input data in string format.
46+
"""
3847
DATA_FORMAT_UNSPECIFIED = 0
3948
JSON = 1
4049
STRING = 2
@@ -148,7 +157,21 @@ class AsyncModelMetadata(proto.Message):
148157
"""
149158

150159
class State(proto.Enum):
151-
r"""Possible states of the operation."""
160+
r"""Possible states of the operation.
161+
162+
Values:
163+
STATE_UNSPECIFIED (0):
164+
The default value. This value is used if the
165+
state is omitted.
166+
RUNNING (1):
167+
Request is being processed.
168+
SUCCEEDED (2):
169+
The operation completed successfully.
170+
CANCELLED (3):
171+
The operation was cancelled.
172+
FAILED (4):
173+
The operation has failed.
174+
"""
152175
STATE_UNSPECIFIED = 0
153176
RUNNING = 1
154177
SUCCEEDED = 2

google/cloud/optimization_v1/types/fleet_routing.py

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,24 @@ class SolvingMode(proto.Enum):
288288
``INVALID_REQUEST`` error. See
289289
[max_validation_errors][google.cloud.optimization.v1.OptimizeToursRequest.max_validation_errors]
290290
to cap the number of errors returned.
291+
292+
Values:
293+
DEFAULT_SOLVE (0):
294+
Solve the model.
295+
VALIDATE_ONLY (1):
296+
Only validates the model without solving it: populates as
297+
many
298+
[OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors]
299+
as possible.
300+
DETECT_SOME_INFEASIBLE_SHIPMENTS (2):
301+
Only populates
302+
[OptimizeToursResponse.skipped_shipments][google.cloud.optimization.v1.OptimizeToursResponse.skipped_shipments],
303+
and doesn't actually solve the rest of the request
304+
(``status`` and ``routes`` are unset in the response).
305+
306+
*IMPORTANT*: not all infeasible shipments are returned here,
307+
but only the ones that are detected as infeasible as a
308+
preprocessing.
291309
"""
292310
DEFAULT_SOLVE = 0
293311
VALIDATE_ONLY = 1
@@ -297,6 +315,16 @@ class SearchMode(proto.Enum):
297315
r"""Mode defining the behavior of the search, trading off latency
298316
versus solution quality. In all modes, the global request
299317
deadline is enforced.
318+
319+
Values:
320+
SEARCH_MODE_UNSPECIFIED (0):
321+
Unspecified search mode, equivalent to ``RETURN_FAST``.
322+
RETURN_FAST (1):
323+
Stop the search after finding the first good
324+
solution.
325+
CONSUME_ALL_AVAILABLE_TIME (2):
326+
Spend all the available time to search for
327+
better solutions.
300328
"""
301329
SEARCH_MODE_UNSPECIFIED = 0
302330
RETURN_FAST = 1
@@ -1540,6 +1568,25 @@ class ShipmentTypeIncompatibility(proto.Message):
15401568
class IncompatibilityMode(proto.Enum):
15411569
r"""Modes defining how the appearance of incompatible shipments
15421570
are restricted on the same route.
1571+
1572+
Values:
1573+
INCOMPATIBILITY_MODE_UNSPECIFIED (0):
1574+
Unspecified incompatibility mode. This value
1575+
should never be used.
1576+
NOT_PERFORMED_BY_SAME_VEHICLE (1):
1577+
In this mode, two shipments with incompatible
1578+
types can never share the same vehicle.
1579+
NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY (2):
1580+
For two shipments with incompatible types with the
1581+
``NOT_IN_SAME_VEHICLE_SIMULTANEOUSLY`` incompatibility mode:
1582+
1583+
- If both are pickups only (no deliveries) or deliveries
1584+
only (no pickups), they cannot share the same vehicle at
1585+
all.
1586+
- If one of the shipments has a delivery and the other a
1587+
pickup, the two shipments can share the same vehicle iff
1588+
the former shipment is delivered before the latter is
1589+
picked up.
15431590
"""
15441591
INCOMPATIBILITY_MODE_UNSPECIFIED = 0
15451592
NOT_PERFORMED_BY_SAME_VEHICLE = 1
@@ -1580,6 +1627,32 @@ class ShipmentTypeRequirement(proto.Message):
15801627
class RequirementMode(proto.Enum):
15811628
r"""Modes defining the appearance of dependent shipments on a
15821629
route.
1630+
1631+
Values:
1632+
REQUIREMENT_MODE_UNSPECIFIED (0):
1633+
Unspecified requirement mode. This value
1634+
should never be used.
1635+
PERFORMED_BY_SAME_VEHICLE (1):
1636+
In this mode, all "dependent" shipments must
1637+
share the same vehicle as at least one of their
1638+
"required" shipments.
1639+
IN_SAME_VEHICLE_AT_PICKUP_TIME (2):
1640+
With the ``IN_SAME_VEHICLE_AT_PICKUP_TIME`` mode, all
1641+
"dependent" shipments need to have at least one "required"
1642+
shipment on their vehicle at the time of their pickup.
1643+
1644+
A "dependent" shipment pickup must therefore have either:
1645+
1646+
- A delivery-only "required" shipment delivered on the
1647+
route after, or
1648+
- A "required" shipment picked up on the route before it,
1649+
and if the "required" shipment has a delivery, this
1650+
delivery must be performed after the "dependent"
1651+
shipment's pickup.
1652+
IN_SAME_VEHICLE_AT_DELIVERY_TIME (3):
1653+
Same as before, except the "dependent" shipments need to
1654+
have a "required" shipment on their vehicle at the time of
1655+
their *delivery*.
15831656
"""
15841657
REQUIREMENT_MODE_UNSPECIFIED = 0
15851658
PERFORMED_BY_SAME_VEHICLE = 1
@@ -1821,6 +1894,13 @@ class TravelMode(proto.Enum):
18211894
These should be a subset of the Google Maps Platform Routes
18221895
Preferred API travel modes, see:
18231896
https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode.
1897+
1898+
Values:
1899+
TRAVEL_MODE_UNSPECIFIED (0):
1900+
Unspecified travel mode, equivalent to ``DRIVING``.
1901+
DRIVING (1):
1902+
Travel mode corresponding to driving
1903+
directions (car, ...).
18241904
"""
18251905
TRAVEL_MODE_UNSPECIFIED = 0
18261906
DRIVING = 1
@@ -1831,6 +1911,17 @@ class UnloadingPolicy(proto.Enum):
18311911
18321912
Other shipments are free to occur anywhere on the route independent
18331913
of ``unloading_policy``.
1914+
1915+
Values:
1916+
UNLOADING_POLICY_UNSPECIFIED (0):
1917+
Unspecified unloading policy; deliveries must
1918+
just occur after their corresponding pickups.
1919+
LAST_IN_FIRST_OUT (1):
1920+
Deliveries must occur in reverse order of
1921+
pickups
1922+
FIRST_IN_FIRST_OUT (2):
1923+
Deliveries must occur in the same order as
1924+
pickups
18341925
"""
18351926
UNLOADING_POLICY_UNSPECIFIED = 0
18361927
LAST_IN_FIRST_OUT = 1
@@ -3410,6 +3501,47 @@ class Code(proto.Enum):
34103501
meaningless. In particular, it gives no indication of whether a
34113502
given reason will appear before another in the solution, if both
34123503
apply.
3504+
3505+
Values:
3506+
CODE_UNSPECIFIED (0):
3507+
This should never be used. If we are unable
3508+
to understand why a shipment was skipped, we
3509+
simply return an empty set of reasons.
3510+
NO_VEHICLE (1):
3511+
There is no vehicle in the model making all
3512+
shipments infeasible.
3513+
DEMAND_EXCEEDS_VEHICLE_CAPACITY (2):
3514+
The demand of the shipment exceeds a vehicle's capacity for
3515+
some capacity types, one of which is
3516+
``example_exceeded_capacity_type``.
3517+
CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT (3):
3518+
The minimum distance necessary to perform this shipment,
3519+
i.e. from the vehicle's ``start_location`` to the shipment's
3520+
pickup and/or delivery locations and to the vehicle's end
3521+
location exceeds the vehicle's ``route_distance_limit``.
3522+
3523+
Note that for this computation we use the geodesic
3524+
distances.
3525+
CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT (4):
3526+
The minimum time necessary to perform this shipment,
3527+
including travel time, wait time and service time exceeds
3528+
the vehicle's ``route_duration_limit``.
3529+
3530+
Note: travel time is computed in the best-case scenario,
3531+
namely as geodesic distance x 36 m/s (roughly 130 km/hour).
3532+
CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TRAVEL_DURATION_LIMIT (5):
3533+
Same as above but we only compare minimum travel time and
3534+
the vehicle's ``travel_duration_limit``.
3535+
CANNOT_BE_PERFORMED_WITHIN_VEHICLE_TIME_WINDOWS (6):
3536+
The vehicle cannot perform this shipment in the best-case
3537+
scenario (see
3538+
``CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DURATION_LIMIT`` for
3539+
time computation) if it starts at its earliest start time:
3540+
the total time would make the vehicle end after its latest
3541+
end time.
3542+
VEHICLE_NOT_ALLOWED (7):
3543+
The ``allowed_vehicle_indices`` field of the shipment is not
3544+
empty and this vehicle does not belong to it.
34133545
"""
34143546
CODE_UNSPECIFIED = 0
34153547
NO_VEHICLE = 1
@@ -3672,6 +3804,28 @@ class Level(proto.Enum):
36723804
the threshold conditions.
36733805
36743806
The enumeration below is in order of increasing relaxation.
3807+
3808+
Values:
3809+
LEVEL_UNSPECIFIED (0):
3810+
Implicit default relaxation level: no constraints are
3811+
relaxed, i.e., all visits are fully constrained.
3812+
3813+
This value must not be explicly used in ``level``.
3814+
RELAX_VISIT_TIMES_AFTER_THRESHOLD (1):
3815+
Visit start times and vehicle start/end times
3816+
will be relaxed, but each visit remains bound to
3817+
the same vehicle and the visit sequence must be
3818+
observed: no visit can be inserted between them
3819+
or before them.
3820+
RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD (2):
3821+
Same as ``RELAX_VISIT_TIMES_AFTER_THRESHOLD``, but the visit
3822+
sequence is also relaxed: visits remain simply bound to
3823+
their vehicle.
3824+
RELAX_ALL_AFTER_THRESHOLD (3):
3825+
Same as ``RELAX_VISIT_TIMES_AND_SEQUENCE_AFTER_THRESHOLD``,
3826+
but the vehicle is also relaxed: visits are completely free
3827+
at or after the threshold time and can potentially become
3828+
unperformed.
36753829
"""
36763830
LEVEL_UNSPECIFIED = 0
36773831
RELAX_VISIT_TIMES_AFTER_THRESHOLD = 1

samples/generated_samples/snippet_metadata_google.cloud.optimization.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-optimization",
11-
"version": "1.3.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)