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 Summary
Modifier 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].double
getCoefficient
(int index) Must be finite.int
Must be finite.Must be finite.static final com.google.protobuf.Descriptors.Descriptor
com.google.protobuf.Descriptors.Descriptor
double
lower_bound must be <= upper_bound.double
getQcoefficient
(int index) Must be finite.int
Must be finite.Must be finite.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].int
Sparse 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].int
getQvar2Index
(int index) repeated int32 qvar2_index = 4;
int
repeated int32 qvar2_index = 4;
repeated int32 qvar2_index = 4;
double
optional double upper_bound = 7 [default = inf];
int
getVarIndex
(int index) Sparse representation of linear terms in the quadratic constraint, where term i is var_index[i] * coefficient[i].int
Sparse 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].boolean
lower_bound must be <= upper_bound.boolean
optional double upper_bound = 7 [default = inf];
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
final boolean
mergeFrom
(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.Builder
addRepeatedField, 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, setUnknownFieldsProto3
Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFrom
Methods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFrom
Methods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTable
in classcom.google.protobuf.GeneratedMessage.Builder<MPQuadraticConstraint.Builder>
-
clear
- Specified by:
clear
in interfacecom.google.protobuf.Message.Builder
- Specified by:
clear
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
clear
in classcom.google.protobuf.GeneratedMessage.Builder<MPQuadraticConstraint.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.Message.Builder
- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.MessageOrBuilder
- Overrides:
getDescriptorForType
in classcom.google.protobuf.GeneratedMessage.Builder<MPQuadraticConstraint.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
build
in interfacecom.google.protobuf.Message.Builder
- Specified by:
build
in interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartial
in interfacecom.google.protobuf.Message.Builder
- Specified by:
buildPartial
in interfacecom.google.protobuf.MessageLite.Builder
-
mergeFrom
- Specified by:
mergeFrom
in interfacecom.google.protobuf.Message.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<MPQuadraticConstraint.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in classcom.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 interfacecom.google.protobuf.Message.Builder
- Specified by:
mergeFrom
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<MPQuadraticConstraint.Builder>
- Throws:
IOException
-
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 interfaceMPQuadraticConstraintOrBuilder
- 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 interfaceMPQuadraticConstraintOrBuilder
- 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 interfaceMPQuadraticConstraintOrBuilder
- Parameters:
index
- The index of the element to return.- Returns:
- The varIndex at the given index.
-
setVarIndex
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
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
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
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
Must be finite.
repeated double coefficient = 2;
- Specified by:
getCoefficientList
in interfaceMPQuadraticConstraintOrBuilder
- Returns:
- A list containing the coefficient.
-
getCoefficientCount
public int getCoefficientCount()Must be finite.
repeated double coefficient = 2;
- Specified by:
getCoefficientCount
in interfaceMPQuadraticConstraintOrBuilder
- Returns:
- The count of coefficient.
-
getCoefficient
public double getCoefficient(int index) Must be finite.
repeated double coefficient = 2;
- Specified by:
getCoefficient
in interfaceMPQuadraticConstraintOrBuilder
- Parameters:
index
- The index of the element to return.- Returns:
- The coefficient at the given index.
-
setCoefficient
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
Must be finite.
repeated double coefficient = 2;
- Parameters:
value
- The coefficient to add.- Returns:
- This builder for chaining.
-
addAllCoefficient
Must be finite.
repeated double coefficient = 2;
- Parameters:
values
- The coefficient to add.- Returns:
- This builder for chaining.
-
clearCoefficient
Must be finite.
repeated double coefficient = 2;
- Returns:
- This builder for chaining.
-
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 interfaceMPQuadraticConstraintOrBuilder
- 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 interfaceMPQuadraticConstraintOrBuilder
- 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 interfaceMPQuadraticConstraintOrBuilder
- Parameters:
index
- The index of the element to return.- Returns:
- The qvar1Index at the given index.
-
setQvar1Index
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
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
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
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
repeated int32 qvar2_index = 4;
- Specified by:
getQvar2IndexList
in interfaceMPQuadraticConstraintOrBuilder
- Returns:
- A list containing the qvar2Index.
-
getQvar2IndexCount
public int getQvar2IndexCount()repeated int32 qvar2_index = 4;
- Specified by:
getQvar2IndexCount
in interfaceMPQuadraticConstraintOrBuilder
- Returns:
- The count of qvar2Index.
-
getQvar2Index
public int getQvar2Index(int index) repeated int32 qvar2_index = 4;
- Specified by:
getQvar2Index
in interfaceMPQuadraticConstraintOrBuilder
- Parameters:
index
- The index of the element to return.- Returns:
- The qvar2Index at the given index.
-
setQvar2Index
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
repeated int32 qvar2_index = 4;
- Parameters:
value
- The qvar2Index to add.- Returns:
- This builder for chaining.
-
addAllQvar2Index
repeated int32 qvar2_index = 4;
- Parameters:
values
- The qvar2Index to add.- Returns:
- This builder for chaining.
-
clearQvar2Index
repeated int32 qvar2_index = 4;
- Returns:
- This builder for chaining.
-
getQcoefficientList
Must be finite.
repeated double qcoefficient = 5;
- Specified by:
getQcoefficientList
in interfaceMPQuadraticConstraintOrBuilder
- Returns:
- A list containing the qcoefficient.
-
getQcoefficientCount
public int getQcoefficientCount()Must be finite.
repeated double qcoefficient = 5;
- Specified by:
getQcoefficientCount
in interfaceMPQuadraticConstraintOrBuilder
- Returns:
- The count of qcoefficient.
-
getQcoefficient
public double getQcoefficient(int index) Must be finite.
repeated double qcoefficient = 5;
- Specified by:
getQcoefficient
in interfaceMPQuadraticConstraintOrBuilder
- Parameters:
index
- The index of the element to return.- Returns:
- The qcoefficient at the given index.
-
setQcoefficient
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
Must be finite.
repeated double qcoefficient = 5;
- Parameters:
value
- The qcoefficient to add.- Returns:
- This builder for chaining.
-
addAllQcoefficient
Must be finite.
repeated double qcoefficient = 5;
- Parameters:
values
- The qcoefficient to add.- Returns:
- This builder for chaining.
-
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 interfaceMPQuadraticConstraintOrBuilder
- 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 interfaceMPQuadraticConstraintOrBuilder
- Returns:
- The lowerBound.
-
setLowerBound
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
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 interfaceMPQuadraticConstraintOrBuilder
- Returns:
- Whether the upperBound field is set.
-
getUpperBound
public double getUpperBound()optional double upper_bound = 7 [default = inf];
- Specified by:
getUpperBound
in interfaceMPQuadraticConstraintOrBuilder
- Returns:
- The upperBound.
-
setUpperBound
optional double upper_bound = 7 [default = inf];
- Parameters:
value
- The upperBound to set.- Returns:
- This builder for chaining.
-
clearUpperBound
optional double upper_bound = 7 [default = inf];
- Returns:
- This builder for chaining.
-