Class Shipment (1.35.0)

publicfinalclass ShipmentextendsGeneratedMessageV3implementsShipmentOrBuilder

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).

Protobuf type google.cloud.optimization.v1.Shipment

Implements

ShipmentOrBuilder

Inherited Members

com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT)
com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT,int)
com.google.protobuf.GeneratedMessageV3.<T>emptyList(java.lang.Class<T>)
com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int)

Static Fields

ALLOWED_VEHICLE_INDICES_FIELD_NUMBER

publicstaticfinalintALLOWED_VEHICLE_INDICES_FIELD_NUMBER
Field Value
Type Description
int

COSTS_PER_VEHICLE_FIELD_NUMBER

publicstaticfinalintCOSTS_PER_VEHICLE_FIELD_NUMBER
Field Value
Type Description
int

COSTS_PER_VEHICLE_INDICES_FIELD_NUMBER

publicstaticfinalintCOSTS_PER_VEHICLE_INDICES_FIELD_NUMBER
Field Value
Type Description
int

DELIVERIES_FIELD_NUMBER

publicstaticfinalintDELIVERIES_FIELD_NUMBER
Field Value
Type Description
int

DEMANDS_FIELD_NUMBER

publicstaticfinalintDEMANDS_FIELD_NUMBER
Field Value
Type Description
int

IGNORE_FIELD_NUMBER

publicstaticfinalintIGNORE_FIELD_NUMBER
Field Value
Type Description
int

LABEL_FIELD_NUMBER

publicstaticfinalintLABEL_FIELD_NUMBER
Field Value
Type Description
int

LOAD_DEMANDS_FIELD_NUMBER

publicstaticfinalintLOAD_DEMANDS_FIELD_NUMBER
Field Value
Type Description
int

PENALTY_COST_FIELD_NUMBER

publicstaticfinalintPENALTY_COST_FIELD_NUMBER
Field Value
Type Description
int

PICKUPS_FIELD_NUMBER

publicstaticfinalintPICKUPS_FIELD_NUMBER
Field Value
Type Description
int

PICKUP_TO_DELIVERY_ABSOLUTE_DETOUR_LIMIT_FIELD_NUMBER

publicstaticfinalintPICKUP_TO_DELIVERY_ABSOLUTE_DETOUR_LIMIT_FIELD_NUMBER
Field Value
Type Description
int

PICKUP_TO_DELIVERY_RELATIVE_DETOUR_LIMIT_FIELD_NUMBER

publicstaticfinalintPICKUP_TO_DELIVERY_RELATIVE_DETOUR_LIMIT_FIELD_NUMBER
Field Value
Type Description
int

PICKUP_TO_DELIVERY_TIME_LIMIT_FIELD_NUMBER

publicstaticfinalintPICKUP_TO_DELIVERY_TIME_LIMIT_FIELD_NUMBER
Field Value
Type Description
int

SHIPMENT_TYPE_FIELD_NUMBER

publicstaticfinalintSHIPMENT_TYPE_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

publicstaticShipmentgetDefaultInstance()
Returns
Type Description
Shipment

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

newBuilder()

publicstaticShipment.BuildernewBuilder()
Returns
Type Description
Shipment.Builder

newBuilder(Shipment prototype)

publicstaticShipment.BuildernewBuilder(Shipmentprototype)
Parameter
Name Description
prototype Shipment
Returns
Type Description
Shipment.Builder

parseDelimitedFrom(InputStream input)

publicstaticShipmentparseDelimitedFrom(InputStreaminput)
Parameter
Name Description
input InputStream
Returns
Type Description
Shipment
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticShipmentparseDelimitedFrom(InputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Shipment
Exceptions
Type Description
IOException

parseFrom(byte[] data)

publicstaticShipmentparseFrom(byte[]data)
Parameter
Name Description
data byte[]
Returns
Type Description
Shipment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

publicstaticShipmentparseFrom(byte[]data,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Shipment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

publicstaticShipmentparseFrom(ByteStringdata)
Parameter
Name Description
data ByteString
Returns
Type Description
Shipment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

publicstaticShipmentparseFrom(ByteStringdata,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Shipment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

publicstaticShipmentparseFrom(CodedInputStreaminput)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Shipment
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticShipmentparseFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Shipment
Exceptions
Type Description
IOException

parseFrom(InputStream input)

publicstaticShipmentparseFrom(InputStreaminput)
Parameter
Name Description
input InputStream
Returns
Type Description
Shipment
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

publicstaticShipmentparseFrom(InputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Shipment
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

publicstaticShipmentparseFrom(ByteBufferdata)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Shipment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

publicstaticShipmentparseFrom(ByteBufferdata,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Shipment
Exceptions
Type Description
InvalidProtocolBufferException

parser()

publicstaticParser<Shipment>parser()
Returns
Type Description
Parser<Shipment>

Methods

containsLoadDemands(String key)

publicbooleancontainsLoadDemands(Stringkey)

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.

map<string, .google.cloud.optimization.v1.Shipment.Load> load_demands = 14;

Parameter
Name Description
key String
Returns
Type Description
boolean

equals(Object obj)

publicbooleanequals(Objectobj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getAllowedVehicleIndices(int index)

publicintgetAllowedVehicleIndices(intindex)

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.

repeated int32 allowed_vehicle_indices = 5;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
int

The allowedVehicleIndices at the given index.

getAllowedVehicleIndicesCount()

publicintgetAllowedVehicleIndicesCount()

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.

repeated int32 allowed_vehicle_indices = 5;

Returns
Type Description
int

The count of allowedVehicleIndices.

getAllowedVehicleIndicesList()

publicList<Integer>getAllowedVehicleIndicesList()

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.

repeated int32 allowed_vehicle_indices = 5;

Returns
Type Description
List<Integer>

A list containing the allowedVehicleIndices.

getCostsPerVehicle(int index)

publicdoublegetCostsPerVehicle(intindex)

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.

repeated double costs_per_vehicle = 6;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
double

The costsPerVehicle at the given index.

getCostsPerVehicleCount()

publicintgetCostsPerVehicleCount()

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.

repeated double costs_per_vehicle = 6;

Returns
Type Description
int

The count of costsPerVehicle.

getCostsPerVehicleIndices(int index)

publicintgetCostsPerVehicleIndices(intindex)

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.

repeated int32 costs_per_vehicle_indices = 7;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
int

The costsPerVehicleIndices at the given index.

getCostsPerVehicleIndicesCount()

publicintgetCostsPerVehicleIndicesCount()

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.

repeated int32 costs_per_vehicle_indices = 7;

Returns
Type Description
int

The count of costsPerVehicleIndices.

getCostsPerVehicleIndicesList()

publicList<Integer>getCostsPerVehicleIndicesList()

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.

repeated int32 costs_per_vehicle_indices = 7;

Returns
Type Description
List<Integer>

A list containing the costsPerVehicleIndices.

getCostsPerVehicleList()

publicList<Double>getCostsPerVehicleList()

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.

repeated double costs_per_vehicle = 6;

Returns
Type Description
List<Double>

A list containing the costsPerVehicle.

getDefaultInstanceForType()

publicShipmentgetDefaultInstanceForType()
Returns
Type Description
Shipment

getDeliveries(int index)

publicShipment.VisitRequestgetDeliveries(intindex)

Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2;

Parameter
Name Description
index int
Returns
Type Description
Shipment.VisitRequest

getDeliveriesCount()

publicintgetDeliveriesCount()

Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2;

Returns
Type Description
int

getDeliveriesList()

publicList<Shipment.VisitRequest>getDeliveriesList()

Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2;

Returns
Type Description
List<VisitRequest>

getDeliveriesOrBuilder(int index)

publicShipment.VisitRequestOrBuildergetDeliveriesOrBuilder(intindex)

Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2;

Parameter
Name Description
index int
Returns
Type Description
Shipment.VisitRequestOrBuilder

getDeliveriesOrBuilderList()

publicList<?extendsShipment.VisitRequestOrBuilder>getDeliveriesOrBuilderList()

Set of delivery alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the pickups.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest deliveries = 2;

Returns
Type Description
List<? extends com.google.cloud.optimization.v1.Shipment.VisitRequestOrBuilder>

getDemands(int index) (deprecated)

publicCapacityQuantitygetDemands(intindex)

Deprecated: Use Shipment.load_demands instead.

repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true];

Parameter
Name Description
index int
Returns
Type Description
CapacityQuantity

getDemandsCount() (deprecated)

publicintgetDemandsCount()

Deprecated: Use Shipment.load_demands instead.

repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true];

Returns
Type Description
int

getDemandsList() (deprecated)

publicList<CapacityQuantity>getDemandsList()

Deprecated: Use Shipment.load_demands instead.

repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true];

Returns
Type Description
List<CapacityQuantity>

getDemandsOrBuilder(int index) (deprecated)

publicCapacityQuantityOrBuildergetDemandsOrBuilder(intindex)

Deprecated: Use Shipment.load_demands instead.

repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true];

Parameter
Name Description
index int
Returns
Type Description
CapacityQuantityOrBuilder

getDemandsOrBuilderList() (deprecated)

publicList<?extendsCapacityQuantityOrBuilder>getDemandsOrBuilderList()

Deprecated: Use Shipment.load_demands instead.

repeated .google.cloud.optimization.v1.CapacityQuantity demands = 3 [deprecated = true];

Returns
Type Description
List<? extends com.google.cloud.optimization.v1.CapacityQuantityOrBuilder>

getIgnore()

publicbooleangetIgnore()

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.

bool ignore = 13;

Returns
Type Description
boolean

The ignore.

getLabel()

publicStringgetLabel()

Specifies a label for this shipment. This label is reported in the response in the shipment_label of the corresponding ShipmentRoute.Visit.

string label = 12;

Returns
Type Description
String

The label.

getLabelBytes()

publicByteStringgetLabelBytes()

Specifies a label for this shipment. This label is reported in the response in the shipment_label of the corresponding ShipmentRoute.Visit.

string label = 12;

Returns
Type Description
ByteString

The bytes for label.

getLoadDemands() (deprecated)

publicMap<String,Shipment.Load>getLoadDemands()

Use #getLoadDemandsMap() instead.

Returns
Type Description
Map<String,Load>

getLoadDemandsCount()

publicintgetLoadDemandsCount()

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.

map<string, .google.cloud.optimization.v1.Shipment.Load> load_demands = 14;

Returns
Type Description
int

getLoadDemandsMap()

publicMap<String,Shipment.Load>getLoadDemandsMap()

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.

map<string, .google.cloud.optimization.v1.Shipment.Load> load_demands = 14;

Returns
Type Description
Map<String,Load>

getLoadDemandsOrDefault(String key, Shipment.Load defaultValue)

publicShipment.LoadgetLoadDemandsOrDefault(Stringkey,Shipment.LoaddefaultValue)

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.

map<string, .google.cloud.optimization.v1.Shipment.Load> load_demands = 14;

Parameters
Name Description
key String
defaultValue Shipment.Load
Returns
Type Description
Shipment.Load

getLoadDemandsOrThrow(String key)

publicShipment.LoadgetLoadDemandsOrThrow(Stringkey)

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.

map<string, .google.cloud.optimization.v1.Shipment.Load> load_demands = 14;

Parameter
Name Description
key String
Returns
Type Description
Shipment.Load

getParserForType()

publicParser<Shipment>getParserForType()
Returns
Type Description
Parser<Shipment>
Overrides

getPenaltyCost()

publicdoublegetPenaltyCost()

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.

optional double penalty_cost = 4;

Returns
Type Description
double

The penaltyCost.

getPickupToDeliveryAbsoluteDetourLimit()

publicDurationgetPickupToDeliveryAbsoluteDetourLimit()

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:

<code><code> start_time(delivery) - start_time(pickup) &lt;= t + pickup_to_delivery_absolute_detour_limit </code></code>

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.

.google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9;

Returns
Type Description
Duration

The pickupToDeliveryAbsoluteDetourLimit.

getPickupToDeliveryAbsoluteDetourLimitOrBuilder()

publicDurationOrBuildergetPickupToDeliveryAbsoluteDetourLimitOrBuilder()

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:

<code><code> start_time(delivery) - start_time(pickup) &lt;= t + pickup_to_delivery_absolute_detour_limit </code></code>

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.

.google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9;

Returns
Type Description
DurationOrBuilder

getPickupToDeliveryRelativeDetourLimit()

publicdoublegetPickupToDeliveryRelativeDetourLimit()

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:

<code><code> start_time(delivery) - start_time(pickup) &lt;= std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) </code></code>

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.

optional double pickup_to_delivery_relative_detour_limit = 8;

Returns
Type Description
double

The pickupToDeliveryRelativeDetourLimit.

getPickupToDeliveryTimeLimit()

publicDurationgetPickupToDeliveryTimeLimit()

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.

.google.protobuf.Duration pickup_to_delivery_time_limit = 10;

Returns
Type Description
Duration

The pickupToDeliveryTimeLimit.

getPickupToDeliveryTimeLimitOrBuilder()

publicDurationOrBuildergetPickupToDeliveryTimeLimitOrBuilder()

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.

.google.protobuf.Duration pickup_to_delivery_time_limit = 10;

Returns
Type Description
DurationOrBuilder

getPickups(int index)

publicShipment.VisitRequestgetPickups(intindex)

Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1;

Parameter
Name Description
index int
Returns
Type Description
Shipment.VisitRequest

getPickupsCount()

publicintgetPickupsCount()

Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1;

Returns
Type Description
int

getPickupsList()

publicList<Shipment.VisitRequest>getPickupsList()

Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1;

Returns
Type Description
List<VisitRequest>

getPickupsOrBuilder(int index)

publicShipment.VisitRequestOrBuildergetPickupsOrBuilder(intindex)

Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1;

Parameter
Name Description
index int
Returns
Type Description
Shipment.VisitRequestOrBuilder

getPickupsOrBuilderList()

publicList<?extendsShipment.VisitRequestOrBuilder>getPickupsOrBuilderList()

Set of pickup alternatives associated to the shipment. If not specified, the vehicle only needs to visit a location corresponding to the deliveries.

repeated .google.cloud.optimization.v1.Shipment.VisitRequest pickups = 1;

Returns
Type Description
List<? extends com.google.cloud.optimization.v1.Shipment.VisitRequestOrBuilder>

getSerializedSize()

publicintgetSerializedSize()
Returns
Type Description
int
Overrides

getShipmentType()

publicStringgetShipmentType()

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.

string shipment_type = 11;

Returns
Type Description
String

The shipmentType.

getShipmentTypeBytes()

publicByteStringgetShipmentTypeBytes()

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.

string shipment_type = 11;

Returns
Type Description
ByteString

The bytes for shipmentType.

hasPenaltyCost()

publicbooleanhasPenaltyCost()

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.

optional double penalty_cost = 4;

Returns
Type Description
boolean

Whether the penaltyCost field is set.

hasPickupToDeliveryAbsoluteDetourLimit()

publicbooleanhasPickupToDeliveryAbsoluteDetourLimit()

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:

<code><code> start_time(delivery) - start_time(pickup) &lt;= t + pickup_to_delivery_absolute_detour_limit </code></code>

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.

.google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9;

Returns
Type Description
boolean

Whether the pickupToDeliveryAbsoluteDetourLimit field is set.

hasPickupToDeliveryRelativeDetourLimit()

publicbooleanhasPickupToDeliveryRelativeDetourLimit()

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:

<code><code> start_time(delivery) - start_time(pickup) &lt;= std::ceil(t * (1.0 + pickup_to_delivery_relative_detour_limit)) </code></code>

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.

optional double pickup_to_delivery_relative_detour_limit = 8;

Returns
Type Description
boolean

Whether the pickupToDeliveryRelativeDetourLimit field is set.

hasPickupToDeliveryTimeLimit()

publicbooleanhasPickupToDeliveryTimeLimit()

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.

.google.protobuf.Duration pickup_to_delivery_time_limit = 10;

Returns
Type Description
boolean

Whether the pickupToDeliveryTimeLimit field is set.

hashCode()

publicinthashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

protectedMapFieldReflectionAccessorinternalGetMapFieldReflection(intnumber)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int)

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

publicShipment.BuildernewBuilderForType()
Returns
Type Description
Shipment.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protectedShipment.BuildernewBuilderForType(GeneratedMessageV3.BuilderParentparent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Shipment.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protectedObjectnewInstance(GeneratedMessageV3.UnusedPrivateParameterunused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

publicShipment.BuildertoBuilder()
Returns
Type Description
Shipment.Builder

writeTo(CodedOutputStream output)

publicvoidwriteTo(CodedOutputStreamoutput)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.