Class LinearObjective.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<LinearObjective.Builder>
com.google.protobuf.GeneratedMessage.Builder<LinearObjective.Builder>
com.google.ortools.sat.LinearObjective.Builder
- All Implemented Interfaces:
LinearObjectiveOrBuilder
,com.google.protobuf.Message.Builder
,com.google.protobuf.MessageLite.Builder
,com.google.protobuf.MessageLiteOrBuilder
,com.google.protobuf.MessageOrBuilder
,Cloneable
- Enclosing class:
LinearObjective
public static final class LinearObjective.Builder
extends com.google.protobuf.GeneratedMessage.Builder<LinearObjective.Builder>
implements LinearObjectiveOrBuilder
The objective of an optimization problem.Protobuf type
operations_research.sat.LinearObjective
-
Method Summary
Modifier and TypeMethodDescriptionaddAllCoefficients
(Iterable<? extends Long> values) repeated int64 coefficients = 2;
addAllLiterals
(Iterable<? extends Integer> values) The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment.addCoefficients
(long value) repeated int64 coefficients = 2;
addLiterals
(int value) The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment.build()
clear()
repeated int64 coefficients = 2;
The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment.For a given variable assignment, the "real" problem objective value is 'scaling_factor * (minimization_objective + offset)' where 'minimization_objective is the one defined just above.optional double scaling_factor = 4 [default = 1];
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) The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment.int
The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment.The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment.double
For a given variable assignment, the "real" problem objective value is 'scaling_factor * (minimization_objective + offset)' where 'minimization_objective is the one defined just above.double
optional double scaling_factor = 4 [default = 1];
boolean
For a given variable assignment, the "real" problem objective value is 'scaling_factor * (minimization_objective + offset)' where 'minimization_objective is the one defined just above.boolean
optional double scaling_factor = 4 [default = 1];
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
final boolean
mergeFrom
(LinearObjective 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) The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment.setOffset
(double value) For a given variable assignment, the "real" problem objective value is 'scaling_factor * (minimization_objective + offset)' where 'minimization_objective is the one defined just above.setScalingFactor
(double value) optional double scaling_factor = 4 [default = 1];
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<LinearObjective.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<LinearObjective.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<LinearObjective.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<LinearObjective.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in classcom.google.protobuf.GeneratedMessage.Builder<LinearObjective.Builder>
-
mergeFrom
public LinearObjective.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<LinearObjective.Builder>
- Throws:
IOException
-
getLiteralsList
The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;
- Specified by:
getLiteralsList
in interfaceLinearObjectiveOrBuilder
- Returns:
- A list containing the literals.
-
getLiteralsCount
public int getLiteralsCount()The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;
- Specified by:
getLiteralsCount
in interfaceLinearObjectiveOrBuilder
- Returns:
- The count of literals.
-
getLiterals
public int getLiterals(int index) The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment. Note that the same variable shouldn't appear twice and that zero coefficients are not allowed.
repeated int32 literals = 1;
- Specified by:
getLiterals
in interfaceLinearObjectiveOrBuilder
- Parameters:
index
- The index of the element to return.- Returns:
- The literals at the given index.
-
setLiterals
The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment. 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
The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment. 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
The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment. 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
The goal is always to minimize the linear Boolean formula defined by these two fields: sum_i literal_i * coefficient_i where literal_i is 1 iff literal_i is true in a given assignment. 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 interfaceLinearObjectiveOrBuilder
- Returns:
- A list containing the coefficients.
-
getCoefficientsCount
public int getCoefficientsCount()repeated int64 coefficients = 2;
- Specified by:
getCoefficientsCount
in interfaceLinearObjectiveOrBuilder
- Returns:
- The count of coefficients.
-
getCoefficients
public long getCoefficients(int index) repeated int64 coefficients = 2;
- Specified by:
getCoefficients
in interfaceLinearObjectiveOrBuilder
- 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.
-
hasOffset
public boolean hasOffset()For a given variable assignment, the "real" problem objective value is 'scaling_factor * (minimization_objective + offset)' where 'minimization_objective is the one defined just above. Note that this is not what we minimize, but it is what we display. In particular if scaling_factor is negative, then the "real" problem is a maximization problem, even if the "internal" objective is minimized.
optional double offset = 3 [default = 0];
- Specified by:
hasOffset
in interfaceLinearObjectiveOrBuilder
- Returns:
- Whether the offset field is set.
-
getOffset
public double getOffset()For a given variable assignment, the "real" problem objective value is 'scaling_factor * (minimization_objective + offset)' where 'minimization_objective is the one defined just above. Note that this is not what we minimize, but it is what we display. In particular if scaling_factor is negative, then the "real" problem is a maximization problem, even if the "internal" objective is minimized.
optional double offset = 3 [default = 0];
- Specified by:
getOffset
in interfaceLinearObjectiveOrBuilder
- Returns:
- The offset.
-
setOffset
For a given variable assignment, the "real" problem objective value is 'scaling_factor * (minimization_objective + offset)' where 'minimization_objective is the one defined just above. Note that this is not what we minimize, but it is what we display. In particular if scaling_factor is negative, then the "real" problem is a maximization problem, even if the "internal" objective is minimized.
optional double offset = 3 [default = 0];
- Parameters:
value
- The offset to set.- Returns:
- This builder for chaining.
-
clearOffset
For a given variable assignment, the "real" problem objective value is 'scaling_factor * (minimization_objective + offset)' where 'minimization_objective is the one defined just above. Note that this is not what we minimize, but it is what we display. In particular if scaling_factor is negative, then the "real" problem is a maximization problem, even if the "internal" objective is minimized.
optional double offset = 3 [default = 0];
- Returns:
- This builder for chaining.
-
hasScalingFactor
public boolean hasScalingFactor()optional double scaling_factor = 4 [default = 1];
- Specified by:
hasScalingFactor
in interfaceLinearObjectiveOrBuilder
- Returns:
- Whether the scalingFactor field is set.
-
getScalingFactor
public double getScalingFactor()optional double scaling_factor = 4 [default = 1];
- Specified by:
getScalingFactor
in interfaceLinearObjectiveOrBuilder
- Returns:
- The scalingFactor.
-
setScalingFactor
optional double scaling_factor = 4 [default = 1];
- Parameters:
value
- The scalingFactor to set.- Returns:
- This builder for chaining.
-
clearScalingFactor
optional double scaling_factor = 4 [default = 1];
- Returns:
- This builder for chaining.
-