Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
com.google.ortools.sat.RoutesConstraintProto Class Reference

Detailed Description

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

Definition at line 35 of file RoutesConstraintProto.java.

Inheritance diagram for com.google.ortools.sat.RoutesConstraintProto:
com.google.ortools.sat.RoutesConstraintProtoOrBuilder

Classes

class  Builder
class  NodeExpressions
interface  NodeExpressionsOrBuilder

Public Member Functions

java.util.List< java.lang.Integer > getTailsList ()
int getTailsCount ()
int getTails (int index)
java.util.List< java.lang.Integer > getHeadsList ()
int getHeadsCount ()
int getHeads (int index)
java.util.List< java.lang.Integer > getLiteralsList ()
int getLiteralsCount ()
int getLiterals (int index)
java.util.List< java.lang.Integer > getDemandsList ()
int getDemandsCount ()
int getDemands (int index)
long getCapacity ()
java.util.List< com.google.ortools.sat.RoutesConstraintProto.NodeExpressionsgetDimensionsList ()
java.util.List<? extends com.google.ortools.sat.RoutesConstraintProto.NodeExpressionsOrBuildergetDimensionsOrBuilderList ()
int getDimensionsCount ()
com.google.ortools.sat.RoutesConstraintProto.NodeExpressions getDimensions (int index)
com.google.ortools.sat.RoutesConstraintProto.NodeExpressionsOrBuilder getDimensionsOrBuilder (int index)
final boolean isInitialized ()
void writeTo (com.google.protobuf.CodedOutputStream output) throws java.io.IOException
int getSerializedSize ()
boolean equals (final java.lang.Object obj)
int hashCode ()
Builder newBuilderForType ()
Builder toBuilder ()
com.google.protobuf.Parser< RoutesConstraintProtogetParserForType ()
com.google.ortools.sat.RoutesConstraintProto getDefaultInstanceForType ()

Static Public Member Functions

static final com.google.protobuf.Descriptors.Descriptor getDescriptor ()
static com.google.ortools.sat.RoutesConstraintProto parseFrom (java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (java.io.InputStream input) throws java.io.IOException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
static com.google.ortools.sat.RoutesConstraintProto parseDelimitedFrom (java.io.InputStream input) throws java.io.IOException
static com.google.ortools.sat.RoutesConstraintProto parseDelimitedFrom (java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (com.google.protobuf.CodedInputStream input) throws java.io.IOException
static com.google.ortools.sat.RoutesConstraintProto parseFrom (com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
static Builder newBuilder ()
static Builder newBuilder (com.google.ortools.sat.RoutesConstraintProto prototype)
static com.google.ortools.sat.RoutesConstraintProto getDefaultInstance ()
static com.google.protobuf.Parser< RoutesConstraintProtoparser ()

Static Public Attributes

static final int TAILS_FIELD_NUMBER = 1
static final int HEADS_FIELD_NUMBER = 2
static final int LITERALS_FIELD_NUMBER = 3
static final int DEMANDS_FIELD_NUMBER = 4
static final int CAPACITY_FIELD_NUMBER = 5
static final int DIMENSIONS_FIELD_NUMBER = 6

Protected Member Functions

com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable ()
Builder newBuilderForType (com.google.protobuf.GeneratedMessage.BuilderParent parent)

Member Function Documentation

◆ equals()

boolean com.google.ortools.sat.RoutesConstraintProto.equals ( final java.lang.Object obj)

Definition at line 1334 of file RoutesConstraintProto.java.

◆ getCapacity()

long com.google.ortools.sat.RoutesConstraintProto.getCapacity ( )

int64 capacity = 5;

Returns
The capacity.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1101 of file RoutesConstraintProto.java.

◆ getDefaultInstance()

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.getDefaultInstance ( )
static

Definition at line 2693 of file RoutesConstraintProto.java.

◆ getDefaultInstanceForType()

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.getDefaultInstanceForType ( )

Definition at line 2729 of file RoutesConstraintProto.java.

◆ getDemands()

int com.google.ortools.sat.RoutesConstraintProto.getDemands ( int index)
DEPRECATED. These fields are no longer used. The solver ignores them.

repeated int32 demands = 4;

Parameters
indexThe index of the element to return.
Returns
The demands at the given index.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1089 of file RoutesConstraintProto.java.

◆ getDemandsCount()

int com.google.ortools.sat.RoutesConstraintProto.getDemandsCount ( )
DEPRECATED. These fields are no longer used. The solver ignores them.

repeated int32 demands = 4;

Returns
The count of demands.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1077 of file RoutesConstraintProto.java.

◆ getDemandsList()

java.util.List< java.lang.Integer > com.google.ortools.sat.RoutesConstraintProto.getDemandsList ( )
DEPRECATED. These fields are no longer used. The solver ignores them.

repeated int32 demands = 4;

Returns
A list containing the demands.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1066 of file RoutesConstraintProto.java.

◆ getDescriptor()

final com.google.protobuf.Descriptors.Descriptor com.google.ortools.sat.RoutesConstraintProto.getDescriptor ( )
static

Definition at line 62 of file RoutesConstraintProto.java.

◆ getDimensions()

com.google.ortools.sat.RoutesConstraintProto.NodeExpressions com.google.ortools.sat.RoutesConstraintProto.getDimensions ( int index)
Expressions associated with the nodes of the graph, such as the load of the
vehicle arriving at a node, or the time at which a vehicle arrives at a
node. Expressions with the same "dimension" (such as "load" or "time") must
be listed together.
This field is optional. If it is set, the linear constraints of size 1 or 2
between the variables in these expressions will be used to derive cuts for
this constraint. If it is not set, the solver will try to automatically
derive it, from the linear constraints of size 1 or 2 in the model (this
can fail in complex cases).

repeated .operations_research.sat.RoutesConstraintProto.NodeExpressions dimensions = 6;

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1182 of file RoutesConstraintProto.java.

◆ getDimensionsCount()

int com.google.ortools.sat.RoutesConstraintProto.getDimensionsCount ( )
Expressions associated with the nodes of the graph, such as the load of the
vehicle arriving at a node, or the time at which a vehicle arrives at a
node. Expressions with the same "dimension" (such as "load" or "time") must
be listed together.
This field is optional. If it is set, the linear constraints of size 1 or 2
between the variables in these expressions will be used to derive cuts for
this constraint. If it is not set, the solver will try to automatically
derive it, from the linear constraints of size 1 or 2 in the model (this
can fail in complex cases).

repeated .operations_research.sat.RoutesConstraintProto.NodeExpressions dimensions = 6;

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1163 of file RoutesConstraintProto.java.

◆ getDimensionsList()

java.util.List< com.google.ortools.sat.RoutesConstraintProto.NodeExpressions > com.google.ortools.sat.RoutesConstraintProto.getDimensionsList ( )
Expressions associated with the nodes of the graph, such as the load of the
vehicle arriving at a node, or the time at which a vehicle arrives at a
node. Expressions with the same "dimension" (such as "load" or "time") must
be listed together.
This field is optional. If it is set, the linear constraints of size 1 or 2
between the variables in these expressions will be used to derive cuts for
this constraint. If it is not set, the solver will try to automatically
derive it, from the linear constraints of size 1 or 2 in the model (this
can fail in complex cases).

repeated .operations_research.sat.RoutesConstraintProto.NodeExpressions dimensions = 6;

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1124 of file RoutesConstraintProto.java.

◆ getDimensionsOrBuilder()

com.google.ortools.sat.RoutesConstraintProto.NodeExpressionsOrBuilder com.google.ortools.sat.RoutesConstraintProto.getDimensionsOrBuilder ( int index)
Expressions associated with the nodes of the graph, such as the load of the
vehicle arriving at a node, or the time at which a vehicle arrives at a
node. Expressions with the same "dimension" (such as "load" or "time") must
be listed together.
This field is optional. If it is set, the linear constraints of size 1 or 2
between the variables in these expressions will be used to derive cuts for
this constraint. If it is not set, the solver will try to automatically
derive it, from the linear constraints of size 1 or 2 in the model (this
can fail in complex cases).

repeated .operations_research.sat.RoutesConstraintProto.NodeExpressions dimensions = 6;

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1201 of file RoutesConstraintProto.java.

◆ getDimensionsOrBuilderList()

java.util.List<? extends com.google.ortools.sat.RoutesConstraintProto.NodeExpressionsOrBuilder > com.google.ortools.sat.RoutesConstraintProto.getDimensionsOrBuilderList ( )
Expressions associated with the nodes of the graph, such as the load of the
vehicle arriving at a node, or the time at which a vehicle arrives at a
node. Expressions with the same "dimension" (such as "load" or "time") must
be listed together.
This field is optional. If it is set, the linear constraints of size 1 or 2
between the variables in these expressions will be used to derive cuts for
this constraint. If it is not set, the solver will try to automatically
derive it, from the linear constraints of size 1 or 2 in the model (this
can fail in complex cases).

repeated .operations_research.sat.RoutesConstraintProto.NodeExpressions dimensions = 6;

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1144 of file RoutesConstraintProto.java.

◆ getHeads()

int com.google.ortools.sat.RoutesConstraintProto.getHeads ( int index)

repeated int32 heads = 2;

Parameters
indexThe index of the element to return.
Returns
The heads at the given index.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1017 of file RoutesConstraintProto.java.

◆ getHeadsCount()

int com.google.ortools.sat.RoutesConstraintProto.getHeadsCount ( )

repeated int32 heads = 2;

Returns
The count of heads.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1009 of file RoutesConstraintProto.java.

◆ getHeadsList()

java.util.List< java.lang.Integer > com.google.ortools.sat.RoutesConstraintProto.getHeadsList ( )

repeated int32 heads = 2;

Returns
A list containing the heads.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1002 of file RoutesConstraintProto.java.

◆ getLiterals()

int com.google.ortools.sat.RoutesConstraintProto.getLiterals ( int index)

repeated int32 literals = 3;

Parameters
indexThe index of the element to return.
Returns
The literals at the given index.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1047 of file RoutesConstraintProto.java.

◆ getLiteralsCount()

int com.google.ortools.sat.RoutesConstraintProto.getLiteralsCount ( )

repeated int32 literals = 3;

Returns
The count of literals.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1039 of file RoutesConstraintProto.java.

◆ getLiteralsList()

java.util.List< java.lang.Integer > com.google.ortools.sat.RoutesConstraintProto.getLiteralsList ( )

repeated int32 literals = 3;

Returns
A list containing the literals.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 1032 of file RoutesConstraintProto.java.

◆ getParserForType()

com.google.protobuf.Parser< RoutesConstraintProto > com.google.ortools.sat.RoutesConstraintProto.getParserForType ( )

Definition at line 2724 of file RoutesConstraintProto.java.

◆ getSerializedSize()

int com.google.ortools.sat.RoutesConstraintProto.getSerializedSize ( )

Definition at line 1259 of file RoutesConstraintProto.java.

◆ getTails()

int com.google.ortools.sat.RoutesConstraintProto.getTails ( int index)

repeated int32 tails = 1;

Parameters
indexThe index of the element to return.
Returns
The tails at the given index.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 987 of file RoutesConstraintProto.java.

◆ getTailsCount()

int com.google.ortools.sat.RoutesConstraintProto.getTailsCount ( )

repeated int32 tails = 1;

Returns
The count of tails.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 979 of file RoutesConstraintProto.java.

◆ getTailsList()

java.util.List< java.lang.Integer > com.google.ortools.sat.RoutesConstraintProto.getTailsList ( )

repeated int32 tails = 1;

Returns
A list containing the tails.

Implements com.google.ortools.sat.RoutesConstraintProtoOrBuilder.

Definition at line 972 of file RoutesConstraintProto.java.

◆ hashCode()

int com.google.ortools.sat.RoutesConstraintProto.hashCode ( )

Definition at line 1360 of file RoutesConstraintProto.java.

◆ internalGetFieldAccessorTable()

com.google.protobuf.GeneratedMessage.FieldAccessorTable com.google.ortools.sat.RoutesConstraintProto.internalGetFieldAccessorTable ( )
protected

Definition at line 68 of file RoutesConstraintProto.java.

◆ isInitialized()

final boolean com.google.ortools.sat.RoutesConstraintProto.isInitialized ( )

Definition at line 1208 of file RoutesConstraintProto.java.

◆ newBuilder() [1/2]

Builder com.google.ortools.sat.RoutesConstraintProto.newBuilder ( )
static

Definition at line 1468 of file RoutesConstraintProto.java.

◆ newBuilder() [2/2]

Builder com.google.ortools.sat.RoutesConstraintProto.newBuilder ( com.google.ortools.sat.RoutesConstraintProto prototype)
static

Definition at line 1471 of file RoutesConstraintProto.java.

◆ newBuilderForType() [1/2]

Builder com.google.ortools.sat.RoutesConstraintProto.newBuilderForType ( )

Definition at line 1467 of file RoutesConstraintProto.java.

◆ newBuilderForType() [2/2]

Builder com.google.ortools.sat.RoutesConstraintProto.newBuilderForType ( com.google.protobuf.GeneratedMessage.BuilderParent parent)
protected

Definition at line 1481 of file RoutesConstraintProto.java.

◆ parseDelimitedFrom() [1/2]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseDelimitedFrom ( java.io.InputStream input) throws java.io.IOException
static

Definition at line 1439 of file RoutesConstraintProto.java.

◆ parseDelimitedFrom() [2/2]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseDelimitedFrom ( java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws java.io.IOException
static

Definition at line 1445 of file RoutesConstraintProto.java.

◆ parseFrom() [1/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 1416 of file RoutesConstraintProto.java.

◆ parseFrom() [2/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 1420 of file RoutesConstraintProto.java.

◆ parseFrom() [3/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 1405 of file RoutesConstraintProto.java.

◆ parseFrom() [4/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 1410 of file RoutesConstraintProto.java.

◆ parseFrom() [5/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( com.google.protobuf.CodedInputStream input) throws java.io.IOException
static

Definition at line 1452 of file RoutesConstraintProto.java.

◆ parseFrom() [6/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws java.io.IOException
static

Definition at line 1458 of file RoutesConstraintProto.java.

◆ parseFrom() [7/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( java.io.InputStream input) throws java.io.IOException
static

Definition at line 1426 of file RoutesConstraintProto.java.

◆ parseFrom() [8/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws java.io.IOException
static

Definition at line 1431 of file RoutesConstraintProto.java.

◆ parseFrom() [9/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 1394 of file RoutesConstraintProto.java.

◆ parseFrom() [10/10]

com.google.ortools.sat.RoutesConstraintProto com.google.ortools.sat.RoutesConstraintProto.parseFrom ( java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 1399 of file RoutesConstraintProto.java.

◆ parser()

com.google.protobuf.Parser< RoutesConstraintProto > com.google.ortools.sat.RoutesConstraintProto.parser ( )
static

Definition at line 2719 of file RoutesConstraintProto.java.

◆ toBuilder()

Builder com.google.ortools.sat.RoutesConstraintProto.toBuilder ( )

Definition at line 1475 of file RoutesConstraintProto.java.

◆ writeTo()

void com.google.ortools.sat.RoutesConstraintProto.writeTo ( com.google.protobuf.CodedOutputStream output) throws java.io.IOException

Definition at line 1218 of file RoutesConstraintProto.java.

Member Data Documentation

◆ CAPACITY_FIELD_NUMBER

final int com.google.ortools.sat.RoutesConstraintProto.CAPACITY_FIELD_NUMBER = 5
static

Definition at line 1094 of file RoutesConstraintProto.java.

◆ DEMANDS_FIELD_NUMBER

final int com.google.ortools.sat.RoutesConstraintProto.DEMANDS_FIELD_NUMBER = 4
static

Definition at line 1052 of file RoutesConstraintProto.java.

◆ DIMENSIONS_FIELD_NUMBER

final int com.google.ortools.sat.RoutesConstraintProto.DIMENSIONS_FIELD_NUMBER = 6
static

Definition at line 1105 of file RoutesConstraintProto.java.

◆ HEADS_FIELD_NUMBER

final int com.google.ortools.sat.RoutesConstraintProto.HEADS_FIELD_NUMBER = 2
static

Definition at line 992 of file RoutesConstraintProto.java.

◆ LITERALS_FIELD_NUMBER

final int com.google.ortools.sat.RoutesConstraintProto.LITERALS_FIELD_NUMBER = 3
static

Definition at line 1022 of file RoutesConstraintProto.java.

◆ TAILS_FIELD_NUMBER

final int com.google.ortools.sat.RoutesConstraintProto.TAILS_FIELD_NUMBER = 1
static

Definition at line 962 of file RoutesConstraintProto.java.


The documentation for this class was generated from the following file: