QuadTerm
- java.lang.Object
-
- com.dashoptimization.objects.Expression
-
- com.dashoptimization.objects.AbstractExpression
-
- com.dashoptimization.objects.QuadTerm
-
public final class QuadTerm extends AbstractExpression
A quadratic term.- Since:
- 43.00
-
-
Method Summary
Modifier and Type Method Description QuadTerm
div(double arg)
Create a new expression that represents the quotient ofthis
andarg
.QuadTerm
div(ConstantExpression arg)
Create a new expression that represents the quotient ofthis
andarg
.Expression
div(Expression arg)
Create a new expression that represents the quotient ofthis
andarg
.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
getCoefficient()
Variable
getVariable1()
Variable
getVariable2()
QuadTerm
mul(double arg)
Create a new expression that represents the product ofthis
andarg
.QuadTerm
mul(ConstantExpression arg)
Create a new expression that represents the product ofthis
andarg
.Expression
mul(Expression arg)
Create a new expression that represents the product ofthis
andarg
.static QuadTerm
qTerm(Variable variable1, Variable variable2)
Convenience function to create a single quadratic term.static QuadTerm
qTerm(Variable variable1, Variable variable2, double coefficient)
Convenience function to create a single quadratic term.java.lang.String
toString()
static java.lang.String
toString(Variable v1, Variable v2, double coef)
Convert a quadratic term to a string.QuadTerm
uminus()
Create a new expression that represents the unary minus of this one.-
Methods inherited from class com.dashoptimization.objects.AbstractExpression
eq, eq, geq, geq, in, leq, leq
-
Methods inherited from class com.dashoptimization.objects.Expression
minus, minus, plus, plus
-
-
-
-
Method Detail
-
getVariable1
public Variable getVariable1()
-
getVariable2
public Variable getVariable2()
-
getCoefficient
public double getCoefficient()
-
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).- Specified by:
-
evaluate
in classExpression
- Parameters:
-
solution
- Solution values for which the expression is evaluated. - Returns:
-
The value of this expression evaluated at
solution
. - Since:
- 43.00
-
qTerm
public static QuadTerm qTerm(Variable variable1, Variable variable2, double coefficient)
Convenience function to create a single quadratic term.- Parameters:
-
variable1
- First variable for term. -
variable2
- Second variable for term. -
coefficient
- Coefficient for term. - Returns:
- The newly created term.
- Since:
- 43.00
-
qTerm
public static QuadTerm qTerm(Variable variable1, Variable variable2)
Convenience function to create a single quadratic term. Creates the term1 * variable1 * variable2
.- Parameters:
-
variable1
- First variable for term. -
variable2
- Second variable for term. - Returns:
- The newly created term.
- Since:
- 43.00
-
toString
public java.lang.String toString()
- Overrides:
-
toString
in classjava.lang.Object
- Returns:
- Since:
- 43.00
-
toString
public static java.lang.String toString(Variable v1, Variable v2, double coef)
Convert a quadratic term to a string. Note that while theQuadTerm
class does not allowXpressProblem.NULL_VARIABLE
as either of the variables, this function allows those variables to indicate constant or linear terms.Used in these examples:
- GlobalRHSParametrics
- IISExample
- Knapsack
- Trimloss
- Parameters:
-
v1
- First variable in quadratic term. -
v2
- Second variable in quadratic term. -
coef
- Coeffcient for quadratic term. - Returns:
-
String representation of
coef*v1*v2
. - Since:
- 43.00
-
uminus
public QuadTerm uminus()
Create a new expression that represents the unary minus of this one.- Overrides:
-
uminus
in classExpression
- Returns:
-
Expression representing
-this
. - Since:
- 43.00
-
mul
public Expression mul(Expression arg)
Create a new expression that represents the product ofthis
andarg
.- Overrides:
-
mul
in classExpression
- Parameters:
-
arg
- Factor. - Returns:
-
Product of
this
andarg
. - Since:
- 43.00
-
mul
public QuadTerm mul(ConstantExpression arg)
Create a new expression that represents the product ofthis
andarg
.- Parameters:
-
arg
- Factor. - Returns:
- The new expression.
- Since:
- 43.00
-
mul
public QuadTerm mul(double arg)
Create a new expression that represents the product ofthis
andarg
.- Overrides:
-
mul
in classExpression
- Parameters:
-
arg
- Factor. - Returns:
-
Product of
this
andarg
. - Since:
- 43.00
-
div
public Expression div(Expression arg)
Create a new expression that represents the quotient ofthis
andarg
.- Overrides:
-
div
in classExpression
- Parameters:
-
arg
- Divisor. - Returns:
-
Quotient of
this
andarg
. - Since:
- 43.00
-
div
public QuadTerm div(ConstantExpression arg)
Create a new expression that represents the quotient ofthis
andarg
.- Parameters:
-
arg
- Divisor. - Returns:
- The new expression.
- Since:
- 43.00
-
div
public QuadTerm div(double arg)
Create a new expression that represents the quotient ofthis
andarg
.- Overrides:
-
div
in classExpression
- Parameters:
-
arg
- Divisor. - Returns:
-
Quotient of
this
andarg
. - 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.