Class LinearBooleanConstraint.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<LinearBooleanConstraint.Builder>
com.google.protobuf.GeneratedMessage.Builder<LinearBooleanConstraint.Builder>
com.google.ortools.sat.LinearBooleanConstraint.Builder
All Implemented Interfaces:
LinearBooleanConstraintOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
Enclosing class:
LinearBooleanConstraint

public static final class LinearBooleanConstraint.Builder extends com.google.protobuf.GeneratedMessage.Builder<LinearBooleanConstraint.Builder> implements LinearBooleanConstraintOrBuilder
 A linear Boolean constraint which is a bounded sum of linear terms. Each term
 beeing a literal times an integer coefficient. If we assume that a literal
 takes the value 1 if it is true and 0 otherwise, the constraint is:
 lower_bound <= ... + coefficients[i] * literals[i] + ... <= upper_bound
 
Protobuf type operations_research.sat.LinearBooleanConstraint
  • 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.Builder<LinearBooleanConstraint.Builder>
    • clear

      Specified by:
      clear in interface com.google.protobuf.Message.Builder
      Specified by:
      clear in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clear in class com.google.protobuf.GeneratedMessage.Builder<LinearBooleanConstraint.Builder>
    • getDescriptorForType

      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
      Specified by:
      getDescriptorForType in interface com.google.protobuf.Message.Builder
      Specified by:
      getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
      Overrides:
      getDescriptorForType in class com.google.protobuf.GeneratedMessage.Builder<LinearBooleanConstraint.Builder>
    • getDefaultInstanceForType

      public LinearBooleanConstraint getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
    • build

      public LinearBooleanConstraint build()
      Specified by:
      build in interface com.google.protobuf.Message.Builder
      Specified by:
      build in interface com.google.protobuf.MessageLite.Builder
    • buildPartial

      public LinearBooleanConstraint buildPartial()
      Specified by:
      buildPartial in interface com.google.protobuf.Message.Builder
      Specified by:
      buildPartial in interface com.google.protobuf.MessageLite.Builder
    • mergeFrom

      public LinearBooleanConstraint.Builder mergeFrom(com.google.protobuf.Message other)
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<LinearBooleanConstraint.Builder>
    • mergeFrom

    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessage.Builder<LinearBooleanConstraint.Builder>
    • mergeFrom

      public LinearBooleanConstraint.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Specified by:
      mergeFrom in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<LinearBooleanConstraint.Builder>
      Throws:
      IOException
    • getLiteralsList

      public List<Integer> getLiteralsList()
       Linear terms involved in this constraint.
      
       literals[i] is the signed representation of the i-th literal of the
       constraint and coefficients[i] its coefficients. The signed representation
       is as follow: for a 0-based variable index x, (x + 1) represents the
       variable x and -(x + 1) represents its negation.
      
       Note that the same variable shouldn't appear twice and that zero
       coefficients are not allowed.
       
      repeated int32 literals = 1;
      Specified by:
      getLiteralsList in interface LinearBooleanConstraintOrBuilder
      Returns:
      A list containing the literals.
    • getLiteralsCount

      public int getLiteralsCount()
       Linear terms involved in this constraint.
      
       literals[i] is the signed representation of the i-th literal of the
       constraint and coefficients[i] its coefficients. The signed representation
       is as follow: for a 0-based variable index x, (x + 1) represents the
       variable x and -(x + 1) represents its negation.
      
       Note that the same variable shouldn't appear twice and that zero
       coefficients are not allowed.
       
      repeated int32 literals = 1;
      Specified by:
      getLiteralsCount in interface LinearBooleanConstraintOrBuilder
      Returns:
      The count of literals.
    • getLiterals

      public int getLiterals(int index)
       Linear terms involved in this constraint.
      
       literals[i] is the signed representation of the i-th literal of the
       constraint and coefficients[i] its coefficients. The signed representation
       is as follow: for a 0-based variable index x, (x + 1) represents the
       variable x and -(x + 1) represents its negation.
      
       Note that the same variable shouldn't appear twice and that zero
       coefficients are not allowed.
       
      repeated int32 literals = 1;
      Specified by:
      getLiterals in interface LinearBooleanConstraintOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The literals at the given index.
    • setLiterals

      public LinearBooleanConstraint.Builder setLiterals(int index, int value)
       Linear terms involved in this constraint.
      
       literals[i] is the signed representation of the i-th literal of the
       constraint and coefficients[i] its coefficients. The signed representation
       is as follow: for a 0-based variable index x, (x + 1) represents the
       variable x and -(x + 1) represents its negation.
      
       Note that the same variable shouldn't appear twice and that zero
       coefficients are not allowed.
       
      repeated int32 literals = 1;
      Parameters:
      index - The index to set the value at.
      value - The literals to set.
      Returns:
      This builder for chaining.
    • addLiterals

      public LinearBooleanConstraint.Builder addLiterals(int value)
       Linear terms involved in this constraint.
      
       literals[i] is the signed representation of the i-th literal of the
       constraint and coefficients[i] its coefficients. The signed representation
       is as follow: for a 0-based variable index x, (x + 1) represents the
       variable x and -(x + 1) represents its negation.
      
       Note that the same variable shouldn't appear twice and that zero
       coefficients are not allowed.
       
      repeated int32 literals = 1;
      Parameters:
      value - The literals to add.
      Returns:
      This builder for chaining.
    • addAllLiterals

      public LinearBooleanConstraint.Builder addAllLiterals(Iterable<? extends Integer> values)
       Linear terms involved in this constraint.
      
       literals[i] is the signed representation of the i-th literal of the
       constraint and coefficients[i] its coefficients. The signed representation
       is as follow: for a 0-based variable index x, (x + 1) represents the
       variable x and -(x + 1) represents its negation.
      
       Note that the same variable shouldn't appear twice and that zero
       coefficients are not allowed.
       
      repeated int32 literals = 1;
      Parameters:
      values - The literals to add.
      Returns:
      This builder for chaining.
    • clearLiterals

      public LinearBooleanConstraint.Builder clearLiterals()
       Linear terms involved in this constraint.
      
       literals[i] is the signed representation of the i-th literal of the
       constraint and coefficients[i] its coefficients. The signed representation
       is as follow: for a 0-based variable index x, (x + 1) represents the
       variable x and -(x + 1) represents its negation.
      
       Note that the same variable shouldn't appear twice and that zero
       coefficients are not allowed.
       
      repeated int32 literals = 1;
      Returns:
      This builder for chaining.
    • getCoefficientsList

      public List<Long> getCoefficientsList()
      repeated int64 coefficients = 2;
      Specified by:
      getCoefficientsList in interface LinearBooleanConstraintOrBuilder
      Returns:
      A list containing the coefficients.
    • getCoefficientsCount

      public int getCoefficientsCount()
      repeated int64 coefficients = 2;
      Specified by:
      getCoefficientsCount in interface LinearBooleanConstraintOrBuilder
      Returns:
      The count of coefficients.
    • getCoefficients

      public long getCoefficients(int index)
      repeated int64 coefficients = 2;
      Specified by:
      getCoefficients in interface LinearBooleanConstraintOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The coefficients at the given index.
    • setCoefficients

      public LinearBooleanConstraint.Builder setCoefficients(int index, long value)
      repeated int64 coefficients = 2;
      Parameters:
      index - The index to set the value at.
      value - The coefficients to set.
      Returns:
      This builder for chaining.
    • addCoefficients

      public LinearBooleanConstraint.Builder addCoefficients(long value)
      repeated int64 coefficients = 2;
      Parameters:
      value - The coefficients to add.
      Returns:
      This builder for chaining.
    • addAllCoefficients

      public LinearBooleanConstraint.Builder addAllCoefficients(Iterable<? extends Long> values)
      repeated int64 coefficients = 2;
      Parameters:
      values - The coefficients to add.
      Returns:
      This builder for chaining.
    • clearCoefficients

      public LinearBooleanConstraint.Builder clearCoefficients()
      repeated int64 coefficients = 2;
      Returns:
      This builder for chaining.
    • hasLowerBound

      public boolean hasLowerBound()
       Optional lower (resp. upper) bound of the constraint. If not present, it
       means that the constraint is not bounded in this direction. The bounds
       are INCLUSIVE.
       
      optional int64 lower_bound = 3;
      Specified by:
      hasLowerBound in interface LinearBooleanConstraintOrBuilder
      Returns:
      Whether the lowerBound field is set.
    • getLowerBound

      public long getLowerBound()
       Optional lower (resp. upper) bound of the constraint. If not present, it
       means that the constraint is not bounded in this direction. The bounds
       are INCLUSIVE.
       
      optional int64 lower_bound = 3;
      Specified by:
      getLowerBound in interface LinearBooleanConstraintOrBuilder
      Returns:
      The lowerBound.
    • setLowerBound

      public LinearBooleanConstraint.Builder setLowerBound(long value)
       Optional lower (resp. upper) bound of the constraint. If not present, it
       means that the constraint is not bounded in this direction. The bounds
       are INCLUSIVE.
       
      optional int64 lower_bound = 3;
      Parameters:
      value - The lowerBound to set.
      Returns:
      This builder for chaining.
    • clearLowerBound

      public LinearBooleanConstraint.Builder clearLowerBound()
       Optional lower (resp. upper) bound of the constraint. If not present, it
       means that the constraint is not bounded in this direction. The bounds
       are INCLUSIVE.
       
      optional int64 lower_bound = 3;
      Returns:
      This builder for chaining.
    • hasUpperBound

      public boolean hasUpperBound()
      optional int64 upper_bound = 4;
      Specified by:
      hasUpperBound in interface LinearBooleanConstraintOrBuilder
      Returns:
      Whether the upperBound field is set.
    • getUpperBound

      public long getUpperBound()
      optional int64 upper_bound = 4;
      Specified by:
      getUpperBound in interface LinearBooleanConstraintOrBuilder
      Returns:
      The upperBound.
    • setUpperBound

      public LinearBooleanConstraint.Builder setUpperBound(long value)
      optional int64 upper_bound = 4;
      Parameters:
      value - The upperBound to set.
      Returns:
      This builder for chaining.
    • clearUpperBound

      public LinearBooleanConstraint.Builder clearUpperBound()
      optional int64 upper_bound = 4;
      Returns:
      This builder for chaining.
    • hasName

      public boolean hasName()
       The name of this constraint.
       
      optional string name = 5 [default = ""];
      Specified by:
      hasName in interface LinearBooleanConstraintOrBuilder
      Returns:
      Whether the name field is set.
    • getName

      public String getName()
       The name of this constraint.
       
      optional string name = 5 [default = ""];
      Specified by:
      getName in interface LinearBooleanConstraintOrBuilder
      Returns:
      The name.
    • getNameBytes

      public com.google.protobuf.ByteString getNameBytes()
       The name of this constraint.
       
      optional string name = 5 [default = ""];
      Specified by:
      getNameBytes in interface LinearBooleanConstraintOrBuilder
      Returns:
      The bytes for name.
    • setName

      public LinearBooleanConstraint.Builder setName(String value)
       The name of this constraint.
       
      optional string name = 5 [default = ""];
      Parameters:
      value - The name to set.
      Returns:
      This builder for chaining.
    • clearName

      public LinearBooleanConstraint.Builder clearName()
       The name of this constraint.
       
      optional string name = 5 [default = ""];
      Returns:
      This builder for chaining.
    • setNameBytes

      public LinearBooleanConstraint.Builder setNameBytes(com.google.protobuf.ByteString value)
       The name of this constraint.
       
      optional string name = 5 [default = ""];
      Parameters:
      value - The bytes for name to set.
      Returns:
      This builder for chaining.