Initializing help system before first use

# QuadExpression

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

- Direct Known Subclasses:
    `QuadTermList`, `QuadTermMap`

      public abstract class QuadExpression
      extends AbstractExpression

  A quadratic expression that represents its data by a collection of terms. This is an abstract base class that is implement by different subclasses which use different data types to actually store the various terms in the expression.
  Since:
    43.00

- - ### Constructor Summary

    Constructor | Description
    --- | ---
    `QuadExpression()` |

  - ### Method Summary

    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract QuadExpression` | `addConstant​(double c)` | Add a value to the constant term of this expression.
    `abstract QuadExpression` | `addTerm​(double coefficient, Variable variable)` | Add a term to this expression.
    `abstract QuadExpression` | `addTerm​(double coefficient, Variable variable1, Variable variable2)` | Add a term to this expression.
    `QuadExpression` | `addTerm​(LinTerm term)` | Add `term` to this expression.
    `QuadExpression` | `addTerm​(QuadTerm term)` | Add `term` to this expression.
    `abstract QuadExpression` | `addTerm​(Variable x)` | Add term `1.0*x` to this expression.
    `abstract QuadExpression` | `addTerm​(Variable variable, double coefficient)` | Add a term to this expression.
    `abstract QuadExpression` | `addTerm​(Variable x1, Variable x2)` | Add term `1.0*x1*x2` to this expression.
    `abstract QuadExpression` | `addTerm​(Variable variable1, Variable variable2, double coefficient)` | Add a term to this expression.
    `abstract QuadExpression` | `addTerms​(LinExpression expr)` | Add another linear expression to this expression.
    `abstract QuadExpression` | `addTerms​(LinExpression expr, double factor)` | Add another linear expression to this expression.
    `abstract QuadExpression` | `addTerms​(QuadExpression expr)` | Add another quadratic expression to this expression.
    `abstract QuadExpression` | `addTerms​(QuadExpression expr, double factor)` | Add another quadratic expression to this expression.
    `QuadExpression` | `addTerms​(Variable[] variables, double[] coefficients)` | Add multiple terms to this expression.
    `QuadExpression` | `addTerms​(Variable[] variables, double[] coefficients, int offset, int count)` | Add multiple terms to this expression.
    `QuadExpression` | `addTerms​(Variable[] variables1, Variable[] variables2, double[] coefficients)` | Add multiple terms to this expression.
    `QuadExpression` | `addTerms​(Variable[] variables1, Variable[] variables2, double[] coefficients, int offset, int count)` | Add multiple terms to this expression.
    `QuadExpression` | `addTerms​(java.lang.Iterable<Variable> variables1, java.lang.Iterable<Variable> variables2, java.lang.Iterable<java.lang.Double> coefficients)` | Add multiple terms to this expression.
    `QuadExpression` | `addTerms​(java.lang.Iterable<Variable> variables, java.lang.Iterable<java.lang.Double> coefficients)` | Add multiple terms to this expression.
    `QuadExpression` | `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.
    `QuadExpression` | `addTerms​(java.util.stream.Stream<Variable> variables, java.util.stream.Stream<java.lang.Double> coefficients)` | Add multiple linear terms to this expression.
    `static QuadExpression` | `create()` | Create a new empty quadratic expression.
    `static QuadExpression` | `create​(double constant)` | Create a new quadratic expression with the specified constant term.
    `static QuadExpression` | `create​(double constant, int reserve)` | Create a quadratic expression with the specified constant term and prepare for adding the specified number of terms.
    `abstract QuadExpression` | `deepCopy()` | Get a deep copy of this expression.
    `abstract QuadExpression` | `deepCopy​(double factor)` | Get a deep copy of this expression multiplied by a constant
    `abstract double` | `getConstant()` | Get the constant value in this expression.
    `abstract QuadExpression` | `reset()` | Clear this expression.
    `abstract QuadExpression` | `setConstant​(double c)` | Set the constant term in this expression.
    `static boolean` | `setCreateLists​(boolean newValue)` | Configures whether the `create()` functions should return instances of `QuadTermList` (if `newValue` is true) or `QuadTermMap` (if `newValue` is false).

    - ### 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, evaluate, minus, minus, mul, mul, plus, plus, uminus`

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

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

- - ### Constructor Detail

    - #### QuadExpression

          public QuadExpression()

  - ### Method Detail

    - #### deepCopy

          public abstract QuadExpression deepCopy()

      Get a deep copy of this expression.
      Returns:
        A deep copy of this expression.
      Since:
        43.00

    - #### deepCopy

          public abstract QuadExpression deepCopy​(double factor)

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

    - #### getConstant

          public abstract double getConstant()

      Get the constant value in this expression.
      Returns:
        The constant value in this expression.
      Since:
        43.00

    - #### addConstant

          public abstract QuadExpression addConstant​(double c)

      Add a value to the constant term of this expression.
      Parameters:
        `c` - The constant to add.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### setConstant

          public abstract QuadExpression setConstant​(double c)

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

    - #### reset

          public abstract QuadExpression reset()

      Clear this expression. Removes all terms and sets the constant to 0.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadExpression 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`.
      Parameters:
        `variables` - Variables.
        `coefficients` - Coefficients.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadExpression 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`.
      Parameters:
        `variables1` - First variables.
        `variables2` - Second variables.
        `coefficients` - Coefficients.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadExpression 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`.
      Parameters:
        `variables` - Variables
        `coefficients` - Coefficients
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadExpression 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`.
      Parameters:
        `variables1` - First variables
        `variables2` - Second variables
        `coefficients` - Coefficients
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadExpression 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`.
      Parameters:
        `variables` - Variables
        `coefficients` - Coefficients
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadExpression 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`.
      Parameters:
        `variables1` - First variables
        `variables2` - Second variables
        `coefficients` - Coefficients
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public QuadExpression 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`.
      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 QuadExpression 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`.
      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 abstract QuadExpression 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
      Parameters:
        `variable` - Variable.
        `coefficient` - Coefficient to add for `variable`.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public abstract QuadExpression 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
      Parameters:
        `coefficient` - Coefficient to add for `variable`.
        `variable` - Variable.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public abstract QuadExpression 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
      Parameters:
        `x` - Variable.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public QuadExpression addTerm​(LinTerm term)

      Add `term` to this expression.

      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
      Parameters:
        `term` - The term to add.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public QuadExpression addTerm​(QuadTerm term)

      Add `term` to this expression.

      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
      Parameters:
        `term` - The term to add.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public abstract QuadExpression 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
      Parameters:
        `variable1` - First variable.
        `variable2` - Second variable.
        `coefficient` - Coefficient to add for `variable1*variable2`.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public abstract QuadExpression 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
      Parameters:
        `coefficient` - Coefficient to add for `variable1*variable2`.
        `variable1` - First variable.
        `variable2` - Second variable.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerm

          public abstract QuadExpression 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
      Parameters:
        `x1` - First variable.
        `x2` - Second variable.
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public abstract QuadExpression addTerms​(LinExpression expr)

      Add another linear expression to this expression.
      Parameters:
        `expr` - The expression to add
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public abstract QuadExpression addTerms​(QuadExpression expr)

      Add another quadratic expression to this expression.
      Parameters:
        `expr` - The expression to add
      Returns:
        Always returns `this`.
      Since:
        43.00

    - #### addTerms

          public abstract QuadExpression addTerms​(LinExpression expr,
                                                  double factor)

      Add another linear expression to this expression.
      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 abstract QuadExpression addTerms​(QuadExpression expr,
                                                  double factor)

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

    - #### setCreateLists

          public static boolean setCreateLists​(boolean newValue)

      Configures whether the `create()` functions should return instances of `QuadTermList` (if `newValue` is true) or `QuadTermMap` (if `newValue` is false).
      Parameters:
        `newValue` - The new value.
      Returns:
        The old value.
      Since:
        46.00

    - #### create

          public static QuadExpression create()

      Create a new empty quadratic expression.

      Examples using `create`:

      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Returns:
        The new quadratic expression.
      Since:
        43.00

    - #### create

          public static QuadExpression create​(double constant)

      Create a new quadratic expression with the specified constant term.

      Examples using `create`:

      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Parameters:
        `constant` - The constant term to which the expression is initialized.
      Returns:
        The new quadratic expression.
      Since:
        43.00

    - #### create

          public static QuadExpression create​(double constant,
                                              int reserve)

      Create a quadratic expression with the specified constant term and prepare for adding the specified number of terms.

      Examples using `create`:

      - ELSManagedCuts.java
      - FolioIIS.java
      - FolioQC.java
      - FolioQP.java
      - Pplan.java
      - Pplan2.java
      - ProductionPlanning_Index.java
      - QuadraticProgramming.java
      - Sangraalind.java
      - TravelingSalesPerson.java
      Parameters:
        `constant` - The constant term to which the expression is initialized.
        `reserve` - Prepare for this many terms to add.
      Returns:
        The new quadratic expression.
      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.