Class MPConstraintProto.Builder

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

public static final class MPConstraintProto.Builder extends com.google.protobuf.GeneratedMessage.Builder<MPConstraintProto.Builder> implements MPConstraintProtoOrBuilder
 A linear constraint is always of the form:
 lower_bound <= sum of linear term elements <= upper_bound,
 where lower_bound and upper_bound:
 - Can form a singleton: lower_bound == upper_bound. The constraint is an
 equation.
 - Can form a finite interval [lower_bound, upper_bound]. The constraint is
 both lower- and upper-bounded, i.e. "boxed".
 - Can form a semi-infinite interval. lower_bound = -infinity: the constraint
 is upper-bounded. upper_bound = +infinity: the constraint is lower-bounded.
 - Can form the infinite interval: lower_bound = -infinity and
 upper_bound = +infinity. The constraint is free.
 
Protobuf type operations_research.MPConstraintProto
  • 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<MPConstraintProto.Builder>
    • clear

      public MPConstraintProto.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<MPConstraintProto.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<MPConstraintProto.Builder>
    • getDefaultInstanceForType

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

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

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

      public MPConstraintProto.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<MPConstraintProto.Builder>
    • mergeFrom

      public MPConstraintProto.Builder mergeFrom(MPConstraintProto other)
    • isInitialized

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

      public MPConstraintProto.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<MPConstraintProto.Builder>
      Throws:
      IOException
    • getVarIndexList

      public List<Integer> getVarIndexList()
       var_index[i] is the variable index (w.r.t. to "variable" field of
       MPModelProto) of the i-th linear term involved in this constraint, and
       coefficient[i] is its coefficient. Only the terms with non-zero
       coefficients need to appear. var_index may not contain duplicates.
       
      repeated int32 var_index = 6 [packed = true];
      Specified by:
      getVarIndexList in interface MPConstraintProtoOrBuilder
      Returns:
      A list containing the varIndex.
    • getVarIndexCount

      public int getVarIndexCount()
       var_index[i] is the variable index (w.r.t. to "variable" field of
       MPModelProto) of the i-th linear term involved in this constraint, and
       coefficient[i] is its coefficient. Only the terms with non-zero
       coefficients need to appear. var_index may not contain duplicates.
       
      repeated int32 var_index = 6 [packed = true];
      Specified by:
      getVarIndexCount in interface MPConstraintProtoOrBuilder
      Returns:
      The count of varIndex.
    • getVarIndex

      public int getVarIndex(int index)
       var_index[i] is the variable index (w.r.t. to "variable" field of
       MPModelProto) of the i-th linear term involved in this constraint, and
       coefficient[i] is its coefficient. Only the terms with non-zero
       coefficients need to appear. var_index may not contain duplicates.
       
      repeated int32 var_index = 6 [packed = true];
      Specified by:
      getVarIndex in interface MPConstraintProtoOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The varIndex at the given index.
    • setVarIndex

      public MPConstraintProto.Builder setVarIndex(int index, int value)
       var_index[i] is the variable index (w.r.t. to "variable" field of
       MPModelProto) of the i-th linear term involved in this constraint, and
       coefficient[i] is its coefficient. Only the terms with non-zero
       coefficients need to appear. var_index may not contain duplicates.
       
      repeated int32 var_index = 6 [packed = true];
      Parameters:
      index - The index to set the value at.
      value - The varIndex to set.
      Returns:
      This builder for chaining.
    • addVarIndex

      public MPConstraintProto.Builder addVarIndex(int value)
       var_index[i] is the variable index (w.r.t. to "variable" field of
       MPModelProto) of the i-th linear term involved in this constraint, and
       coefficient[i] is its coefficient. Only the terms with non-zero
       coefficients need to appear. var_index may not contain duplicates.
       
      repeated int32 var_index = 6 [packed = true];
      Parameters:
      value - The varIndex to add.
      Returns:
      This builder for chaining.
    • addAllVarIndex

      public MPConstraintProto.Builder addAllVarIndex(Iterable<? extends Integer> values)
       var_index[i] is the variable index (w.r.t. to "variable" field of
       MPModelProto) of the i-th linear term involved in this constraint, and
       coefficient[i] is its coefficient. Only the terms with non-zero
       coefficients need to appear. var_index may not contain duplicates.
       
      repeated int32 var_index = 6 [packed = true];
      Parameters:
      values - The varIndex to add.
      Returns:
      This builder for chaining.
    • clearVarIndex

      public MPConstraintProto.Builder clearVarIndex()
       var_index[i] is the variable index (w.r.t. to "variable" field of
       MPModelProto) of the i-th linear term involved in this constraint, and
       coefficient[i] is its coefficient. Only the terms with non-zero
       coefficients need to appear. var_index may not contain duplicates.
       
      repeated int32 var_index = 6 [packed = true];
      Returns:
      This builder for chaining.
    • getCoefficientList

      public List<Double> getCoefficientList()
       Must be finite.
       
      repeated double coefficient = 7 [packed = true];
      Specified by:
      getCoefficientList in interface MPConstraintProtoOrBuilder
      Returns:
      A list containing the coefficient.
    • getCoefficientCount

      public int getCoefficientCount()
       Must be finite.
       
      repeated double coefficient = 7 [packed = true];
      Specified by:
      getCoefficientCount in interface MPConstraintProtoOrBuilder
      Returns:
      The count of coefficient.
    • getCoefficient

      public double getCoefficient(int index)
       Must be finite.
       
      repeated double coefficient = 7 [packed = true];
      Specified by:
      getCoefficient in interface MPConstraintProtoOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The coefficient at the given index.
    • setCoefficient

      public MPConstraintProto.Builder setCoefficient(int index, double value)
       Must be finite.
       
      repeated double coefficient = 7 [packed = true];
      Parameters:
      index - The index to set the value at.
      value - The coefficient to set.
      Returns:
      This builder for chaining.
    • addCoefficient

      public MPConstraintProto.Builder addCoefficient(double value)
       Must be finite.
       
      repeated double coefficient = 7 [packed = true];
      Parameters:
      value - The coefficient to add.
      Returns:
      This builder for chaining.
    • addAllCoefficient

      public MPConstraintProto.Builder addAllCoefficient(Iterable<? extends Double> values)
       Must be finite.
       
      repeated double coefficient = 7 [packed = true];
      Parameters:
      values - The coefficient to add.
      Returns:
      This builder for chaining.
    • clearCoefficient

      public MPConstraintProto.Builder clearCoefficient()
       Must be finite.
       
      repeated double coefficient = 7 [packed = true];
      Returns:
      This builder for chaining.
    • hasLowerBound

      public boolean hasLowerBound()
       lower_bound must be <= upper_bound.
       
      optional double lower_bound = 2 [default = -inf];
      Specified by:
      hasLowerBound in interface MPConstraintProtoOrBuilder
      Returns:
      Whether the lowerBound field is set.
    • getLowerBound

      public double getLowerBound()
       lower_bound must be <= upper_bound.
       
      optional double lower_bound = 2 [default = -inf];
      Specified by:
      getLowerBound in interface MPConstraintProtoOrBuilder
      Returns:
      The lowerBound.
    • setLowerBound

      public MPConstraintProto.Builder setLowerBound(double value)
       lower_bound must be <= upper_bound.
       
      optional double lower_bound = 2 [default = -inf];
      Parameters:
      value - The lowerBound to set.
      Returns:
      This builder for chaining.
    • clearLowerBound

      public MPConstraintProto.Builder clearLowerBound()
       lower_bound must be <= upper_bound.
       
      optional double lower_bound = 2 [default = -inf];
      Returns:
      This builder for chaining.
    • hasUpperBound

      public boolean hasUpperBound()
      optional double upper_bound = 3 [default = inf];
      Specified by:
      hasUpperBound in interface MPConstraintProtoOrBuilder
      Returns:
      Whether the upperBound field is set.
    • getUpperBound

      public double getUpperBound()
      optional double upper_bound = 3 [default = inf];
      Specified by:
      getUpperBound in interface MPConstraintProtoOrBuilder
      Returns:
      The upperBound.
    • setUpperBound

      public MPConstraintProto.Builder setUpperBound(double value)
      optional double upper_bound = 3 [default = inf];
      Parameters:
      value - The upperBound to set.
      Returns:
      This builder for chaining.
    • clearUpperBound

      public MPConstraintProto.Builder clearUpperBound()
      optional double upper_bound = 3 [default = inf];
      Returns:
      This builder for chaining.
    • hasName

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

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

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

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

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

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

      public boolean hasIsLazy()
       [Advanced usage: do not use this if you don't know what you're doing.]
       A lazy constraint is handled differently by the core solving engine, but
       it does not change the result. It may or may not impact the performance.
       For more info see: http://tinyurl.com/lazy-constraints.
       
      optional bool is_lazy = 5 [default = false];
      Specified by:
      hasIsLazy in interface MPConstraintProtoOrBuilder
      Returns:
      Whether the isLazy field is set.
    • getIsLazy

      public boolean getIsLazy()
       [Advanced usage: do not use this if you don't know what you're doing.]
       A lazy constraint is handled differently by the core solving engine, but
       it does not change the result. It may or may not impact the performance.
       For more info see: http://tinyurl.com/lazy-constraints.
       
      optional bool is_lazy = 5 [default = false];
      Specified by:
      getIsLazy in interface MPConstraintProtoOrBuilder
      Returns:
      The isLazy.
    • setIsLazy

      public MPConstraintProto.Builder setIsLazy(boolean value)
       [Advanced usage: do not use this if you don't know what you're doing.]
       A lazy constraint is handled differently by the core solving engine, but
       it does not change the result. It may or may not impact the performance.
       For more info see: http://tinyurl.com/lazy-constraints.
       
      optional bool is_lazy = 5 [default = false];
      Parameters:
      value - The isLazy to set.
      Returns:
      This builder for chaining.
    • clearIsLazy

      public MPConstraintProto.Builder clearIsLazy()
       [Advanced usage: do not use this if you don't know what you're doing.]
       A lazy constraint is handled differently by the core solving engine, but
       it does not change the result. It may or may not impact the performance.
       For more info see: http://tinyurl.com/lazy-constraints.
       
      optional bool is_lazy = 5 [default = false];
      Returns:
      This builder for chaining.