Class RoutesConstraintProto

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessage
com.google.ortools.sat.RoutesConstraintProto
All Implemented Interfaces:
RoutesConstraintProtoOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable

@Generated public final class RoutesConstraintProto extends com.google.protobuf.GeneratedMessage 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 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
See Also:
  • Field Details

  • Method Details

    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage
    • getTailsList

      public List<Integer> getTailsList()
      repeated int32 tails = 1;
      Specified by:
      getTailsList in interface RoutesConstraintProtoOrBuilder
      Returns:
      A list containing the tails.
    • getTailsCount

      public int getTailsCount()
      repeated int32 tails = 1;
      Specified by:
      getTailsCount in interface RoutesConstraintProtoOrBuilder
      Returns:
      The count of tails.
    • getTails

      public int getTails(int index)
      repeated int32 tails = 1;
      Specified by:
      getTails in interface RoutesConstraintProtoOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The tails at the given index.
    • getHeadsList

      public List<Integer> getHeadsList()
      repeated int32 heads = 2;
      Specified by:
      getHeadsList in interface RoutesConstraintProtoOrBuilder
      Returns:
      A list containing the heads.
    • getHeadsCount

      public int getHeadsCount()
      repeated int32 heads = 2;
      Specified by:
      getHeadsCount in interface RoutesConstraintProtoOrBuilder
      Returns:
      The count of heads.
    • getHeads

      public int getHeads(int index)
      repeated int32 heads = 2;
      Specified by:
      getHeads in interface RoutesConstraintProtoOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The heads at the given index.
    • getLiteralsList

      public List<Integer> getLiteralsList()
      repeated int32 literals = 3;
      Specified by:
      getLiteralsList in interface RoutesConstraintProtoOrBuilder
      Returns:
      A list containing the literals.
    • getLiteralsCount

      public int getLiteralsCount()
      repeated int32 literals = 3;
      Specified by:
      getLiteralsCount in interface RoutesConstraintProtoOrBuilder
      Returns:
      The count of literals.
    • getLiterals

      public int getLiterals(int index)
      repeated int32 literals = 3;
      Specified by:
      getLiterals in interface RoutesConstraintProtoOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The literals at the given index.
    • getDemandsList

      public List<Integer> getDemandsList()
       DEPRECATED. These fields are no longer used. The solver ignores them.
       
      repeated int32 demands = 4;
      Specified by:
      getDemandsList in interface RoutesConstraintProtoOrBuilder
      Returns:
      A list containing the demands.
    • getDemandsCount

      public int getDemandsCount()
       DEPRECATED. These fields are no longer used. The solver ignores them.
       
      repeated int32 demands = 4;
      Specified by:
      getDemandsCount in interface RoutesConstraintProtoOrBuilder
      Returns:
      The count of demands.
    • getDemands

      public int getDemands(int index)
       DEPRECATED. These fields are no longer used. The solver ignores them.
       
      repeated int32 demands = 4;
      Specified by:
      getDemands in interface RoutesConstraintProtoOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The demands at the given index.
    • getCapacity

      public long getCapacity()
      int64 capacity = 5;
      Specified by:
      getCapacity in interface RoutesConstraintProtoOrBuilder
      Returns:
      The capacity.
    • getDimensionsList

      public List<RoutesConstraintProto.NodeExpressions> 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;
      Specified by:
      getDimensionsList in interface RoutesConstraintProtoOrBuilder
    • getDimensionsOrBuilderList

      public List<? extends RoutesConstraintProto.NodeExpressionsOrBuilder> 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;
      Specified by:
      getDimensionsOrBuilderList in interface RoutesConstraintProtoOrBuilder
    • getDimensionsCount

      public int 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;
      Specified by:
      getDimensionsCount in interface RoutesConstraintProtoOrBuilder
    • getDimensions

      public RoutesConstraintProto.NodeExpressions 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;
      Specified by:
      getDimensions in interface RoutesConstraintProtoOrBuilder
    • getDimensionsOrBuilder

      public RoutesConstraintProto.NodeExpressionsOrBuilder 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;
      Specified by:
      getDimensionsOrBuilder in interface RoutesConstraintProtoOrBuilder
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessage
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessage
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessage
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static RoutesConstraintProto parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static RoutesConstraintProto parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static RoutesConstraintProto parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static RoutesConstraintProto parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static RoutesConstraintProto parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static RoutesConstraintProto parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static RoutesConstraintProto parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static RoutesConstraintProto parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static RoutesConstraintProto parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static RoutesConstraintProto parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static RoutesConstraintProto parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static RoutesConstraintProto parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

      public RoutesConstraintProto.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.Message
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • newBuilder

      public static RoutesConstraintProto.Builder newBuilder()
    • newBuilder

      public static RoutesConstraintProto.Builder newBuilder(RoutesConstraintProto prototype)
    • toBuilder

      public RoutesConstraintProto.Builder toBuilder()
      Specified by:
      toBuilder in interface com.google.protobuf.Message
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • newBuilderForType

      protected RoutesConstraintProto.Builder newBuilderForType(com.google.protobuf.AbstractMessage.BuilderParent parent)
      Overrides:
      newBuilderForType in class com.google.protobuf.AbstractMessage
    • getDefaultInstance

      public static RoutesConstraintProto getDefaultInstance()
    • parser

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

      public com.google.protobuf.Parser<RoutesConstraintProto> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessage
    • getDefaultInstanceForType

      public RoutesConstraintProto getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder