Class LinearBooleanConstraint.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<LinearBooleanConstraint.Builder>
com.google.protobuf.GeneratedMessage.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.GeneratedMessage.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.build()
clear()
repeated int64 coefficients = 2;
Linear terms involved in this constraint.Optional lower (resp. upper) bound of the constraint.The name of this constraint.optional int64 upper_bound = 4;
long
getCoefficients
(int index) repeated int64 coefficients = 2;
int
repeated int64 coefficients = 2;
repeated int64 coefficients = 2;
static final com.google.protobuf.Descriptors.Descriptor
com.google.protobuf.Descriptors.Descriptor
int
getLiterals
(int index) Linear terms involved in this constraint.int
Linear terms involved in this constraint.Linear terms involved in this constraint.long
Optional lower (resp. upper) bound of the constraint.getName()
The name of this constraint.com.google.protobuf.ByteString
The name of this constraint.long
optional int64 upper_bound = 4;
boolean
Optional lower (resp. upper) bound of the constraint.boolean
hasName()
The name of this constraint.boolean
optional int64 upper_bound = 4;
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
final boolean
mergeFrom
(LinearBooleanConstraint other) mergeFrom
(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom
(com.google.protobuf.Message other) 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. upper) bound of the constraint.The name of this constraint.setNameBytes
(com.google.protobuf.ByteString value) The name of this constraint.setUpperBound
(long value) optional int64 upper_bound = 4;
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<LinearBooleanConstraint.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<LinearBooleanConstraint.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<LinearBooleanConstraint.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<LinearBooleanConstraint.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in classcom.google.protobuf.GeneratedMessage.Builder<LinearBooleanConstraint.Builder>
-
mergeFrom
public LinearBooleanConstraint.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<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:
getLiteralsList
in 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:
getLiteralsCount
in 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:
getLiterals
in 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:
getCoefficientsList
in interfaceLinearBooleanConstraintOrBuilder
- Returns:
- A list containing the coefficients.
-
getCoefficientsCount
public int getCoefficientsCount()repeated int64 coefficients = 2;
- Specified by:
getCoefficientsCount
in interfaceLinearBooleanConstraintOrBuilder
- Returns:
- The count of coefficients.
-
getCoefficients
public long getCoefficients(int index) repeated int64 coefficients = 2;
- Specified by:
getCoefficients
in 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:
hasLowerBound
in 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:
getLowerBound
in 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:
hasUpperBound
in interfaceLinearBooleanConstraintOrBuilder
- Returns:
- Whether the upperBound field is set.
-
getUpperBound
public long getUpperBound()optional int64 upper_bound = 4;
- Specified by:
getUpperBound
in 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:
hasName
in interfaceLinearBooleanConstraintOrBuilder
- Returns:
- Whether the name field is set.
-
getName
The name of this constraint.
optional string name = 5 [default = ""];
- Specified by:
getName
in interfaceLinearBooleanConstraintOrBuilder
- Returns:
- The name.
-
getNameBytes
public com.google.protobuf.ByteString getNameBytes()The name of this constraint.
optional string name = 5 [default = ""];
- Specified by:
getNameBytes
in 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.
-