Reference documentation and code samples for the Google Cloud Optimization V1 Client class Shipment.
The shipment of a single item, from one of its pickups to one of its deliveries. For the shipment to be considered as performed, a unique vehicle must visit one of its pickup locations (and decrease its spare capacities accordingly), then visit one of its delivery locations later on (and therefore re-increase its spare capacities accordingly).
Generated from protobuf message google.cloud.optimization.v1.Shipment
Namespace
Google \ Cloud \ Optimization \ V1Methods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ pickups |
array<Google\Cloud\Optimization\V1\Shipment\VisitRequest>
Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries. |
↳ deliveries |
array<Google\Cloud\Optimization\V1\Shipment\VisitRequest>
Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups. |
↳ load_demands |
array|Google\Protobuf\Internal\MapField
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. |
↳ penalty_cost |
float
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. |
↳ allowed_vehicle_indices |
array
The set of vehicles that may perform this shipment. If empty, all vehicles may perform it. Vehicles are given by their index in the |
↳ costs_per_vehicle |
array
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 |
array
Indices of the vehicles to which |
↳ pickup_to_delivery_relative_detour_limit |
float
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_absolute_detour_limit |
Google\Protobuf\Duration
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_time_limit |
Google\Protobuf\Duration
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. |
↳ shipment_type |
string
Non-empty string specifying a "type" for this shipment. This feature can be used to define incompatibilities or requirements between |
↳ label |
string
Specifies a label for this shipment. This label is reported in the response in the |
↳ ignore |
bool
If true, skip this shipment, but don't apply a |
↳ demands |
array<Google\Cloud\Optimization\V1\CapacityQuantity>
Deprecated: Use Shipment.load_demands instead. |
getPickups
Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setPickups
Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.
Parameter | |
---|---|
Name | Description |
var |
array<Google\Cloud\Optimization\V1\Shipment\VisitRequest>
|
Returns | |
---|---|
Type | Description |
$this |
getDeliveries
Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setDeliveries
Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.
Parameter | |
---|---|
Name | Description |
var |
array<Google\Cloud\Optimization\V1\Shipment\VisitRequest>
|
Returns | |
---|---|
Type | Description |
$this |
getLoadDemands
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.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\MapField |
setLoadDemands
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.
Parameter | |
---|---|
Name | Description |
var |
array|Google\Protobuf\Internal\MapField
|
Returns | |
---|---|
Type | Description |
$this |
getPenaltyCost
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.
Returns | |
---|---|
Type | Description |
float |
hasPenaltyCost
clearPenaltyCost
setPenaltyCost
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.
Parameter | |
---|---|
Name | Description |
var |
float
|
Returns | |
---|---|
Type | Description |
$this |
getAllowedVehicleIndices
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.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setAllowedVehicleIndices
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.
Parameter | |
---|---|
Name | Description |
var |
int[]
|
Returns | |
---|---|
Type | Description |
$this |
getCostsPerVehicle
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.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setCostsPerVehicle
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.
Parameter | |
---|---|
Name | Description |
var |
float[]
|
Returns | |
---|---|
Type | Description |
$this |
getCostsPerVehicleIndices
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.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setCostsPerVehicleIndices
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.
Parameter | |
---|---|
Name | Description |
var |
int[]
|
Returns | |
---|---|
Type | Description |
$this |
getPickupToDeliveryRelativeDetourLimit
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.
Returns | |
---|---|
Type | Description |
float |
hasPickupToDeliveryRelativeDetourLimit
clearPickupToDeliveryRelativeDetourLimit
setPickupToDeliveryRelativeDetourLimit
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.
Parameter | |
---|---|
Name | Description |
var |
float
|
Returns | |
---|---|
Type | Description |
$this |
getPickupToDeliveryAbsoluteDetourLimit
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.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Duration|null |
hasPickupToDeliveryAbsoluteDetourLimit
clearPickupToDeliveryAbsoluteDetourLimit
setPickupToDeliveryAbsoluteDetourLimit
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.
Parameter | |
---|---|
Name | Description |
var |
Google\Protobuf\Duration
|
Returns | |
---|---|
Type | Description |
$this |
getPickupToDeliveryTimeLimit
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.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Duration|null |
hasPickupToDeliveryTimeLimit
clearPickupToDeliveryTimeLimit
setPickupToDeliveryTimeLimit
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.
Parameter | |
---|---|
Name | Description |
var |
Google\Protobuf\Duration
|
Returns | |
---|---|
Type | Description |
$this |
getShipmentType
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
.
Returns | |
---|---|
Type | Description |
string |
setShipmentType
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
.
Parameter | |
---|---|
Name | Description |
var |
string
|
Returns | |
---|---|
Type | Description |
$this |
getLabel
Specifies a label for this shipment. This label is reported in the response
in the shipment_label
of the corresponding
ShipmentRoute.Visit.
Returns | |
---|---|
Type | Description |
string |
setLabel
Specifies a label for this shipment. This label is reported in the response
in the shipment_label
of the corresponding
ShipmentRoute.Visit.
Parameter | |
---|---|
Name | Description |
var |
string
|
Returns | |
---|---|
Type | Description |
$this |
getIgnore
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.
Returns | |
---|---|
Type | Description |
bool |
setIgnore
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.
Parameter | |
---|---|
Name | Description |
var |
bool
|
Returns | |
---|---|
Type | Description |
$this |
getDemands
Deprecated: Use Shipment.load_demands instead.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setDemands
Deprecated: Use Shipment.load_demands instead.
Parameter | |
---|---|
Name | Description |
var |
array<Google\Cloud\Optimization\V1\CapacityQuantity>
|
Returns | |
---|---|
Type | Description |
$this |