LinExpression
- java.lang.Object
-  
  - com.dashoptimization.objects.Expression
-  
    - com.dashoptimization.objects.AbstractExpression
-  
      - com.dashoptimization.objects.LinExpression
 
 
 
-  
   - Direct Known Subclasses:
- 
     LinTermList,LinTermMap
 
 public abstract class LinExpression extends AbstractExpression A linear 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 SummaryConstructor Description LinExpression()
 -  
         Method SummaryModifier and Type Method Description abstract LinExpressionaddConstant(double c)Add a value to the constant term of this expression.abstract LinExpressionaddTerm(double coefficient, Variable variable)Add a term to this expression.LinExpressionaddTerm(LinTerm term)Addtermterm to this expression.abstract LinExpressionaddTerm(Variable x)Add term1*xthis expression.abstract LinExpressionaddTerm(Variable variable, double coefficient)Add a term to this expression.abstract LinExpressionaddTerms(LinExpression expr)Add another linear expression to this expression.abstract LinExpressionaddTerms(LinExpression expr, double factor)Add another linear expression to this expression.abstract LinExpressionaddTerms(Variable[] variables, double[] coefficients)Add multiple terms to this expression.abstract LinExpressionaddTerms(java.util.Collection<Variable> variables, java.util.Collection<java.lang.Double> coefficients)Add multiple terms to this expression.static LinExpressioncreate()Create a new empty linear expression.static LinExpressioncreate(double constant)Create a new linear expression with the specified constant term.abstract LinExpressiondeepCopy()Get a deep copy of this expression.abstract LinExpressiondeepCopy(double factor)Get a deep copy of this expression multiplied by a constantabstract doublegetConstant()Get the constant value in this expression.abstract LinExpressionreset()Clear this expression.abstract LinExpressionsetConstant(double c)Set the constant term in this expression.Expressionsquare()Create a newQuadExpressionby multiplying this expression by itself.java.lang.StringtoString()-  
           Methods inherited from class com.dashoptimization.objects.AbstractExpressioneq, eq, geq, geq, in, leq, leq
 
-  
           
 
-  
         
-  
    
   -  
         Method Detail-  deepCopypublic abstract LinExpression deepCopy() Get a deep copy of this expression.- Returns:
- A deep copy of this expression.
- Since:
- 43.00
 
 -  deepCopypublic abstract LinExpression deepCopy(double factor) Get a deep copy of this expression multiplied by a constant- Parameters:
- 
          factor- Factor to scalethiswith.
- Returns:
- 
          A deep copy of this expression multiplied by 
          factor.
- Since:
- 43.00
 
 -  getConstantpublic abstract double getConstant() Get the constant value in this expression.- Returns:
- The constant value in this expression.
- Since:
- 43.00
 
 -  addConstantpublic abstract LinExpression 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
 
 -  setConstantpublic abstract LinExpression 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
 
 -  resetpublic abstract LinExpression reset() Clear this expression. Removes all terms and sets the constant to 0.- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic abstract LinExpression addTerms(java.util.Collection<Variable> variables, java.util.Collection<java.lang.Double> coefficients) Add multiple terms to this expression. Adds the scalar product defined by the two parallel collections to this expression.- Parameters:
- 
          variables- Variables.
- 
          coefficients- Coefficients.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic abstract LinExpression 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]); - Parameters:
- 
          variables- Variables
- 
          coefficients- Coefficients
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic abstract LinExpression 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.- Parameters:
- 
          variable- Variable.
- 
          coefficient- Coefficient to add forvariable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic abstract LinExpression 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.- Parameters:
- 
          coefficient- Coefficient to add forvariable.
- 
          variable- Variable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic LinExpression addTerm(LinTerm term) Addtermterm to this expression.- Parameters:
- 
          term- The term to add.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermpublic abstract LinExpression addTerm(Variable x) Add term1*xthis expression. If the expression already has a coefficient forxthen the old and the new coefficients will be added.- Parameters:
- 
          x- Variable.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic abstract LinExpression addTerms(LinExpression expr) Add another linear expression to this expression.- Parameters:
- 
          expr- The expression to add
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  addTermspublic abstract LinExpression 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 inexprbefore adding.
- Returns:
- 
          Always returns 
          this.
- Since:
- 43.00
 
 -  squarepublic Expression square() Create a newQuadExpressionby multiplying this expression by itself.- Returns:
- 
          New expression that represents the product of 
          thiswith itself.
- Since:
- 43.00
 
 -  createpublic static LinExpression create() Create a new empty linear expression.- Returns:
- The new linear expression.
- Since:
- 43.00
 
 -  createpublic static LinExpression create(double constant) Create a new linear expression with the specified constant term.- Parameters:
- 
          constant- The constant term to which the expression is initialized.
- Returns:
- The new quadratic expression.
- Since:
- 43.00
 
 -  toStringpublic java.lang.String toString() Used in these examples: - GlobalRHSParametrics
- IISExample
- Knapsack
- Trimloss
 - Overrides:
- 
          toStringin classjava.lang.Object
- 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.
 
