QuadTermMap
- java.lang.Object
-  
  - com.dashoptimization.objects.Expression
-  
    - com.dashoptimization.objects.AbstractExpression
-  
      - com.dashoptimization.objects.QuadExpression
-  
        - com.dashoptimization.objects.QuadTermMap
 
 
 
 
-  
   
 public final class QuadTermMap extends QuadExpression A quadratic expression. This class implements a quadratic expression as a map from variables to values.- Since:
- 43.00
 
-  
    
   -  
         Constructor SummaryConstructor Description QuadTermMap()Create a new empty expression.QuadTermMap(double constant)Create an expression with a constant term.
 -  
         Method SummaryModifier and Type Method Description QuadExpressionaddConstant(double constant)Add a value to the constant term of this expression.QuadExpressionaddTerm(double coefficient, Variable variable)Add a term to this expression.QuadExpressionaddTerm(double coefficient, Variable variable1, Variable variable2)Add a term to this expression.QuadExpressionaddTerm(Variable x)Add term1.0*xto this expression.QuadExpressionaddTerm(Variable variable, double coefficient)Add a term to this expression.QuadExpressionaddTerm(Variable x1, Variable x2)Add term1.0*x1*x2to this expression.QuadExpressionaddTerm(Variable variable1, Variable variable2, double coefficient)Add a term to this expression.QuadExpressionaddTerms(LinExpression expr)Add another linear expression to this expression.QuadExpressionaddTerms(LinExpression expr, double factor)Add another linear expression to this expression.QuadExpressionaddTerms(QuadExpression expr)Add another quadratic expression to this expression.QuadExpressionaddTerms(QuadExpression expr, double factor)Add another quadratic expression to this expression.QuadExpressionaddTerms(Variable[] variables, double[] coefficients)Add multiple terms to this expression.QuadExpressionaddTerms(Variable[] variables, double[] coefficients, int offset, int count)Add multiple terms to this expression.QuadExpressionaddTerms(Variable[] variables1, Variable[] variables2, double[] coefficients)Add multiple terms to this expression.QuadExpressionaddTerms(Variable[] variables1, Variable[] variables2, double[] coefficients, int offset, int count)Add multiple terms to this expression.QuadExpressionaddTerms(java.util.Collection<Variable> variables1, java.util.Collection<Variable> variables2, java.util.Collection<java.lang.Double> coefficients)Add multiple quadratic terms to this expression.QuadExpressionaddTerms(java.util.Collection<Variable> variables, java.util.Collection<java.lang.Double> coefficients)Add multiple linear terms to this expression.QuadExpressiondeepCopy()Get a deep copy of this expression.QuadExpressiondeepCopy(double factor)Get a deep copy of this expression multiplied by a constantdoubleevaluate(double[] solution)Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).voidextract(double factor, PostfixExtractor extractor)Extract this expression into postfix notation.booleanextract(double factor, XPRSprob.RowCreator creator)Extract this expression into a row.doublegetCoefficient(Variable variable)Get the coefficient for a variable.doublegetCoefficient(Variable variable1, Variable variable2)Get the coefficient for a variable product.doublegetConstant()Get the constant value in this expression.QuadExpressionreset()Clear this expression.QuadTermMapsetCoefficient(Variable variable, double coefficient)Set the coefficient for a variable in this expression.QuadTermMapsetCoefficient(Variable variable1, Variable variable2, double coefficient)Set the coefficient for a variable product in this expression.QuadExpressionsetConstant(double constant)Set the constant term in this expression.-  
           Methods inherited from class com.dashoptimization.objects.QuadExpressionaddTerm, addTerm, create, create, toString
 -  
           Methods inherited from class com.dashoptimization.objects.AbstractExpressioneq, eq, geq, geq, in, leq, leq
 
-  
           
 
-  
         
-  
    
   -  
         Method Detail-  deepCopypublic QuadExpression deepCopy() Get a deep copy of this expression.- Specified by:
- 
          deepCopyin classQuadExpression
- Returns:
- A deep copy of this expression.
- Since:
- 43.00
 
 -  deepCopypublic QuadExpression deepCopy(double factor) Get a deep copy of this expression multiplied by a constant- Specified by:
- 
          deepCopyin classQuadExpression
- Parameters:
- 
          factor- Factor to scalethiswith.
- Returns:
- 
          A deep copy of this expression multiplied by 
          factor.
- Since:
- 43.00
 
 -  resetpublic QuadExpression reset() Clear this expression. Removes all terms and sets the constant to 0.- Specified by:
- 
          resetin classQuadExpression
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(java.util.Collection<Variable> variables, java.util.Collection<java.lang.Double> coefficients) Add multiple linear terms to this expression. Adds the scalar product defined by the two parallel collections to this expression.- Specified by:
- 
          addTermsin classQuadExpression
- Parameters:
- 
          variables- Variables.
- 
          coefficients- Coefficients.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(java.util.Collection<Variable> variables1, java.util.Collection<Variable> variables2, java.util.Collection<java.lang.Double> coefficients) Add multiple quadratic terms to this expression. Adds the scalar product defined by the three parallel collections to this expression.- Specified by:
- 
          addTermsin classQuadExpression
- Parameters:
- 
          variables1- First variables.
- 
          variables2- Second variables.
- 
          coefficients- Coefficients.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(Variable[] variables, double[] coefficients) Add multiple terms to this expression. Adds the scalar product defined by the two parallel arrays to this expression. This function is equivalent tofor (int i = 0; i < variables.length; ++i) addTerm(variables[i], coefficients[i]); - Specified by:
- 
          addTermsin classQuadExpression
- Parameters:
- 
          variables- Variables
- 
          coefficients- Coefficients
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(Variable[] variables1, Variable[] variables2, double[] coefficients) Add multiple terms to this expression. Adds the scalar product defined by the three parallel arrays to this expression. This function is equivalent tofor (int i = 0; i < variables.length; ++i) addTerm(variables1[i], variables2[i], coefficients[i]); - Specified by:
- 
          addTermsin classQuadExpression
- Parameters:
- 
          variables1- First variables
- 
          variables2- Second variables
- 
          coefficients- Coefficients
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(Variable[] variables, double[] coefficients, int offset, int count) Add multiple terms to this expression. Adds the scalar product defined by the two parallel arrays to this expression. The function only uses the slice of the two arrays that is indicated byoffsetandlength. This function is equivalent tofor (int i = 0, j = offset; i < count; ++i, ++j) addTerm(variables[j], coefficients[j]); - Specified by:
- 
          addTermsin classQuadExpression
- 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
 
 -  addTermspublic 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 three parallel arrays to this expression. The function only uses the slice of the two arrays that is indicated byoffsetandlength. This function is equivalent tofor (int i = 0, j = offset; i < count; ++i, ++j) addTerm(variables1[j], variables2[j], coefficients[j]); - Specified by:
- 
          addTermsin classQuadExpression
- 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
 
 -  addTermpublic QuadExpression addTerm(Variable variable, double coefficient) Add a term to this expression. If the expression already has a coefficient forvariablethen the old and the new coefficients will be added.- Specified by:
- 
          addTermin classQuadExpression
- Parameters:
- 
          variable- Variable.
- 
          coefficient- Coefficient to add forvariable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic QuadExpression addTerm(double coefficient, Variable variable) Add a term to this expression. If the expression already has a coefficient forvariablethen the old and the new coefficients will be added.- Specified by:
- 
          addTermin classQuadExpression
- Parameters:
- 
          coefficient- Coefficient to add forvariable.
- 
          variable- Variable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic QuadExpression addTerm(Variable x) Add term1.0*xto this expression. If the expression already has a coefficient forxthen the old and the new coefficients will be added.- Specified by:
- 
          addTermin classQuadExpression
- Parameters:
- 
          x- Variable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic QuadExpression addTerm(Variable variable1, Variable variable2, double coefficient) Add a term to this expression. If the expression already has a coefficient forvariable1*variable2then the old and the new coefficients will be added.- Specified by:
- 
          addTermin classQuadExpression
- Parameters:
- 
          variable1- First variable.
- 
          variable2- Second variable.
- 
          coefficient- Coefficient to add forvariable1*variable2.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic QuadExpression addTerm(double coefficient, Variable variable1, Variable variable2) Add a term to this expression. If the expression already has a coefficient forvariable1*variable2then the old and the new coefficients will be added.- Specified by:
- 
          addTermin classQuadExpression
- Parameters:
- 
          coefficient- Coefficient to add forvariable1*variable2.
- 
          variable1- First variable.
- 
          variable2- Second variable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic QuadExpression addTerm(Variable x1, Variable x2) Add term1.0*x1*x2to this expression. If the expression already has a coefficient forxthen the old and the new coefficients will be added.- Specified by:
- 
          addTermin classQuadExpression
- Parameters:
- 
          x1- First variable.
- 
          x2- Second variable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(LinExpression expr) Add another linear expression to this expression.- Specified by:
- 
          addTermsin classQuadExpression
- Parameters:
- 
          expr- The expression to add
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(QuadExpression expr) Add another quadratic expression to this expression.- Specified by:
- 
          addTermsin classQuadExpression
- Parameters:
- 
          expr- The expression to add
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(LinExpression expr, double factor) Add another linear expression to this expression.- Specified by:
- 
          addTermsin classQuadExpression
- Parameters:
- 
          expr- The expression to add.
- 
          factor- Factor by which to multiply elements inexprbefore adding.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic QuadExpression addTerms(QuadExpression expr, double factor) Add another quadratic expression to this expression.- Specified by:
- 
          addTermsin classQuadExpression
- Parameters:
- 
          expr- The expression to add.
- 
          factor- Factor by which to multiply elements inexprbefore adding.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  setCoefficientpublic QuadTermMap setCoefficient(Variable variable, double coefficient) Set the coefficient for a variable in this expression. Any existing coefficient will be overwritten.- Parameters:
- 
          variable- objects.Variable index.
- 
          coefficient- New coefficient forvariable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  setCoefficientpublic QuadTermMap setCoefficient(Variable variable1, Variable variable2, double coefficient) Set the coefficient for a variable product in this expression. Any existing coefficient will be overwritten.- Parameters:
- 
          variable1- First variable index.
- 
          variable2- Second variable index.
- 
          coefficient- New coefficient forvariable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  getCoefficientpublic double getCoefficient(Variable variable) Get the coefficient for a variable.- Parameters:
- 
          variable- objects.Variable to query.
- Returns:
- 
          The coefficient for 
          variablein this expression.
- Since:
- 43.00
 
 -  getCoefficientpublic double getCoefficient(Variable variable1, Variable variable2) Get the coefficient for a variable product.- Parameters:
- 
          variable1- First variable to query.
- 
          variable2- Second variable to query.
- Returns:
- 
          The coefficient for 
          variablein this expression.
- Since:
- 43.00
 
 -  addConstantpublic QuadExpression addConstant(double constant) Add a value to the constant term of this expression.- Specified by:
- 
          addConstantin classQuadExpression
- Parameters:
- 
          constant- The constant to add.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  setConstantpublic QuadExpression setConstant(double constant) Set the constant term in this expression. Any existing constant term will be overwritten.- Specified by:
- 
          setConstantin classQuadExpression
- Parameters:
- 
          constant- New constant term for this expression
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  getConstantpublic double getConstant() Get the constant value in this expression.- Specified by:
- 
          getConstantin classQuadExpression
- Returns:
- The constant value in this expression.
- Since:
- 43.00
 
 -  extractpublic boolean extract(double factor, XPRSprob.RowCreator creator)Extract this expression into a row. This is for internal use only, you should never have to call this function explicitly.- Specified by:
- 
          extractin classExpression
- Parameters:
- 
          factor- Factor by which to multiply the expression during extraction.
- 
          creator- The creator to which this expression should be extracted.
- Returns:
- 
          trueif the low-level representation does requires normalization (sorting, removal of dups, ...). In some special cases we know that this is not required and can returnfalseto save the overhead.
- Since:
- 43.00
 
 -  extractpublic void extract(double factor, PostfixExtractor extractor)Extract this expression into postfix notation.- Specified by:
- 
          extractin classExpression
- Parameters:
- 
          factor- Factor by which to multiply the expression during extraction.
- 
          extractor- The extractor to which the expression is extract.
- Since:
- 43.00
 
 -  evaluatepublic double evaluate(double[] solution) Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).- Specified by:
- 
          evaluatein classExpression
- Parameters:
- 
          solution- Solution values for which the expression is evaluated.
- Since:
- 43.00
 
 
-  
 
-  
         
© 2001-2024 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.
 
