public static final class RoutesConstraintProto.Builder extends com.google.protobuf.GeneratedMessage.Builder<RoutesConstraintProto.Builder> implements RoutesConstraintProtoOrBuilder
The "VRP" (Vehicle Routing Problem) constraint. The direct graph where arc #i (from tails[i] to head[i]) is present iff literals[i] is true must satisfy this set of properties: - #incoming arcs == 1 except for node 0. - #outgoing arcs == 1 except for node 0. - for node zero, #incoming arcs == #outgoing arcs. - There are no duplicate arcs. - Self-arcs are allowed except for node 0. - There is no cycle in this graph, except through node 0. Note: Currently this constraint expect all the nodes in [0, num_nodes) to have at least one incident arc. The model will be considered invalid if it is not the case. You can add self-arc fixed to one to ignore some nodes if needed. TODO(user): It is probably possible to generalize this constraint to a no-cycle in a general graph, or a no-cycle with sum incoming <= 1 and sum outgoing <= 1 (more efficient implementation). On the other hand, having this specific constraint allow us to add specific "cuts" to a VRP problem.Protobuf type
operations_research.sat.RoutesConstraintProto
Modifier and Type | Method and Description |
---|---|
RoutesConstraintProto.Builder |
addAllDemands(java.lang.Iterable<? extends java.lang.Integer> values)
EXPERIMENTAL.
|
RoutesConstraintProto.Builder |
addAllHeads(java.lang.Iterable<? extends java.lang.Integer> values)
repeated int32 heads = 2; |
RoutesConstraintProto.Builder |
addAllLiterals(java.lang.Iterable<? extends java.lang.Integer> values)
repeated int32 literals = 3; |
RoutesConstraintProto.Builder |
addAllTails(java.lang.Iterable<? extends java.lang.Integer> values)
repeated int32 tails = 1; |
RoutesConstraintProto.Builder |
addDemands(int value)
EXPERIMENTAL.
|
RoutesConstraintProto.Builder |
addHeads(int value)
repeated int32 heads = 2; |
RoutesConstraintProto.Builder |
addLiterals(int value)
repeated int32 literals = 3; |
RoutesConstraintProto.Builder |
addTails(int value)
repeated int32 tails = 1; |
RoutesConstraintProto |
build() |
RoutesConstraintProto |
buildPartial() |
RoutesConstraintProto.Builder |
clear() |
RoutesConstraintProto.Builder |
clearCapacity()
int64 capacity = 5; |
RoutesConstraintProto.Builder |
clearDemands()
EXPERIMENTAL.
|
RoutesConstraintProto.Builder |
clearHeads()
repeated int32 heads = 2; |
RoutesConstraintProto.Builder |
clearLiterals()
repeated int32 literals = 3; |
RoutesConstraintProto.Builder |
clearTails()
repeated int32 tails = 1; |
long |
getCapacity()
int64 capacity = 5; |
RoutesConstraintProto |
getDefaultInstanceForType() |
int |
getDemands(int index)
EXPERIMENTAL.
|
int |
getDemandsCount()
EXPERIMENTAL.
|
java.util.List<java.lang.Integer> |
getDemandsList()
EXPERIMENTAL.
|
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.protobuf.Descriptors.Descriptor |
getDescriptorForType() |
int |
getHeads(int index)
repeated int32 heads = 2; |
int |
getHeadsCount()
repeated int32 heads = 2; |
java.util.List<java.lang.Integer> |
getHeadsList()
repeated int32 heads = 2; |
int |
getLiterals(int index)
repeated int32 literals = 3; |
int |
getLiteralsCount()
repeated int32 literals = 3; |
java.util.List<java.lang.Integer> |
getLiteralsList()
repeated int32 literals = 3; |
int |
getTails(int index)
repeated int32 tails = 1; |
int |
getTailsCount()
repeated int32 tails = 1; |
java.util.List<java.lang.Integer> |
getTailsList()
repeated int32 tails = 1; |
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
RoutesConstraintProto.Builder |
mergeFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
RoutesConstraintProto.Builder |
mergeFrom(com.google.protobuf.Message other) |
RoutesConstraintProto.Builder |
mergeFrom(RoutesConstraintProto other) |
RoutesConstraintProto.Builder |
setCapacity(long value)
int64 capacity = 5; |
RoutesConstraintProto.Builder |
setDemands(int index,
int value)
EXPERIMENTAL.
|
RoutesConstraintProto.Builder |
setHeads(int index,
int value)
repeated int32 heads = 2; |
RoutesConstraintProto.Builder |
setLiterals(int index,
int value)
repeated int32 literals = 3; |
RoutesConstraintProto.Builder |
setTails(int index,
int value)
repeated int32 tails = 1; |
addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, newUninitializedMessageException
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable
in class com.google.protobuf.GeneratedMessage.Builder<RoutesConstraintProto.Builder>
public RoutesConstraintProto.Builder clear()
clear
in interface com.google.protobuf.Message.Builder
clear
in interface com.google.protobuf.MessageLite.Builder
clear
in class com.google.protobuf.GeneratedMessage.Builder<RoutesConstraintProto.Builder>
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
getDescriptorForType
in interface com.google.protobuf.Message.Builder
getDescriptorForType
in interface com.google.protobuf.MessageOrBuilder
getDescriptorForType
in class com.google.protobuf.GeneratedMessage.Builder<RoutesConstraintProto.Builder>
public RoutesConstraintProto getDefaultInstanceForType()
getDefaultInstanceForType
in interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType
in interface com.google.protobuf.MessageOrBuilder
public RoutesConstraintProto build()
build
in interface com.google.protobuf.Message.Builder
build
in interface com.google.protobuf.MessageLite.Builder
public RoutesConstraintProto buildPartial()
buildPartial
in interface com.google.protobuf.Message.Builder
buildPartial
in interface com.google.protobuf.MessageLite.Builder
public RoutesConstraintProto.Builder mergeFrom(com.google.protobuf.Message other)
mergeFrom
in interface com.google.protobuf.Message.Builder
mergeFrom
in class com.google.protobuf.AbstractMessage.Builder<RoutesConstraintProto.Builder>
public RoutesConstraintProto.Builder mergeFrom(RoutesConstraintProto other)
public final boolean isInitialized()
isInitialized
in interface com.google.protobuf.MessageLiteOrBuilder
isInitialized
in class com.google.protobuf.GeneratedMessage.Builder<RoutesConstraintProto.Builder>
public RoutesConstraintProto.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
mergeFrom
in interface com.google.protobuf.Message.Builder
mergeFrom
in interface com.google.protobuf.MessageLite.Builder
mergeFrom
in class com.google.protobuf.AbstractMessage.Builder<RoutesConstraintProto.Builder>
java.io.IOException
public java.util.List<java.lang.Integer> getTailsList()
repeated int32 tails = 1;
getTailsList
in interface RoutesConstraintProtoOrBuilder
public int getTailsCount()
repeated int32 tails = 1;
getTailsCount
in interface RoutesConstraintProtoOrBuilder
public int getTails(int index)
repeated int32 tails = 1;
getTails
in interface RoutesConstraintProtoOrBuilder
index
- The index of the element to return.public RoutesConstraintProto.Builder setTails(int index, int value)
repeated int32 tails = 1;
index
- The index to set the value at.value
- The tails to set.public RoutesConstraintProto.Builder addTails(int value)
repeated int32 tails = 1;
value
- The tails to add.public RoutesConstraintProto.Builder addAllTails(java.lang.Iterable<? extends java.lang.Integer> values)
repeated int32 tails = 1;
values
- The tails to add.public RoutesConstraintProto.Builder clearTails()
repeated int32 tails = 1;
public java.util.List<java.lang.Integer> getHeadsList()
repeated int32 heads = 2;
getHeadsList
in interface RoutesConstraintProtoOrBuilder
public int getHeadsCount()
repeated int32 heads = 2;
getHeadsCount
in interface RoutesConstraintProtoOrBuilder
public int getHeads(int index)
repeated int32 heads = 2;
getHeads
in interface RoutesConstraintProtoOrBuilder
index
- The index of the element to return.public RoutesConstraintProto.Builder setHeads(int index, int value)
repeated int32 heads = 2;
index
- The index to set the value at.value
- The heads to set.public RoutesConstraintProto.Builder addHeads(int value)
repeated int32 heads = 2;
value
- The heads to add.public RoutesConstraintProto.Builder addAllHeads(java.lang.Iterable<? extends java.lang.Integer> values)
repeated int32 heads = 2;
values
- The heads to add.public RoutesConstraintProto.Builder clearHeads()
repeated int32 heads = 2;
public java.util.List<java.lang.Integer> getLiteralsList()
repeated int32 literals = 3;
getLiteralsList
in interface RoutesConstraintProtoOrBuilder
public int getLiteralsCount()
repeated int32 literals = 3;
getLiteralsCount
in interface RoutesConstraintProtoOrBuilder
public int getLiterals(int index)
repeated int32 literals = 3;
getLiterals
in interface RoutesConstraintProtoOrBuilder
index
- The index of the element to return.public RoutesConstraintProto.Builder setLiterals(int index, int value)
repeated int32 literals = 3;
index
- The index to set the value at.value
- The literals to set.public RoutesConstraintProto.Builder addLiterals(int value)
repeated int32 literals = 3;
value
- The literals to add.public RoutesConstraintProto.Builder addAllLiterals(java.lang.Iterable<? extends java.lang.Integer> values)
repeated int32 literals = 3;
values
- The literals to add.public RoutesConstraintProto.Builder clearLiterals()
repeated int32 literals = 3;
public java.util.List<java.lang.Integer> getDemandsList()
EXPERIMENTAL. The demands for each node, and the maximum capacity for each route. Note that this is currently only used for the LP relaxation and one need to add the corresponding constraint to enforce this outside of the LP. TODO(user): Ideally, we should be able to extract any dimension like these (i.e. capacity, route_length, etc..) automatically from the encoding. The classical way to encode that is to have "current_capacity" variables along the route and linear equations of the form: arc_literal => (current_capacity_tail + demand <= current_capacity_head)
repeated int32 demands = 4;
getDemandsList
in interface RoutesConstraintProtoOrBuilder
public int getDemandsCount()
EXPERIMENTAL. The demands for each node, and the maximum capacity for each route. Note that this is currently only used for the LP relaxation and one need to add the corresponding constraint to enforce this outside of the LP. TODO(user): Ideally, we should be able to extract any dimension like these (i.e. capacity, route_length, etc..) automatically from the encoding. The classical way to encode that is to have "current_capacity" variables along the route and linear equations of the form: arc_literal => (current_capacity_tail + demand <= current_capacity_head)
repeated int32 demands = 4;
getDemandsCount
in interface RoutesConstraintProtoOrBuilder
public int getDemands(int index)
EXPERIMENTAL. The demands for each node, and the maximum capacity for each route. Note that this is currently only used for the LP relaxation and one need to add the corresponding constraint to enforce this outside of the LP. TODO(user): Ideally, we should be able to extract any dimension like these (i.e. capacity, route_length, etc..) automatically from the encoding. The classical way to encode that is to have "current_capacity" variables along the route and linear equations of the form: arc_literal => (current_capacity_tail + demand <= current_capacity_head)
repeated int32 demands = 4;
getDemands
in interface RoutesConstraintProtoOrBuilder
index
- The index of the element to return.public RoutesConstraintProto.Builder setDemands(int index, int value)
EXPERIMENTAL. The demands for each node, and the maximum capacity for each route. Note that this is currently only used for the LP relaxation and one need to add the corresponding constraint to enforce this outside of the LP. TODO(user): Ideally, we should be able to extract any dimension like these (i.e. capacity, route_length, etc..) automatically from the encoding. The classical way to encode that is to have "current_capacity" variables along the route and linear equations of the form: arc_literal => (current_capacity_tail + demand <= current_capacity_head)
repeated int32 demands = 4;
index
- The index to set the value at.value
- The demands to set.public RoutesConstraintProto.Builder addDemands(int value)
EXPERIMENTAL. The demands for each node, and the maximum capacity for each route. Note that this is currently only used for the LP relaxation and one need to add the corresponding constraint to enforce this outside of the LP. TODO(user): Ideally, we should be able to extract any dimension like these (i.e. capacity, route_length, etc..) automatically from the encoding. The classical way to encode that is to have "current_capacity" variables along the route and linear equations of the form: arc_literal => (current_capacity_tail + demand <= current_capacity_head)
repeated int32 demands = 4;
value
- The demands to add.public RoutesConstraintProto.Builder addAllDemands(java.lang.Iterable<? extends java.lang.Integer> values)
EXPERIMENTAL. The demands for each node, and the maximum capacity for each route. Note that this is currently only used for the LP relaxation and one need to add the corresponding constraint to enforce this outside of the LP. TODO(user): Ideally, we should be able to extract any dimension like these (i.e. capacity, route_length, etc..) automatically from the encoding. The classical way to encode that is to have "current_capacity" variables along the route and linear equations of the form: arc_literal => (current_capacity_tail + demand <= current_capacity_head)
repeated int32 demands = 4;
values
- The demands to add.public RoutesConstraintProto.Builder clearDemands()
EXPERIMENTAL. The demands for each node, and the maximum capacity for each route. Note that this is currently only used for the LP relaxation and one need to add the corresponding constraint to enforce this outside of the LP. TODO(user): Ideally, we should be able to extract any dimension like these (i.e. capacity, route_length, etc..) automatically from the encoding. The classical way to encode that is to have "current_capacity" variables along the route and linear equations of the form: arc_literal => (current_capacity_tail + demand <= current_capacity_head)
repeated int32 demands = 4;
public long getCapacity()
int64 capacity = 5;
getCapacity
in interface RoutesConstraintProtoOrBuilder
public RoutesConstraintProto.Builder setCapacity(long value)
int64 capacity = 5;
value
- The capacity to set.public RoutesConstraintProto.Builder clearCapacity()
int64 capacity = 5;
Copyright © 2025. All rights reserved.