#include <OSnLNode.h>
Inheritance diagram for OSnLNode:
Public Member Functions | |
virtual std::string | getTokenNumber () |
virtual std::string | getTokenName ()=0 |
virtual std::string | getNonlinearExpressionInXML () |
OSnLNode * | createExpressionTreeFromPostfix (std::vector< OSnLNode * > nlNodeVec) |
OSnLNode * | createExpressionTreeFromPrefix (std::vector< OSnLNode * > nlNodeVec) |
std::vector< OSnLNode * > | getPrefixFromExpressionTree () |
std::vector< OSnLNode * > | preOrderOSnLNodeTraversal (std::vector< OSnLNode * > *prefixVector) |
std::vector< OSnLNode * > | getPostfixFromExpressionTree () |
std::vector< OSnLNode * > | postOrderOSnLNodeTraversal (std::vector< OSnLNode * > *postfixVector) |
virtual void | getVariableIndexMap (std::map< int, int > *varIdx) |
virtual double | calculateFunction (double *x)=0 |
virtual ADdouble | constructADTape (std::map< int, int > *ADIdx, vector< ADdouble > *XAD)=0 |
virtual OSnLNode * | cloneOSnLNode ()=0 |
OSnLNode () | |
default constructor. | |
virtual | ~OSnLNode () |
default destructor. | |
Public Attributes | |
unsigned int | inumberOfChildren |
numberOfChildren is the number of OSnLNode child elements set to -1 if the number is not fixed, i.e. | |
int | inodeInt |
ssymbolInt is the unique integer assigned to the OSnLNode | |
int | inodeType |
inodeType is the number of children the node has, it is set to -1 if the number is not known a prior, e.g. | |
OSnLNode ** | m_mChildren |
m_mChildren holds all the operands, that is nodes that the current node operate on. | |
double | m_dFunctionValue |
m_dFunctionValue holds the function value given the current variable values. | |
ADdouble | m_ADTape |
m_ADTape stores the espression tree for the this OSnLNode as an ADdouble. |
Definition at line 51 of file OSnLNode.h.
OSnLNode::OSnLNode | ( | ) |
OSnLNode::~OSnLNode | ( | ) | [virtual] |
std::string OSnLNode::getTokenNumber | ( | ) | [virtual] |
Reimplemented in OSnLNodeNumber, OSnLNodeE, OSnLNodePI, and OSnLNodeVariable.
Definition at line 237 of file OSnLNode.cpp.
References inodeInt, inodeType, and inumberOfChildren.
virtual std::string OSnLNode::getTokenName | ( | ) | [pure virtual] |
Implemented in OSnLNodePlus, OSnLNodeSum, OSnLNodeMax, OSnLNodeMin, OSnLNodeMinus, OSnLNodeNegate, OSnLNodeTimes, OSnLNodeDivide, OSnLNodePower, OSnLNodeProduct, OSnLNodeLn, OSnLNodeSqrt, OSnLNodeSquare, OSnLNodeCos, OSnLNodeSin, OSnLNodeExp, OSnLNodeAbs, OSnLNodeErf, OSnLNodeIf, OSnLNodeNumber, OSnLNodeE, OSnLNodePI, OSnLNodeVariable, and OSnLNodeAllDiff.
Referenced by getNonlinearExpressionInXML(), and OSInstance::getNonlinearExpressionTreeInInfix().
std::string OSnLNode::getNonlinearExpressionInXML | ( | ) | [virtual] |
the following method writes an OSnLNode in OSiL format, it is used by OSiLWriter to take an OSInstance and write the corresponding OSiL
Reimplemented in OSnLNodeNumber, OSnLNodeE, OSnLNodePI, and OSnLNodeVariable.
Definition at line 365 of file OSnLNode.cpp.
References getTokenName(), inumberOfChildren, and m_mChildren.
Take a vector of OSnLNodes in postfix format and create an create an OSExpressionTree root node
nlNodeVec | holds a vector of pointers to OSnLNodes in postfix format |
Definition at line 171 of file OSnLNode.cpp.
References inumberOfChildren, and m_mChildren.
Referenced by main(), and OSInstance::setQuadraticTermsInNonlinearExpressions().
Take a vector of OSnLNodes in prefix format and create an create an OSExpressionTree root node
nlNodeVec | holds a vector of pointers to OSnLNodes in prefix format |
Definition at line 204 of file OSnLNode.cpp.
References inumberOfChildren, and m_mChildren.
std::vector< OSnLNode * > OSnLNode::getPrefixFromExpressionTree | ( | ) |
Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in prefix format
Definition at line 222 of file OSnLNode.cpp.
References preOrderOSnLNodeTraversal().
Referenced by OSInstance::getNonlinearExpressionTreeInPrefix(), OSInstance::getNonlinearExpressionTreeModInPrefix(), and OSExpressionTree::getPrefixFromExpressionTree().
std::vector< OSnLNode * > OSnLNode::preOrderOSnLNodeTraversal | ( | std::vector< OSnLNode * > * | prefixVector | ) |
Called by getPrefixFromExpressionTree(). This method calls itself recursively and generates a vector of pointers to OSnLNodes in prefix
a | pointer prefixVector to a vector of pointers of OSnLNodes |
Definition at line 227 of file OSnLNode.cpp.
References inumberOfChildren, and m_mChildren.
Referenced by getPrefixFromExpressionTree().
std::vector< OSnLNode * > OSnLNode::getPostfixFromExpressionTree | ( | ) |
Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in postfix format
Definition at line 189 of file OSnLNode.cpp.
References postOrderOSnLNodeTraversal().
Referenced by OSInstance::getNonlinearExpressionTreeInPostfix(), OSInstance::getNonlinearExpressionTreeModInPostfix(), and OSExpressionTree::getPostfixFromExpressionTree().
std::vector< OSnLNode * > OSnLNode::postOrderOSnLNodeTraversal | ( | std::vector< OSnLNode * > * | postfixVector | ) |
Called by getPostfixFromExpressionTree(). This method calls itself recursively and generates a vector of pointers to OSnLNodes in postfix
a | pointer postfixVector to a vector of pointers of OSnLNodes |
Definition at line 194 of file OSnLNode.cpp.
References inumberOfChildren, and m_mChildren.
Referenced by getPostfixFromExpressionTree().
void OSnLNode::getVariableIndexMap | ( | std::map< int, int > * | varIdx | ) | [virtual] |
varIdx is a map where the key is the index of an OSnLNodeVariable and (*varIdx)[ idx] is the kth variable in the map, e.g. (*varIdx)[ 5] = 2 means that variable indexed by 5 is the second variable in the OSnLNode and all of its children
a | pointer to a map of the variables in the OSnLNode and its children |
Reimplemented in OSnLNodeVariable.
Definition at line 394 of file OSnLNode.cpp.
References inodeInt, inumberOfChildren, m_mChildren, and OS_VARIABLE.
Referenced by OSExpressionTree::getVariableIndiciesMap().
virtual double OSnLNode::calculateFunction | ( | double * | x | ) | [pure virtual] |
Calculate the function value given the current variable values. This is an abstract method which is required to be implemented by the concrete operator nodes that derive or extend from this OSnLNode class.
x | holds the values of the variables in a double array. |
Implemented in OSnLNodePlus, OSnLNodeSum, OSnLNodeMax, OSnLNodeMin, OSnLNodeMinus, OSnLNodeNegate, OSnLNodeTimes, OSnLNodeDivide, OSnLNodePower, OSnLNodeProduct, OSnLNodeLn, OSnLNodeSqrt, OSnLNodeSquare, OSnLNodeCos, OSnLNodeSin, OSnLNodeExp, OSnLNodeAbs, OSnLNodeErf, OSnLNodeIf, OSnLNodeNumber, OSnLNodeE, OSnLNodePI, OSnLNodeVariable, and OSnLNodeAllDiff.
Referenced by OSnLNodeIf::calculateFunction(), OSnLNodeDivide::calculateFunction(), OSnLNodeTimes::calculateFunction(), OSnLNodeNegate::calculateFunction(), OSnLNodeMinus::calculateFunction(), OSnLNodeMin::calculateFunction(), OSnLNodeMax::calculateFunction(), OSnLNodePlus::calculateFunction(), and OSExpressionTree::calculateFunction().
virtual ADdouble OSnLNode::constructADTape | ( | std::map< int, int > * | ADIdx, | |
vector< ADdouble > * | XAD | |||
) | [pure virtual] |
Create the AD tape to be evaluated by AD. This is an abstract method which is required to be implemented by the concrete operator nodes that derive or extend from this OSnLNode class.
Implemented in OSnLNodePlus, OSnLNodeSum, OSnLNodeMax, OSnLNodeMin, OSnLNodeMinus, OSnLNodeNegate, OSnLNodeTimes, OSnLNodeDivide, OSnLNodePower, OSnLNodeProduct, OSnLNodeLn, OSnLNodeSqrt, OSnLNodeSquare, OSnLNodeCos, OSnLNodeSin, OSnLNodeExp, OSnLNodeAbs, OSnLNodeErf, OSnLNodeIf, OSnLNodeNumber, OSnLNodeE, OSnLNodePI, OSnLNodeVariable, and OSnLNodeAllDiff.
Referenced by OSnLNodeDivide::constructADTape(), OSnLNodeTimes::constructADTape(), OSnLNodeNegate::constructADTape(), OSnLNodeMinus::constructADTape(), and OSnLNodePlus::constructADTape().
virtual OSnLNode* OSnLNode::cloneOSnLNode | ( | ) | [pure virtual] |
Create or clone a node of this type. This is an abstract method which is required to be implemented by the concrete operator nodes that derive or extend from this OSnLNode class.
x | holds the values of the variables in a double array. |
Implemented in OSnLNodePlus, OSnLNodeSum, OSnLNodeMax, OSnLNodeMin, OSnLNodeMinus, OSnLNodeNegate, OSnLNodeTimes, OSnLNodeDivide, OSnLNodePower, OSnLNodeProduct, OSnLNodeLn, OSnLNodeSqrt, OSnLNodeSquare, OSnLNodeCos, OSnLNodeSin, OSnLNodeExp, OSnLNodeAbs, OSnLNodeErf, OSnLNodeIf, OSnLNodeNumber, OSnLNodeE, OSnLNodePI, OSnLNodeVariable, and OSnLNodeAllDiff.
unsigned int OSnLNode::inumberOfChildren |
numberOfChildren is the number of OSnLNode child elements set to -1 if the number is not fixed, i.e.
for a sum
Definition at line 59 of file OSnLNode.h.
Referenced by OSnLNodeProduct::calculateFunction(), OSnLNodeMin::calculateFunction(), OSnLNodeMax::calculateFunction(), OSnLNodeAllDiff::calculateFunction(), OSnLNodeSum::calculateFunction(), OSnLNodeProduct::constructADTape(), OSnLNodeSum::constructADTape(), CouenneSolver::createCouenneExpression(), createExpressionTreeFromPostfix(), createExpressionTreeFromPrefix(), OSnLNodeVariable::getNonlinearExpressionInXML(), getNonlinearExpressionInXML(), OSInstance::getNonlinearExpressionTreeInInfix(), OSnLNodeVariable::getTokenName(), OSnLNodeVariable::getTokenNumber(), getTokenNumber(), getVariableIndexMap(), main(), OSnLNodeAbs::OSnLNodeAbs(), OSnLNodeAllDiff::OSnLNodeAllDiff(), OSnLNodeCos::OSnLNodeCos(), OSnLNodeDivide::OSnLNodeDivide(), OSnLNodeE::OSnLNodeE(), OSnLNodeErf::OSnLNodeErf(), OSnLNodeExp::OSnLNodeExp(), OSnLNodeIf::OSnLNodeIf(), OSnLNodeLn::OSnLNodeLn(), OSnLNodeMax::OSnLNodeMax(), OSnLNodeMin::OSnLNodeMin(), OSnLNodeMinus::OSnLNodeMinus(), OSnLNodeNegate::OSnLNodeNegate(), OSnLNodeNumber::OSnLNodeNumber(), OSnLNodePI::OSnLNodePI(), OSnLNodePlus::OSnLNodePlus(), OSnLNodePower::OSnLNodePower(), OSnLNodeProduct::OSnLNodeProduct(), OSnLNodeSin::OSnLNodeSin(), OSnLNodeSqrt::OSnLNodeSqrt(), OSnLNodeSquare::OSnLNodeSquare(), OSnLNodeSum::OSnLNodeSum(), OSnLNodeTimes::OSnLNodeTimes(), OSnLNodeVariable::OSnLNodeVariable(), postOrderOSnLNodeTraversal(), preOrderOSnLNodeTraversal(), OSnl2osil::walkTree(), OSnLNodeAbs::~OSnLNodeAbs(), OSnLNodeAllDiff::~OSnLNodeAllDiff(), OSnLNodeCos::~OSnLNodeCos(), OSnLNodeDivide::~OSnLNodeDivide(), OSnLNodeErf::~OSnLNodeErf(), OSnLNodeExp::~OSnLNodeExp(), OSnLNodeIf::~OSnLNodeIf(), OSnLNodeLn::~OSnLNodeLn(), OSnLNodeMax::~OSnLNodeMax(), OSnLNodeMin::~OSnLNodeMin(), OSnLNodeMinus::~OSnLNodeMinus(), OSnLNodeNegate::~OSnLNodeNegate(), OSnLNodePlus::~OSnLNodePlus(), OSnLNodePower::~OSnLNodePower(), OSnLNodeProduct::~OSnLNodeProduct(), OSnLNodeSin::~OSnLNodeSin(), OSnLNodeSqrt::~OSnLNodeSqrt(), OSnLNodeSquare::~OSnLNodeSquare(), OSnLNodeSum::~OSnLNodeSum(), OSnLNodeTimes::~OSnLNodeTimes(), and OSnLNodeVariable::~OSnLNodeVariable().
ssymbolInt is the unique integer assigned to the OSnLNode
Definition at line 62 of file OSnLNode.h.
Referenced by CouenneSolver::createCouenneExpression(), OSInstance::getNonlinearExpressionTreeInInfix(), OSnLNodeVariable::getTokenNumber(), OSnLNodePI::getTokenNumber(), OSnLNodeE::getTokenNumber(), OSnLNodeNumber::getTokenNumber(), getTokenNumber(), getVariableIndexMap(), OSnLNodeAbs::OSnLNodeAbs(), OSnLNodeAllDiff::OSnLNodeAllDiff(), OSnLNodeCos::OSnLNodeCos(), OSnLNodeDivide::OSnLNodeDivide(), OSnLNodeE::OSnLNodeE(), OSnLNodeErf::OSnLNodeErf(), OSnLNodeExp::OSnLNodeExp(), OSnLNodeIf::OSnLNodeIf(), OSnLNodeLn::OSnLNodeLn(), OSnLNodeMax::OSnLNodeMax(), OSnLNodeMin::OSnLNodeMin(), OSnLNodeMinus::OSnLNodeMinus(), OSnLNodeNegate::OSnLNodeNegate(), OSnLNodeNumber::OSnLNodeNumber(), OSnLNodePI::OSnLNodePI(), OSnLNodePlus::OSnLNodePlus(), OSnLNodePower::OSnLNodePower(), OSnLNodeProduct::OSnLNodeProduct(), OSnLNodeSin::OSnLNodeSin(), OSnLNodeSqrt::OSnLNodeSqrt(), OSnLNodeSquare::OSnLNodeSquare(), OSnLNodeSum::OSnLNodeSum(), OSnLNodeTimes::OSnLNodeTimes(), and OSnLNodeVariable::OSnLNodeVariable().
inodeType is the number of children the node has, it is set to -1 if the number is not known a prior, e.g.
a sum node
Definition at line 67 of file OSnLNode.h.
Referenced by getTokenNumber(), OSnLNodeAbs::OSnLNodeAbs(), OSnLNodeAllDiff::OSnLNodeAllDiff(), OSnLNodeCos::OSnLNodeCos(), OSnLNodeDivide::OSnLNodeDivide(), OSnLNodeE::OSnLNodeE(), OSnLNodeErf::OSnLNodeErf(), OSnLNodeExp::OSnLNodeExp(), OSnLNodeIf::OSnLNodeIf(), OSnLNodeLn::OSnLNodeLn(), OSnLNodeMax::OSnLNodeMax(), OSnLNodeMin::OSnLNodeMin(), OSnLNodeMinus::OSnLNodeMinus(), OSnLNodeNegate::OSnLNodeNegate(), OSnLNodeNumber::OSnLNodeNumber(), OSnLNodePI::OSnLNodePI(), OSnLNodePlus::OSnLNodePlus(), OSnLNodePower::OSnLNodePower(), OSnLNodeProduct::OSnLNodeProduct(), OSnLNodeSin::OSnLNodeSin(), OSnLNodeSqrt::OSnLNodeSqrt(), OSnLNodeSquare::OSnLNodeSquare(), OSnLNodeSum::OSnLNodeSum(), OSnLNodeTimes::OSnLNodeTimes(), and OSnLNodeVariable::OSnLNodeVariable().
m_mChildren holds all the operands, that is nodes that the current node operate on.
Definition at line 72 of file OSnLNode.h.
Referenced by OSnLNodeIf::calculateFunction(), OSnLNodeErf::calculateFunction(), OSnLNodeAbs::calculateFunction(), OSnLNodeExp::calculateFunction(), OSnLNodeCos::calculateFunction(), OSnLNodeSin::calculateFunction(), OSnLNodeSquare::calculateFunction(), OSnLNodeSqrt::calculateFunction(), OSnLNodeLn::calculateFunction(), OSnLNodeProduct::calculateFunction(), OSnLNodePower::calculateFunction(), OSnLNodeDivide::calculateFunction(), OSnLNodeTimes::calculateFunction(), OSnLNodeNegate::calculateFunction(), OSnLNodeMinus::calculateFunction(), OSnLNodeMin::calculateFunction(), OSnLNodeMax::calculateFunction(), OSnLNodeAllDiff::calculateFunction(), OSnLNodeSum::calculateFunction(), OSnLNodePlus::calculateFunction(), OSnLNodeErf::constructADTape(), OSnLNodeAbs::constructADTape(), OSnLNodeExp::constructADTape(), OSnLNodeCos::constructADTape(), OSnLNodeSin::constructADTape(), OSnLNodeSquare::constructADTape(), OSnLNodeSqrt::constructADTape(), OSnLNodeLn::constructADTape(), OSnLNodeProduct::constructADTape(), OSnLNodePower::constructADTape(), OSnLNodeDivide::constructADTape(), OSnLNodeTimes::constructADTape(), OSnLNodeNegate::constructADTape(), OSnLNodeMinus::constructADTape(), OSnLNodeSum::constructADTape(), OSnLNodePlus::constructADTape(), CouenneSolver::createCouenneExpression(), createExpressionTreeFromPostfix(), createExpressionTreeFromPrefix(), OSgams2osil::createOSInstance(), OSInstance::getAllNonlinearExpressionTrees(), OSnLNodeVariable::getNonlinearExpressionInXML(), getNonlinearExpressionInXML(), getVariableIndexMap(), main(), OSnLNodeAbs::OSnLNodeAbs(), OSnLNodeCos::OSnLNodeCos(), OSnLNodeDivide::OSnLNodeDivide(), OSnLNodeE::OSnLNodeE(), OSnLNodeErf::OSnLNodeErf(), OSnLNodeExp::OSnLNodeExp(), OSnLNodeIf::OSnLNodeIf(), OSnLNodeLn::OSnLNodeLn(), OSnLNodeMinus::OSnLNodeMinus(), OSnLNodeNegate::OSnLNodeNegate(), OSnLNodeNumber::OSnLNodeNumber(), OSnLNodePI::OSnLNodePI(), OSnLNodePlus::OSnLNodePlus(), OSnLNodePower::OSnLNodePower(), OSnLNodeSin::OSnLNodeSin(), OSnLNodeSqrt::OSnLNodeSqrt(), OSnLNodeSquare::OSnLNodeSquare(), OSnLNodeTimes::OSnLNodeTimes(), OSnLNodeVariable::OSnLNodeVariable(), postOrderOSnLNodeTraversal(), preOrderOSnLNodeTraversal(), OSnl2osil::walkTree(), OSnLNodeAbs::~OSnLNodeAbs(), OSnLNodeAllDiff::~OSnLNodeAllDiff(), OSnLNodeCos::~OSnLNodeCos(), OSnLNodeDivide::~OSnLNodeDivide(), OSnLNodeE::~OSnLNodeE(), OSnLNodeErf::~OSnLNodeErf(), OSnLNodeExp::~OSnLNodeExp(), OSnLNodeIf::~OSnLNodeIf(), OSnLNodeLn::~OSnLNodeLn(), OSnLNodeMax::~OSnLNodeMax(), OSnLNodeMin::~OSnLNodeMin(), OSnLNodeMinus::~OSnLNodeMinus(), OSnLNodeNegate::~OSnLNodeNegate(), OSnLNodeNumber::~OSnLNodeNumber(), OSnLNodePI::~OSnLNodePI(), OSnLNodePlus::~OSnLNodePlus(), OSnLNodePower::~OSnLNodePower(), OSnLNodeProduct::~OSnLNodeProduct(), OSnLNodeSin::~OSnLNodeSin(), OSnLNodeSqrt::~OSnLNodeSqrt(), OSnLNodeSquare::~OSnLNodeSquare(), OSnLNodeSum::~OSnLNodeSum(), OSnLNodeTimes::~OSnLNodeTimes(), and OSnLNodeVariable::~OSnLNodeVariable().
double OSnLNode::m_dFunctionValue |
m_dFunctionValue holds the function value given the current variable values.
Definition at line 77 of file OSnLNode.h.
Referenced by OSnLNodeVariable::calculateFunction(), OSnLNodePI::calculateFunction(), OSnLNodeE::calculateFunction(), OSnLNodeNumber::calculateFunction(), OSnLNodeIf::calculateFunction(), OSnLNodeErf::calculateFunction(), OSnLNodeAbs::calculateFunction(), OSnLNodeExp::calculateFunction(), OSnLNodeCos::calculateFunction(), OSnLNodeSin::calculateFunction(), OSnLNodeSquare::calculateFunction(), OSnLNodeSqrt::calculateFunction(), OSnLNodeLn::calculateFunction(), OSnLNodeProduct::calculateFunction(), OSnLNodePower::calculateFunction(), OSnLNodeDivide::calculateFunction(), OSnLNodeTimes::calculateFunction(), OSnLNodeNegate::calculateFunction(), OSnLNodeMinus::calculateFunction(), OSnLNodeMin::calculateFunction(), OSnLNodeMax::calculateFunction(), OSnLNodeAllDiff::calculateFunction(), OSnLNodeSum::calculateFunction(), and OSnLNodePlus::calculateFunction().
m_ADTape stores the espression tree for the this OSnLNode as an ADdouble.
Definition at line 83 of file OSnLNode.h.
Referenced by OSnLNodeVariable::constructADTape(), OSnLNodePI::constructADTape(), OSnLNodeE::constructADTape(), OSnLNodeNumber::constructADTape(), OSnLNodeIf::constructADTape(), OSnLNodeErf::constructADTape(), OSnLNodeAbs::constructADTape(), OSnLNodeExp::constructADTape(), OSnLNodeCos::constructADTape(), OSnLNodeSin::constructADTape(), OSnLNodeSquare::constructADTape(), OSnLNodeSqrt::constructADTape(), OSnLNodeLn::constructADTape(), OSnLNodeProduct::constructADTape(), OSnLNodePower::constructADTape(), OSnLNodeDivide::constructADTape(), OSnLNodeTimes::constructADTape(), OSnLNodeNegate::constructADTape(), OSnLNodeMinus::constructADTape(), OSnLNodeMin::constructADTape(), OSnLNodeMax::constructADTape(), OSnLNodeAllDiff::constructADTape(), OSnLNodeSum::constructADTape(), and OSnLNodePlus::constructADTape().