Initializing help system before first use

# QuadTermList

- java.lang.Object
- - com.dashoptimization.objects.Expression
  - - com.dashoptimization.objects.AbstractExpression
    - - com.dashoptimization.objects.QuadExpression
      - - com.dashoptimization.objects.QuadTermList

-     public final class QuadTermList
      extends QuadExpression

  A quadratic expression that is represented as a list of terms. Instances of this class represent a quadratic expression as a list of terms. This is the most efficient way to represent a list. By default, the implementation assumes that there are no two terms in the list that refer to the same pair of variables. If there are you must either explicitly call `compress()` or set the `autoCompress` property to `true`.
  Since:
    43.00

- - ### Constructor Summary

    Constructor | Description
    --- | ---
    `QuadTermList()` | Create a new empty expression.
    `QuadTermList​(double c)` | Create a new expression that represents a constant term.
    `QuadTermList​(double c, int capacity)` | Create a new expression with a constant term and an initial capacity.

  - ### Method Summary

    Modifier and Type | Method | Description
    --- | --- | ---
    `QuadTermList` | `addConstant​(double c)` | Add a value to the constant term of this expression.
    `QuadTermList` | `addTerm​(double coefficient, Variable variable)` | Add a term to this expression.
    `QuadTermList` | `addTerm​(double coefficient, Variable variable1, Variable variable2)` | Add a term to this expression.
    `QuadTermList` | `addTerm​(Variable x)` | Add term `1.0*x` to this expression.
    `QuadTermList` | `addTerm​(Variable variable, double coefficient)` | Add a term to this expression.
    `QuadTermList` | `addTerm​(Variable x1, Variable x2)` | Add term `1.0*x1*x2` to this expression.
    `QuadTermList` | `addTerm​(Variable variable1, Variable variable2, double coefficient)` | Add a term to this expression.
    `QuadTermList` | `addTerms​(LinExpression expr)` | Add another linear expression to this expression.
    `QuadTermList` | `addTerms​(LinExpression expr, double factor)` | Add another linear expression to this expression.
    `QuadTermList` | `addTerms​(QuadExpression expr)` | Add another quadratic expression to this expression.
    `QuadTermList` | `addTerms​(QuadExpression expr, double factor)` | Add another quadratic expression to this expression.
    `QuadTermList` | `addTerms​(Variable[] variables, double[] coefficients)` | Add multiple terms to this expression.
    `QuadTermList` | `addTerms​(Variable[] variables, double[] coefficients, int offset, int count)` | Add multiple terms to this expression.
    `QuadTermList` | `addTerms​(Variable[] variables1, Variable[] variables2, double[] coefficients)` | Add multiple terms to this expression.
    `QuadTermList` | `addTerms​(Variable[] variables1, Variable[] variables2, double[] coefficients, int offset, int count)` | Add multiple terms to this expression.
    `QuadTermList` | `addTerms​(java.lang.Iterable<Variable> variables1, java.lang.Iterable<Variable> variables2, java.lang.Iterable<java.lang.Double> coefficients)` | Add multiple terms to this expression.
    `QuadTermList` | `addTerms​(java.lang.Iterable<Variable> variables, java.lang.Iterable<java.lang.Double> coefficients)` | Add multiple terms to this expression.
    `QuadTermList` | `addTerms​(java.util.stream.Stream<Variable> variables1, java.util.stream.Stream<Variable> variables2, java.util.stream.Stream<java.lang.Double> coefficients)` | Add multiple quadratic terms to this expression.
    `QuadTermList` | `addTerms​(java.util.stream.Stream<Variable> variables, java.util.stream.Stream<java.lang.Double> coefficients)` | Add multiple linear terms to this expression.
    `void` | `compress()` | Compress duplicate terms.
    `QuadExpression` | `deepCopy()` | Get a deep copy of this expression.
    `QuadExpression` | `deepCopy​(double factor)` | Get a deep copy of this expression multiplied by a constant
    `double` | `evaluate​(double[] solution)` | Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).
    `double` | `getConstant()` | Get the constant value in this expression.
    `static boolean` | `isAutoCompress()` | Test whether auto-compression is enabled for this class.
    `QuadTermList` | `reserve​(int l)` | Reserve a maximum number of elements in this expression.
    `QuadTermList` | `reset()` | Clear this expression.
    `static void` | `setAutoCompress​(boolean compress)` | Enable/disable auto-compression for instances of this class.
    `QuadTermList` | `setConstant​(double c)` | Set the constant term in this expression.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class com.dashoptimization.objects.QuadExpression

      `addTerm, addTerm, create, create, create, setCreateLists`

    - ### Methods inherited from class com.dashoptimization.objects.AbstractExpression

      `eq, eq, geq, geq, in, leq, leq`

    - ### Methods inherited from class com.dashoptimization.objects.Expression

      `div, div, minus, minus, mul, mul, plus, plus, uminus`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### QuadTermList

          public QuadTermList()

      Create a new empty expression.
      Since:
        43.00

    - #### QuadTermList

          public QuadTermList​(double c)

      Create a new expression that represents a constant term.
      Parameters:
        `c` - The constant term.
      Since:
        43.00

    - #### QuadTermList

          public QuadTermList​(double c,
                              int capacity)

      Create a new expression with a constant term and an initial capacity.
      Parameters:
        `c` - The constant term.
        `capacity` - The initial capacity.
      Since:
        43.00

  - ### Method Detail

    - #### setAutoCompress

          public static void setAutoCompress​(boolean compress)

      Enable/disable auto-compression for instances of this class. With auto-compression disabled, any instance of this class assumes that expressions do not contain two terms with the same pair of variables.
      Parameters:
        `compress` - `true` to enable, `false` otherwise.
      Since:
        43.00

    - #### isAutoCompress

          public static boolean isAutoCompress()

      Test whether auto-compression is enabled for this class.
      Returns:
        `true` if auto compression is enabled for all instances of this class.
      Since:
        43.00

    - #### deepCopy

          public QuadExpression deepCopy()

      Get a deep copy of this expression.
      Specified by:
        `deepCopy` in class `QuadExpression`
      Returns:
        A deep copy of this expression.
      Since:
        43.00

    - #### deepCopy

          public QuadExpression deepCopy​(double factor)

      Get a deep copy of this expression multiplied by a constant
      Specified by:
        `deepCopy` in class `QuadExpression`
      Parameters:
        `factor` - Factor to scale `this` with.
      Returns:
        A deep copy of this expression multiplied by `factor`.
      Since:
        43.00

    - #### reserve

          public QuadTermList reserve​(int l)

      Reserve a maximum number of elements in this expression.
      Parameters:
        `l` - The number of additional elements to reserve.
      Returns:
        Always returns this instance.
      Since:
        43.00

    - #### reset

          public QuadTermList reset()

      Clear this expression. Removes all terms and sets the constant to 0.
      Specified by:
        `reset` in class `QuadExpression`
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(java.util.stream.Stream<Variable> variables,
                                       java.util.stream.Stream<java.lang.Double> coefficients)

      Add multiple linear terms to this expression. Adds the scalar product defined by the element-wise multiplication of `variables` and `coefficients`.
      Overrides:
        `addTerms` in class `QuadExpression`
      Parameters:
        `variables` - Variables.
        `coefficients` - Coefficients.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(java.util.stream.Stream<Variable> variables1,
                                       java.util.stream.Stream<Variable> variables2,
                                       java.util.stream.Stream<java.lang.Double> coefficients)

      Add multiple quadratic terms to this expression. Adds the scalar product defined by the element-wise multiplication of `variables1`, `variables2` and `coefficients`.
      Overrides:
        `addTerms` in class `QuadExpression`
      Parameters:
        `variables1` - First variables.
        `variables2` - Second variables.
        `coefficients` - Coefficients.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(java.lang.Iterable<Variable> variables,
                                       java.lang.Iterable<java.lang.Double> coefficients)

      Add multiple terms to this expression. Adds the scalar product defined by the element-wise multiplication of `variables` and `coefficients`.
      Overrides:
        `addTerms` in class `QuadExpression`
      Parameters:
        `variables` - Variables
        `coefficients` - Coefficients
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(java.lang.Iterable<Variable> variables1,
                                       java.lang.Iterable<Variable> variables2,
                                       java.lang.Iterable<java.lang.Double> coefficients)

      Add multiple terms to this expression. Adds the scalar product defined by the element-wise multiplication of `variables1`, `variables2` and `coefficients`.
      Overrides:
        `addTerms` in class `QuadExpression`
      Parameters:
        `variables1` - First variables
        `variables2` - Second variables
        `coefficients` - Coefficients
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(Variable[] variables,
                                       double[] coefficients)

      Add multiple terms to this expression. Adds the scalar product defined by the element-wise multiplication of `variables` and `coefficients`.
      Overrides:
        `addTerms` in class `QuadExpression`
      Parameters:
        `variables` - Variables
        `coefficients` - Coefficients
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(Variable[] variables1,
                                       Variable[] variables2,
                                       double[] coefficients)

      Add multiple terms to this expression. Adds the scalar product defined by the element-wise multiplication of `variables1`, `variables2` and `coefficients`.
      Overrides:
        `addTerms` in class `QuadExpression`
      Parameters:
        `variables1` - First variables
        `variables2` - Second variables
        `coefficients` - Coefficients
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(Variable[] variables,
                                       double[] coefficients,
                                       int offset,
                                       int count)

      Add multiple terms to this expression. Adds the scalar product defined by the element-wise multiplication of `variables` and `coefficients` using `count` elements starting from `offset`.
      Overrides:
        `addTerms` in class `QuadExpression`
      Parameters:
        `variables` - Variables
        `coefficients` - Coefficients
        `offset` - Offset into arrays.
        `count` - Number of elements to use from each array.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(Variable[] variables1,
                                       Variable[] variables2,
                                       double[] coefficients,
                                       int offset,
                                       int count)

      Add multiple terms to this expression. Adds the scalar product defined by the element-wise multiplication of `variables1`, `variables2` and `coefficients` using `count` elements starting from `offset`.
      Overrides:
        `addTerms` in class `QuadExpression`
      Parameters:
        `variables1` - First variables
        `variables2` - Second variables
        `coefficients` - Coefficients
        `offset` - Offset into arrays.
        `count` - Number of elements to use from each array.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public QuadTermList addTerm​(Variable variable,
                                      double coefficient)

      Add a term to this expression. If the expression already has a coefficient for `variable` then the old and the new coefficients will be added.

      Examples using `addTerm`:

      - Catenary.java
      - CuttingStock.java
      - ELS.java
      - ELSCut.java
      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - RecursiveFinancialPlanning.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Specified by:
        `addTerm` in class `QuadExpression`
      Parameters:
        `variable` - Variable.
        `coefficient` - Coefficient to add for `variable`.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public QuadTermList addTerm​(double coefficient,
                                      Variable variable)

      Add a term to this expression. If the expression already has a coefficient for `variable` then the old and the new coefficients will be added.

      Examples using `addTerm`:

      - Catenary.java
      - CuttingStock.java
      - ELS.java
      - ELSCut.java
      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - RecursiveFinancialPlanning.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Specified by:
        `addTerm` in class `QuadExpression`
      Parameters:
        `coefficient` - Coefficient to add for `variable`.
        `variable` - Variable.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public QuadTermList addTerm​(Variable x)

      Add term `1.0*x` to this expression. If the expression already has a coefficient for `x` then the old and the new coefficients will be added.

      Examples using `addTerm`:

      - Catenary.java
      - CuttingStock.java
      - ELS.java
      - ELSCut.java
      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - RecursiveFinancialPlanning.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Specified by:
        `addTerm` in class `QuadExpression`
      Parameters:
        `x` - Variable.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public QuadTermList addTerm​(Variable variable1,
                                      Variable variable2,
                                      double coefficient)

      Add a term to this expression. If the expression already has a coefficient for `variable1*variable2` then the old and the new coefficients will be added.

      Examples using `addTerm`:

      - Catenary.java
      - CuttingStock.java
      - ELS.java
      - ELSCut.java
      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - RecursiveFinancialPlanning.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Specified by:
        `addTerm` in class `QuadExpression`
      Parameters:
        `variable1` - First variable.
        `variable2` - Second variable.
        `coefficient` - Coefficient to add for `variable1*variable2`.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public QuadTermList addTerm​(double coefficient,
                                      Variable variable1,
                                      Variable variable2)

      Add a term to this expression. If the expression already has a coefficient for `variable1*variable2` then the old and the new coefficients will be added.

      Examples using `addTerm`:

      - Catenary.java
      - CuttingStock.java
      - ELS.java
      - ELSCut.java
      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - RecursiveFinancialPlanning.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Specified by:
        `addTerm` in class `QuadExpression`
      Parameters:
        `coefficient` - Coefficient to add for `variable1*variable2`.
        `variable1` - First variable.
        `variable2` - Second variable.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public QuadTermList addTerm​(Variable x1,
                                      Variable x2)

      Add term `1.0*x1*x2` to this expression. If the expression already has a coefficient for `x` then the old and the new coefficients will be added.

      Examples using `addTerm`:

      - Catenary.java
      - CuttingStock.java
      - ELS.java
      - ELSCut.java
      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - RecursiveFinancialPlanning.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Specified by:
        `addTerm` in class `QuadExpression`
      Parameters:
        `x1` - First variable.
        `x2` - Second variable.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(LinExpression expr)

      Add another linear expression to this expression.
      Specified by:
        `addTerms` in class `QuadExpression`
      Parameters:
        `expr` - The expression to add
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(QuadExpression expr)

      Add another quadratic expression to this expression.
      Specified by:
        `addTerms` in class `QuadExpression`
      Parameters:
        `expr` - The expression to add
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(LinExpression expr,
                                       double factor)

      Add another linear expression to this expression.
      Specified by:
        `addTerms` in class `QuadExpression`
      Parameters:
        `expr` - The expression to add.
        `factor` - Factor by which to multiply elements in `expr` before adding.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadTermList addTerms​(QuadExpression expr,
                                       double factor)

      Add another quadratic expression to this expression.
      Specified by:
        `addTerms` in class `QuadExpression`
      Parameters:
        `expr` - The expression to add.
        `factor` - Factor by which to multiply elements in `expr` before adding.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addConstant

          public QuadTermList addConstant​(double c)

      Add a value to the constant term of this expression.
      Specified by:
        `addConstant` in class `QuadExpression`
      Parameters:
        `c` - The constant to add.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### setConstant

          public QuadTermList setConstant​(double c)

      Set the constant term in this expression. Any existing constant term will be overwritten.
      Specified by:
        `setConstant` in class `QuadExpression`
      Parameters:
        `c` - New constant term for this expression
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### getConstant

          public double getConstant()

      Get the constant value in this expression.
      Specified by:
        `getConstant` in class `QuadExpression`
      Returns:
        The constant value in this expression.
      Since:
        43.00

    - #### compress

          public void compress()

      Compress duplicate terms. Sorts the terms and merges any terms for the same variable into a single term.
      Since:
        43.00

    - #### evaluate

          public double evaluate​(double[] solution)

      Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).

      Examples using `evaluate`:

      - CapitalBudgeting.java
      - PolygonObjects.java
      Specified by:
        `evaluate` in class `Expression`
      Parameters:
        `solution` - Solution values for which the expression is evaluated.
      Returns:
        The value of this expression evaluated at `solution`.
      Since:
        43.00

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
      Since:
        43.00

Parent Topic Class Summary

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.