Class CpObjectiveProto.Builder

  • All Implemented Interfaces:
    CpObjectiveProtoOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.lang.Cloneable
    Enclosing class:
    CpObjectiveProto

    public static final class CpObjectiveProto.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
    implements CpObjectiveProtoOrBuilder
     Optimization objective.
     
    Protobuf type operations_research.sat.CpObjectiveProto
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • clear

        public CpObjectiveProto.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • getDefaultInstanceForType

        public CpObjectiveProto getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public CpObjectiveProto build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public CpObjectiveProto buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public CpObjectiveProto.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • setField

        public CpObjectiveProto.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                 java.lang.Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • clearField

        public CpObjectiveProto.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • clearOneof

        public CpObjectiveProto.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • setRepeatedField

        public CpObjectiveProto.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                         int index,
                                                         java.lang.Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • addRepeatedField

        public CpObjectiveProto.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                         java.lang.Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • mergeFrom

        public CpObjectiveProto.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<CpObjectiveProto.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • mergeFrom

        public CpObjectiveProto.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                                  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                           throws java.io.IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<CpObjectiveProto.Builder>
        Throws:
        java.io.IOException
      • getVarsList

        public java.util.List<java.lang.Integer> 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 interface CpObjectiveProtoOrBuilder
        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 interface CpObjectiveProtoOrBuilder
        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 interface CpObjectiveProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The vars at the given index.
      • setVars

        public CpObjectiveProto.Builder setVars​(int index,
                                                int value)
         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

        public CpObjectiveProto.Builder addVars​(int value)
         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

        public CpObjectiveProto.Builder addAllVars​(java.lang.Iterable<? extends java.lang.Integer> values)
         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

        public CpObjectiveProto.Builder 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

        public java.util.List<java.lang.Long> getCoeffsList()
        repeated int64 coeffs = 4;
        Specified by:
        getCoeffsList in interface CpObjectiveProtoOrBuilder
        Returns:
        A list containing the coeffs.
      • getCoeffs

        public long getCoeffs​(int index)
        repeated int64 coeffs = 4;
        Specified by:
        getCoeffs in interface CpObjectiveProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The coeffs at the given index.
      • setCoeffs

        public CpObjectiveProto.Builder setCoeffs​(int index,
                                                  long value)
        repeated int64 coeffs = 4;
        Parameters:
        index - The index to set the value at.
        value - The coeffs to set.
        Returns:
        This builder for chaining.
      • addCoeffs

        public CpObjectiveProto.Builder addCoeffs​(long value)
        repeated int64 coeffs = 4;
        Parameters:
        value - The coeffs to add.
        Returns:
        This builder for chaining.
      • addAllCoeffs

        public CpObjectiveProto.Builder addAllCoeffs​(java.lang.Iterable<? extends java.lang.Long> values)
        repeated int64 coeffs = 4;
        Parameters:
        values - The coeffs to add.
        Returns:
        This builder for chaining.
      • clearCoeffs

        public CpObjectiveProto.Builder 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 interface CpObjectiveProtoOrBuilder
        Returns:
        The offset.
      • setOffset

        public CpObjectiveProto.Builder setOffset​(double value)
         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

        public CpObjectiveProto.Builder 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.
      • setScalingFactor

        public CpObjectiveProto.Builder setScalingFactor​(double value)
        double scaling_factor = 3;
        Parameters:
        value - The scalingFactor to set.
        Returns:
        This builder for chaining.
      • clearScalingFactor

        public CpObjectiveProto.Builder clearScalingFactor()
        double scaling_factor = 3;
        Returns:
        This builder for chaining.
      • getDomainList

        public java.util.List<java.lang.Long> 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 interface CpObjectiveProtoOrBuilder
        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 interface CpObjectiveProtoOrBuilder
        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 interface CpObjectiveProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The domain at the given index.
      • setDomain

        public CpObjectiveProto.Builder setDomain​(int index,
                                                  long value)
         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

        public CpObjectiveProto.Builder addDomain​(long value)
         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

        public CpObjectiveProto.Builder addAllDomain​(java.lang.Iterable<? extends java.lang.Long> values)
         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

        public CpObjectiveProto.Builder 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 interface CpObjectiveProtoOrBuilder
        Returns:
        The scalingWasExact.
      • setScalingWasExact

        public CpObjectiveProto.Builder setScalingWasExact​(boolean value)
         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

        public CpObjectiveProto.Builder 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 interface CpObjectiveProtoOrBuilder
        Returns:
        The integerBeforeOffset.
      • setIntegerBeforeOffset

        public CpObjectiveProto.Builder setIntegerBeforeOffset​(long value)
         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

        public CpObjectiveProto.Builder 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.
      • setIntegerAfterOffset

        public CpObjectiveProto.Builder setIntegerAfterOffset​(long value)
        int64 integer_after_offset = 9;
        Parameters:
        value - The integerAfterOffset to set.
        Returns:
        This builder for chaining.
      • clearIntegerAfterOffset

        public CpObjectiveProto.Builder clearIntegerAfterOffset()
        int64 integer_after_offset = 9;
        Returns:
        This builder for chaining.
      • setIntegerScalingFactor

        public CpObjectiveProto.Builder setIntegerScalingFactor​(long value)
        int64 integer_scaling_factor = 8;
        Parameters:
        value - The integerScalingFactor to set.
        Returns:
        This builder for chaining.
      • clearIntegerScalingFactor

        public CpObjectiveProto.Builder clearIntegerScalingFactor()
        int64 integer_scaling_factor = 8;
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final CpObjectiveProto.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
      • mergeUnknownFields

        public final CpObjectiveProto.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>