Class MPQuadraticObjective.Builder

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

    public static final class MPQuadraticObjective.Builder
    extends com.google.protobuf.GeneratedMessageV3.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 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<MPQuadraticObjective.Builder>
      • clear

        public 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.GeneratedMessageV3.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.GeneratedMessageV3.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
      • clone

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

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

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

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

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

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

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

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

        public java.util.List<java.lang.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​(java.lang.Iterable<? extends java.lang.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 java.util.List<java.lang.Integer> getQvar2IndexList()
        repeated int32 qvar2_index = 2;
        Specified by:
        getQvar2IndexList in interface MPQuadraticObjectiveOrBuilder
        Returns:
        A list containing the 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​(java.lang.Iterable<? extends java.lang.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 java.util.List<java.lang.Double> getCoefficientList()
         Must be finite.
         
        repeated double coefficient = 3;
        Specified by:
        getCoefficientList in interface MPQuadraticObjectiveOrBuilder
        Returns:
        A list containing the 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​(java.lang.Iterable<? extends java.lang.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.
      • setUnknownFields

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

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