Class MPQuadraticObjective.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<MPQuadraticObjective.Builder>
com.google.protobuf.GeneratedMessage.Builder<MPQuadraticObjective.Builder>
com.google.ortools.linearsolver.MPQuadraticObjective.Builder
All Implemented Interfaces:
MPQuadraticObjectiveOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
Enclosing class:
MPQuadraticObjective

public static final class MPQuadraticObjective.Builder extends com.google.protobuf.GeneratedMessage.Builder<MPQuadraticObjective.Builder> implements MPQuadraticObjectiveOrBuilder
 Quadratic part of a model's objective. Added with other objectives (such as
 linear), this creates the model's objective function to be optimized.
 Note: the linear part of the objective currently needs to be specified in the
 MPVariableProto.objective_coefficient fields. If you'd rather have a
 dedicated linear array here, talk to or-core-team@
 
Protobuf type operations_research.MPQuadraticObjective
  • 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<MPQuadraticObjective.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<MPQuadraticObjective.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<MPQuadraticObjective.Builder>
    • getDefaultInstanceForType

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

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

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

      public MPQuadraticObjective.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<MPQuadraticObjective.Builder>
    • mergeFrom

    • isInitialized

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

      public MPQuadraticObjective.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<MPQuadraticObjective.Builder>
      Throws:
      IOException
    • getQvar1IndexList

      public List<Integer> getQvar1IndexList()
       Sparse representation of quadratic terms in the objective function, where
       term i is qvar1_index[i] * qvar2_index[i] * coefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 1;
      Specified by:
      getQvar1IndexList in interface MPQuadraticObjectiveOrBuilder
      Returns:
      A list containing the qvar1Index.
    • getQvar1IndexCount

      public int getQvar1IndexCount()
       Sparse representation of quadratic terms in the objective function, where
       term i is qvar1_index[i] * qvar2_index[i] * coefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 1;
      Specified by:
      getQvar1IndexCount in interface MPQuadraticObjectiveOrBuilder
      Returns:
      The count of qvar1Index.
    • getQvar1Index

      public int getQvar1Index(int index)
       Sparse representation of quadratic terms in the objective function, where
       term i is qvar1_index[i] * qvar2_index[i] * coefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 1;
      Specified by:
      getQvar1Index in interface MPQuadraticObjectiveOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The qvar1Index at the given index.
    • setQvar1Index

      public MPQuadraticObjective.Builder setQvar1Index(int index, int value)
       Sparse representation of quadratic terms in the objective function, where
       term i is qvar1_index[i] * qvar2_index[i] * coefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 1;
      Parameters:
      index - The index to set the value at.
      value - The qvar1Index to set.
      Returns:
      This builder for chaining.
    • addQvar1Index

      public MPQuadraticObjective.Builder addQvar1Index(int value)
       Sparse representation of quadratic terms in the objective function, where
       term i is qvar1_index[i] * qvar2_index[i] * coefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 1;
      Parameters:
      value - The qvar1Index to add.
      Returns:
      This builder for chaining.
    • addAllQvar1Index

      public MPQuadraticObjective.Builder addAllQvar1Index(Iterable<? extends Integer> values)
       Sparse representation of quadratic terms in the objective function, where
       term i is qvar1_index[i] * qvar2_index[i] * coefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 1;
      Parameters:
      values - The qvar1Index to add.
      Returns:
      This builder for chaining.
    • clearQvar1Index

      public MPQuadraticObjective.Builder clearQvar1Index()
       Sparse representation of quadratic terms in the objective function, where
       term i is qvar1_index[i] * qvar2_index[i] * coefficient[i].
       `qvar1_index` and `qvar2_index` are variable indices w.r.t the "variable"
       field in MPModelProto.
       `qvar1_index`, `qvar2_index` and `coefficients` must have the same size.
       If the same unordered pair (qvar1_index, qvar2_index) appears several
       times, the sum of all of the associated coefficients will be applied.
       
      repeated int32 qvar1_index = 1;
      Returns:
      This builder for chaining.
    • getQvar2IndexList

      public List<Integer> getQvar2IndexList()
      repeated int32 qvar2_index = 2;
      Specified by:
      getQvar2IndexList in interface MPQuadraticObjectiveOrBuilder
      Returns:
      A list containing the qvar2Index.
    • getQvar2IndexCount

      public int getQvar2IndexCount()
      repeated int32 qvar2_index = 2;
      Specified by:
      getQvar2IndexCount in interface MPQuadraticObjectiveOrBuilder
      Returns:
      The count of qvar2Index.
    • getQvar2Index

      public int getQvar2Index(int index)
      repeated int32 qvar2_index = 2;
      Specified by:
      getQvar2Index in interface MPQuadraticObjectiveOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The qvar2Index at the given index.
    • setQvar2Index

      public MPQuadraticObjective.Builder setQvar2Index(int index, int value)
      repeated int32 qvar2_index = 2;
      Parameters:
      index - The index to set the value at.
      value - The qvar2Index to set.
      Returns:
      This builder for chaining.
    • addQvar2Index

      public MPQuadraticObjective.Builder addQvar2Index(int value)
      repeated int32 qvar2_index = 2;
      Parameters:
      value - The qvar2Index to add.
      Returns:
      This builder for chaining.
    • addAllQvar2Index

      public MPQuadraticObjective.Builder addAllQvar2Index(Iterable<? extends Integer> values)
      repeated int32 qvar2_index = 2;
      Parameters:
      values - The qvar2Index to add.
      Returns:
      This builder for chaining.
    • clearQvar2Index

      public MPQuadraticObjective.Builder clearQvar2Index()
      repeated int32 qvar2_index = 2;
      Returns:
      This builder for chaining.
    • getCoefficientList

      public List<Double> getCoefficientList()
       Must be finite.
       
      repeated double coefficient = 3;
      Specified by:
      getCoefficientList in interface MPQuadraticObjectiveOrBuilder
      Returns:
      A list containing the coefficient.
    • getCoefficientCount

      public int getCoefficientCount()
       Must be finite.
       
      repeated double coefficient = 3;
      Specified by:
      getCoefficientCount in interface MPQuadraticObjectiveOrBuilder
      Returns:
      The count of coefficient.
    • getCoefficient

      public double getCoefficient(int index)
       Must be finite.
       
      repeated double coefficient = 3;
      Specified by:
      getCoefficient in interface MPQuadraticObjectiveOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The coefficient at the given index.
    • setCoefficient

      public MPQuadraticObjective.Builder setCoefficient(int index, double value)
       Must be finite.
       
      repeated double coefficient = 3;
      Parameters:
      index - The index to set the value at.
      value - The coefficient to set.
      Returns:
      This builder for chaining.
    • addCoefficient

      public MPQuadraticObjective.Builder addCoefficient(double value)
       Must be finite.
       
      repeated double coefficient = 3;
      Parameters:
      value - The coefficient to add.
      Returns:
      This builder for chaining.
    • addAllCoefficient

      public MPQuadraticObjective.Builder addAllCoefficient(Iterable<? extends Double> values)
       Must be finite.
       
      repeated double coefficient = 3;
      Parameters:
      values - The coefficient to add.
      Returns:
      This builder for chaining.
    • clearCoefficient

      public MPQuadraticObjective.Builder clearCoefficient()
       Must be finite.
       
      repeated double coefficient = 3;
      Returns:
      This builder for chaining.