Class MPQuadraticConstraint.Builder

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

public static final class MPQuadraticConstraint.Builder extends com.google.protobuf.GeneratedMessage.Builder<MPQuadraticConstraint.Builder> implements MPQuadraticConstraintOrBuilder
 Quadratic constraints of the form lb <= sum a_i x_i + sum b_ij x_i x_j <= ub,
 where a, b, lb and ub are constants, and x are the model's variables.
 Quadratic matrices that are Positive Semi-Definite, Second-Order Cones or
 rotated Second-Order Cones are always accepted. Other forms may or may not be
 accepted depending on the underlying solver used.
 See https://scip.zib.de/doc/html/cons__quadratic_8h.php and
 https://www.gurobi.com/documentation/9.0/refman/constraints.html#subsubsection:QuadraticConstraints
 
Protobuf type operations_research.MPQuadraticConstraint
  • 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<MPQuadraticConstraint.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<MPQuadraticConstraint.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<MPQuadraticConstraint.Builder>
    • getDefaultInstanceForType

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

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

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

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

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

      public List<Integer> getVarIndexList()
       Sparse representation of linear terms in the quadratic constraint, where
       term i is var_index[i] * coefficient[i].
       `var_index` are variable indices w.r.t the "variable" field in
       MPModelProto, and should be unique.
       
      repeated int32 var_index = 1;
      Specified by:
      getVarIndexList in interface MPQuadraticConstraintOrBuilder
      Returns:
      A list containing the varIndex.
    • getVarIndexCount

      public int getVarIndexCount()
       Sparse representation of linear terms in the quadratic constraint, where
       term i is var_index[i] * coefficient[i].
       `var_index` are variable indices w.r.t the "variable" field in
       MPModelProto, and should be unique.
       
      repeated int32 var_index = 1;
      Specified by:
      getVarIndexCount in interface MPQuadraticConstraintOrBuilder
      Returns:
      The count of varIndex.
    • getVarIndex

      public int getVarIndex(int index)
       Sparse representation of linear terms in the quadratic constraint, where
       term i is var_index[i] * coefficient[i].
       `var_index` are variable indices w.r.t the "variable" field in
       MPModelProto, and should be unique.
       
      repeated int32 var_index = 1;
      Specified by:
      getVarIndex in interface MPQuadraticConstraintOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The varIndex at the given index.
    • setVarIndex

      public MPQuadraticConstraint.Builder setVarIndex(int index, int value)
       Sparse representation of linear terms in the quadratic constraint, where
       term i is var_index[i] * coefficient[i].
       `var_index` are variable indices w.r.t the "variable" field in
       MPModelProto, and should be unique.
       
      repeated int32 var_index = 1;
      Parameters:
      index - The index to set the value at.
      value - The varIndex to set.
      Returns:
      This builder for chaining.
    • addVarIndex

      public MPQuadraticConstraint.Builder addVarIndex(int value)
       Sparse representation of linear terms in the quadratic constraint, where
       term i is var_index[i] * coefficient[i].
       `var_index` are variable indices w.r.t the "variable" field in
       MPModelProto, and should be unique.
       
      repeated int32 var_index = 1;
      Parameters:
      value - The varIndex to add.
      Returns:
      This builder for chaining.
    • addAllVarIndex

      public MPQuadraticConstraint.Builder addAllVarIndex(Iterable<? extends Integer> values)
       Sparse representation of linear terms in the quadratic constraint, where
       term i is var_index[i] * coefficient[i].
       `var_index` are variable indices w.r.t the "variable" field in
       MPModelProto, and should be unique.
       
      repeated int32 var_index = 1;
      Parameters:
      values - The varIndex to add.
      Returns:
      This builder for chaining.
    • clearVarIndex

      public MPQuadraticConstraint.Builder clearVarIndex()
       Sparse representation of linear terms in the quadratic constraint, where
       term i is var_index[i] * coefficient[i].
       `var_index` are variable indices w.r.t the "variable" field in
       MPModelProto, and should be unique.
       
      repeated int32 var_index = 1;
      Returns:
      This builder for chaining.
    • getCoefficientList

      public List<Double> getCoefficientList()
       Must be finite.
       
      repeated double coefficient = 2;
      Specified by:
      getCoefficientList in interface MPQuadraticConstraintOrBuilder
      Returns:
      A list containing the coefficient.
    • getCoefficientCount

      public int getCoefficientCount()
       Must be finite.
       
      repeated double coefficient = 2;
      Specified by:
      getCoefficientCount in interface MPQuadraticConstraintOrBuilder
      Returns:
      The count of coefficient.
    • getCoefficient

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

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

      public MPQuadraticConstraint.Builder addCoefficient(double value)
       Must be finite.
       
      repeated double coefficient = 2;
      Parameters:
      value - The coefficient to add.
      Returns:
      This builder for chaining.
    • addAllCoefficient

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

      public MPQuadraticConstraint.Builder clearCoefficient()
       Must be finite.
       
      repeated double coefficient = 2;
      Returns:
      This builder for chaining.
    • getQvar1IndexList

      public List<Integer> getQvar1IndexList()
       Sparse representation of quadratic terms in the quadratic constraint, where
       term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 3;
      Specified by:
      getQvar1IndexList in interface MPQuadraticConstraintOrBuilder
      Returns:
      A list containing the qvar1Index.
    • getQvar1IndexCount

      public int getQvar1IndexCount()
       Sparse representation of quadratic terms in the quadratic constraint, where
       term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 3;
      Specified by:
      getQvar1IndexCount in interface MPQuadraticConstraintOrBuilder
      Returns:
      The count of qvar1Index.
    • getQvar1Index

      public int getQvar1Index(int index)
       Sparse representation of quadratic terms in the quadratic constraint, where
       term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 3;
      Specified by:
      getQvar1Index in interface MPQuadraticConstraintOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The qvar1Index at the given index.
    • setQvar1Index

      public MPQuadraticConstraint.Builder setQvar1Index(int index, int value)
       Sparse representation of quadratic terms in the quadratic constraint, where
       term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 3;
      Parameters:
      index - The index to set the value at.
      value - The qvar1Index to set.
      Returns:
      This builder for chaining.
    • addQvar1Index

      public MPQuadraticConstraint.Builder addQvar1Index(int value)
       Sparse representation of quadratic terms in the quadratic constraint, where
       term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 3;
      Parameters:
      value - The qvar1Index to add.
      Returns:
      This builder for chaining.
    • addAllQvar1Index

      public MPQuadraticConstraint.Builder addAllQvar1Index(Iterable<? extends Integer> values)
       Sparse representation of quadratic terms in the quadratic constraint, where
       term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 3;
      Parameters:
      values - The qvar1Index to add.
      Returns:
      This builder for chaining.
    • clearQvar1Index

      public MPQuadraticConstraint.Builder clearQvar1Index()
       Sparse representation of quadratic terms in the quadratic constraint, where
       term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 3;
      Returns:
      This builder for chaining.
    • getQvar2IndexList

      public List<Integer> getQvar2IndexList()
      repeated int32 qvar2_index = 4;
      Specified by:
      getQvar2IndexList in interface MPQuadraticConstraintOrBuilder
      Returns:
      A list containing the qvar2Index.
    • getQvar2IndexCount

      public int getQvar2IndexCount()
      repeated int32 qvar2_index = 4;
      Specified by:
      getQvar2IndexCount in interface MPQuadraticConstraintOrBuilder
      Returns:
      The count of qvar2Index.
    • getQvar2Index

      public int getQvar2Index(int index)
      repeated int32 qvar2_index = 4;
      Specified by:
      getQvar2Index in interface MPQuadraticConstraintOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The qvar2Index at the given index.
    • setQvar2Index

      public MPQuadraticConstraint.Builder setQvar2Index(int index, int value)
      repeated int32 qvar2_index = 4;
      Parameters:
      index - The index to set the value at.
      value - The qvar2Index to set.
      Returns:
      This builder for chaining.
    • addQvar2Index

      public MPQuadraticConstraint.Builder addQvar2Index(int value)
      repeated int32 qvar2_index = 4;
      Parameters:
      value - The qvar2Index to add.
      Returns:
      This builder for chaining.
    • addAllQvar2Index

      public MPQuadraticConstraint.Builder addAllQvar2Index(Iterable<? extends Integer> values)
      repeated int32 qvar2_index = 4;
      Parameters:
      values - The qvar2Index to add.
      Returns:
      This builder for chaining.
    • clearQvar2Index

      public MPQuadraticConstraint.Builder clearQvar2Index()
      repeated int32 qvar2_index = 4;
      Returns:
      This builder for chaining.
    • getQcoefficientList

      public List<Double> getQcoefficientList()
       Must be finite.
       
      repeated double qcoefficient = 5;
      Specified by:
      getQcoefficientList in interface MPQuadraticConstraintOrBuilder
      Returns:
      A list containing the qcoefficient.
    • getQcoefficientCount

      public int getQcoefficientCount()
       Must be finite.
       
      repeated double qcoefficient = 5;
      Specified by:
      getQcoefficientCount in interface MPQuadraticConstraintOrBuilder
      Returns:
      The count of qcoefficient.
    • getQcoefficient

      public double getQcoefficient(int index)
       Must be finite.
       
      repeated double qcoefficient = 5;
      Specified by:
      getQcoefficient in interface MPQuadraticConstraintOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The qcoefficient at the given index.
    • setQcoefficient

      public MPQuadraticConstraint.Builder setQcoefficient(int index, double value)
       Must be finite.
       
      repeated double qcoefficient = 5;
      Parameters:
      index - The index to set the value at.
      value - The qcoefficient to set.
      Returns:
      This builder for chaining.
    • addQcoefficient

      public MPQuadraticConstraint.Builder addQcoefficient(double value)
       Must be finite.
       
      repeated double qcoefficient = 5;
      Parameters:
      value - The qcoefficient to add.
      Returns:
      This builder for chaining.
    • addAllQcoefficient

      public MPQuadraticConstraint.Builder addAllQcoefficient(Iterable<? extends Double> values)
       Must be finite.
       
      repeated double qcoefficient = 5;
      Parameters:
      values - The qcoefficient to add.
      Returns:
      This builder for chaining.
    • clearQcoefficient

      public MPQuadraticConstraint.Builder clearQcoefficient()
       Must be finite.
       
      repeated double qcoefficient = 5;
      Returns:
      This builder for chaining.
    • hasLowerBound

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

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

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

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

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

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

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

      public MPQuadraticConstraint.Builder clearUpperBound()
      optional double upper_bound = 7 [default = inf];
      Returns:
      This builder for chaining.