OPAL (Object Oriented Parallel Accelerator Library)
2.2.0
OPAL
|
Expression to be evaluated in the framework. More...
#include <Expression.h>
Public Member Functions | |
Expression () | |
Expression (std::string expr) | |
Expression (std::string expr, functionDictionary_t known_expr_funcs) | |
virtual | ~Expression () |
std::set< std::string > | getReqVars () const |
std::set< std::string > | getReqFuncs () const |
std::string | toString () const |
functionDictionary_t | getRegFuncs () const |
Expressions::OperatorType_t | getOpType () const |
get operator type present (if expression is constraint) More... | |
Expressions::Result_t | evaluate (variableDictionary_t vars) |
evaluate an expression given a value dictionary of free variables More... | |
Private Types | |
typedef std::string::const_iterator | iterator_type |
Private Member Functions | |
void | determineConstrOperator () |
void | parse () |
Private Attributes | |
client::ast::expression | ast_ |
std::set< std::string > | vars_ |
std::set< std::string > | funcs_ |
std::string | expr_ |
functionDictionary_t | known_expr_funcs_ |
Expressions::OperatorType_t | type_ |
Expression to be evaluated in the framework.
This class uses the Boost Spirit parser to parse and evaluate string expressions (objectives or constraints). Custom functions called in the expression should be registered by the driver. A collection of C math default functions is always included. For constraints the operator type can be queried.
Definition at line 75 of file Expression.h.
|
private |
Definition at line 136 of file Expression.h.
|
inline |
Definition at line 79 of file Expression.h.
|
inline |
Definition at line 82 of file Expression.h.
References determineConstrOperator(), known_expr_funcs_, and parse().
|
inline |
Definition at line 91 of file Expression.h.
References determineConstrOperator(), known_expr_funcs_, and parse().
|
inlinevirtual |
Definition at line 101 of file Expression.h.
|
inlineprivate |
Definition at line 147 of file Expression.h.
References Expressions::EQ, expr_, Expressions::INEQ_LHS, Expressions::INEQ_LHS_EQ, Expressions::INEQ_RHS, Expressions::INEQ_RHS_EQ, Expressions::NONE, Expressions::NOT_EQ, and type_.
Referenced by Expression().
|
inline |
evaluate an expression given a value dictionary of free variables
Definition at line 114 of file Expression.h.
References ast_, expr_, known_expr_funcs_, client::code_gen::StackEvaluator::registerFunctions(), client::code_gen::StackEvaluator::registerVariables(), and client::code_gen::StackEvaluator::result().
Referenced by Individual::checkConstraints(), and OpalSimulation::collectResults().
|
inline |
get operator type present (if expression is constraint)
Definition at line 111 of file Expression.h.
References type_.
|
inline |
Definition at line 108 of file Expression.h.
References known_expr_funcs_.
Referenced by OpalSimulation::collectResults().
|
inline |
Definition at line 106 of file Expression.h.
References funcs_.
|
inline |
Definition at line 105 of file Expression.h.
References vars_.
Referenced by Individual::checkConstraints(), and OpalSimulation::getVariableDictionary().
|
inlineprivate |
Definition at line 167 of file Expression.h.
References ast_, endl(), expr_, funcs_, client::code_gen::requirements::functions(), client::code_gen::requirements::variables(), and vars_.
Referenced by Expression().
|
inline |
Definition at line 107 of file Expression.h.
References expr_.
Referenced by OpalSimulation::collectResults().
|
private |
Definition at line 137 of file Expression.h.
Referenced by evaluate(), and parse().
|
private |
Definition at line 142 of file Expression.h.
Referenced by determineConstrOperator(), evaluate(), parse(), and toString().
|
private |
Definition at line 140 of file Expression.h.
Referenced by getReqFuncs(), and parse().
|
private |
Definition at line 143 of file Expression.h.
Referenced by evaluate(), Expression(), and getRegFuncs().
|
private |
Definition at line 145 of file Expression.h.
Referenced by determineConstrOperator(), and getOpType().
|
private |
Definition at line 139 of file Expression.h.
Referenced by getReqVars(), and parse().