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 Summary
Modifier and TypeMethodDescriptionaddAllCoefficient
(Iterable<? extends Double> values) Must be finite.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.addCoefficient
(double value) Must be finite.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.build()
clear()
Must be finite.[Advanced usage: do not use this if you don't know what you're doing.]lower_bound must be <= upper_bound.The name of the constraint.optional double upper_bound = 3 [default = inf];
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.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
boolean
[Advanced usage: do not use this if you don't know what you're doing.]double
lower_bound must be <= upper_bound.getName()
The name of the constraint.com.google.protobuf.ByteString
The name of the constraint.double
optional double upper_bound = 3 [default = inf];
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.int
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.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.boolean
[Advanced usage: do not use this if you don't know what you're doing.]boolean
lower_bound must be <= upper_bound.boolean
hasName()
The name of the constraint.boolean
optional double upper_bound = 3 [default = inf];
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
final boolean
mergeFrom
(MPConstraintProto 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.setIsLazy
(boolean value) [Advanced usage: do not use this if you don't know what you're doing.]setLowerBound
(double value) lower_bound must be <= upper_bound.The name of the constraint.setNameBytes
(com.google.protobuf.ByteString value) The name of the constraint.setUpperBound
(double value) optional double upper_bound = 3 [default = inf];
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.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<MPConstraintProto.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<MPConstraintProto.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<MPConstraintProto.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<MPConstraintProto.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in classcom.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 interfacecom.google.protobuf.Message.Builder
- Specified by:
mergeFrom
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<MPConstraintProto.Builder>
- Throws:
IOException
-
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 interfaceMPConstraintProtoOrBuilder
- 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 interfaceMPConstraintProtoOrBuilder
- 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 interfaceMPConstraintProtoOrBuilder
- Parameters:
index
- The index of the element to return.- Returns:
- The varIndex at the given index.
-
setVarIndex
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
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
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
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
Must be finite.
repeated double coefficient = 7 [packed = true];
- Specified by:
getCoefficientList
in interfaceMPConstraintProtoOrBuilder
- Returns:
- A list containing the coefficient.
-
getCoefficientCount
public int getCoefficientCount()Must be finite.
repeated double coefficient = 7 [packed = true];
- Specified by:
getCoefficientCount
in interfaceMPConstraintProtoOrBuilder
- Returns:
- The count of coefficient.
-
getCoefficient
public double getCoefficient(int index) Must be finite.
repeated double coefficient = 7 [packed = true];
- Specified by:
getCoefficient
in interfaceMPConstraintProtoOrBuilder
- Parameters:
index
- The index of the element to return.- Returns:
- The coefficient at the given index.
-
setCoefficient
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
Must be finite.
repeated double coefficient = 7 [packed = true];
- Parameters:
value
- The coefficient to add.- Returns:
- This builder for chaining.
-
addAllCoefficient
Must be finite.
repeated double coefficient = 7 [packed = true];
- Parameters:
values
- The coefficient to add.- Returns:
- This builder for chaining.
-
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 interfaceMPConstraintProtoOrBuilder
- 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 interfaceMPConstraintProtoOrBuilder
- Returns:
- The lowerBound.
-
setLowerBound
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
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 interfaceMPConstraintProtoOrBuilder
- Returns:
- Whether the upperBound field is set.
-
getUpperBound
public double getUpperBound()optional double upper_bound = 3 [default = inf];
- Specified by:
getUpperBound
in interfaceMPConstraintProtoOrBuilder
- Returns:
- The upperBound.
-
setUpperBound
optional double upper_bound = 3 [default = inf];
- Parameters:
value
- The upperBound to set.- Returns:
- This builder for chaining.
-
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 interfaceMPConstraintProtoOrBuilder
- Returns:
- Whether the name field is set.
-
getName
The name of the constraint.
optional string name = 4 [default = ""];
- Specified by:
getName
in interfaceMPConstraintProtoOrBuilder
- Returns:
- The name.
-
getNameBytes
public com.google.protobuf.ByteString getNameBytes()The name of the constraint.
optional string name = 4 [default = ""];
- Specified by:
getNameBytes
in interfaceMPConstraintProtoOrBuilder
- Returns:
- The bytes for name.
-
setName
The name of the constraint.
optional string name = 4 [default = ""];
- Parameters:
value
- The name to set.- Returns:
- This builder for chaining.
-
clearName
The name of the constraint.
optional string name = 4 [default = ""];
- Returns:
- This builder for chaining.
-
setNameBytes
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 interfaceMPConstraintProtoOrBuilder
- 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 interfaceMPConstraintProtoOrBuilder
- Returns:
- The isLazy.
-
setIsLazy
[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
[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.
-