Class ShipmentModel.Builder (1.73.0)

publicstaticfinalclass ShipmentModel.BuilderextendsGeneratedMessageV3.Builder<ShipmentModel.Builder>implementsShipmentModelOrBuilder

A shipment model contains a set of shipments which must be performed by a set of vehicles, while minimizing the overall cost, which is the sum of:

  • the cost of routing the vehicles (sum of cost per total time, cost per travel time, and fixed cost over all vehicles).
  • the unperformed shipment penalties.
  • the cost of the global duration of the shipments

Protobuf type google.cloud.optimization.v1.ShipmentModel

Inherited Members

com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

Methods

addAllBreakRules(Iterable<? extends ShipmentModel.BreakRule> values) (deprecated)

publicShipmentModel.BuilderaddAllBreakRules(Iterable<?extendsShipmentModel.BreakRule>values)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

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

addAllDurationDistanceMatrices(Iterable<? extends ShipmentModel.DurationDistanceMatrix> values)

publicShipmentModel.BuilderaddAllDurationDistanceMatrices(Iterable<?extendsShipmentModel.DurationDistanceMatrix>values)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

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

addAllDurationDistanceMatrixDstTags(Iterable<String> values)

publicShipmentModel.BuilderaddAllDurationDistanceMatrixDstTags(Iterable<String>values)

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Parameter
Name Description
values Iterable<String>

The durationDistanceMatrixDstTags to add.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

addAllDurationDistanceMatrixSrcTags(Iterable<String> values)

publicShipmentModel.BuilderaddAllDurationDistanceMatrixSrcTags(Iterable<String>values)

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Parameter
Name Description
values Iterable<String>

The durationDistanceMatrixSrcTags to add.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

addAllPrecedenceRules(Iterable<? extends ShipmentModel.PrecedenceRule> values)

publicShipmentModel.BuilderaddAllPrecedenceRules(Iterable<?extendsShipmentModel.PrecedenceRule>values)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

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

addAllShipmentTypeIncompatibilities(Iterable<? extends ShipmentTypeIncompatibility> values)

publicShipmentModel.BuilderaddAllShipmentTypeIncompatibilities(Iterable<?extendsShipmentTypeIncompatibility>values)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

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

addAllShipmentTypeRequirements(Iterable<? extends ShipmentTypeRequirement> values)

publicShipmentModel.BuilderaddAllShipmentTypeRequirements(Iterable<?extendsShipmentTypeRequirement>values)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

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

addAllShipments(Iterable<? extends Shipment> values)

publicShipmentModel.BuilderaddAllShipments(Iterable<?extendsShipment>values)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

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

addAllTransitionAttributes(Iterable<? extends TransitionAttributes> values)

publicShipmentModel.BuilderaddAllTransitionAttributes(Iterable<?extendsTransitionAttributes>values)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

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

addAllVehicles(Iterable<? extends Vehicle> values)

publicShipmentModel.BuilderaddAllVehicles(Iterable<?extendsVehicle>values)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

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

addBreakRules(ShipmentModel.BreakRule value) (deprecated)

publicShipmentModel.BuilderaddBreakRules(ShipmentModel.BreakRulevalue)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameter
Name Description
value ShipmentModel.BreakRule
Returns
Type Description
ShipmentModel.Builder

addBreakRules(ShipmentModel.BreakRule.Builder builderForValue) (deprecated)

publicShipmentModel.BuilderaddBreakRules(ShipmentModel.BreakRule.BuilderbuilderForValue)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameter
Name Description
builderForValue ShipmentModel.BreakRule.Builder
Returns
Type Description
ShipmentModel.Builder

addBreakRules(int index, ShipmentModel.BreakRule value) (deprecated)

publicShipmentModel.BuilderaddBreakRules(intindex,ShipmentModel.BreakRulevalue)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameters
Name Description
index int
value ShipmentModel.BreakRule
Returns
Type Description
ShipmentModel.Builder

addBreakRules(int index, ShipmentModel.BreakRule.Builder builderForValue) (deprecated)

publicShipmentModel.BuilderaddBreakRules(intindex,ShipmentModel.BreakRule.BuilderbuilderForValue)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameters
Name Description
index int
builderForValue ShipmentModel.BreakRule.Builder
Returns
Type Description
ShipmentModel.Builder

addBreakRulesBuilder() (deprecated)

publicShipmentModel.BreakRule.BuilderaddBreakRulesBuilder()

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Returns
Type Description
ShipmentModel.BreakRule.Builder

addBreakRulesBuilder(int index) (deprecated)

publicShipmentModel.BreakRule.BuilderaddBreakRulesBuilder(intindex)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.BreakRule.Builder

addDurationDistanceMatrices(ShipmentModel.DurationDistanceMatrix value)

publicShipmentModel.BuilderaddDurationDistanceMatrices(ShipmentModel.DurationDistanceMatrixvalue)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameter
Name Description
value ShipmentModel.DurationDistanceMatrix
Returns
Type Description
ShipmentModel.Builder

addDurationDistanceMatrices(ShipmentModel.DurationDistanceMatrix.Builder builderForValue)

publicShipmentModel.BuilderaddDurationDistanceMatrices(ShipmentModel.DurationDistanceMatrix.BuilderbuilderForValue)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameter
Name Description
builderForValue ShipmentModel.DurationDistanceMatrix.Builder
Returns
Type Description
ShipmentModel.Builder

addDurationDistanceMatrices(int index, ShipmentModel.DurationDistanceMatrix value)

publicShipmentModel.BuilderaddDurationDistanceMatrices(intindex,ShipmentModel.DurationDistanceMatrixvalue)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameters
Name Description
index int
value ShipmentModel.DurationDistanceMatrix
Returns
Type Description
ShipmentModel.Builder

addDurationDistanceMatrices(int index, ShipmentModel.DurationDistanceMatrix.Builder builderForValue)

publicShipmentModel.BuilderaddDurationDistanceMatrices(intindex,ShipmentModel.DurationDistanceMatrix.BuilderbuilderForValue)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameters
Name Description
index int
builderForValue ShipmentModel.DurationDistanceMatrix.Builder
Returns
Type Description
ShipmentModel.Builder

addDurationDistanceMatricesBuilder()

publicShipmentModel.DurationDistanceMatrix.BuilderaddDurationDistanceMatricesBuilder()

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Returns
Type Description
ShipmentModel.DurationDistanceMatrix.Builder

addDurationDistanceMatricesBuilder(int index)

publicShipmentModel.DurationDistanceMatrix.BuilderaddDurationDistanceMatricesBuilder(intindex)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.DurationDistanceMatrix.Builder

addDurationDistanceMatrixDstTags(String value)

publicShipmentModel.BuilderaddDurationDistanceMatrixDstTags(Stringvalue)

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Parameter
Name Description
value String

The durationDistanceMatrixDstTags to add.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

addDurationDistanceMatrixDstTagsBytes(ByteString value)

publicShipmentModel.BuilderaddDurationDistanceMatrixDstTagsBytes(ByteStringvalue)

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Parameter
Name Description
value ByteString

The bytes of the durationDistanceMatrixDstTags to add.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

addDurationDistanceMatrixSrcTags(String value)

publicShipmentModel.BuilderaddDurationDistanceMatrixSrcTags(Stringvalue)

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Parameter
Name Description
value String

The durationDistanceMatrixSrcTags to add.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

addDurationDistanceMatrixSrcTagsBytes(ByteString value)

publicShipmentModel.BuilderaddDurationDistanceMatrixSrcTagsBytes(ByteStringvalue)

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Parameter
Name Description
value ByteString

The bytes of the durationDistanceMatrixSrcTags to add.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

addPrecedenceRules(ShipmentModel.PrecedenceRule value)

publicShipmentModel.BuilderaddPrecedenceRules(ShipmentModel.PrecedenceRulevalue)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameter
Name Description
value ShipmentModel.PrecedenceRule
Returns
Type Description
ShipmentModel.Builder

addPrecedenceRules(ShipmentModel.PrecedenceRule.Builder builderForValue)

publicShipmentModel.BuilderaddPrecedenceRules(ShipmentModel.PrecedenceRule.BuilderbuilderForValue)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameter
Name Description
builderForValue ShipmentModel.PrecedenceRule.Builder
Returns
Type Description
ShipmentModel.Builder

addPrecedenceRules(int index, ShipmentModel.PrecedenceRule value)

publicShipmentModel.BuilderaddPrecedenceRules(intindex,ShipmentModel.PrecedenceRulevalue)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameters
Name Description
index int
value ShipmentModel.PrecedenceRule
Returns
Type Description
ShipmentModel.Builder

addPrecedenceRules(int index, ShipmentModel.PrecedenceRule.Builder builderForValue)

publicShipmentModel.BuilderaddPrecedenceRules(intindex,ShipmentModel.PrecedenceRule.BuilderbuilderForValue)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameters
Name Description
index int
builderForValue ShipmentModel.PrecedenceRule.Builder
Returns
Type Description
ShipmentModel.Builder

addPrecedenceRulesBuilder()

publicShipmentModel.PrecedenceRule.BuilderaddPrecedenceRulesBuilder()

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Returns
Type Description
ShipmentModel.PrecedenceRule.Builder

addPrecedenceRulesBuilder(int index)

publicShipmentModel.PrecedenceRule.BuilderaddPrecedenceRulesBuilder(intindex)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.PrecedenceRule.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

publicShipmentModel.BuilderaddRepeatedField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
ShipmentModel.Builder
Overrides

addShipmentTypeIncompatibilities(ShipmentTypeIncompatibility value)

publicShipmentModel.BuilderaddShipmentTypeIncompatibilities(ShipmentTypeIncompatibilityvalue)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameter
Name Description
value ShipmentTypeIncompatibility
Returns
Type Description
ShipmentModel.Builder

addShipmentTypeIncompatibilities(ShipmentTypeIncompatibility.Builder builderForValue)

publicShipmentModel.BuilderaddShipmentTypeIncompatibilities(ShipmentTypeIncompatibility.BuilderbuilderForValue)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameter
Name Description
builderForValue ShipmentTypeIncompatibility.Builder
Returns
Type Description
ShipmentModel.Builder

addShipmentTypeIncompatibilities(int index, ShipmentTypeIncompatibility value)

publicShipmentModel.BuilderaddShipmentTypeIncompatibilities(intindex,ShipmentTypeIncompatibilityvalue)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameters
Name Description
index int
value ShipmentTypeIncompatibility
Returns
Type Description
ShipmentModel.Builder

addShipmentTypeIncompatibilities(int index, ShipmentTypeIncompatibility.Builder builderForValue)

publicShipmentModel.BuilderaddShipmentTypeIncompatibilities(intindex,ShipmentTypeIncompatibility.BuilderbuilderForValue)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameters
Name Description
index int
builderForValue ShipmentTypeIncompatibility.Builder
Returns
Type Description
ShipmentModel.Builder

addShipmentTypeIncompatibilitiesBuilder()

publicShipmentTypeIncompatibility.BuilderaddShipmentTypeIncompatibilitiesBuilder()

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Returns
Type Description
ShipmentTypeIncompatibility.Builder

addShipmentTypeIncompatibilitiesBuilder(int index)

publicShipmentTypeIncompatibility.BuilderaddShipmentTypeIncompatibilitiesBuilder(intindex)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameter
Name Description
index int
Returns
Type Description
ShipmentTypeIncompatibility.Builder

addShipmentTypeRequirements(ShipmentTypeRequirement value)

publicShipmentModel.BuilderaddShipmentTypeRequirements(ShipmentTypeRequirementvalue)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameter
Name Description
value ShipmentTypeRequirement
Returns
Type Description
ShipmentModel.Builder

addShipmentTypeRequirements(ShipmentTypeRequirement.Builder builderForValue)

publicShipmentModel.BuilderaddShipmentTypeRequirements(ShipmentTypeRequirement.BuilderbuilderForValue)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameter
Name Description
builderForValue ShipmentTypeRequirement.Builder
Returns
Type Description
ShipmentModel.Builder

addShipmentTypeRequirements(int index, ShipmentTypeRequirement value)

publicShipmentModel.BuilderaddShipmentTypeRequirements(intindex,ShipmentTypeRequirementvalue)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameters
Name Description
index int
value ShipmentTypeRequirement
Returns
Type Description
ShipmentModel.Builder

addShipmentTypeRequirements(int index, ShipmentTypeRequirement.Builder builderForValue)

publicShipmentModel.BuilderaddShipmentTypeRequirements(intindex,ShipmentTypeRequirement.BuilderbuilderForValue)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameters
Name Description
index int
builderForValue ShipmentTypeRequirement.Builder
Returns
Type Description
ShipmentModel.Builder

addShipmentTypeRequirementsBuilder()

publicShipmentTypeRequirement.BuilderaddShipmentTypeRequirementsBuilder()

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Returns
Type Description
ShipmentTypeRequirement.Builder

addShipmentTypeRequirementsBuilder(int index)

publicShipmentTypeRequirement.BuilderaddShipmentTypeRequirementsBuilder(intindex)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameter
Name Description
index int
Returns
Type Description
ShipmentTypeRequirement.Builder

addShipments(Shipment value)

publicShipmentModel.BuilderaddShipments(Shipmentvalue)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Parameter
Name Description
value Shipment
Returns
Type Description
ShipmentModel.Builder

addShipments(Shipment.Builder builderForValue)

publicShipmentModel.BuilderaddShipments(Shipment.BuilderbuilderForValue)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

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

addShipments(int index, Shipment value)

publicShipmentModel.BuilderaddShipments(intindex,Shipmentvalue)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

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

addShipments(int index, Shipment.Builder builderForValue)

publicShipmentModel.BuilderaddShipments(intindex,Shipment.BuilderbuilderForValue)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

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

addShipmentsBuilder()

publicShipment.BuilderaddShipmentsBuilder()

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Returns
Type Description
Shipment.Builder

addShipmentsBuilder(int index)

publicShipment.BuilderaddShipmentsBuilder(intindex)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Parameter
Name Description
index int
Returns
Type Description
Shipment.Builder

addTransitionAttributes(TransitionAttributes value)

publicShipmentModel.BuilderaddTransitionAttributes(TransitionAttributesvalue)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameter
Name Description
value TransitionAttributes
Returns
Type Description
ShipmentModel.Builder

addTransitionAttributes(TransitionAttributes.Builder builderForValue)

publicShipmentModel.BuilderaddTransitionAttributes(TransitionAttributes.BuilderbuilderForValue)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameter
Name Description
builderForValue TransitionAttributes.Builder
Returns
Type Description
ShipmentModel.Builder

addTransitionAttributes(int index, TransitionAttributes value)

publicShipmentModel.BuilderaddTransitionAttributes(intindex,TransitionAttributesvalue)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameters
Name Description
index int
value TransitionAttributes
Returns
Type Description
ShipmentModel.Builder

addTransitionAttributes(int index, TransitionAttributes.Builder builderForValue)

publicShipmentModel.BuilderaddTransitionAttributes(intindex,TransitionAttributes.BuilderbuilderForValue)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameters
Name Description
index int
builderForValue TransitionAttributes.Builder
Returns
Type Description
ShipmentModel.Builder

addTransitionAttributesBuilder()

publicTransitionAttributes.BuilderaddTransitionAttributesBuilder()

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Returns
Type Description
TransitionAttributes.Builder

addTransitionAttributesBuilder(int index)

publicTransitionAttributes.BuilderaddTransitionAttributesBuilder(intindex)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameter
Name Description
index int
Returns
Type Description
TransitionAttributes.Builder

addVehicles(Vehicle value)

publicShipmentModel.BuilderaddVehicles(Vehiclevalue)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameter
Name Description
value Vehicle
Returns
Type Description
ShipmentModel.Builder

addVehicles(Vehicle.Builder builderForValue)

publicShipmentModel.BuilderaddVehicles(Vehicle.BuilderbuilderForValue)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameter
Name Description
builderForValue Vehicle.Builder
Returns
Type Description
ShipmentModel.Builder

addVehicles(int index, Vehicle value)

publicShipmentModel.BuilderaddVehicles(intindex,Vehiclevalue)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameters
Name Description
index int
value Vehicle
Returns
Type Description
ShipmentModel.Builder

addVehicles(int index, Vehicle.Builder builderForValue)

publicShipmentModel.BuilderaddVehicles(intindex,Vehicle.BuilderbuilderForValue)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameters
Name Description
index int
builderForValue Vehicle.Builder
Returns
Type Description
ShipmentModel.Builder

addVehiclesBuilder()

publicVehicle.BuilderaddVehiclesBuilder()

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Returns
Type Description
Vehicle.Builder

addVehiclesBuilder(int index)

publicVehicle.BuilderaddVehiclesBuilder(intindex)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameter
Name Description
index int
Returns
Type Description
Vehicle.Builder

build()

publicShipmentModelbuild()
Returns
Type Description
ShipmentModel

buildPartial()

publicShipmentModelbuildPartial()
Returns
Type Description
ShipmentModel

clear()

publicShipmentModel.Builderclear()
Returns
Type Description
ShipmentModel.Builder
Overrides

clearBreakRules() (deprecated)

publicShipmentModel.BuilderclearBreakRules()

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Returns
Type Description
ShipmentModel.Builder

clearDurationDistanceMatrices()

publicShipmentModel.BuilderclearDurationDistanceMatrices()

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Returns
Type Description
ShipmentModel.Builder

clearDurationDistanceMatrixDstTags()

publicShipmentModel.BuilderclearDurationDistanceMatrixDstTags()

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

clearDurationDistanceMatrixSrcTags()

publicShipmentModel.BuilderclearDurationDistanceMatrixSrcTags()

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

publicShipmentModel.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
ShipmentModel.Builder
Overrides

clearGlobalDurationCostPerHour()

publicShipmentModel.BuilderclearGlobalDurationCostPerHour()

The "global duration" of the overall plan is the difference between the earliest effective start time and the latest effective end time of all vehicles. Users can assign a cost per hour to that quantity to try and optimize for earliest job completion, for example. This cost must be in the same unit as Shipment.penalty_cost.

double global_duration_cost_per_hour = 7;

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

clearGlobalEndTime()

publicShipmentModel.BuilderclearGlobalEndTime()

If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

.google.protobuf.Timestamp global_end_time = 6;

Returns
Type Description
ShipmentModel.Builder

clearGlobalStartTime()

publicShipmentModel.BuilderclearGlobalStartTime()

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

.google.protobuf.Timestamp global_start_time = 5;

Returns
Type Description
ShipmentModel.Builder

clearMaxActiveVehicles()

publicShipmentModel.BuilderclearMaxActiveVehicles()

Constrains the maximum number of active vehicles. A vehicle is active if its route performs at least one shipment. This can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicles is heterogeneous. The optimization will then select the best subset of vehicles to use. Must be strictly positive.

optional int32 max_active_vehicles = 4;

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

publicShipmentModel.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
ShipmentModel.Builder
Overrides

clearPrecedenceRules()

publicShipmentModel.BuilderclearPrecedenceRules()

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Returns
Type Description
ShipmentModel.Builder

clearShipmentTypeIncompatibilities()

publicShipmentModel.BuilderclearShipmentTypeIncompatibilities()

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Returns
Type Description
ShipmentModel.Builder

clearShipmentTypeRequirements()

publicShipmentModel.BuilderclearShipmentTypeRequirements()

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Returns
Type Description
ShipmentModel.Builder

clearShipments()

publicShipmentModel.BuilderclearShipments()

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Returns
Type Description
ShipmentModel.Builder

clearTransitionAttributes()

publicShipmentModel.BuilderclearTransitionAttributes()

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Returns
Type Description
ShipmentModel.Builder

clearVehicles()

publicShipmentModel.BuilderclearVehicles()

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Returns
Type Description
ShipmentModel.Builder

clone()

publicShipmentModel.Builderclone()
Returns
Type Description
ShipmentModel.Builder
Overrides

getBreakRules(int index) (deprecated)

publicShipmentModel.BreakRulegetBreakRules(intindex)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.BreakRule

getBreakRulesBuilder(int index) (deprecated)

publicShipmentModel.BreakRule.BuildergetBreakRulesBuilder(intindex)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.BreakRule.Builder

getBreakRulesBuilderList() (deprecated)

publicList<ShipmentModel.BreakRule.Builder>getBreakRulesBuilderList()

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Returns
Type Description
List<Builder>

getBreakRulesCount() (deprecated)

publicintgetBreakRulesCount()

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Returns
Type Description
int

getBreakRulesList() (deprecated)

publicList<ShipmentModel.BreakRule>getBreakRulesList()

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Returns
Type Description
List<BreakRule>

getBreakRulesOrBuilder(int index) (deprecated)

publicShipmentModel.BreakRuleOrBuildergetBreakRulesOrBuilder(intindex)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.BreakRuleOrBuilder

getBreakRulesOrBuilderList() (deprecated)

publicList<?extendsShipmentModel.BreakRuleOrBuilder>getBreakRulesOrBuilderList()

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

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

getDefaultInstanceForType()

publicShipmentModelgetDefaultInstanceForType()
Returns
Type Description
ShipmentModel

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getDurationDistanceMatrices(int index)

publicShipmentModel.DurationDistanceMatrixgetDurationDistanceMatrices(intindex)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.DurationDistanceMatrix

getDurationDistanceMatricesBuilder(int index)

publicShipmentModel.DurationDistanceMatrix.BuildergetDurationDistanceMatricesBuilder(intindex)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.DurationDistanceMatrix.Builder

getDurationDistanceMatricesBuilderList()

publicList<ShipmentModel.DurationDistanceMatrix.Builder>getDurationDistanceMatricesBuilderList()

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Returns
Type Description
List<Builder>

getDurationDistanceMatricesCount()

publicintgetDurationDistanceMatricesCount()

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Returns
Type Description
int

getDurationDistanceMatricesList()

publicList<ShipmentModel.DurationDistanceMatrix>getDurationDistanceMatricesList()

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Returns
Type Description
List<DurationDistanceMatrix>

getDurationDistanceMatricesOrBuilder(int index)

publicShipmentModel.DurationDistanceMatrixOrBuildergetDurationDistanceMatricesOrBuilder(intindex)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.DurationDistanceMatrixOrBuilder

getDurationDistanceMatricesOrBuilderList()

publicList<?extendsShipmentModel.DurationDistanceMatrixOrBuilder>getDurationDistanceMatricesOrBuilderList()

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

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

getDurationDistanceMatrixDstTags(int index)

publicStringgetDurationDistanceMatrixDstTags(intindex)

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The durationDistanceMatrixDstTags at the given index.

getDurationDistanceMatrixDstTagsBytes(int index)

publicByteStringgetDurationDistanceMatrixDstTagsBytes(intindex)

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the durationDistanceMatrixDstTags at the given index.

getDurationDistanceMatrixDstTagsCount()

publicintgetDurationDistanceMatrixDstTagsCount()

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Returns
Type Description
int

The count of durationDistanceMatrixDstTags.

getDurationDistanceMatrixDstTagsList()

publicProtocolStringListgetDurationDistanceMatrixDstTagsList()

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Returns
Type Description
ProtocolStringList

A list containing the durationDistanceMatrixDstTags.

getDurationDistanceMatrixSrcTags(int index)

publicStringgetDurationDistanceMatrixSrcTags(intindex)

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The durationDistanceMatrixSrcTags at the given index.

getDurationDistanceMatrixSrcTagsBytes(int index)

publicByteStringgetDurationDistanceMatrixSrcTagsBytes(intindex)

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the durationDistanceMatrixSrcTags at the given index.

getDurationDistanceMatrixSrcTagsCount()

publicintgetDurationDistanceMatrixSrcTagsCount()

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Returns
Type Description
int

The count of durationDistanceMatrixSrcTags.

getDurationDistanceMatrixSrcTagsList()

publicProtocolStringListgetDurationDistanceMatrixSrcTagsList()

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Returns
Type Description
ProtocolStringList

A list containing the durationDistanceMatrixSrcTags.

getGlobalDurationCostPerHour()

publicdoublegetGlobalDurationCostPerHour()

The "global duration" of the overall plan is the difference between the earliest effective start time and the latest effective end time of all vehicles. Users can assign a cost per hour to that quantity to try and optimize for earliest job completion, for example. This cost must be in the same unit as Shipment.penalty_cost.

double global_duration_cost_per_hour = 7;

Returns
Type Description
double

The globalDurationCostPerHour.

getGlobalEndTime()

publicTimestampgetGlobalEndTime()

If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

.google.protobuf.Timestamp global_end_time = 6;

Returns
Type Description
Timestamp

The globalEndTime.

getGlobalEndTimeBuilder()

publicTimestamp.BuildergetGlobalEndTimeBuilder()

If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

.google.protobuf.Timestamp global_end_time = 6;

Returns
Type Description
Builder

getGlobalEndTimeOrBuilder()

publicTimestampOrBuildergetGlobalEndTimeOrBuilder()

If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

.google.protobuf.Timestamp global_end_time = 6;

Returns
Type Description
TimestampOrBuilder

getGlobalStartTime()

publicTimestampgetGlobalStartTime()

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

.google.protobuf.Timestamp global_start_time = 5;

Returns
Type Description
Timestamp

The globalStartTime.

getGlobalStartTimeBuilder()

publicTimestamp.BuildergetGlobalStartTimeBuilder()

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

.google.protobuf.Timestamp global_start_time = 5;

Returns
Type Description
Builder

getGlobalStartTimeOrBuilder()

publicTimestampOrBuildergetGlobalStartTimeOrBuilder()

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

.google.protobuf.Timestamp global_start_time = 5;

Returns
Type Description
TimestampOrBuilder

getMaxActiveVehicles()

publicintgetMaxActiveVehicles()

Constrains the maximum number of active vehicles. A vehicle is active if its route performs at least one shipment. This can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicles is heterogeneous. The optimization will then select the best subset of vehicles to use. Must be strictly positive.

optional int32 max_active_vehicles = 4;

Returns
Type Description
int

The maxActiveVehicles.

getPrecedenceRules(int index)

publicShipmentModel.PrecedenceRulegetPrecedenceRules(intindex)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.PrecedenceRule

getPrecedenceRulesBuilder(int index)

publicShipmentModel.PrecedenceRule.BuildergetPrecedenceRulesBuilder(intindex)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.PrecedenceRule.Builder

getPrecedenceRulesBuilderList()

publicList<ShipmentModel.PrecedenceRule.Builder>getPrecedenceRulesBuilderList()

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Returns
Type Description
List<Builder>

getPrecedenceRulesCount()

publicintgetPrecedenceRulesCount()

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Returns
Type Description
int

getPrecedenceRulesList()

publicList<ShipmentModel.PrecedenceRule>getPrecedenceRulesList()

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Returns
Type Description
List<PrecedenceRule>

getPrecedenceRulesOrBuilder(int index)

publicShipmentModel.PrecedenceRuleOrBuildergetPrecedenceRulesOrBuilder(intindex)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.PrecedenceRuleOrBuilder

getPrecedenceRulesOrBuilderList()

publicList<?extendsShipmentModel.PrecedenceRuleOrBuilder>getPrecedenceRulesOrBuilderList()

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

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

getShipmentTypeIncompatibilities(int index)

publicShipmentTypeIncompatibilitygetShipmentTypeIncompatibilities(intindex)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameter
Name Description
index int
Returns
Type Description
ShipmentTypeIncompatibility

getShipmentTypeIncompatibilitiesBuilder(int index)

publicShipmentTypeIncompatibility.BuildergetShipmentTypeIncompatibilitiesBuilder(intindex)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameter
Name Description
index int
Returns
Type Description
ShipmentTypeIncompatibility.Builder

getShipmentTypeIncompatibilitiesBuilderList()

publicList<ShipmentTypeIncompatibility.Builder>getShipmentTypeIncompatibilitiesBuilderList()

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Returns
Type Description
List<Builder>

getShipmentTypeIncompatibilitiesCount()

publicintgetShipmentTypeIncompatibilitiesCount()

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Returns
Type Description
int

getShipmentTypeIncompatibilitiesList()

publicList<ShipmentTypeIncompatibility>getShipmentTypeIncompatibilitiesList()

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Returns
Type Description
List<ShipmentTypeIncompatibility>

getShipmentTypeIncompatibilitiesOrBuilder(int index)

publicShipmentTypeIncompatibilityOrBuildergetShipmentTypeIncompatibilitiesOrBuilder(intindex)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameter
Name Description
index int
Returns
Type Description
ShipmentTypeIncompatibilityOrBuilder

getShipmentTypeIncompatibilitiesOrBuilderList()

publicList<?extendsShipmentTypeIncompatibilityOrBuilder>getShipmentTypeIncompatibilitiesOrBuilderList()

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

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

getShipmentTypeRequirements(int index)

publicShipmentTypeRequirementgetShipmentTypeRequirements(intindex)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameter
Name Description
index int
Returns
Type Description
ShipmentTypeRequirement

getShipmentTypeRequirementsBuilder(int index)

publicShipmentTypeRequirement.BuildergetShipmentTypeRequirementsBuilder(intindex)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameter
Name Description
index int
Returns
Type Description
ShipmentTypeRequirement.Builder

getShipmentTypeRequirementsBuilderList()

publicList<ShipmentTypeRequirement.Builder>getShipmentTypeRequirementsBuilderList()

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Returns
Type Description
List<Builder>

getShipmentTypeRequirementsCount()

publicintgetShipmentTypeRequirementsCount()

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Returns
Type Description
int

getShipmentTypeRequirementsList()

publicList<ShipmentTypeRequirement>getShipmentTypeRequirementsList()

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Returns
Type Description
List<ShipmentTypeRequirement>

getShipmentTypeRequirementsOrBuilder(int index)

publicShipmentTypeRequirementOrBuildergetShipmentTypeRequirementsOrBuilder(intindex)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameter
Name Description
index int
Returns
Type Description
ShipmentTypeRequirementOrBuilder

getShipmentTypeRequirementsOrBuilderList()

publicList<?extendsShipmentTypeRequirementOrBuilder>getShipmentTypeRequirementsOrBuilderList()

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

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

getShipments(int index)

publicShipmentgetShipments(intindex)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Parameter
Name Description
index int
Returns
Type Description
Shipment

getShipmentsBuilder(int index)

publicShipment.BuildergetShipmentsBuilder(intindex)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Parameter
Name Description
index int
Returns
Type Description
Shipment.Builder

getShipmentsBuilderList()

publicList<Shipment.Builder>getShipmentsBuilderList()

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Returns
Type Description
List<Builder>

getShipmentsCount()

publicintgetShipmentsCount()

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Returns
Type Description
int

getShipmentsList()

publicList<Shipment>getShipmentsList()

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Returns
Type Description
List<Shipment>

getShipmentsOrBuilder(int index)

publicShipmentOrBuildergetShipmentsOrBuilder(intindex)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Parameter
Name Description
index int
Returns
Type Description
ShipmentOrBuilder

getShipmentsOrBuilderList()

publicList<?extendsShipmentOrBuilder>getShipmentsOrBuilderList()

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

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

getTransitionAttributes(int index)

publicTransitionAttributesgetTransitionAttributes(intindex)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameter
Name Description
index int
Returns
Type Description
TransitionAttributes

getTransitionAttributesBuilder(int index)

publicTransitionAttributes.BuildergetTransitionAttributesBuilder(intindex)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameter
Name Description
index int
Returns
Type Description
TransitionAttributes.Builder

getTransitionAttributesBuilderList()

publicList<TransitionAttributes.Builder>getTransitionAttributesBuilderList()

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Returns
Type Description
List<Builder>

getTransitionAttributesCount()

publicintgetTransitionAttributesCount()

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Returns
Type Description
int

getTransitionAttributesList()

publicList<TransitionAttributes>getTransitionAttributesList()

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Returns
Type Description
List<TransitionAttributes>

getTransitionAttributesOrBuilder(int index)

publicTransitionAttributesOrBuildergetTransitionAttributesOrBuilder(intindex)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameter
Name Description
index int
Returns
Type Description
TransitionAttributesOrBuilder

getTransitionAttributesOrBuilderList()

publicList<?extendsTransitionAttributesOrBuilder>getTransitionAttributesOrBuilderList()

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

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

getVehicles(int index)

publicVehiclegetVehicles(intindex)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameter
Name Description
index int
Returns
Type Description
Vehicle

getVehiclesBuilder(int index)

publicVehicle.BuildergetVehiclesBuilder(intindex)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameter
Name Description
index int
Returns
Type Description
Vehicle.Builder

getVehiclesBuilderList()

publicList<Vehicle.Builder>getVehiclesBuilderList()

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Returns
Type Description
List<Builder>

getVehiclesCount()

publicintgetVehiclesCount()

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Returns
Type Description
int

getVehiclesList()

publicList<Vehicle>getVehiclesList()

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Returns
Type Description
List<Vehicle>

getVehiclesOrBuilder(int index)

publicVehicleOrBuildergetVehiclesOrBuilder(intindex)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameter
Name Description
index int
Returns
Type Description
VehicleOrBuilder

getVehiclesOrBuilderList()

publicList<?extendsVehicleOrBuilder>getVehiclesOrBuilderList()

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

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

hasGlobalEndTime()

publicbooleanhasGlobalEndTime()

If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

.google.protobuf.Timestamp global_end_time = 6;

Returns
Type Description
boolean

Whether the globalEndTime field is set.

hasGlobalStartTime()

publicbooleanhasGlobalStartTime()

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

.google.protobuf.Timestamp global_start_time = 5;

Returns
Type Description
boolean

Whether the globalStartTime field is set.

hasMaxActiveVehicles()

publicbooleanhasMaxActiveVehicles()

Constrains the maximum number of active vehicles. A vehicle is active if its route performs at least one shipment. This can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicles is heterogeneous. The optimization will then select the best subset of vehicles to use. Must be strictly positive.

optional int32 max_active_vehicles = 4;

Returns
Type Description
boolean

Whether the maxActiveVehicles field is set.

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(ShipmentModel other)

publicShipmentModel.BuildermergeFrom(ShipmentModelother)
Parameter
Name Description
other ShipmentModel
Returns
Type Description
ShipmentModel.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicShipmentModel.BuildermergeFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
ShipmentModel.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

publicShipmentModel.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
ShipmentModel.Builder
Overrides

mergeGlobalEndTime(Timestamp value)

publicShipmentModel.BuildermergeGlobalEndTime(Timestampvalue)

If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

.google.protobuf.Timestamp global_end_time = 6;

Parameter
Name Description
value Timestamp
Returns
Type Description
ShipmentModel.Builder

mergeGlobalStartTime(Timestamp value)

publicShipmentModel.BuildermergeGlobalStartTime(Timestampvalue)

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

.google.protobuf.Timestamp global_start_time = 5;

Parameter
Name Description
value Timestamp
Returns
Type Description
ShipmentModel.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

publicfinalShipmentModel.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
ShipmentModel.Builder
Overrides

removeBreakRules(int index) (deprecated)

publicShipmentModel.BuilderremoveBreakRules(intindex)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.Builder

removeDurationDistanceMatrices(int index)

publicShipmentModel.BuilderremoveDurationDistanceMatrices(intindex)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.Builder

removePrecedenceRules(int index)

publicShipmentModel.BuilderremovePrecedenceRules(intindex)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.Builder

removeShipmentTypeIncompatibilities(int index)

publicShipmentModel.BuilderremoveShipmentTypeIncompatibilities(intindex)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.Builder

removeShipmentTypeRequirements(int index)

publicShipmentModel.BuilderremoveShipmentTypeRequirements(intindex)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.Builder

removeShipments(int index)

publicShipmentModel.BuilderremoveShipments(intindex)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.Builder

removeTransitionAttributes(int index)

publicShipmentModel.BuilderremoveTransitionAttributes(intindex)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.Builder

removeVehicles(int index)

publicShipmentModel.BuilderremoveVehicles(intindex)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameter
Name Description
index int
Returns
Type Description
ShipmentModel.Builder

setBreakRules(int index, ShipmentModel.BreakRule value) (deprecated)

publicShipmentModel.BuildersetBreakRules(intindex,ShipmentModel.BreakRulevalue)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameters
Name Description
index int
value ShipmentModel.BreakRule
Returns
Type Description
ShipmentModel.Builder

setBreakRules(int index, ShipmentModel.BreakRule.Builder builderForValue) (deprecated)

publicShipmentModel.BuildersetBreakRules(intindex,ShipmentModel.BreakRule.BuilderbuilderForValue)

Deprecated: No longer used. Set of break rules used in the model. Each vehicle specifies the BreakRule that applies to it via the Vehicle.break_rule_indices field (which must be a singleton).

repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true];

Parameters
Name Description
index int
builderForValue ShipmentModel.BreakRule.Builder
Returns
Type Description
ShipmentModel.Builder

setDurationDistanceMatrices(int index, ShipmentModel.DurationDistanceMatrix value)

publicShipmentModel.BuildersetDurationDistanceMatrices(intindex,ShipmentModel.DurationDistanceMatrixvalue)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameters
Name Description
index int
value ShipmentModel.DurationDistanceMatrix
Returns
Type Description
ShipmentModel.Builder

setDurationDistanceMatrices(int index, ShipmentModel.DurationDistanceMatrix.Builder builderForValue)

publicShipmentModel.BuildersetDurationDistanceMatrices(intindex,ShipmentModel.DurationDistanceMatrix.BuilderbuilderForValue)

Specifies duration and distance matrices used in the model. If this field is empty, Google Maps or geodesic distances will be used instead, depending on the value of the use_geodesic_distances field. If it is not empty, use_geodesic_distances cannot be true and neither duration_distance_matrix_src_tags nor duration_distance_matrix_dst_tags can be empty.

Usage examples:

  • There are two locations: locA and locB.
  • 1 vehicle starting its route at locA and ending it at locA.
  • 1 pickup visit request at locB.

    ` model { vehicles { start_tags: "locA" end_tags: "locA" } shipments { pickups { tags: "locB" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_dst_tags: "locA" duration_distance_matrix_dst_tags: "locB" duration_distance_matrices { rows { # from: locA durations { seconds: 0 } meters: 0 # to: locA durations { seconds: 100 } meters: 1000 # to: locB } rows { # from: locB durations { seconds: 102 } meters: 990 # to: locA durations { seconds: 0 } meters: 0 # to: locB } } }

  • There are three locations: locA, locB and locC.

  • 1 vehicle starting its route at locA and ending it at locB, using matrix "fast".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "slow".
  • 1 vehicle starting its route at locB and ending it at locB, using matrix "fast".
  • 1 pickup visit request at locC.

    model { vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } shipments { pickups { tags: "locC" } } duration_distance_matrix_src_tags: "locA" duration_distance_matrix_src_tags: "locB" duration_distance_matrix_src_tags: "locC" duration_distance_matrix_dst_tags: "locB" duration_distance_matrix_dst_tags: "locC" duration_distance_matrices { vehicle_start_tag: "fast" rows { # from: locA durations { seconds: 1000 } meters: 2000 # to: locB durations { seconds: 600 } meters: 1000 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 700 } meters: 1200 # to: locC } rows { # from: locC durations { seconds: 702 } meters: 1190 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } duration_distance_matrices { vehicle_start_tag: "slow" rows { # from: locA durations { seconds: 1800 } meters: 2001 # to: locB durations { seconds: 900 } meters: 1002 # to: locC } rows { # from: locB durations { seconds: 0 } meters: 0 # to: locB durations { seconds: 1000 } meters: 1202 # to: locC } rows { # from: locC durations { seconds: 1001 } meters: 1195 # to: locB durations { seconds: 0 } meters: 0 # to: locC } } } `

repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8;

Parameters
Name Description
index int
builderForValue ShipmentModel.DurationDistanceMatrix.Builder
Returns
Type Description
ShipmentModel.Builder

setDurationDistanceMatrixDstTags(int index, String value)

publicShipmentModel.BuildersetDurationDistanceMatrixDstTags(intindex,Stringvalue)

Tags defining the destinations of the duration and distance matrices; duration_distance_matrices(i).rows(j).durations(k) (resp. duration_distance_matrices(i).rows(j).meters(k)) defines the duration (resp. the distance) of the travel from visits with tag duration_distance_matrix_src_tags(j) to visits with tag duration_distance_matrix_dst_tags(k) in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_dst_tags = 10;

Parameters
Name Description
index int

The index to set the value at.

value String

The durationDistanceMatrixDstTags to set.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

setDurationDistanceMatrixSrcTags(int index, String value)

publicShipmentModel.BuildersetDurationDistanceMatrixSrcTags(intindex,Stringvalue)

Tags defining the sources of the duration and distance matrices; duration_distance_matrices(i).rows(j) defines durations and distances from visits with tag duration_distance_matrix_src_tags(j) to other visits in matrix i.

Tags correspond to VisitRequest.tags or Vehicle.start_tags. A given VisitRequest or Vehicle must match exactly one tag in this field. Note that a Vehicle's source, destination and matrix tags may be the same; similarly a VisitRequest's source and destination tags may be the same. All tags must be different and cannot be empty strings. If this field is not empty, then duration_distance_matrices must not be empty.

repeated string duration_distance_matrix_src_tags = 9;

Parameters
Name Description
index int

The index to set the value at.

value String

The durationDistanceMatrixSrcTags to set.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

publicShipmentModel.BuildersetField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
ShipmentModel.Builder
Overrides

setGlobalDurationCostPerHour(double value)

publicShipmentModel.BuildersetGlobalDurationCostPerHour(doublevalue)

The "global duration" of the overall plan is the difference between the earliest effective start time and the latest effective end time of all vehicles. Users can assign a cost per hour to that quantity to try and optimize for earliest job completion, for example. This cost must be in the same unit as Shipment.penalty_cost.

double global_duration_cost_per_hour = 7;

Parameter
Name Description
value double

The globalDurationCostPerHour to set.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

setGlobalEndTime(Timestamp value)

publicShipmentModel.BuildersetGlobalEndTime(Timestampvalue)

If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

.google.protobuf.Timestamp global_end_time = 6;

Parameter
Name Description
value Timestamp
Returns
Type Description
ShipmentModel.Builder

setGlobalEndTime(Timestamp.Builder builderForValue)

publicShipmentModel.BuildersetGlobalEndTime(Timestamp.BuilderbuilderForValue)

If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) is used as default.

.google.protobuf.Timestamp global_end_time = 6;

Parameter
Name Description
builderForValue Builder
Returns
Type Description
ShipmentModel.Builder

setGlobalStartTime(Timestamp value)

publicShipmentModel.BuildersetGlobalStartTime(Timestampvalue)

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

.google.protobuf.Timestamp global_start_time = 5;

Parameter
Name Description
value Timestamp
Returns
Type Description
ShipmentModel.Builder

setGlobalStartTime(Timestamp.Builder builderForValue)

publicShipmentModel.BuildersetGlobalStartTime(Timestamp.BuilderbuilderForValue)

Global start and end time of the model: no times outside of this range can be considered valid.

The model's time span must be less than a year, i.e. the global_end_time and the global_start_time must be within 31536000 seconds of each other.

When using cost_per_*hour fields, you might want to set this window to a smaller interval to increase performance (eg. if you model a single day, you should set the global time limits to that day). If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used as default.

.google.protobuf.Timestamp global_start_time = 5;

Parameter
Name Description
builderForValue Builder
Returns
Type Description
ShipmentModel.Builder

setMaxActiveVehicles(int value)

publicShipmentModel.BuildersetMaxActiveVehicles(intvalue)

Constrains the maximum number of active vehicles. A vehicle is active if its route performs at least one shipment. This can be used to limit the number of routes in the case where there are fewer drivers than vehicles and that the fleet of vehicles is heterogeneous. The optimization will then select the best subset of vehicles to use. Must be strictly positive.

optional int32 max_active_vehicles = 4;

Parameter
Name Description
value int

The maxActiveVehicles to set.

Returns
Type Description
ShipmentModel.Builder

This builder for chaining.

setPrecedenceRules(int index, ShipmentModel.PrecedenceRule value)

publicShipmentModel.BuildersetPrecedenceRules(intindex,ShipmentModel.PrecedenceRulevalue)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameters
Name Description
index int
value ShipmentModel.PrecedenceRule
Returns
Type Description
ShipmentModel.Builder

setPrecedenceRules(int index, ShipmentModel.PrecedenceRule.Builder builderForValue)

publicShipmentModel.BuildersetPrecedenceRules(intindex,ShipmentModel.PrecedenceRule.BuilderbuilderForValue)

Set of precedence rules which must be enforced in the model.

repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14;

Parameters
Name Description
index int
builderForValue ShipmentModel.PrecedenceRule.Builder
Returns
Type Description
ShipmentModel.Builder

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

publicShipmentModel.BuildersetRepeatedField(Descriptors.FieldDescriptorfield,intindex,Objectvalue)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
ShipmentModel.Builder
Overrides

setShipmentTypeIncompatibilities(int index, ShipmentTypeIncompatibility value)

publicShipmentModel.BuildersetShipmentTypeIncompatibilities(intindex,ShipmentTypeIncompatibilityvalue)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameters
Name Description
index int
value ShipmentTypeIncompatibility
Returns
Type Description
ShipmentModel.Builder

setShipmentTypeIncompatibilities(int index, ShipmentTypeIncompatibility.Builder builderForValue)

publicShipmentModel.BuildersetShipmentTypeIncompatibilities(intindex,ShipmentTypeIncompatibility.BuilderbuilderForValue)

Sets of incompatible shipment_types (see ShipmentTypeIncompatibility).

repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12;

Parameters
Name Description
index int
builderForValue ShipmentTypeIncompatibility.Builder
Returns
Type Description
ShipmentModel.Builder

setShipmentTypeRequirements(int index, ShipmentTypeRequirement value)

publicShipmentModel.BuildersetShipmentTypeRequirements(intindex,ShipmentTypeRequirementvalue)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameters
Name Description
index int
value ShipmentTypeRequirement
Returns
Type Description
ShipmentModel.Builder

setShipmentTypeRequirements(int index, ShipmentTypeRequirement.Builder builderForValue)

publicShipmentModel.BuildersetShipmentTypeRequirements(intindex,ShipmentTypeRequirement.BuilderbuilderForValue)

Sets of shipment_type requirements (see ShipmentTypeRequirement).

repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13;

Parameters
Name Description
index int
builderForValue ShipmentTypeRequirement.Builder
Returns
Type Description
ShipmentModel.Builder

setShipments(int index, Shipment value)

publicShipmentModel.BuildersetShipments(intindex,Shipmentvalue)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

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

setShipments(int index, Shipment.Builder builderForValue)

publicShipmentModel.BuildersetShipments(intindex,Shipment.BuilderbuilderForValue)

Set of shipments which must be performed in the model.

repeated .google.cloud.optimization.v1.Shipment shipments = 1;

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

setTransitionAttributes(int index, TransitionAttributes value)

publicShipmentModel.BuildersetTransitionAttributes(intindex,TransitionAttributesvalue)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameters
Name Description
index int
value TransitionAttributes
Returns
Type Description
ShipmentModel.Builder

setTransitionAttributes(int index, TransitionAttributes.Builder builderForValue)

publicShipmentModel.BuildersetTransitionAttributes(intindex,TransitionAttributes.BuilderbuilderForValue)

Transition attributes added to the model.

repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11;

Parameters
Name Description
index int
builderForValue TransitionAttributes.Builder
Returns
Type Description
ShipmentModel.Builder

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalShipmentModel.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
ShipmentModel.Builder
Overrides

setVehicles(int index, Vehicle value)

publicShipmentModel.BuildersetVehicles(intindex,Vehiclevalue)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameters
Name Description
index int
value Vehicle
Returns
Type Description
ShipmentModel.Builder

setVehicles(int index, Vehicle.Builder builderForValue)

publicShipmentModel.BuildersetVehicles(intindex,Vehicle.BuilderbuilderForValue)

Set of vehicles which can be used to perform visits.

repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;

Parameters
Name Description
index int
builderForValue Vehicle.Builder
Returns
Type Description
ShipmentModel.Builder

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.