- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# OSExpressionTree Class Reference

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

`#include <OSExpressionTree.h>`

Collaboration diagram for OSExpressionTree:

[legend]
List of all members.

## Public Member Functions
| OSExpressionTree ()
| default constructor.
| ~OSExpressionTree ()
| default destructor.
bool | IsEqual (OSExpressionTree *that)
| A function to check for the equality of two objects.
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
OSnLNode * | m_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 constructADTape(std::map<int, int> *varIdx, AD::vector< AD<double> > *XAD) to generate the infix expression for AD -- 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 | bADMustReTape
| is true if a AD 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
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.

Definition at line 25 of file OSExpressionTree.cpp.

OSExpressionTree::~OSExpressionTree | ( |  | ) |

default destructor.

Definition at line 34 of file OSExpressionTree.cpp.

References bDestroyNlNodes, m_treeRoot, and mapVarIdx.

## Member Function Documentation

bool OSExpressionTree::IsEqual | ( | OSExpressionTree * | that | ) |

A function to check for the equality of two objects.

Definition at line 85 of file OSExpressionTree.cpp.

References m_treeRoot.

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.

Definition at line 59 of file OSExpressionTree.cpp.

References OSnLNode::calculateFunction(), m_dTreeRootValue, and m_treeRoot.

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.

Definition at line 53 of file OSExpressionTree.cpp.

References OSnLNode::getPrefixFromExpressionTree(), and m_treeRoot.

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.

Definition at line 48 of file OSExpressionTree.cpp.

References OSnLNode::getPostfixFromExpressionTree(), and m_treeRoot.

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.

Definition at line 70 of file OSExpressionTree.cpp.

References OSnLNode::getVariableIndexMap(), m_bIndexMapGenerated, m_treeRoot, and mapVarIdx.

Referenced by OSInstance::addQTermsToExressionTree(), OSInstance::getAllNonlinearVariablesIndexMap(), and OSInstance::getLagrangianExpTree().

## Member Data Documentation

OSnLNode* OSExpressionTree::m_treeRoot

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

Definition at line 42 of file OSExpressionTree.h.

Referenced by OSInstance::addQTermsToExressionTree(), CouenneSolver::buildSolverInstance(), calculateFunction(), OSgams2osil::createOSInstance(), OSInstance::getAllNonlinearExpressionTrees(), OSInstance::getLagrangianExpTree(), OSInstance::getNonlinearExpressionTreeInPostfix(), OSInstance::getNonlinearExpressionTreeInPrefix(), OSInstance::getNonlinearExpressionTreeModInPostfix(), OSInstance::getNonlinearExpressionTreeModInPrefix(), getPostfixFromExpressionTree(), getPrefixFromExpressionTree(), OSInstance::getSparseJacobianFromColumnMajor(), getVariableIndiciesMap(), IsEqual(), main(), OSInstance::setQuadraticTermsInNonlinearExpressions(), and ~OSExpressionTree().

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

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

Definition at line 102 of file OSExpressionTree.h.

Referenced by OSInstance::addQTermsToExressionTree(), OSInstance::getAllNonlinearVariablesIndexMap(), OSInstance::getFirstOrderResults(), OSInstance::getSecondOrderResults(), getVariableIndiciesMap(), and ~OSExpressionTree().

bool OSExpressionTree::m_bIndexMapGenerated

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

Definition at line 116 of file OSExpressionTree.h.

Referenced by OSInstance::addQTermsToExressionTree(), OSInstance::getAllNonlinearVariablesIndexMap(), and getVariableIndiciesMap().

bool OSExpressionTree::bADMustReTape

is true if a AD 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 122 of file OSExpressionTree.h.

bool OSExpressionTree::bDestroyNlNodes

m_bDestroyNlNodes if the destructor deletes the OSnLNodes in the Expression tree

Definition at line 127 of file OSExpressionTree.h.

Referenced by OSInstance::getAllNonlinearExpressionTrees(), and ~OSExpressionTree().

double OSExpressionTree::m_dTreeRootValue`[private]`

m_dTreeRootValue is the function value of the root node

Definition at line 136 of file OSExpressionTree.h.

Referenced by calculateFunction().

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

- /home/coin/SVN-release/OS-2.3.5/OS/src/OSCommonInterfaces/OSExpressionTree.h
- /home/coin/SVN-release/OS-2.3.5/OS/src/OSCommonInterfaces/OSExpressionTree.cpp