ConstantExpression
- java.lang.Object
-
- com.dashoptimization.objects.Expression
-
- com.dashoptimization.objects.AbstractExpression
-
- com.dashoptimization.objects.ConstantExpression
-
public final class ConstantExpression extends AbstractExpression
A constant value.- Since:
- 43.00
-
-
Constructor Summary
Constructor Description ConstantExpression(double value)
Create a new constant expression.
-
Method Summary
Modifier and Type Method Description static ConstantExpression
constant(double cnst)
Utility function to create a constant expression.ConstantExpression
div(double arg)
Create a new expression that represents the quotient ofthis
andarg
.ConstantExpression
div(ConstantExpression arg)
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).void
extract(double factor, PostfixExtractor extractor)
Extract this expression into postfix notation.boolean
extract(double factor, XPRSprob.RowCreator creator)
Extract this expression into a row.double
getValue()
ConstantExpression
minus(double arg)
Create a new expression that represents the difference ofthis
andarg
.ConstantExpression
minus(ConstantExpression arg)
Expression
minus(Expression arg)
Create a new expression that represents the difference ofthis
andarg
.ConstantExpression
mul(double arg)
Create a new expression that represents the product ofthis
andarg
.ConstantExpression
mul(ConstantExpression arg)
Expression
mul(Expression arg)
Create a new expression that represents the product ofthis
andarg
.LinTerm
mul(LinTerm arg)
QuadTerm
mul(QuadTerm arg)
LinTerm
mul(Variable arg)
ConstantExpression
plus(double arg)
Create a new expression that represents the sum ofthis
andarg
.ConstantExpression
plus(ConstantExpression arg)
Expression
plus(Expression arg)
Create a new expression that represents the sum ofthis
andarg
.java.lang.String
toString()
ConstantExpression
uminus()
Create a new expression that represents the unary minus of this one.
-
-
-
Method Detail
-
getValue
public double getValue()
-
constant
public static ConstantExpression constant(double cnst)
Utility function to create a constant expression.- Parameters:
-
cnst
- Constant value for new expression. - Returns:
- The new expression.
- Since:
- 43.00
-
extract
public 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:
-
extract
in classExpression
- Parameters:
-
factor
- Factor by which to multiply the expression during extraction. -
creator
- The creator to which this expression should be extracted. - Returns:
-
true
if the low-level representation does requires normalization (sorting, removal of dups, ...). In some special cases we know that this is not required and can returnfalse
to save the overhead. - 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).- Specified by:
-
evaluate
in classExpression
- Parameters:
-
solution
- Solution values for which the expression is evaluated. - Since:
- 43.00
-
extract
public void extract(double factor, PostfixExtractor extractor)
Extract this expression into postfix notation.- Specified by:
-
extract
in classExpression
- Parameters:
-
factor
- Factor by which to multiply the expression during extraction. -
extractor
- The extractor to which the expression is extract. - Since:
- 43.00
-
toString
public java.lang.String toString()
Used in these examples:
- GlobalRHSParametrics
- IISExample
- Knapsack
- Trimloss
- Overrides:
-
toString
in classjava.lang.Object
- Since:
- 43.00
-
uminus
public ConstantExpression uminus()
Create a new expression that represents the unary minus of this one.- Overrides:
-
uminus
in classExpression
- Returns:
-
Expression representing
-this
. - Since:
- 43.00
-
plus
public Expression plus(Expression arg)
Create a new expression that represents the sum ofthis
andarg
.- Overrides:
-
plus
in classExpression
- Parameters:
-
arg
- Addend. - Returns:
-
Sum of
this
andarg
. - Since:
- 43.00
-
plus
public ConstantExpression plus(ConstantExpression arg)
- Since:
- 43.00
-
plus
public ConstantExpression plus(double arg)
Create a new expression that represents the sum ofthis
andarg
.- Overrides:
-
plus
in classExpression
- Parameters:
-
arg
- Addend. - Returns:
-
Sum of
this
andarg
. - Since:
- 43.00
-
minus
public Expression minus(Expression arg)
Create a new expression that represents the difference ofthis
andarg
.- Overrides:
-
minus
in classExpression
- Parameters:
-
arg
- Minuend. - Returns:
-
Difference of
this
andarg
. - Since:
- 43.00
-
minus
public ConstantExpression minus(ConstantExpression arg)
- Since:
- 43.00
-
minus
public ConstantExpression minus(double arg)
Create a new expression that represents the difference ofthis
andarg
.- Overrides:
-
minus
in classExpression
- Parameters:
-
arg
- Minuend. - Returns:
-
Difference of
this
andarg
. - 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 ConstantExpression mul(ConstantExpression arg)
- Since:
- 43.00
-
mul
public ConstantExpression 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 ConstantExpression div(ConstantExpression arg)
- Since:
- 43.00
-
div
public ConstantExpression 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.