Class CpObjectiveProto.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<CpObjectiveProto.Builder>
com.google.protobuf.GeneratedMessage.Builder<CpObjectiveProto.Builder>
com.google.ortools.sat.CpObjectiveProto.Builder
- All Implemented Interfaces:
CpObjectiveProtoOrBuilder,com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,Cloneable
- Enclosing class:
CpObjectiveProto
public static final class CpObjectiveProto.Builder
extends com.google.protobuf.GeneratedMessage.Builder<CpObjectiveProto.Builder>
implements CpObjectiveProtoOrBuilder
Optimization objective.Protobuf type
operations_research.sat.CpObjectiveProto-
Method Summary
Modifier and TypeMethodDescriptionaddAllCoeffs(Iterable<? extends Long> values) repeated int64 coeffs = 4;addAllDomain(Iterable<? extends Long> values) If non-empty, only look for an objective value in the given domain.addAllVars(Iterable<? extends Integer> values) The linear terms of the objective to minimize.addCoeffs(long value) repeated int64 coeffs = 4;addDomain(long value) If non-empty, only look for an objective value in the given domain.addVars(int value) The linear terms of the objective to minimize.build()clear()repeated int64 coeffs = 4;If non-empty, only look for an objective value in the given domain.int64 integer_after_offset = 9;Internal fields to recover a bound on the original integer objective from the presolved one.int64 integer_scaling_factor = 8;The displayed objective is always: scaling_factor * (sum(coefficients[i] * objective_vars[i]) + offset).double scaling_factor = 3;Internal field.The linear terms of the objective to minimize.longgetCoeffs(int index) repeated int64 coeffs = 4;intrepeated int64 coeffs = 4;repeated int64 coeffs = 4;static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorlonggetDomain(int index) If non-empty, only look for an objective value in the given domain.intIf non-empty, only look for an objective value in the given domain.If non-empty, only look for an objective value in the given domain.longint64 integer_after_offset = 9;longInternal fields to recover a bound on the original integer objective from the presolved one.longint64 integer_scaling_factor = 8;doubleThe displayed objective is always: scaling_factor * (sum(coefficients[i] * objective_vars[i]) + offset).doubledouble scaling_factor = 3;booleanInternal field.intgetVars(int index) The linear terms of the objective to minimize.intThe linear terms of the objective to minimize.The linear terms of the objective to minimize.protected com.google.protobuf.GeneratedMessage.FieldAccessorTablefinal booleanmergeFrom(CpObjectiveProto other) mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) setCoeffs(int index, long value) repeated int64 coeffs = 4;setDomain(int index, long value) If non-empty, only look for an objective value in the given domain.setIntegerAfterOffset(long value) int64 integer_after_offset = 9;setIntegerBeforeOffset(long value) Internal fields to recover a bound on the original integer objective from the presolved one.setIntegerScalingFactor(long value) int64 integer_scaling_factor = 8;setOffset(double value) The displayed objective is always: scaling_factor * (sum(coefficients[i] * objective_vars[i]) + offset).setScalingFactor(double value) double scaling_factor = 3;setScalingWasExact(boolean value) Internal field.setVars(int index, int value) The linear terms of the objective to minimize.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, 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.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessage.Builder<CpObjectiveProto.Builder>
-
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessage.Builder<CpObjectiveProto.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.GeneratedMessage.Builder<CpObjectiveProto.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
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<CpObjectiveProto.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessage.Builder<CpObjectiveProto.Builder>
-
mergeFrom
public CpObjectiveProto.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<CpObjectiveProto.Builder>- Throws:
IOException
-
getVarsList
The linear terms of the objective to minimize. For a maximization problem, one can negate all coefficients in the objective and set scaling_factor to -1.
repeated int32 vars = 1;- Specified by:
getVarsListin interfaceCpObjectiveProtoOrBuilder- Returns:
- A list containing the vars.
-
getVarsCount
public int getVarsCount()The linear terms of the objective to minimize. For a maximization problem, one can negate all coefficients in the objective and set scaling_factor to -1.
repeated int32 vars = 1;- Specified by:
getVarsCountin interfaceCpObjectiveProtoOrBuilder- Returns:
- The count of vars.
-
getVars
public int getVars(int index) The linear terms of the objective to minimize. For a maximization problem, one can negate all coefficients in the objective and set scaling_factor to -1.
repeated int32 vars = 1;- Specified by:
getVarsin interfaceCpObjectiveProtoOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The vars at the given index.
-
setVars
The linear terms of the objective to minimize. For a maximization problem, one can negate all coefficients in the objective and set scaling_factor to -1.
repeated int32 vars = 1;- Parameters:
index- The index to set the value at.value- The vars to set.- Returns:
- This builder for chaining.
-
addVars
The linear terms of the objective to minimize. For a maximization problem, one can negate all coefficients in the objective and set scaling_factor to -1.
repeated int32 vars = 1;- Parameters:
value- The vars to add.- Returns:
- This builder for chaining.
-
addAllVars
The linear terms of the objective to minimize. For a maximization problem, one can negate all coefficients in the objective and set scaling_factor to -1.
repeated int32 vars = 1;- Parameters:
values- The vars to add.- Returns:
- This builder for chaining.
-
clearVars
The linear terms of the objective to minimize. For a maximization problem, one can negate all coefficients in the objective and set scaling_factor to -1.
repeated int32 vars = 1;- Returns:
- This builder for chaining.
-
getCoeffsList
repeated int64 coeffs = 4;- Specified by:
getCoeffsListin interfaceCpObjectiveProtoOrBuilder- Returns:
- A list containing the coeffs.
-
getCoeffsCount
public int getCoeffsCount()repeated int64 coeffs = 4;- Specified by:
getCoeffsCountin interfaceCpObjectiveProtoOrBuilder- Returns:
- The count of coeffs.
-
getCoeffs
public long getCoeffs(int index) repeated int64 coeffs = 4;- Specified by:
getCoeffsin interfaceCpObjectiveProtoOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The coeffs at the given index.
-
setCoeffs
repeated int64 coeffs = 4;- Parameters:
index- The index to set the value at.value- The coeffs to set.- Returns:
- This builder for chaining.
-
addCoeffs
repeated int64 coeffs = 4;- Parameters:
value- The coeffs to add.- Returns:
- This builder for chaining.
-
addAllCoeffs
repeated int64 coeffs = 4;- Parameters:
values- The coeffs to add.- Returns:
- This builder for chaining.
-
clearCoeffs
repeated int64 coeffs = 4;- Returns:
- This builder for chaining.
-
getOffset
public double getOffset()The displayed objective is always: scaling_factor * (sum(coefficients[i] * objective_vars[i]) + offset). This is needed to have a consistent objective after presolve or when scaling a double problem to express it with integers. Note that if scaling_factor is zero, then it is assumed to be 1, so that by default these fields have no effect.
double offset = 2;- Specified by:
getOffsetin interfaceCpObjectiveProtoOrBuilder- Returns:
- The offset.
-
setOffset
The displayed objective is always: scaling_factor * (sum(coefficients[i] * objective_vars[i]) + offset). This is needed to have a consistent objective after presolve or when scaling a double problem to express it with integers. Note that if scaling_factor is zero, then it is assumed to be 1, so that by default these fields have no effect.
double offset = 2;- Parameters:
value- The offset to set.- Returns:
- This builder for chaining.
-
clearOffset
The displayed objective is always: scaling_factor * (sum(coefficients[i] * objective_vars[i]) + offset). This is needed to have a consistent objective after presolve or when scaling a double problem to express it with integers. Note that if scaling_factor is zero, then it is assumed to be 1, so that by default these fields have no effect.
double offset = 2;- Returns:
- This builder for chaining.
-
getScalingFactor
public double getScalingFactor()double scaling_factor = 3;- Specified by:
getScalingFactorin interfaceCpObjectiveProtoOrBuilder- Returns:
- The scalingFactor.
-
setScalingFactor
double scaling_factor = 3;- Parameters:
value- The scalingFactor to set.- Returns:
- This builder for chaining.
-
clearScalingFactor
double scaling_factor = 3;- Returns:
- This builder for chaining.
-
getDomainList
If non-empty, only look for an objective value in the given domain. Note that this does not depend on the offset or scaling factor, it is a domain on the sum of the objective terms only.
repeated int64 domain = 5;- Specified by:
getDomainListin interfaceCpObjectiveProtoOrBuilder- Returns:
- A list containing the domain.
-
getDomainCount
public int getDomainCount()If non-empty, only look for an objective value in the given domain. Note that this does not depend on the offset or scaling factor, it is a domain on the sum of the objective terms only.
repeated int64 domain = 5;- Specified by:
getDomainCountin interfaceCpObjectiveProtoOrBuilder- Returns:
- The count of domain.
-
getDomain
public long getDomain(int index) If non-empty, only look for an objective value in the given domain. Note that this does not depend on the offset or scaling factor, it is a domain on the sum of the objective terms only.
repeated int64 domain = 5;- Specified by:
getDomainin interfaceCpObjectiveProtoOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The domain at the given index.
-
setDomain
If non-empty, only look for an objective value in the given domain. Note that this does not depend on the offset or scaling factor, it is a domain on the sum of the objective terms only.
repeated int64 domain = 5;- Parameters:
index- The index to set the value at.value- The domain to set.- Returns:
- This builder for chaining.
-
addDomain
If non-empty, only look for an objective value in the given domain. Note that this does not depend on the offset or scaling factor, it is a domain on the sum of the objective terms only.
repeated int64 domain = 5;- Parameters:
value- The domain to add.- Returns:
- This builder for chaining.
-
addAllDomain
If non-empty, only look for an objective value in the given domain. Note that this does not depend on the offset or scaling factor, it is a domain on the sum of the objective terms only.
repeated int64 domain = 5;- Parameters:
values- The domain to add.- Returns:
- This builder for chaining.
-
clearDomain
If non-empty, only look for an objective value in the given domain. Note that this does not depend on the offset or scaling factor, it is a domain on the sum of the objective terms only.
repeated int64 domain = 5;- Returns:
- This builder for chaining.
-
getScalingWasExact
public boolean getScalingWasExact()Internal field. Do not set. When we scale a FloatObjectiveProto to a integer version, we set this to true if the scaling was exact (i.e. all original coeff were integer for instance). TODO(user): Put the error bounds we computed instead?
bool scaling_was_exact = 6;- Specified by:
getScalingWasExactin interfaceCpObjectiveProtoOrBuilder- Returns:
- The scalingWasExact.
-
setScalingWasExact
Internal field. Do not set. When we scale a FloatObjectiveProto to a integer version, we set this to true if the scaling was exact (i.e. all original coeff were integer for instance). TODO(user): Put the error bounds we computed instead?
bool scaling_was_exact = 6;- Parameters:
value- The scalingWasExact to set.- Returns:
- This builder for chaining.
-
clearScalingWasExact
Internal field. Do not set. When we scale a FloatObjectiveProto to a integer version, we set this to true if the scaling was exact (i.e. all original coeff were integer for instance). TODO(user): Put the error bounds we computed instead?
bool scaling_was_exact = 6;- Returns:
- This builder for chaining.
-
getIntegerBeforeOffset
public long getIntegerBeforeOffset()Internal fields to recover a bound on the original integer objective from the presolved one. Basically, initially the integer objective fit on an int64 and is in [Initial_lb, Initial_ub]. During presolve, we might change the linear expression to have a new domain [Presolved_lb, Presolved_ub] that will also always fit on an int64. The two domain will always be linked with an affine transformation between the two of the form: old = (new + before_offset) * integer_scaling_factor + after_offset. Note that we use both offsets to always be able to do the computation while staying in the int64 domain. In particular, the after_offset will always be in (-integer_scaling_factor, integer_scaling_factor).
int64 integer_before_offset = 7;- Specified by:
getIntegerBeforeOffsetin interfaceCpObjectiveProtoOrBuilder- Returns:
- The integerBeforeOffset.
-
setIntegerBeforeOffset
Internal fields to recover a bound on the original integer objective from the presolved one. Basically, initially the integer objective fit on an int64 and is in [Initial_lb, Initial_ub]. During presolve, we might change the linear expression to have a new domain [Presolved_lb, Presolved_ub] that will also always fit on an int64. The two domain will always be linked with an affine transformation between the two of the form: old = (new + before_offset) * integer_scaling_factor + after_offset. Note that we use both offsets to always be able to do the computation while staying in the int64 domain. In particular, the after_offset will always be in (-integer_scaling_factor, integer_scaling_factor).
int64 integer_before_offset = 7;- Parameters:
value- The integerBeforeOffset to set.- Returns:
- This builder for chaining.
-
clearIntegerBeforeOffset
Internal fields to recover a bound on the original integer objective from the presolved one. Basically, initially the integer objective fit on an int64 and is in [Initial_lb, Initial_ub]. During presolve, we might change the linear expression to have a new domain [Presolved_lb, Presolved_ub] that will also always fit on an int64. The two domain will always be linked with an affine transformation between the two of the form: old = (new + before_offset) * integer_scaling_factor + after_offset. Note that we use both offsets to always be able to do the computation while staying in the int64 domain. In particular, the after_offset will always be in (-integer_scaling_factor, integer_scaling_factor).
int64 integer_before_offset = 7;- Returns:
- This builder for chaining.
-
getIntegerAfterOffset
public long getIntegerAfterOffset()int64 integer_after_offset = 9;- Specified by:
getIntegerAfterOffsetin interfaceCpObjectiveProtoOrBuilder- Returns:
- The integerAfterOffset.
-
setIntegerAfterOffset
int64 integer_after_offset = 9;- Parameters:
value- The integerAfterOffset to set.- Returns:
- This builder for chaining.
-
clearIntegerAfterOffset
int64 integer_after_offset = 9;- Returns:
- This builder for chaining.
-
getIntegerScalingFactor
public long getIntegerScalingFactor()int64 integer_scaling_factor = 8;- Specified by:
getIntegerScalingFactorin interfaceCpObjectiveProtoOrBuilder- Returns:
- The integerScalingFactor.
-
setIntegerScalingFactor
int64 integer_scaling_factor = 8;- Parameters:
value- The integerScalingFactor to set.- Returns:
- This builder for chaining.
-
clearIntegerScalingFactor
int64 integer_scaling_factor = 8;- Returns:
- This builder for chaining.
-