Class CpObjectiveProto.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderType>
com.google.protobuf.GeneratedMessageV3.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, java.lang.Cloneable
Enclosing class:
CpObjectiveProto

public static final class CpObjectiveProto.Builder
extends com.google.protobuf.GeneratedMessageV3.Builder<CpObjectiveProto.Builder>
implements CpObjectiveProtoOrBuilder
 Optimization objective.
 This is in a message because decision problems don't have any objective.
 
Protobuf type operations_research.sat.CpObjectiveProto
  • Method Details

    • 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>
    • 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.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 a 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 a 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 a 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 a 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 a 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 a 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 a 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.
    • 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​(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.
    • 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 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.
    • 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>