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:QuadraticConstraintsProtobuf type
operations_research.MPQuadraticConstraint- 
Method SummaryModifier and TypeMethodDescriptionaddAllCoefficient(Iterable<? extends Double> values) Must be finite.addAllQcoefficient(Iterable<? extends Double> values) Must be finite.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].addAllQvar2Index(Iterable<? extends Integer> values) repeated int32 qvar2_index = 4;addAllVarIndex(Iterable<? extends Integer> values) Sparse representation of linear terms in the quadratic constraint, where term i is var_index[i] * coefficient[i].addCoefficient(double value) Must be finite.addQcoefficient(double value) Must be finite.addQvar1Index(int value) Sparse representation of quadratic terms in the quadratic constraint, where term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].addQvar2Index(int value) repeated int32 qvar2_index = 4;addVarIndex(int value) Sparse representation of linear terms in the quadratic constraint, where term i is var_index[i] * coefficient[i].build()clear()Must be finite.lower_bound must be <= upper_bound.Must be finite.Sparse representation of quadratic terms in the quadratic constraint, where term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].repeated int32 qvar2_index = 4;optional double upper_bound = 7 [default = inf];Sparse representation of linear terms in the quadratic constraint, where term i is var_index[i] * coefficient[i].doublegetCoefficient(int index) Must be finite.intMust be finite.Must be finite.static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.Descriptordoublelower_bound must be <= upper_bound.doublegetQcoefficient(int index) Must be finite.intMust be finite.Must be finite.intgetQvar1Index(int index) Sparse representation of quadratic terms in the quadratic constraint, where term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].intSparse representation of quadratic terms in the quadratic constraint, where term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].Sparse representation of quadratic terms in the quadratic constraint, where term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[i].intgetQvar2Index(int index) repeated int32 qvar2_index = 4;intrepeated int32 qvar2_index = 4;repeated int32 qvar2_index = 4;doubleoptional double upper_bound = 7 [default = inf];intgetVarIndex(int index) Sparse representation of linear terms in the quadratic constraint, where term i is var_index[i] * coefficient[i].intSparse representation of linear terms in the quadratic constraint, where term i is var_index[i] * coefficient[i].Sparse representation of linear terms in the quadratic constraint, where term i is var_index[i] * coefficient[i].booleanlower_bound must be <= upper_bound.booleanoptional double upper_bound = 7 [default = inf];protected com.google.protobuf.GeneratedMessage.FieldAccessorTablefinal booleanmergeFrom(MPQuadraticConstraint other) mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) setCoefficient(int index, double value) Must be finite.setLowerBound(double value) lower_bound must be <= upper_bound.setQcoefficient(int index, double value) Must be finite.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].setQvar2Index(int index, int value) repeated int32 qvar2_index = 4;setUpperBound(double value) optional double upper_bound = 7 [default = inf];setVarIndex(int index, int value) Sparse representation of linear terms in the quadratic constraint, where term i is var_index[i] * coefficient[i].Methods inherited from class com.google.protobuf.GeneratedMessage.BuilderaddRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.BuilderfindInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.BuilderaddAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.BuildermergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.BuildermergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilderfindInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
- 
Method Details- 
getDescriptorpublic static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
- 
internalGetFieldAccessorTableprotected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
- internalGetFieldAccessorTablein class- com.google.protobuf.GeneratedMessage.Builder<MPQuadraticConstraint.Builder>
 
- 
clear- Specified by:
- clearin interface- com.google.protobuf.Message.Builder
- Specified by:
- clearin interface- com.google.protobuf.MessageLite.Builder
- Overrides:
- clearin class- com.google.protobuf.GeneratedMessage.Builder<MPQuadraticConstraint.Builder>
 
- 
getDescriptorForTypepublic com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
- getDescriptorForTypein interface- com.google.protobuf.Message.Builder
- Specified by:
- getDescriptorForTypein interface- com.google.protobuf.MessageOrBuilder
- Overrides:
- getDescriptorForTypein class- com.google.protobuf.GeneratedMessage.Builder<MPQuadraticConstraint.Builder>
 
- 
getDefaultInstanceForType- Specified by:
- getDefaultInstanceForTypein interface- com.google.protobuf.MessageLiteOrBuilder
- Specified by:
- getDefaultInstanceForTypein interface- com.google.protobuf.MessageOrBuilder
 
- 
build- Specified by:
- buildin interface- com.google.protobuf.Message.Builder
- Specified by:
- buildin interface- com.google.protobuf.MessageLite.Builder
 
- 
buildPartial- Specified by:
- buildPartialin interface- com.google.protobuf.Message.Builder
- Specified by:
- buildPartialin interface- com.google.protobuf.MessageLite.Builder
 
- 
mergeFrom- Specified by:
- mergeFromin interface- com.google.protobuf.Message.Builder
- Overrides:
- mergeFromin class- com.google.protobuf.AbstractMessage.Builder<MPQuadraticConstraint.Builder>
 
- 
mergeFrom
- 
isInitializedpublic final boolean isInitialized()- Specified by:
- isInitializedin interface- com.google.protobuf.MessageLiteOrBuilder
- Overrides:
- isInitializedin class- com.google.protobuf.GeneratedMessage.Builder<MPQuadraticConstraint.Builder>
 
- 
mergeFrompublic MPQuadraticConstraint.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
- mergeFromin interface- com.google.protobuf.Message.Builder
- Specified by:
- mergeFromin interface- com.google.protobuf.MessageLite.Builder
- Overrides:
- mergeFromin class- com.google.protobuf.AbstractMessage.Builder<MPQuadraticConstraint.Builder>
- Throws:
- IOException
 
- 
getVarIndexListSparse 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:
- getVarIndexListin interface- MPQuadraticConstraintOrBuilder
- Returns:
- A list containing the varIndex.
 
- 
getVarIndexCountpublic 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:
- getVarIndexCountin interface- MPQuadraticConstraintOrBuilder
- Returns:
- The count of varIndex.
 
- 
getVarIndexpublic 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:
- getVarIndexin interface- MPQuadraticConstraintOrBuilder
- Parameters:
- index- The index of the element to return.
- Returns:
- The varIndex at the given index.
 
- 
setVarIndexSparse 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.
 
- 
addVarIndexSparse 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.
 
- 
addAllVarIndexSparse 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.
 
- 
clearVarIndexSparse 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.
 
- 
getCoefficientListMust be finite. repeated double coefficient = 2;- Specified by:
- getCoefficientListin interface- MPQuadraticConstraintOrBuilder
- Returns:
- A list containing the coefficient.
 
- 
getCoefficientCountpublic int getCoefficientCount()Must be finite. repeated double coefficient = 2;- Specified by:
- getCoefficientCountin interface- MPQuadraticConstraintOrBuilder
- Returns:
- The count of coefficient.
 
- 
getCoefficientpublic double getCoefficient(int index) Must be finite. repeated double coefficient = 2;- Specified by:
- getCoefficientin interface- MPQuadraticConstraintOrBuilder
- Parameters:
- index- The index of the element to return.
- Returns:
- The coefficient at the given index.
 
- 
setCoefficientMust 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.
 
- 
addCoefficientMust be finite. repeated double coefficient = 2;- Parameters:
- value- The coefficient to add.
- Returns:
- This builder for chaining.
 
- 
addAllCoefficientMust be finite. repeated double coefficient = 2;- Parameters:
- values- The coefficient to add.
- Returns:
- This builder for chaining.
 
- 
clearCoefficientMust be finite. repeated double coefficient = 2;- Returns:
- This builder for chaining.
 
- 
getQvar1IndexListSparse 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:
- getQvar1IndexListin interface- MPQuadraticConstraintOrBuilder
- Returns:
- A list containing the qvar1Index.
 
- 
getQvar1IndexCountpublic 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:
- getQvar1IndexCountin interface- MPQuadraticConstraintOrBuilder
- Returns:
- The count of qvar1Index.
 
- 
getQvar1Indexpublic 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:
- getQvar1Indexin interface- MPQuadraticConstraintOrBuilder
- Parameters:
- index- The index of the element to return.
- Returns:
- The qvar1Index at the given index.
 
- 
setQvar1IndexSparse 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.
 
- 
addQvar1IndexSparse 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.
 
- 
addAllQvar1IndexSparse 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.
 
- 
clearQvar1IndexSparse 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.
 
- 
getQvar2IndexListrepeated int32 qvar2_index = 4;- Specified by:
- getQvar2IndexListin interface- MPQuadraticConstraintOrBuilder
- Returns:
- A list containing the qvar2Index.
 
- 
getQvar2IndexCountpublic int getQvar2IndexCount()repeated int32 qvar2_index = 4;- Specified by:
- getQvar2IndexCountin interface- MPQuadraticConstraintOrBuilder
- Returns:
- The count of qvar2Index.
 
- 
getQvar2Indexpublic int getQvar2Index(int index) repeated int32 qvar2_index = 4;- Specified by:
- getQvar2Indexin interface- MPQuadraticConstraintOrBuilder
- Parameters:
- index- The index of the element to return.
- Returns:
- The qvar2Index at the given index.
 
- 
setQvar2Indexrepeated int32 qvar2_index = 4;- Parameters:
- index- The index to set the value at.
- value- The qvar2Index to set.
- Returns:
- This builder for chaining.
 
- 
addQvar2Indexrepeated int32 qvar2_index = 4;- Parameters:
- value- The qvar2Index to add.
- Returns:
- This builder for chaining.
 
- 
addAllQvar2Indexrepeated int32 qvar2_index = 4;- Parameters:
- values- The qvar2Index to add.
- Returns:
- This builder for chaining.
 
- 
clearQvar2Indexrepeated int32 qvar2_index = 4;- Returns:
- This builder for chaining.
 
- 
getQcoefficientListMust be finite. repeated double qcoefficient = 5;- Specified by:
- getQcoefficientListin interface- MPQuadraticConstraintOrBuilder
- Returns:
- A list containing the qcoefficient.
 
- 
getQcoefficientCountpublic int getQcoefficientCount()Must be finite. repeated double qcoefficient = 5;- Specified by:
- getQcoefficientCountin interface- MPQuadraticConstraintOrBuilder
- Returns:
- The count of qcoefficient.
 
- 
getQcoefficientpublic double getQcoefficient(int index) Must be finite. repeated double qcoefficient = 5;- Specified by:
- getQcoefficientin interface- MPQuadraticConstraintOrBuilder
- Parameters:
- index- The index of the element to return.
- Returns:
- The qcoefficient at the given index.
 
- 
setQcoefficientMust 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.
 
- 
addQcoefficientMust be finite. repeated double qcoefficient = 5;- Parameters:
- value- The qcoefficient to add.
- Returns:
- This builder for chaining.
 
- 
addAllQcoefficientMust be finite. repeated double qcoefficient = 5;- Parameters:
- values- The qcoefficient to add.
- Returns:
- This builder for chaining.
 
- 
clearQcoefficientMust be finite. repeated double qcoefficient = 5;- Returns:
- This builder for chaining.
 
- 
hasLowerBoundpublic boolean hasLowerBound()lower_bound must be <= upper_bound. optional double lower_bound = 6 [default = -inf];- Specified by:
- hasLowerBoundin interface- MPQuadraticConstraintOrBuilder
- Returns:
- Whether the lowerBound field is set.
 
- 
getLowerBoundpublic double getLowerBound()lower_bound must be <= upper_bound. optional double lower_bound = 6 [default = -inf];- Specified by:
- getLowerBoundin interface- MPQuadraticConstraintOrBuilder
- Returns:
- The lowerBound.
 
- 
setLowerBoundlower_bound must be <= upper_bound. optional double lower_bound = 6 [default = -inf];- Parameters:
- value- The lowerBound to set.
- Returns:
- This builder for chaining.
 
- 
clearLowerBoundlower_bound must be <= upper_bound. optional double lower_bound = 6 [default = -inf];- Returns:
- This builder for chaining.
 
- 
hasUpperBoundpublic boolean hasUpperBound()optional double upper_bound = 7 [default = inf];- Specified by:
- hasUpperBoundin interface- MPQuadraticConstraintOrBuilder
- Returns:
- Whether the upperBound field is set.
 
- 
getUpperBoundpublic double getUpperBound()optional double upper_bound = 7 [default = inf];- Specified by:
- getUpperBoundin interface- MPQuadraticConstraintOrBuilder
- Returns:
- The upperBound.
 
- 
setUpperBoundoptional double upper_bound = 7 [default = inf];- Parameters:
- value- The upperBound to set.
- Returns:
- This builder for chaining.
 
- 
clearUpperBoundoptional double upper_bound = 7 [default = inf];- Returns:
- This builder for chaining.
 
 
-