22 STORM_LOG_ASSERT(valuation !=
nullptr,
"Evaluating expressions with unknowns without valuation.");
23 STORM_LOG_THROW(this->
hasBooleanType(), storm::exceptions::InvalidTypeException,
"Cannot evaluate expression as boolean: return type is not a boolean.");
29 STORM_LOG_ASSERT(valuation !=
nullptr,
"Evaluating expressions with unknowns without valuation.");
30 STORM_LOG_THROW(this->
hasIntegerType(), storm::exceptions::InvalidTypeException,
"Cannot evaluate expression as integer: return type is not an integer.");
36 STORM_LOG_ASSERT(valuation !=
nullptr,
"Evaluating expressions with unknowns without valuation.");
37 STORM_LOG_THROW(this->
hasNumericalType(), storm::exceptions::InvalidTypeException,
"Cannot evaluate expression as double: return type is not a double.");
39 if (this->
getType().isIntegerType()) {
63 return this->shared_from_this();
67 return visitor.
visit(*
this, data);
The base class of all expression classes.
bool hasBooleanType() const
Retrieves whether the expression has a boolean type.
bool hasIntegerType() const
Retrieves whether the expression has an integer type.
bool hasNumericalType() const
Retrieves whether the expression has a numerical type, i.e., integer or double.
Type const & getType() const
Retrieves the type of the expression.
virtual boost::any visit(IfThenElseExpression const &expression, boost::any const &data)=0
The base class of all valuations of variables.
virtual int_fast64_t getIntegerValue(Variable const &integerVariable) const =0
Retrieves the value of the given integer variable.
virtual double getRationalValue(Variable const &rationalVariable) const =0
Retrieves the value of the given rational variable.
virtual bool getBooleanValue(Variable const &booleanVariable) const =0
Retrieves the value of the given boolean variable.
virtual void printToStream(std::ostream &stream) const override
Prints the expression to the given stream.
virtual int_fast64_t evaluateAsInt(Valuation const *valuation=nullptr) const override
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
virtual std::string const & getIdentifier() const override
Retrieves the identifier associated with this expression.
VariableExpression(Variable const &variable)
Creates a variable expression with the given return type and variable name.
virtual boost::any accept(ExpressionVisitor &visitor, boost::any const &data) const override
Accepts the given visitor by calling its visit method.
virtual std::shared_ptr< BaseExpression const > simplify() const override
Simplifies the expression according to some simple rules.
virtual bool containsVariables() const override
Retrieves whether the expression contains a variable.
virtual bool isVariableExpression() const override
virtual bool isVariable() const override
Retrieves whether the expression is a variable.
virtual bool evaluateAsBool(Valuation const *valuation=nullptr) const override
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
Variable const & getVariable() const
Retrieves the variable associated with this expression.
virtual double evaluateAsDouble(Valuation const *valuation=nullptr) const override
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
std::string const & getVariableName() const
Retrieves the name of the variable associated with this expression.
virtual void gatherVariables(std::set< storm::expressions::Variable > &variables) const override
Retrieves the set of all variables that appear in the expression.
std::string const & getName() const
Retrieves the name of the variable.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)