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 Details

    • getDescriptor

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

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage.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.GeneratedMessage.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.GeneratedMessage.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
    • 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>
    • mergeFrom

      public CpObjectiveProto.Builder mergeFrom(CpObjectiveProto other)
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.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 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:
      IOException
    • getVarsList

      public List<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(Iterable<? extends 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 List<Long> getCoeffsList()
      repeated int64 coeffs = 4;
      Specified by:
      getCoeffsList in interface CpObjectiveProtoOrBuilder
      Returns:
      A list containing the coeffs.
    • getCoeffsCount

      public int getCoeffsCount()
      repeated int64 coeffs = 4;
      Specified by:
      getCoeffsCount in interface CpObjectiveProtoOrBuilder
      Returns:
      The count of 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(Iterable<? extends 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.
    • getScalingFactor

      public double getScalingFactor()
      double scaling_factor = 3;
      Specified by:
      getScalingFactor in interface CpObjectiveProtoOrBuilder
      Returns:
      The scalingFactor.
    • 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 List<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(Iterable<? extends 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.
    • getIntegerAfterOffset

      public long getIntegerAfterOffset()
      int64 integer_after_offset = 9;
      Specified by:
      getIntegerAfterOffset in interface CpObjectiveProtoOrBuilder
      Returns:
      The integerAfterOffset.
    • 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.
    • getIntegerScalingFactor

      public long getIntegerScalingFactor()
      int64 integer_scaling_factor = 8;
      Specified by:
      getIntegerScalingFactor in interface CpObjectiveProtoOrBuilder
      Returns:
      The integerScalingFactor.
    • 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.