Java Reference

Java 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. 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 25 of file RoutesConstraintProto.java.

Classes

class  Builder
 

Public Member Functions

.lang.Override final com.google.protobuf.UnknownFieldSet getUnknownFields ()
 
.lang.Override java.util.List< java.lang.Integer > getTailsList ()
 repeated int32 tails = 1; More...
 
int getTailsCount ()
 repeated int32 tails = 1; More...
 
int getTails (int index)
 repeated int32 tails = 1; More...
 
.lang.Override java.util.List< java.lang.Integer > getHeadsList ()
 repeated int32 heads = 2; More...
 
int getHeadsCount ()
 repeated int32 heads = 2; More...
 
int getHeads (int index)
 repeated int32 heads = 2; More...
 
.lang.Override java.util.List< java.lang.Integer > getLiteralsList ()
 repeated int32 literals = 3; More...
 
int getLiteralsCount ()
 repeated int32 literals = 3; More...
 
int getLiterals (int index)
 repeated int32 literals = 3; More...
 
.lang.Override java.util.List< java.lang.Integer > getDemandsList ()
 
int getDemandsCount ()
 
int getDemands (int index)
 
.lang.Override long getCapacity ()
 int64 capacity = 5; More...
 
.lang.Override final boolean isInitialized ()
 
.lang.Override void writeTo (com.google.protobuf.CodedOutputStream output) throws java.io.IOException
 
.lang.Override int getSerializedSize ()
 
.lang.Override boolean equals (final java.lang.Object obj)
 
.lang.Override int hashCode ()
 
.lang.Override Builder newBuilderForType ()
 
.lang.Override Builder toBuilder ()
 
.lang.Override com.google.protobuf.Parser< RoutesConstraintProtogetParserForType ()
 
.lang.Override 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
 

Protected Member Functions

.lang.Override java.lang.Object newInstance (UnusedPrivateParameter unused)
 
.lang.Override com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable ()
 
.lang.Override Builder newBuilderForType (com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
 

Member Function Documentation

◆ equals()

.lang.Override boolean equals ( final java.lang.Object  obj)

Definition at line 482 of file RoutesConstraintProto.java.

◆ getCapacity()

.lang.Override long getCapacity ( )

int64 capacity = 5;

Returns
The capacity.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 357 of file RoutesConstraintProto.java.

◆ getDefaultInstance()

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

Definition at line 1304 of file RoutesConstraintProto.java.

◆ getDefaultInstanceForType()

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

Definition at line 1329 of file RoutesConstraintProto.java.

◆ getDemands()

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;

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

Implements RoutesConstraintProtoOrBuilder.

Definition at line 345 of file RoutesConstraintProto.java.

◆ getDemandsCount()

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;

Returns
The count of demands.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 326 of file RoutesConstraintProto.java.

◆ getDemandsList()

.lang.Override 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;

Returns
A list containing the demands.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 308 of file RoutesConstraintProto.java.

◆ getDescriptor()

static final com.google.protobuf.Descriptors.Descriptor getDescriptor ( )
static

Definition at line 193 of file RoutesConstraintProto.java.

◆ getHeads()

int getHeads ( int  index)

repeated int32 heads = 2;

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

Implements RoutesConstraintProtoOrBuilder.

Definition at line 256 of file RoutesConstraintProto.java.

◆ getHeadsCount()

int getHeadsCount ( )

repeated int32 heads = 2;

Returns
The count of heads.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 248 of file RoutesConstraintProto.java.

◆ getHeadsList()

.lang.Override java.util.List<java.lang.Integer> getHeadsList ( )

repeated int32 heads = 2;

Returns
A list containing the heads.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 241 of file RoutesConstraintProto.java.

◆ getLiterals()

int getLiterals ( int  index)

repeated int32 literals = 3;

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

Implements RoutesConstraintProtoOrBuilder.

Definition at line 284 of file RoutesConstraintProto.java.

◆ getLiteralsCount()

int getLiteralsCount ( )

repeated int32 literals = 3;

Returns
The count of literals.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 276 of file RoutesConstraintProto.java.

◆ getLiteralsList()

.lang.Override java.util.List<java.lang.Integer> getLiteralsList ( )

repeated int32 literals = 3;

Returns
A list containing the literals.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 269 of file RoutesConstraintProto.java.

◆ getParserForType()

.lang.Override com.google.protobuf.Parser<RoutesConstraintProto> getParserForType ( )

Definition at line 1324 of file RoutesConstraintProto.java.

◆ getSerializedSize()

.lang.Override int getSerializedSize ( )

Definition at line 411 of file RoutesConstraintProto.java.

◆ getTails()

int getTails ( int  index)

repeated int32 tails = 1;

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

Implements RoutesConstraintProtoOrBuilder.

Definition at line 228 of file RoutesConstraintProto.java.

◆ getTailsCount()

int getTailsCount ( )

repeated int32 tails = 1;

Returns
The count of tails.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 220 of file RoutesConstraintProto.java.

◆ getTailsList()

.lang.Override java.util.List<java.lang.Integer> getTailsList ( )

repeated int32 tails = 1;

Returns
A list containing the tails.

Implements RoutesConstraintProtoOrBuilder.

Definition at line 213 of file RoutesConstraintProto.java.

◆ getUnknownFields()

.lang.Override final com.google.protobuf.UnknownFieldSet getUnknownFields ( )

Definition at line 50 of file RoutesConstraintProto.java.

◆ hashCode()

.lang.Override int hashCode ( )

Definition at line 506 of file RoutesConstraintProto.java.

◆ internalGetFieldAccessorTable()

.lang.Override com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable ( )
protected

Definition at line 199 of file RoutesConstraintProto.java.

◆ isInitialized()

.lang.Override final boolean isInitialized ( )

Definition at line 363 of file RoutesConstraintProto.java.

◆ newBuilder() [1/2]

static Builder newBuilder ( )
static

Definition at line 608 of file RoutesConstraintProto.java.

◆ newBuilder() [2/2]

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

Definition at line 611 of file RoutesConstraintProto.java.

◆ newBuilderForType() [1/2]

.lang.Override Builder newBuilderForType ( )

Definition at line 607 of file RoutesConstraintProto.java.

◆ newBuilderForType() [2/2]

.lang.Override Builder newBuilderForType ( com.google.protobuf.GeneratedMessageV3.BuilderParent  parent)
protected

Definition at line 621 of file RoutesConstraintProto.java.

◆ newInstance()

.lang.Override java.lang.Object newInstance ( UnusedPrivateParameter  unused)
protected

Definition at line 43 of file RoutesConstraintProto.java.

◆ parseDelimitedFrom() [1/2]

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

Definition at line 580 of file RoutesConstraintProto.java.

◆ parseDelimitedFrom() [2/2]

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

Definition at line 585 of file RoutesConstraintProto.java.

◆ parseFrom() [1/10]

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

Definition at line 558 of file RoutesConstraintProto.java.

◆ parseFrom() [2/10]

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

Definition at line 562 of file RoutesConstraintProto.java.

◆ parseFrom() [3/10]

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

Definition at line 547 of file RoutesConstraintProto.java.

◆ parseFrom() [4/10]

static 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 552 of file RoutesConstraintProto.java.

◆ parseFrom() [5/10]

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

Definition at line 592 of file RoutesConstraintProto.java.

◆ parseFrom() [6/10]

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

Definition at line 598 of file RoutesConstraintProto.java.

◆ parseFrom() [7/10]

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

Definition at line 568 of file RoutesConstraintProto.java.

◆ parseFrom() [8/10]

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

Definition at line 573 of file RoutesConstraintProto.java.

◆ parseFrom() [9/10]

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

Definition at line 536 of file RoutesConstraintProto.java.

◆ parseFrom() [10/10]

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

Definition at line 541 of file RoutesConstraintProto.java.

◆ parser()

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

Definition at line 1319 of file RoutesConstraintProto.java.

◆ toBuilder()

.lang.Override Builder toBuilder ( )

Definition at line 615 of file RoutesConstraintProto.java.

◆ writeTo()

.lang.Override void writeTo ( com.google.protobuf.CodedOutputStream  output) throws java.io.IOException

Definition at line 373 of file RoutesConstraintProto.java.

Member Data Documentation

◆ CAPACITY_FIELD_NUMBER

final int CAPACITY_FIELD_NUMBER = 5
static

Definition at line 350 of file RoutesConstraintProto.java.

◆ DEMANDS_FIELD_NUMBER

final int DEMANDS_FIELD_NUMBER = 4
static

Definition at line 289 of file RoutesConstraintProto.java.

◆ HEADS_FIELD_NUMBER

final int HEADS_FIELD_NUMBER = 2
static

Definition at line 233 of file RoutesConstraintProto.java.

◆ LITERALS_FIELD_NUMBER

final int LITERALS_FIELD_NUMBER = 3
static

Definition at line 261 of file RoutesConstraintProto.java.

◆ TAILS_FIELD_NUMBER

final int TAILS_FIELD_NUMBER = 1
static

Definition at line 205 of file RoutesConstraintProto.java.


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