Class MPQuadraticConstraint.Builder

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

    public static final class MPQuadraticConstraint.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<MPQuadraticConstraint.Builder>
    implements MPQuadraticConstraintOrBuilder
     Quadratic constraints of the form lb <= sum a_i x_i + sum b_ij x_i x_j <= ub,
     where a, b, lb and ub are constants, and x are the model's variables.
     Quadratic matrices that are Positive Semi-Definite, Second-Order Cones or
     rotated Second-Order Cones are always accepted. Other forms may or may not be
     accepted depending on the underlying solver used.
     See https://scip.zib.de/doc/html/cons__quadratic_8h.php and
     https://www.gurobi.com/documentation/9.0/refman/constraints.html#subsubsection:QuadraticConstraints
     
    Protobuf type operations_research.MPQuadraticConstraint
    • 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<MPQuadraticConstraint.Builder>
      • clear

        public MPQuadraticConstraint.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<MPQuadraticConstraint.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<MPQuadraticConstraint.Builder>
      • getDefaultInstanceForType

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

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

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

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

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

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

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

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

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

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

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

        public java.util.List<java.lang.Integer> getVarIndexList()
         Sparse representation of linear terms in the quadratic constraint, where
         term i is var_index[i] * coefficient[i].
         `var_index` are variable indices w.r.t the "variable" field in
         MPModelProto, and should be unique.
         
        repeated int32 var_index = 1;
        Specified by:
        getVarIndexList in interface MPQuadraticConstraintOrBuilder
        Returns:
        A list containing the varIndex.
      • getVarIndexCount

        public int getVarIndexCount()
         Sparse representation of linear terms in the quadratic constraint, where
         term i is var_index[i] * coefficient[i].
         `var_index` are variable indices w.r.t the "variable" field in
         MPModelProto, and should be unique.
         
        repeated int32 var_index = 1;
        Specified by:
        getVarIndexCount in interface MPQuadraticConstraintOrBuilder
        Returns:
        The count of varIndex.
      • getVarIndex

        public int getVarIndex​(int index)
         Sparse representation of linear terms in the quadratic constraint, where
         term i is var_index[i] * coefficient[i].
         `var_index` are variable indices w.r.t the "variable" field in
         MPModelProto, and should be unique.
         
        repeated int32 var_index = 1;
        Specified by:
        getVarIndex in interface MPQuadraticConstraintOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The varIndex at the given index.
      • setVarIndex

        public MPQuadraticConstraint.Builder setVarIndex​(int index,
                                                         int value)
         Sparse representation of linear terms in the quadratic constraint, where
         term i is var_index[i] * coefficient[i].
         `var_index` are variable indices w.r.t the "variable" field in
         MPModelProto, and should be unique.
         
        repeated int32 var_index = 1;
        Parameters:
        index - The index to set the value at.
        value - The varIndex to set.
        Returns:
        This builder for chaining.
      • addVarIndex

        public MPQuadraticConstraint.Builder addVarIndex​(int value)
         Sparse representation of linear terms in the quadratic constraint, where
         term i is var_index[i] * coefficient[i].
         `var_index` are variable indices w.r.t the "variable" field in
         MPModelProto, and should be unique.
         
        repeated int32 var_index = 1;
        Parameters:
        value - The varIndex to add.
        Returns:
        This builder for chaining.
      • addAllVarIndex

        public MPQuadraticConstraint.Builder addAllVarIndex​(java.lang.Iterable<? extends java.lang.Integer> values)
         Sparse representation of linear terms in the quadratic constraint, where
         term i is var_index[i] * coefficient[i].
         `var_index` are variable indices w.r.t the "variable" field in
         MPModelProto, and should be unique.
         
        repeated int32 var_index = 1;
        Parameters:
        values - The varIndex to add.
        Returns:
        This builder for chaining.
      • clearVarIndex

        public MPQuadraticConstraint.Builder clearVarIndex()
         Sparse representation of linear terms in the quadratic constraint, where
         term i is var_index[i] * coefficient[i].
         `var_index` are variable indices w.r.t the "variable" field in
         MPModelProto, and should be unique.
         
        repeated int32 var_index = 1;
        Returns:
        This builder for chaining.
      • getCoefficientList

        public java.util.List<java.lang.Double> getCoefficientList()
         Must be finite.
         
        repeated double coefficient = 2;
        Specified by:
        getCoefficientList in interface MPQuadraticConstraintOrBuilder
        Returns:
        A list containing the coefficient.
      • getCoefficient

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

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

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

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

        public MPQuadraticConstraint.Builder clearCoefficient()
         Must be finite.
         
        repeated double coefficient = 2;
        Returns:
        This builder for chaining.
      • getQvar1IndexList

        public java.util.List<java.lang.Integer> getQvar1IndexList()
         Sparse representation of quadratic terms in the quadratic constraint, where
         term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[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 = 3;
        Specified by:
        getQvar1IndexList in interface MPQuadraticConstraintOrBuilder
        Returns:
        A list containing the qvar1Index.
      • getQvar1IndexCount

        public int getQvar1IndexCount()
         Sparse representation of quadratic terms in the quadratic constraint, where
         term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[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 = 3;
        Specified by:
        getQvar1IndexCount in interface MPQuadraticConstraintOrBuilder
        Returns:
        The count of qvar1Index.
      • getQvar1Index

        public int getQvar1Index​(int index)
         Sparse representation of quadratic terms in the quadratic constraint, where
         term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[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 = 3;
        Specified by:
        getQvar1Index in interface MPQuadraticConstraintOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The qvar1Index at the given index.
      • setQvar1Index

        public MPQuadraticConstraint.Builder setQvar1Index​(int index,
                                                           int value)
         Sparse representation of quadratic terms in the quadratic constraint, where
         term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[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 = 3;
        Parameters:
        index - The index to set the value at.
        value - The qvar1Index to set.
        Returns:
        This builder for chaining.
      • addQvar1Index

        public MPQuadraticConstraint.Builder addQvar1Index​(int value)
         Sparse representation of quadratic terms in the quadratic constraint, where
         term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[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 = 3;
        Parameters:
        value - The qvar1Index to add.
        Returns:
        This builder for chaining.
      • addAllQvar1Index

        public MPQuadraticConstraint.Builder addAllQvar1Index​(java.lang.Iterable<? extends java.lang.Integer> values)
         Sparse representation of quadratic terms in the quadratic constraint, where
         term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[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 = 3;
        Parameters:
        values - The qvar1Index to add.
        Returns:
        This builder for chaining.
      • clearQvar1Index

        public MPQuadraticConstraint.Builder clearQvar1Index()
         Sparse representation of quadratic terms in the quadratic constraint, where
         term i is qvar1_index[i] * qvar2_index[i] * qcoefficient[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 = 3;
        Returns:
        This builder for chaining.
      • getQvar2IndexList

        public java.util.List<java.lang.Integer> getQvar2IndexList()
        repeated int32 qvar2_index = 4;
        Specified by:
        getQvar2IndexList in interface MPQuadraticConstraintOrBuilder
        Returns:
        A list containing the qvar2Index.
      • getQvar2Index

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

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

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

        public MPQuadraticConstraint.Builder addAllQvar2Index​(java.lang.Iterable<? extends java.lang.Integer> values)
        repeated int32 qvar2_index = 4;
        Parameters:
        values - The qvar2Index to add.
        Returns:
        This builder for chaining.
      • getQcoefficientList

        public java.util.List<java.lang.Double> getQcoefficientList()
         Must be finite.
         
        repeated double qcoefficient = 5;
        Specified by:
        getQcoefficientList in interface MPQuadraticConstraintOrBuilder
        Returns:
        A list containing the qcoefficient.
      • getQcoefficient

        public double getQcoefficient​(int index)
         Must be finite.
         
        repeated double qcoefficient = 5;
        Specified by:
        getQcoefficient in interface MPQuadraticConstraintOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The qcoefficient at the given index.
      • setQcoefficient

        public MPQuadraticConstraint.Builder setQcoefficient​(int index,
                                                             double value)
         Must be finite.
         
        repeated double qcoefficient = 5;
        Parameters:
        index - The index to set the value at.
        value - The qcoefficient to set.
        Returns:
        This builder for chaining.
      • addQcoefficient

        public MPQuadraticConstraint.Builder addQcoefficient​(double value)
         Must be finite.
         
        repeated double qcoefficient = 5;
        Parameters:
        value - The qcoefficient to add.
        Returns:
        This builder for chaining.
      • addAllQcoefficient

        public MPQuadraticConstraint.Builder addAllQcoefficient​(java.lang.Iterable<? extends java.lang.Double> values)
         Must be finite.
         
        repeated double qcoefficient = 5;
        Parameters:
        values - The qcoefficient to add.
        Returns:
        This builder for chaining.
      • clearQcoefficient

        public MPQuadraticConstraint.Builder clearQcoefficient()
         Must be finite.
         
        repeated double qcoefficient = 5;
        Returns:
        This builder for chaining.
      • hasLowerBound

        public boolean hasLowerBound()
         lower_bound must be <= upper_bound.
         
        optional double lower_bound = 6 [default = -inf];
        Specified by:
        hasLowerBound in interface MPQuadraticConstraintOrBuilder
        Returns:
        Whether the lowerBound field is set.
      • getLowerBound

        public double getLowerBound()
         lower_bound must be <= upper_bound.
         
        optional double lower_bound = 6 [default = -inf];
        Specified by:
        getLowerBound in interface MPQuadraticConstraintOrBuilder
        Returns:
        The lowerBound.
      • setLowerBound

        public MPQuadraticConstraint.Builder setLowerBound​(double value)
         lower_bound must be <= upper_bound.
         
        optional double lower_bound = 6 [default = -inf];
        Parameters:
        value - The lowerBound to set.
        Returns:
        This builder for chaining.
      • clearLowerBound

        public MPQuadraticConstraint.Builder clearLowerBound()
         lower_bound must be <= upper_bound.
         
        optional double lower_bound = 6 [default = -inf];
        Returns:
        This builder for chaining.
      • hasUpperBound

        public boolean hasUpperBound()
        optional double upper_bound = 7 [default = inf];
        Specified by:
        hasUpperBound in interface MPQuadraticConstraintOrBuilder
        Returns:
        Whether the upperBound field is set.
      • setUpperBound

        public MPQuadraticConstraint.Builder setUpperBound​(double value)
        optional double upper_bound = 7 [default = inf];
        Parameters:
        value - The upperBound to set.
        Returns:
        This builder for chaining.
      • clearUpperBound

        public MPQuadraticConstraint.Builder clearUpperBound()
        optional double upper_bound = 7 [default = inf];
        Returns:
        This builder for chaining.
      • setUnknownFields

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

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