Package com.google.ortools.sat
Class LinearBooleanConstraint.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
com.google.ortools.sat.LinearBooleanConstraint.Builder
- All Implemented Interfaces:
LinearBooleanConstraintOrBuilder,com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,Cloneable
- Enclosing class:
- LinearBooleanConstraint
public static final class LinearBooleanConstraint.Builder
extends com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
implements LinearBooleanConstraintOrBuilder
A linear Boolean constraint which is a bounded sum of linear terms. Each term beeing a literal times an integer coefficient. If we assume that a literal takes the value 1 if it is true and 0 otherwise, the constraint is: lower_bound <= ... + coefficients[i] * literals[i] + ... <= upper_boundProtobuf type
operations_research.sat.LinearBooleanConstraint-
Method Summary
Modifier and TypeMethodDescriptionaddAllCoefficients(Iterable<? extends Long> values) repeated int64 coefficients = 2;addAllLiterals(Iterable<? extends Integer> values) Linear terms involved in this constraint.addCoefficients(long value) repeated int64 coefficients = 2;addLiterals(int value) Linear terms involved in this constraint.addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) build()clear()repeated int64 coefficients = 2;clearField(com.google.protobuf.Descriptors.FieldDescriptor field) Linear terms involved in this constraint.Optional lower (resp.The name of this constraint.clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) optional int64 upper_bound = 4;clone()longgetCoefficients(int index) repeated int64 coefficients = 2;intrepeated int64 coefficients = 2;repeated int64 coefficients = 2;static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorintgetLiterals(int index) Linear terms involved in this constraint.intLinear terms involved in this constraint.Linear terms involved in this constraint.longOptional lower (resp.getName()The name of this constraint.com.google.protobuf.ByteStringThe name of this constraint.longoptional int64 upper_bound = 4;booleanOptional lower (resp.booleanhasName()The name of this constraint.booleanoptional int64 upper_bound = 4;protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTablefinal booleanmergeFrom(LinearBooleanConstraint other) mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) setCoefficients(int index, long value) repeated int64 coefficients = 2;setLiterals(int index, int value) Linear terms involved in this constraint.setLowerBound(long value) Optional lower (resp.The name of this constraint.setNameBytes(com.google.protobuf.ByteString value) The name of this constraint.setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) setUpperBound(long value) optional int64 upper_bound = 4;Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods 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.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
setField
public LinearBooleanConstraint.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
clearField
public LinearBooleanConstraint.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) - Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
clearOneof
public LinearBooleanConstraint.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) - Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
setRepeatedField
public LinearBooleanConstraint.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) - Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
addRepeatedField
public LinearBooleanConstraint.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<LinearBooleanConstraint.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
mergeFrom
public LinearBooleanConstraint.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<LinearBooleanConstraint.Builder>- Throws:
IOException
-
getLiteralsList
Linear terms involved in this constraint. literals[i] is the signed representation of the i-th literal of the constraint and coefficients[i] its coefficients. The signed representation is as follow: for a 0-based variable index x, (x + 1) represents the variable x and -(x + 1) represents its negation. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;- Specified by:
getLiteralsListin interfaceLinearBooleanConstraintOrBuilder- Returns:
- A list containing the literals.
-
getLiteralsCount
public int getLiteralsCount()Linear terms involved in this constraint. literals[i] is the signed representation of the i-th literal of the constraint and coefficients[i] its coefficients. The signed representation is as follow: for a 0-based variable index x, (x + 1) represents the variable x and -(x + 1) represents its negation. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;- Specified by:
getLiteralsCountin interfaceLinearBooleanConstraintOrBuilder- Returns:
- The count of literals.
-
getLiterals
public int getLiterals(int index) Linear terms involved in this constraint. literals[i] is the signed representation of the i-th literal of the constraint and coefficients[i] its coefficients. The signed representation is as follow: for a 0-based variable index x, (x + 1) represents the variable x and -(x + 1) represents its negation. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;- Specified by:
getLiteralsin interfaceLinearBooleanConstraintOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The literals at the given index.
-
setLiterals
Linear terms involved in this constraint. literals[i] is the signed representation of the i-th literal of the constraint and coefficients[i] its coefficients. The signed representation is as follow: for a 0-based variable index x, (x + 1) represents the variable x and -(x + 1) represents its negation. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;- Parameters:
index- The index to set the value at.value- The literals to set.- Returns:
- This builder for chaining.
-
addLiterals
Linear terms involved in this constraint. literals[i] is the signed representation of the i-th literal of the constraint and coefficients[i] its coefficients. The signed representation is as follow: for a 0-based variable index x, (x + 1) represents the variable x and -(x + 1) represents its negation. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;- Parameters:
value- The literals to add.- Returns:
- This builder for chaining.
-
addAllLiterals
Linear terms involved in this constraint. literals[i] is the signed representation of the i-th literal of the constraint and coefficients[i] its coefficients. The signed representation is as follow: for a 0-based variable index x, (x + 1) represents the variable x and -(x + 1) represents its negation. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;- Parameters:
values- The literals to add.- Returns:
- This builder for chaining.
-
clearLiterals
Linear terms involved in this constraint. literals[i] is the signed representation of the i-th literal of the constraint and coefficients[i] its coefficients. The signed representation is as follow: for a 0-based variable index x, (x + 1) represents the variable x and -(x + 1) represents its negation. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;- Returns:
- This builder for chaining.
-
getCoefficientsList
repeated int64 coefficients = 2;- Specified by:
getCoefficientsListin interfaceLinearBooleanConstraintOrBuilder- Returns:
- A list containing the coefficients.
-
getCoefficientsCount
public int getCoefficientsCount()repeated int64 coefficients = 2;- Specified by:
getCoefficientsCountin interfaceLinearBooleanConstraintOrBuilder- Returns:
- The count of coefficients.
-
getCoefficients
public long getCoefficients(int index) repeated int64 coefficients = 2;- Specified by:
getCoefficientsin interfaceLinearBooleanConstraintOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The coefficients at the given index.
-
setCoefficients
repeated int64 coefficients = 2;- Parameters:
index- The index to set the value at.value- The coefficients to set.- Returns:
- This builder for chaining.
-
addCoefficients
repeated int64 coefficients = 2;- Parameters:
value- The coefficients to add.- Returns:
- This builder for chaining.
-
addAllCoefficients
repeated int64 coefficients = 2;- Parameters:
values- The coefficients to add.- Returns:
- This builder for chaining.
-
clearCoefficients
repeated int64 coefficients = 2;- Returns:
- This builder for chaining.
-
hasLowerBound
public boolean hasLowerBound()Optional lower (resp. upper) bound of the constraint. If not present, it means that the constraint is not bounded in this direction. The bounds are INCLUSIVE.
optional int64 lower_bound = 3;- Specified by:
hasLowerBoundin interfaceLinearBooleanConstraintOrBuilder- Returns:
- Whether the lowerBound field is set.
-
getLowerBound
public long getLowerBound()Optional lower (resp. upper) bound of the constraint. If not present, it means that the constraint is not bounded in this direction. The bounds are INCLUSIVE.
optional int64 lower_bound = 3;- Specified by:
getLowerBoundin interfaceLinearBooleanConstraintOrBuilder- Returns:
- The lowerBound.
-
setLowerBound
Optional lower (resp. upper) bound of the constraint. If not present, it means that the constraint is not bounded in this direction. The bounds are INCLUSIVE.
optional int64 lower_bound = 3;- Parameters:
value- The lowerBound to set.- Returns:
- This builder for chaining.
-
clearLowerBound
Optional lower (resp. upper) bound of the constraint. If not present, it means that the constraint is not bounded in this direction. The bounds are INCLUSIVE.
optional int64 lower_bound = 3;- Returns:
- This builder for chaining.
-
hasUpperBound
public boolean hasUpperBound()optional int64 upper_bound = 4;- Specified by:
hasUpperBoundin interfaceLinearBooleanConstraintOrBuilder- Returns:
- Whether the upperBound field is set.
-
getUpperBound
public long getUpperBound()optional int64 upper_bound = 4;- Specified by:
getUpperBoundin interfaceLinearBooleanConstraintOrBuilder- Returns:
- The upperBound.
-
setUpperBound
optional int64 upper_bound = 4;- Parameters:
value- The upperBound to set.- Returns:
- This builder for chaining.
-
clearUpperBound
optional int64 upper_bound = 4;- Returns:
- This builder for chaining.
-
hasName
public boolean hasName()The name of this constraint.
optional string name = 5 [default = ""];- Specified by:
hasNamein interfaceLinearBooleanConstraintOrBuilder- Returns:
- Whether the name field is set.
-
getName
The name of this constraint.
optional string name = 5 [default = ""];- Specified by:
getNamein interfaceLinearBooleanConstraintOrBuilder- Returns:
- The name.
-
getNameBytes
public com.google.protobuf.ByteString getNameBytes()The name of this constraint.
optional string name = 5 [default = ""];- Specified by:
getNameBytesin interfaceLinearBooleanConstraintOrBuilder- Returns:
- The bytes for name.
-
setName
The name of this constraint.
optional string name = 5 [default = ""];- Parameters:
value- The name to set.- Returns:
- This builder for chaining.
-
clearName
The name of this constraint.
optional string name = 5 [default = ""];- Returns:
- This builder for chaining.
-
setNameBytes
The name of this constraint.
optional string name = 5 [default = ""];- Parameters:
value- The bytes for name to set.- Returns:
- This builder for chaining.
-
setUnknownFields
public final LinearBooleanConstraint.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-
mergeUnknownFields
public final LinearBooleanConstraint.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
-