Class Shipment.Builder (1.44.0)

public static final class Shipment.Builder extends GeneratedMessageV3.Builder<Shipment.Builder> implements ShipmentOrBuilder

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

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addAllAllowedVehicleIndices(Iterable<? extends Integer> values)

public Shipment.Builder addAllAllowedVehicleIndices(Iterable<? extends Integer> values)

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
values Iterable<? extends java.lang.Integer>

The allowedVehicleIndices to add.

Returns
Type Description
Shipment.Builder

This builder for chaining.

addAllCostsPerVehicle(Iterable<? extends Double> values)

public Shipment.Builder addAllCostsPerVehicle(Iterable<? extends Double> values)

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
values Iterable<? extends java.lang.Double>

The costsPerVehicle to add.

Returns
Type Description
Shipment.Builder

This builder for chaining.

addAllCostsPerVehicleIndices(Iterable<? extends Integer> values)

public Shipment.Builder addAllCostsPerVehicleIndices(Iterable<? extends Integer> values)

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
values Iterable<? extends java.lang.Integer>

The costsPerVehicleIndices to add.

Returns
Type Description
Shipment.Builder

This builder for chaining.

addAllDeliveries(Iterable<? extends Shipment.VisitRequest> values)

public Shipment.Builder addAllDeliveries(Iterable<? extends Shipment.VisitRequest> values)

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
values Iterable<? extends com.google.cloud.optimization.v1.Shipment.VisitRequest>
Returns
Type Description
Shipment.Builder

addAllDemands(Iterable<? extends CapacityQuantity> values) (deprecated)

public Shipment.Builder addAllDemands(Iterable<? extends CapacityQuantity> values)

Deprecated: Use Shipment.load_demands instead.

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

Parameter
Name Description
values Iterable<? extends com.google.cloud.optimization.v1.CapacityQuantity>
Returns
Type Description
Shipment.Builder

addAllPickups(Iterable<? extends Shipment.VisitRequest> values)

public Shipment.Builder addAllPickups(Iterable<? extends Shipment.VisitRequest> values)

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
values Iterable<? extends com.google.cloud.optimization.v1.Shipment.VisitRequest>
Returns
Type Description
Shipment.Builder

addAllowedVehicleIndices(int value)

public Shipment.Builder addAllowedVehicleIndices(int value)

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
value int

The allowedVehicleIndices to add.

Returns
Type Description
Shipment.Builder

This builder for chaining.

addCostsPerVehicle(double value)

public Shipment.Builder addCostsPerVehicle(double value)

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
value double

The costsPerVehicle to add.

Returns
Type Description
Shipment.Builder

This builder for chaining.

addCostsPerVehicleIndices(int value)

public Shipment.Builder addCostsPerVehicleIndices(int value)

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
value int

The costsPerVehicleIndices to add.

Returns
Type Description
Shipment.Builder

This builder for chaining.

addDeliveries(Shipment.VisitRequest value)

public Shipment.Builder addDeliveries(Shipment.VisitRequest value)

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
value Shipment.VisitRequest
Returns
Type Description
Shipment.Builder

addDeliveries(Shipment.VisitRequest.Builder builderForValue)

public Shipment.Builder addDeliveries(Shipment.VisitRequest.Builder builderForValue)

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
builderForValue Shipment.VisitRequest.Builder
Returns
Type Description
Shipment.Builder

addDeliveries(int index, Shipment.VisitRequest value)

public Shipment.Builder addDeliveries(int index, Shipment.VisitRequest value)

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;

Parameters
Name Description
index int
value Shipment.VisitRequest
Returns
Type Description
Shipment.Builder

addDeliveries(int index, Shipment.VisitRequest.Builder builderForValue)

public Shipment.Builder addDeliveries(int index, Shipment.VisitRequest.Builder builderForValue)

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;

Parameters
Name Description
index int
builderForValue Shipment.VisitRequest.Builder
Returns
Type Description
Shipment.Builder

addDeliveriesBuilder()

public Shipment.VisitRequest.Builder addDeliveriesBuilder()

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
Shipment.VisitRequest.Builder

addDeliveriesBuilder(int index)

public Shipment.VisitRequest.Builder addDeliveriesBuilder(int index)

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

addDemands(CapacityQuantity value) (deprecated)

public Shipment.Builder addDemands(CapacityQuantity value)

Deprecated: Use Shipment.load_demands instead.

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

Parameter
Name Description
value CapacityQuantity
Returns
Type Description
Shipment.Builder

addDemands(CapacityQuantity.Builder builderForValue) (deprecated)

public Shipment.Builder addDemands(CapacityQuantity.Builder builderForValue)

Deprecated: Use Shipment.load_demands instead.

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

Parameter
Name Description
builderForValue CapacityQuantity.Builder
Returns
Type Description
Shipment.Builder

addDemands(int index, CapacityQuantity value) (deprecated)

public Shipment.Builder addDemands(int index, CapacityQuantity value)

Deprecated: Use Shipment.load_demands instead.

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

Parameters
Name Description
index int
value CapacityQuantity
Returns
Type Description
Shipment.Builder

addDemands(int index, CapacityQuantity.Builder builderForValue) (deprecated)

public Shipment.Builder addDemands(int index, CapacityQuantity.Builder builderForValue)

Deprecated: Use Shipment.load_demands instead.

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

Parameters
Name Description
index int
builderForValue CapacityQuantity.Builder
Returns
Type Description
Shipment.Builder

addDemandsBuilder() (deprecated)

public CapacityQuantity.Builder addDemandsBuilder()

Deprecated: Use Shipment.load_demands instead.

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

Returns
Type Description
CapacityQuantity.Builder

addDemandsBuilder(int index) (deprecated)

public CapacityQuantity.Builder addDemandsBuilder(int index)

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

addPickups(Shipment.VisitRequest value)

public Shipment.Builder addPickups(Shipment.VisitRequest value)

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
value Shipment.VisitRequest
Returns
Type Description
Shipment.Builder

addPickups(Shipment.VisitRequest.Builder builderForValue)

public Shipment.Builder addPickups(Shipment.VisitRequest.Builder builderForValue)

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
builderForValue Shipment.VisitRequest.Builder
Returns
Type Description
Shipment.Builder

addPickups(int index, Shipment.VisitRequest value)

public Shipment.Builder addPickups(int index, Shipment.VisitRequest value)

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;

Parameters
Name Description
index int
value Shipment.VisitRequest
Returns
Type Description
Shipment.Builder

addPickups(int index, Shipment.VisitRequest.Builder builderForValue)

public Shipment.Builder addPickups(int index, Shipment.VisitRequest.Builder builderForValue)

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;

Parameters
Name Description
index int
builderForValue Shipment.VisitRequest.Builder
Returns
Type Description
Shipment.Builder

addPickupsBuilder()

public Shipment.VisitRequest.Builder addPickupsBuilder()

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
Shipment.VisitRequest.Builder

addPickupsBuilder(int index)

public Shipment.VisitRequest.Builder addPickupsBuilder(int index)

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

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Shipment.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Shipment.Builder
Overrides

build()

public Shipment build()
Returns
Type Description
Shipment

buildPartial()

public Shipment buildPartial()
Returns
Type Description
Shipment

clear()

public Shipment.Builder clear()
Returns
Type Description
Shipment.Builder
Overrides

clearAllowedVehicleIndices()

public Shipment.Builder clearAllowedVehicleIndices()

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
Shipment.Builder

This builder for chaining.

clearCostsPerVehicle()

public Shipment.Builder clearCostsPerVehicle()

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
Shipment.Builder

This builder for chaining.

clearCostsPerVehicleIndices()

public Shipment.Builder clearCostsPerVehicleIndices()

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
Shipment.Builder

This builder for chaining.

clearDeliveries()

public Shipment.Builder clearDeliveries()

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
Shipment.Builder

clearDemands() (deprecated)

public Shipment.Builder clearDemands()

Deprecated: Use Shipment.load_demands instead.

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

Returns
Type Description
Shipment.Builder

clearField(Descriptors.FieldDescriptor field)

public Shipment.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
Shipment.Builder
Overrides

clearIgnore()

public Shipment.Builder clearIgnore()

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
Shipment.Builder

This builder for chaining.

clearLabel()

public Shipment.Builder clearLabel()

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
Shipment.Builder

This builder for chaining.

clearLoadDemands()

public Shipment.Builder clearLoadDemands()
Returns
Type Description
Shipment.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public Shipment.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
Shipment.Builder
Overrides

clearPenaltyCost()

public Shipment.Builder clearPenaltyCost()

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
Shipment.Builder

This builder for chaining.

clearPickupToDeliveryAbsoluteDetourLimit()

public Shipment.Builder clearPickupToDeliveryAbsoluteDetourLimit()

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
Shipment.Builder

clearPickupToDeliveryRelativeDetourLimit()

public Shipment.Builder clearPickupToDeliveryRelativeDetourLimit()

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
Shipment.Builder

This builder for chaining.

clearPickupToDeliveryTimeLimit()

public Shipment.Builder clearPickupToDeliveryTimeLimit()

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
Shipment.Builder

clearPickups()

public Shipment.Builder clearPickups()

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
Shipment.Builder

clearShipmentType()

public Shipment.Builder clearShipmentType()

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
Shipment.Builder

This builder for chaining.

clone()

public Shipment.Builder clone()
Returns
Type Description
Shipment.Builder
Overrides

containsLoadDemands(String key)

public boolean containsLoadDemands(String key)

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

getAllowedVehicleIndices(int index)

public int getAllowedVehicleIndices(int index)

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

public int getAllowedVehicleIndicesCount()

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

public List<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)

public double getCostsPerVehicle(int index)

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

public int getCostsPerVehicleCount()

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)

public int getCostsPerVehicleIndices(int index)

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

public int getCostsPerVehicleIndicesCount()

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

public List<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()

public List<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()

public Shipment getDefaultInstanceForType()
Returns
Type Description
Shipment

getDeliveries(int index)

public Shipment.VisitRequest getDeliveries(int index)

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

getDeliveriesBuilder(int index)

public Shipment.VisitRequest.Builder getDeliveriesBuilder(int index)

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

getDeliveriesBuilderList()

public List<Shipment.VisitRequest.Builder> getDeliveriesBuilderList()

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<Builder>

getDeliveriesCount()

public int getDeliveriesCount()

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

public List<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)

public Shipment.VisitRequestOrBuilder getDeliveriesOrBuilder(int index)

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

public List<? extends Shipment.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)

public CapacityQuantity getDemands(int index)

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

getDemandsBuilder(int index) (deprecated)

public CapacityQuantity.Builder getDemandsBuilder(int index)

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

getDemandsBuilderList() (deprecated)

public List<CapacityQuantity.Builder> getDemandsBuilderList()

Deprecated: Use Shipment.load_demands instead.

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

Returns
Type Description
List<Builder>

getDemandsCount() (deprecated)

public int getDemandsCount()

Deprecated: Use Shipment.load_demands instead.

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

Returns
Type Description
int

getDemandsList() (deprecated)

public List<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)

public CapacityQuantityOrBuilder getDemandsOrBuilder(int index)

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)

public List<? extends CapacityQuantityOrBuilder> 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>

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getIgnore()

public boolean 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.

bool ignore = 13;

Returns
Type Description
boolean

The ignore.

getLabel()

public String getLabel()

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

public ByteString getLabelBytes()

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)

public Map<String,Shipment.Load> getLoadDemands()

Use #getLoadDemandsMap() instead.

Returns
Type Description
Map<String,Load>

getLoadDemandsCount()

public int getLoadDemandsCount()

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

public Map<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)

public Shipment.Load getLoadDemandsOrDefault(String key, Shipment.Load defaultValue)

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)

public Shipment.Load getLoadDemandsOrThrow(String key)

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

getMutableLoadDemands() (deprecated)

public Map<String,Shipment.Load> getMutableLoadDemands()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,Load>

getPenaltyCost()

public double 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.

optional double penalty_cost = 4;

Returns
Type Description
double

The penaltyCost.

getPickupToDeliveryAbsoluteDetourLimit()

public Duration 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:

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

getPickupToDeliveryAbsoluteDetourLimitBuilder()

public Duration.Builder getPickupToDeliveryAbsoluteDetourLimitBuilder()

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
Builder

getPickupToDeliveryAbsoluteDetourLimitOrBuilder()

public DurationOrBuilder getPickupToDeliveryAbsoluteDetourLimitOrBuilder()

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

public double 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:

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

public Duration 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.

.google.protobuf.Duration pickup_to_delivery_time_limit = 10;

Returns
Type Description
Duration

The pickupToDeliveryTimeLimit.

getPickupToDeliveryTimeLimitBuilder()

public Duration.Builder getPickupToDeliveryTimeLimitBuilder()

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
Builder

getPickupToDeliveryTimeLimitOrBuilder()

public DurationOrBuilder getPickupToDeliveryTimeLimitOrBuilder()

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)

public Shipment.VisitRequest getPickups(int index)

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

getPickupsBuilder(int index)

public Shipment.VisitRequest.Builder getPickupsBuilder(int index)

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

getPickupsBuilderList()

public List<Shipment.VisitRequest.Builder> getPickupsBuilderList()

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<Builder>

getPickupsCount()

public int getPickupsCount()

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

public List<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)

public Shipment.VisitRequestOrBuilder getPickupsOrBuilder(int index)

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

public List<? extends Shipment.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>

getShipmentType()

public String 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.

string shipment_type = 11;

Returns
Type Description
String

The shipmentType.

getShipmentTypeBytes()

public ByteString getShipmentTypeBytes()

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

public boolean hasPenaltyCost()

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

public boolean hasPickupToDeliveryAbsoluteDetourLimit()

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

public boolean hasPickupToDeliveryRelativeDetourLimit()

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

public boolean hasPickupToDeliveryTimeLimit()

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.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

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

internalGetMutableMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(Shipment other)

public Shipment.Builder mergeFrom(Shipment other)
Parameter
Name Description
other Shipment
Returns
Type Description
Shipment.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Shipment.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Shipment.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public Shipment.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
Shipment.Builder
Overrides

mergePickupToDeliveryAbsoluteDetourLimit(Duration value)

public Shipment.Builder mergePickupToDeliveryAbsoluteDetourLimit(Duration value)

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;

Parameter
Name Description
value Duration
Returns
Type Description
Shipment.Builder

mergePickupToDeliveryTimeLimit(Duration value)

public Shipment.Builder mergePickupToDeliveryTimeLimit(Duration value)

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;

Parameter
Name Description
value Duration
Returns
Type Description
Shipment.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Shipment.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Shipment.Builder
Overrides

putAllLoadDemands(Map<String,Shipment.Load> values)

public Shipment.Builder putAllLoadDemands(Map<String,Shipment.Load> values)

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
values Map<String,Load>
Returns
Type Description
Shipment.Builder

putLoadDemands(String key, Shipment.Load value)

public Shipment.Builder putLoadDemands(String key, Shipment.Load value)

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
value Shipment.Load
Returns
Type Description
Shipment.Builder

putLoadDemandsBuilderIfAbsent(String key)

public Shipment.Load.Builder putLoadDemandsBuilderIfAbsent(String key)

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

removeDeliveries(int index)

public Shipment.Builder removeDeliveries(int index)

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

removeDemands(int index) (deprecated)

public Shipment.Builder removeDemands(int index)

Deprecated: Use Shipment.load_demands instead.

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

Parameter
Name Description
index int
Returns
Type Description
Shipment.Builder

removeLoadDemands(String key)

public Shipment.Builder removeLoadDemands(String key)

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

removePickups(int index)

public Shipment.Builder removePickups(int index)

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

setAllowedVehicleIndices(int index, int value)

public Shipment.Builder setAllowedVehicleIndices(int index, int value)

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;

Parameters
Name Description
index int

The index to set the value at.

value int

The allowedVehicleIndices to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setCostsPerVehicle(int index, double value)

public Shipment.Builder setCostsPerVehicle(int index, double value)

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;

Parameters
Name Description
index int

The index to set the value at.

value double

The costsPerVehicle to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setCostsPerVehicleIndices(int index, int value)

public Shipment.Builder setCostsPerVehicleIndices(int index, int value)

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;

Parameters
Name Description
index int

The index to set the value at.

value int

The costsPerVehicleIndices to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setDeliveries(int index, Shipment.VisitRequest value)

public Shipment.Builder setDeliveries(int index, Shipment.VisitRequest value)

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;

Parameters
Name Description
index int
value Shipment.VisitRequest
Returns
Type Description
Shipment.Builder

setDeliveries(int index, Shipment.VisitRequest.Builder builderForValue)

public Shipment.Builder setDeliveries(int index, Shipment.VisitRequest.Builder builderForValue)

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;

Parameters
Name Description
index int
builderForValue Shipment.VisitRequest.Builder
Returns
Type Description
Shipment.Builder

setDemands(int index, CapacityQuantity value) (deprecated)

public Shipment.Builder setDemands(int index, CapacityQuantity value)

Deprecated: Use Shipment.load_demands instead.

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

Parameters
Name Description
index int
value CapacityQuantity
Returns
Type Description
Shipment.Builder

setDemands(int index, CapacityQuantity.Builder builderForValue) (deprecated)

public Shipment.Builder setDemands(int index, CapacityQuantity.Builder builderForValue)

Deprecated: Use Shipment.load_demands instead.

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

Parameters
Name Description
index int
builderForValue CapacityQuantity.Builder
Returns
Type Description
Shipment.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public Shipment.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Shipment.Builder
Overrides

setIgnore(boolean value)

public Shipment.Builder setIgnore(boolean value)

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;

Parameter
Name Description
value boolean

The ignore to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setLabel(String value)

public Shipment.Builder setLabel(String value)

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;

Parameter
Name Description
value String

The label to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setLabelBytes(ByteString value)

public Shipment.Builder setLabelBytes(ByteString value)

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;

Parameter
Name Description
value ByteString

The bytes for label to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setPenaltyCost(double value)

public Shipment.Builder setPenaltyCost(double value)

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;

Parameter
Name Description
value double

The penaltyCost to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setPickupToDeliveryAbsoluteDetourLimit(Duration value)

public Shipment.Builder setPickupToDeliveryAbsoluteDetourLimit(Duration value)

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;

Parameter
Name Description
value Duration
Returns
Type Description
Shipment.Builder

setPickupToDeliveryAbsoluteDetourLimit(Duration.Builder builderForValue)

public Shipment.Builder setPickupToDeliveryAbsoluteDetourLimit(Duration.Builder builderForValue)

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;

Parameter
Name Description
builderForValue Builder
Returns
Type Description
Shipment.Builder

setPickupToDeliveryRelativeDetourLimit(double value)

public Shipment.Builder setPickupToDeliveryRelativeDetourLimit(double value)

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;

Parameter
Name Description
value double

The pickupToDeliveryRelativeDetourLimit to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setPickupToDeliveryTimeLimit(Duration value)

public Shipment.Builder setPickupToDeliveryTimeLimit(Duration value)

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;

Parameter
Name Description
value Duration
Returns
Type Description
Shipment.Builder

setPickupToDeliveryTimeLimit(Duration.Builder builderForValue)

public Shipment.Builder setPickupToDeliveryTimeLimit(Duration.Builder builderForValue)

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;

Parameter
Name Description
builderForValue Builder
Returns
Type Description
Shipment.Builder

setPickups(int index, Shipment.VisitRequest value)

public Shipment.Builder setPickups(int index, Shipment.VisitRequest value)

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;

Parameters
Name Description
index int
value Shipment.VisitRequest
Returns
Type Description
Shipment.Builder

setPickups(int index, Shipment.VisitRequest.Builder builderForValue)

public Shipment.Builder setPickups(int index, Shipment.VisitRequest.Builder builderForValue)

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;

Parameters
Name Description
index int
builderForValue Shipment.VisitRequest.Builder
Returns
Type Description
Shipment.Builder

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public Shipment.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
Shipment.Builder
Overrides

setShipmentType(String value)

public Shipment.Builder setShipmentType(String value)

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;

Parameter
Name Description
value String

The shipmentType to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setShipmentTypeBytes(ByteString value)

public Shipment.Builder setShipmentTypeBytes(ByteString value)

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;

Parameter
Name Description
value ByteString

The bytes for shipmentType to set.

Returns
Type Description
Shipment.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final Shipment.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Shipment.Builder
Overrides