OSExpressionTree Class Reference

Used to hold the instance in memory. More...

#include <OSExpressionTree.h>

Collaboration diagram for OSExpressionTree:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 OSExpressionTree ()
 default constructor.
 ~OSExpressionTree ()
 default destructor.
double calculateFunction (double *x, bool new_x)
 Calculate the expression tree function value given the current variable values using the calculateFunciton method of OSnLNode.
std::vector< OSnLNode * > getPrefixFromExpressionTree ()
 Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in prefix format.
std::vector< OSnLNode * > getPostfixFromExpressionTree ()
 Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in postfix format.
std::map< int, int > * getVariableIndiciesMap ()
 Retrieve a map of the indicies of the variables that are in the expression tree.

Public Attributes

OSnLNodem_treeRoot
 m_treeRoot holds the root node (of OSnLNode type) of the expression tree.
std::map< int, int > * mapVarIdx
 m_mvarIdx is a map used by constructCppADTape(std::map<int, int> *varIdx, CppAD::vector< AD<double> > *XAD) to generate the infix expression for CPPAD -- the key is idx a variable number, the value of the map is the corresponding variable count in sparse representation
bool m_bIndexMapGenerated
 m_bIndexMapGenerated is set to true if getVariableIndiciesMap() has been called
bool bCppADMustReTape
 is true if a CppAD Expresion Tree has an expression that can change depending on the value of the input, e.g.
bool bDestroyNlNodes
 m_bDestroyNlNodes if the destructor deletes the OSnLNodes in the Expression tree

Private Attributes

std::map< int, int >::iterator m_mPosVarIdx
 posVarIdx is a map iterator used by the map varIdx
CppAD::AD< double > m_CppADTape
 m_CppADTape stores the espression tree for m_treeRoot as an AD<double>.
double m_dTreeRootValue
 m_dTreeRootValue is the function value of the root node

Detailed Description

Used to hold the instance in memory.

Remarks:
This class stores the OSiL instance in memory as an expression tree.

Definition at line 35 of file OSExpressionTree.h.


Constructor & Destructor Documentation

OSExpressionTree::OSExpressionTree (  ) 

default constructor.

OSExpressionTree::~OSExpressionTree (  ) 

default destructor.


Member Function Documentation

double OSExpressionTree::calculateFunction ( double *  x,
bool  new_x 
)

Calculate the expression tree function value given the current variable values using the calculateFunciton method of OSnLNode.

If the function has been calculated, the method will retrieve it.

Parameters:
x holds the values of the variables in a double array.
new_x is false if any evaluation method was previously called for the current x
Returns:
the expression tree function value given the current variable values.
std::vector<OSnLNode*> OSExpressionTree::getPrefixFromExpressionTree (  ) 

Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in prefix format.

Returns:
the expression tree as a vector of OSnLNodes in prefix.
std::vector<OSnLNode*> OSExpressionTree::getPostfixFromExpressionTree (  ) 

Get a vector of pointers to OSnLNodes that correspond to the OSExpressionTree in postfix format.

Returns:
the expression tree as a vector of OSnLNodes in postfix.
std::map<int, int>* OSExpressionTree::getVariableIndiciesMap (  ) 

Retrieve a map of the indicies of the variables that are in the expression tree.

Returns:
a map of the variables in the current expression tree.

Member Data Documentation

m_treeRoot holds the root node (of OSnLNode type) of the expression tree.

Definition at line 42 of file OSExpressionTree.h.

std::map<int, int>* OSExpressionTree::mapVarIdx

m_mvarIdx is a map used by constructCppADTape(std::map<int, int> *varIdx, CppAD::vector< AD<double> > *XAD) to generate the infix expression for CPPAD -- the key is idx a variable number, the value of the map is the corresponding variable count in sparse representation

Definition at line 97 of file OSExpressionTree.h.

m_bIndexMapGenerated is set to true if getVariableIndiciesMap() has been called

Definition at line 111 of file OSExpressionTree.h.

is true if a CppAD Expresion Tree has an expression that can change depending on the value of the input, e.g.

an if statement -- false by default

Definition at line 117 of file OSExpressionTree.h.

m_bDestroyNlNodes if the destructor deletes the OSnLNodes in the Expression tree

Definition at line 122 of file OSExpressionTree.h.

std::map<int, int>::iterator OSExpressionTree::m_mPosVarIdx [private]

posVarIdx is a map iterator used by the map varIdx

Definition at line 130 of file OSExpressionTree.h.

m_CppADTape stores the espression tree for m_treeRoot as an AD<double>.

Definition at line 135 of file OSExpressionTree.h.

m_dTreeRootValue is the function value of the root node

Definition at line 141 of file OSExpressionTree.h.


The documentation for this class was generated from the following file:

Generated on 15 Mar 2015 for Coin-All by  doxygen 1.6.1