Browse Source

added Expression::evaluateAsRational

tempestpy_adaptions
TimQu 8 years ago
parent
commit
cde59bd436
  1. 4
      src/storm/storage/expressions/Expression.cpp
  2. 9
      src/storm/storage/expressions/Expression.h

4
src/storm/storage/expressions/Expression.cpp

@ -59,6 +59,10 @@ namespace storm {
return this->getBaseExpression().evaluateAsDouble(valuation);
}
storm::RationalNumber Expression::evaluateAsRational() const {
return this->getBaseExpression().evaluateAsRational();
}
Expression Expression::simplify() const {
return Expression(this->getBaseExpression().simplify());
}

9
src/storm/storage/expressions/Expression.h

@ -134,6 +134,15 @@ namespace storm {
* @return The double value of the expression under the given valuation.
*/
double evaluateAsDouble(Valuation const* valuation = nullptr) const;
/*!
* Evaluates the expression and returns the resulting rational number.
* If the return type of the expression is not a rational an exception is thrown.
*
* @param valuation The valuation of unknowns under which to evaluate the expression.
* @return The double value of the expression under the given valuation.
*/
storm::RationalNumber evaluateAsRational() const;
/*!
* Simplifies the expression according to some basic rules.

Loading…
Cancel
Save