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.long
getCoeffs
(int index) repeated int64 coeffs = 4;
int
repeated int64 coeffs = 4;
repeated int64 coeffs = 4;
static final com.google.protobuf.Descriptors.Descriptor
com.google.protobuf.Descriptors.Descriptor
long
getDomain
(int index) If non-empty, only look for an objective value in the given domain.int
If 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.long
int64 integer_after_offset = 9;
long
Internal fields to recover a bound on the original integer objective from the presolved one.long
int64 integer_scaling_factor = 8;
double
The displayed objective is always: scaling_factor * (sum(coefficients[i] * objective_vars[i]) + offset).double
double scaling_factor = 3;
boolean
Internal field.int
getVars
(int index) The linear terms of the objective to minimize.int
The linear terms of the objective to minimize.The linear terms of the objective to minimize.protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
final boolean
mergeFrom
(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, 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<CpObjectiveProto.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<CpObjectiveProto.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<CpObjectiveProto.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<CpObjectiveProto.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in 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:
mergeFrom
in interfacecom.google.protobuf.Message.Builder
- Specified by:
mergeFrom
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
mergeFrom
in 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:
getVarsList
in 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:
getVarsCount
in 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:
getVars
in 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:
getCoeffsList
in interfaceCpObjectiveProtoOrBuilder
- Returns:
- A list containing the coeffs.
-
getCoeffsCount
public int getCoeffsCount()repeated int64 coeffs = 4;
- Specified by:
getCoeffsCount
in interfaceCpObjectiveProtoOrBuilder
- Returns:
- The count of coeffs.
-
getCoeffs
public long getCoeffs(int index) repeated int64 coeffs = 4;
- Specified by:
getCoeffs
in 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:
getOffset
in 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:
getScalingFactor
in 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:
getDomainList
in 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:
getDomainCount
in 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:
getDomain
in 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:
getScalingWasExact
in 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:
getIntegerBeforeOffset
in 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:
getIntegerAfterOffset
in 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:
getIntegerScalingFactor
in 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.
-