/home/coin/SVN-release/OS-1.0.0/OS/src/OSCommonInterfaces/OSnLNode.cpp

Go to the documentation of this file.
00001 
00017 #include "OSnLNode.h"
00018 #include "ErrorClass.h"
00019 #include "OSParameters.h"
00020 
00021 #include<string>
00022 
00023 #ifdef HAVE_CMATH
00024 # include <cmath>
00025 #else
00026 # ifdef HAVE_MATH_H
00027 #  include <math.h>
00028 # else
00029 #  error "don't have header file for math"
00030 # endif
00031 #endif
00032 
00033 
00034 #include <iostream>
00035 #include <sstream>  
00036 
00037 
00038 using std::ostringstream;
00039 using std::cout;
00040 using std::endl;
00041   
00042 
00043  
00044 //
00045 //const std::string msnodeNames[] = {
00046 //      /*1--*/"plus", "sum", "minus", "negate", "times", "divide",
00047 //      "quotient", "rem", "power", "product",
00048 //      /*2--*/"abs", "floor", "ceiling", "percent", "square", "squareRoot", "ln", "log", "log10", "exp",
00049 //      "factorial", "combination", "permutation", "gcd", "lcm", "roundToInt", "round", "truncate", "sign", "rand","gammaFn", "gammaLn",
00050 //      /*3--*/"sin", "cos", "tan", "arcsin", "arccos", "arctan", "sinh", "cosh", "tanh", "arcsinh", "arccosh", "arctanh",
00051 //      "cot", "coth", "arccot", "arccoth", "sec", "sech", "arcsec", "arcsech", "csc", "csch", "arccsc", "arccsch",
00052 //      /*4--*/"mean", "geometricMean", "harmonicMean", "trimMean", "count", "median", "firstQuartile", "thirdQuartile", "mode", "min", "max",
00053 //      "percentile", "large", "small", "range", "interQuantileRange", "absdev", "stddev", "variance", "cv", "skewness", "kurtosis",
00054 //      "covariance", "correlation", "pearsonCorrelation", "rankCorrelation", "autoCorrelation1", "autoCorrelation", "npv", "irr", 
00055 //      /*"empiricalDiscreteDist", "empiricalDiscreteCum", */"discreteUniformDist", "discreteUniformCum", "discreteUniformInv",
00056 //      "bernoulliDist", "bernoulliCum", "bernoulliInv", "binomialDist", "binomialCum", "binomialInv", "multinomialDist", "multinomialCum", "multinomialInv",
00057 //      "hypergeometricDist", "hypergeometricCum", "hypergeometricInv", "poissonDist", "poissonCum", "poissonInv",
00058 //      "geometricDist", "geometricCum", "geometricInv", "negativeBinomialDist", "negativeBinomialCum", "negativeBinomialInv",
00059 //      /*"empiricalContinousDist", "empiricalContinuousCum",*/ "uniformDist", "uniformCum", "uniformInv",
00060 //      "normalDist", "normalCum", "normalInv", "stdNormalDist", "stdNormalCum", "stdNormalInv", "bivariateNormalDist", "bivariateNormalCum",
00061 //      "exponentialDist", "exponentialCum", "exponentialInv", "weibullDist", "weibullCum", "weibullInv", "erlangDist", "erlangCum", "erlangInv",
00062 //      "gammaDist", "gammaCum", "gammaInv", "betaDist", "betaCum", "betaInv", "betaGeneralDist", "betaGeneralCum", "betaGeneralInv",
00063 //      "lognormalDist", "lognormalCum", "lognormalInv", "cauchyDist", "cauchyCum", "cauchyInv", "tDist", "tCum", "tInv",
00064 //      "chiSquareDist", "chiSquareCum", "chiSquareInv", "fDist", "fCum", "fInv", "logisticDist", "logisticCum", "logisticInv",
00065 //      "logLogisticDist", "logLogisticCum", "logLogisticInv", "logarithmicDist", "logarithmicCum", "logarithmicInv",
00066 //      "paretoDist", "paretoCum", "paretoDist", "rayleighDist", "rayleighCum", "rayleighInv", "pertDist", "pertCum", "pertDist",
00067 //      "triangularDist", "triangularCum", "triangularInv", "unitNormalLinearLoss",
00068 //      /*5--*/"number", "identifier", "PI", "E", "INF", "EPS", "TRUE", "FALSE", "EULERGAMMA", "NAN",
00069 //      /*6--*/"variable", "objective", "constraint", "parameter",
00070 //      /*7--*/"if", "lt", "leq", "gt", "geq", "eq", "neq", "and", "or", "xor", "implies", "not",
00071 //      "forAll", "exists", "logicCount", "allDiff", /*"allDisjoint",*/ "atMost", "atLeast", "exactly", 
00072 //      "inSet", "inRealSet", "inPositiveRealSet", "inNonnegativeRealSet", "inIntegerSet", "inPositiveIntegerSet","inNonnegativeIntegerSet",
00073 //      /*8--*/
00074 //      /*9--*/"qTerm", "quadratic", "sim", "simInput", "simOutput", "userF", "arg", "xPath", "xPathIndex",
00075 //      "nodeRef", "arcRef", "complements", /*"prob",*/
00076 //};
00077 
00078 
00079 
00080  
00081 //const int m_miNodeIndexes[] = {
00082 //      /*1--*/1001, 1002, 1003, 1004, 1005, 1006,
00083 //      1007, 1008, 1009, 1010,
00084 //      /*2--*/2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
00085 //      2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022,
00086 //      /*3--*/3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 3011, 3012,
00087 //      3013, 3014, 3015, 3016, 3017, 3018, 3019, 3020, 3021, 3022, 3023, 3024,
00088 //      /*4--*/4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011,
00089 //      4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022,
00090 //      4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030,
00091 //      /*4101, 4102, */4111, 4112, 4113,
00092 //      4121, 4122, 4123, 4131, 4132, 4133, 4141, 4142, 4143,
00093 //      4151, 4152, 4153, 4161, 4162, 4163,
00094 //      4171, 4172, 4173, 4181, 4182, 4183,
00095 //      /*4401, 4402,*/ 4411, 4412, 4413,
00096 //      4421, 4422, 4423, 4431, 4432, 4433, 4441, 4442,
00097 //      4451, 4452, 4453, 4461, 4462, 4463, 4471, 4472, 4473,
00098 //      4481, 4482, 4483, 4491, 4492, 4493, 4501, 4502, 4503,
00099 //      4511, 4512, 4513, 4521, 4522, 4523, 4531, 4532, 4533,
00100 //      4541, 4542, 4543, 4551, 4552, 4553, 4561, 4562, 4563,
00101 //      4571, 4572, 4573, 4581, 4582, 4583,
00102 //      4591, 4592, 4593, 4601, 4602, 4603, 4611, 4612, 4613,
00103 //      4621, 4622, 4623, 4624,
00104 //      /*5--*/5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010,
00105 //      /*6--*/6001, 6002, 6003, 6004,
00106 //      /*7--*/7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012,
00107 //      7013, 7014, 7015, 7016, /*7017,*/ 7018, 7019, 7020, 
00108 //      7021, 7022, 7023, 7024, 7025, 7026, 7027,
00109 //      /*8--*/
00110 //      /*9--*/9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009,
00111 //      9010, 9011, 9012, /*9013,*/
00112 //};
00113 
00114 //const int m_miNodeTypes[] = {
00115 //      /*1--*/2, -1, 2, 1, 2, 2,
00116 //      2, 2, 2, -1,
00117 //      /*2--*/1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
00118 //      1, 2, 2, -1, -1, 1, 2, 2, 1, 1, 1, 1,
00119 //      /*3--*/1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00120 //      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00121 //      /*4--*/-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00122 //      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00123 //      -1, -1, -1, -1, -1, -1, -1, -1,
00124 //      /*-1, -1, */2, 2, 2,
00125 //      2, 2, 2, 3, 3, 3, -1, -1, -1,
00126 //      4, 4, 4, 2, 2, 2,
00127 //      2, 2, 2, 3, 3, 3,
00128 //      /*-1, -1,*/ 3, 3, 3,
00129 //      3, 3, 3, 1, 1, 1, 7, 7,
00130 //      2, 2, 2, 4, 4, 4, 3, 3, 3,
00131 //      3, 3, 3, 3, 3, 3, 5, 5, 5,
00132 //      3, 3, 3, 3, 3, 3, 2, 2, 2,
00133 //      2, 2, 2, 3, 3, 3, 3, 3, 3,
00134 //      3, 3, 3, 3, 3, 3,
00135 //      3, 3, 3, 2, 2, 2, 4, 4, 4,
00136 //      4, 4, 4, 1,
00137 //      /*5--*/0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00138 //      /*6--*/-1, -1, -1, 0,
00139 //      /*7--*/3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
00140 //      -1, -1, -1, -1, /*-1,*/ -1, -1, -1, 
00141 //      -1, 1, 1, 1, 1, 1, 1
00142 //      /*8--*/
00143 //      /*9--*/-1, -1, -1, -1, -1, -1, 0, -1, -1,
00144 //      -1, -1, 2, /*1,*/
00145 //};
00146 
00147 
00148 
00149 
00150 //
00151 //OSnLNode methods
00152 //
00153 
00154 OSnLNode::OSnLNode():
00155         snodeName(""),
00156         m_mChildren(NULL),
00157         m_dFunctionValue( OSNAN)
00158         //inumberOfChildren( 0)
00159 {
00160 }//end OSnLNode
00161 
00162 OSnLNode::~OSnLNode(){
00163         #ifdef DEBUGOSNLNODE
00164         cout << "inside OSnLNode destructor" << endl;
00165         #endif
00166 }//end ~OSnLNode
00167 
00168 
00169 OSnLNode* OSnLNode::createExpressionTreeFromPostfix(std::vector<OSnLNode*> nlNodeVec){
00170         std::vector<OSnLNode*> stackVec ;
00171         unsigned int kount =  0;
00172         while(kount <= nlNodeVec.size() - 1){
00173                 int numkids = nlNodeVec[kount]->inumberOfChildren;
00174                 if(numkids  > 0){
00175                         for(int i = numkids - 1; i >= 0;  i--){
00176                                 nlNodeVec[kount]->m_mChildren[i] = stackVec.back()      ;
00177                                 stackVec.pop_back();
00178                         }
00179                 }
00180                 stackVec.push_back( nlNodeVec[kount]);
00181                 kount++;
00182         }
00183         stackVec.clear();
00184         return nlNodeVec[ kount - 1];
00185 }//end createExpressionTreeFromPostfix
00186 
00187 std::vector<OSnLNode*> OSnLNode::getPostfixFromExpressionTree( ){
00188         std::vector<OSnLNode*> postfixVector;
00189         return postOrderOSnLNodeTraversal( &postfixVector);
00190 }//getPostfixFromExpressionTree
00191 
00192 std::vector<OSnLNode*> OSnLNode::postOrderOSnLNodeTraversal( std::vector<OSnLNode*> *postfixVector){
00193         if(inumberOfChildren > 0){
00194                 int i;
00195                 for(i = 0; i < inumberOfChildren; i++) 
00196                         m_mChildren[i]->postOrderOSnLNodeTraversal( postfixVector);
00197         }
00198         (*postfixVector).push_back( this);
00199         return *postfixVector;
00200 }//end postOrderOSnLNodeTraversal()
00201 
00202 OSnLNode* OSnLNode::createExpressionTreeFromPrefix(std::vector<OSnLNode*> nlNodeVec){
00203         std::vector<OSnLNode*> stackVec;
00204         int kount =  nlNodeVec.size() - 1;
00205         while(kount >= 0){
00206                 int numkids = nlNodeVec[kount]->inumberOfChildren;
00207                 if(numkids > 0){
00208                         for(int i = 0; i < numkids;  i++){
00209                                 nlNodeVec[kount]->m_mChildren[i] = stackVec.back()      ;
00210                                 stackVec.pop_back();
00211                         }
00212                 }
00213                 stackVec.push_back( nlNodeVec[kount]);
00214                 kount--;
00215         }
00216         stackVec.clear();
00217         return nlNodeVec[ 0];
00218 }//end createExpressionTreeFromPrefix
00219 
00220 std::vector<OSnLNode*> OSnLNode::getPrefixFromExpressionTree(){
00221         std::vector<OSnLNode*> prefixVector;
00222         return preOrderOSnLNodeTraversal( &prefixVector);
00223 }//getPrefixFromExpressionTree
00224 
00225 std::vector<OSnLNode*> OSnLNode::preOrderOSnLNodeTraversal( std::vector<OSnLNode*> *prefixVector){
00226         (*prefixVector).push_back( this);
00227         if(inumberOfChildren > 0){
00228                 for(int i = 0; i < inumberOfChildren; i++)
00229                         m_mChildren[i]->preOrderOSnLNodeTraversal( prefixVector);
00230         }
00231         return *prefixVector;
00232 }//end preOrderOSnLNodeTraversal
00233 
00234 
00235 std::string OSnLNode::getTokenNumber(){
00236         ostringstream outStr;
00237         outStr << inodeInt;
00238         // when I creat an OSnLNode from a token number, I need to know how many children there are
00239         if(inodeType == -1){
00240                 outStr << "[";
00241                 outStr << inumberOfChildren ;
00242                 outStr << "]";
00243         }
00244         return outStr.str();
00245 }//getTokenNumber
00246 
00247 
00248 std::string OSnLNode::getTokenName(){
00249         ostringstream outStr;
00250         outStr << this->snodeName;
00251         if(inodeType == -1){
00252                 outStr << "[";
00253                 outStr << inumberOfChildren ;
00254                 outStr << "]";
00255         }
00256         return outStr.str();
00257 }//getTokenNumber
00258 
00259 
00260 /*
00261 OSnLNode* OSnLNode::getOSnLNodeFromToken(std::string sToken){
00262 // kipp possibly make this a static method or put it somewhere else
00263         OSnLNode *nlNodePoint;
00264         int nodeID ;
00265         int pos1, pos2;
00266         std::string str1, str2;
00267         // convert the std::string tokens into the appropriate objects
00268                 // kipp -- put in error check -- make sure > 0 and < 10001
00269         nodeID = atoi(  &sToken.substr(0, 4)[0]);
00270         switch (nodeID){
00271                 case OS_SUM:  // the sum token
00272                         pos1 = sToken.find('[');
00273                         pos2 = sToken.find(']');
00274                         if((pos1 == std::string::npos) || (pos2 == std::string::npos)){
00275                                 // throw error
00276                         }
00277                         OSnLNodeSum *nlNodePointSum;
00278                         nlNodePointSum = new OSnLNodeSum();
00279                         nlNodePointSum->inumberOfChildren = atoi(  &sToken.substr(pos1 + 1, pos2 - pos1 - 1)[0]);
00280                         nlNodePointSum->m_mChildren = new OSnLNode*[ nlNodePointSum->inumberOfChildren];
00281                         return nlNodePointSum;
00282                 break;
00283                 case OS_MAX:  // the max token
00284                         pos1 = sToken.find('[');
00285                         pos2 = sToken.find(']');
00286                         if((pos1 == std::string::npos) || (pos2 == std::string::npos)){
00287                                 // throw error
00288                         }
00289                         OSnLNodeMax *nlNodePointMax;
00290                         nlNodePointMax = new OSnLNodeMax();
00291                         nlNodePointMax->inumberOfChildren = atoi(  &sToken.substr(pos1 + 1, pos2 - pos1 - 1)[0]);
00292                         nlNodePointMax->m_mChildren = new OSnLNode*[ nlNodePointMax->inumberOfChildren];
00293                         return nlNodePointMax;
00294                 break;
00295                 case OS_PRODUCT:  // the product token
00296                         pos1 = sToken.find('[');
00297                         pos2 = sToken.find(']');
00298                         if((pos1 == std::string::npos) || (pos2 == std::string::npos)){
00299                                 // throw error
00300                         }
00301                         OSnLNodeProduct *nlNodePointProduct;
00302                         nlNodePointProduct = new OSnLNodeProduct();
00303                         nlNodePointProduct->inumberOfChildren = atoi(  &sToken.substr(pos1 + 1, pos2 - pos1 - 1)[0]);
00304                         nlNodePointProduct->m_mChildren = new OSnLNode*[ nlNodePointProduct->inumberOfChildren];
00305                         return nlNodePointProduct;
00306                 break;
00307                 case OS_NUMBER:  // the number token
00308                         pos1 = sToken.find(':');
00309                         if(pos1 != 4){
00310                                 //throw error
00311                         }
00312                         // now get the second semicolon, the one that should be after value                             
00313                         pos2 = sToken.find(':', pos1 + 1);
00314                         if(pos2 != std::string::npos) {
00315                         }
00316                         else{
00317                                 //throw error
00318                         }
00319                         OSnLNodeNumber *nlNodePointNumber; 
00320                         nlNodePointNumber = new OSnLNodeNumber();
00321                         nlNodePointNumber->value = atof(  &sToken.substr(pos1 + 1, pos2 - pos1 - 1)[0]);
00322                         return nlNodePointNumber;
00323                 break;
00324                 case OS_VARIABLE:  // the variable token
00325                         pos1 = sToken.find('[');
00326                         pos2 = sToken.find(']');
00327                         if((pos1 == std::string::npos) || (pos2 == std::string::npos)){
00328                                 // throw error
00329                         }
00330                         OSnLNodeVariable *nlNodePointVariable;
00331                         nlNodePointVariable = new OSnLNodeVariable();
00332                         nlNodePointVariable->inumberOfChildren = atoi(  &sToken.substr(pos1 + 1, pos2 - pos1 - 1)[0]);
00333                         nlNodePointVariable->m_mChildren = new OSnLNode*[ nlNodePointVariable->inumberOfChildren];
00334                         // throw error if there is more than one child
00335                         // now get the index and the coefficient
00336                         pos1 = sToken.find(':');
00337                         if(pos1 != 4){
00338                                 //throw error
00339                         }
00340                         // now get the second semicolon, the one that should be after idx                               
00341                         pos2 = sToken.find(':', pos1 + 1);
00342                         if(pos2 == std::string::npos) {
00343                                 //throw error
00344                         }
00345                         nlNodePointVariable->idx = atoi(  &sToken.substr(pos1 + 1, pos2 - pos1 - 1)[0]);
00346                         // now get the coefficient
00347                         str1 = sToken;
00348                         str2 = sToken.substr(pos2 + 1, str1.length() - pos2 - 1);
00349                         nlNodePointVariable->coef = atof(&str2[0]);
00350                         return nlNodePointVariable;
00351                 break;
00352                 default:
00353                         nlNodePoint = nlNodeArray[ nlNodeIdxMap[ nodeID]]->cloneOSnLNode();
00354                 
00355                 break;
00356         }
00357         return nlNodePoint;
00358 }//end getOSnLNodeFromToken
00359 */
00360 
00361 
00362 
00363 std::string OSnLNode::getNonlinearExpressionInXML(){
00364         ostringstream outStr;
00365         outStr << "<" ;
00366         outStr << snodeName;
00367         if(inumberOfChildren > 0) {
00368                 outStr << ">";
00369         }
00370         else{
00371                 outStr << "/>";
00372         }
00373         if(inumberOfChildren > 0){
00374                 for(int i = 0; i < inumberOfChildren; i++){
00375                         outStr << m_mChildren[i]->getNonlinearExpressionInXML();
00376                 }
00377         }
00378         if(inumberOfChildren > 0) {
00379                 outStr << "</" ;
00380                 outStr << snodeName ;
00381                 outStr << ">" ;
00382         }
00383         return outStr.str();
00384 }//getNonlinearExpressionInXML()
00385 //
00386 //
00387 
00388 
00389 void OSnLNode::getVariableIndexMap(std::map<int, int> *varIdx){
00390         int i;
00391         if(inodeInt != OS_VARIABLE){
00392                 for(i = 0; i < inumberOfChildren; i++){
00393                         m_mChildren[ i]->getVariableIndexMap( varIdx);
00394                 }
00395         }
00396 }//getVariableIndexMap
00397         
00398 // OSnLNodePlus Methods 
00399 OSnLNodePlus::OSnLNodePlus()
00400 {
00401         snodeName = "plus";
00402         inumberOfChildren = 2;
00403         m_mChildren = new OSnLNode*[2];
00404         m_mChildren[ 0] = NULL;
00405         m_mChildren[ 1] = NULL;
00406         inodeInt = 1001;
00407         inodeType = 2;
00408 }//end OSnLNodePlus
00409 
00410 OSnLNodePlus::~OSnLNodePlus(){
00411         #ifdef DEBUGOSNLNODE
00412         cout << "inside OSnLNodePlus destructor" << endl;
00413         #endif
00414         for(int i = 0; i < inumberOfChildren; i++){
00415                 if( m_mChildren[ i] != NULL) delete m_mChildren[ i];
00416                 m_mChildren[i] = NULL;
00417         }
00418         m_mChildren = NULL;
00419 }//end ~OSnLNodePlus
00420 
00421 
00422 double OSnLNodePlus::calculateFunction(double *x){
00423         m_dFunctionValue = m_mChildren[0]->calculateFunction(x) + m_mChildren[1]->calculateFunction(x);
00424         return m_dFunctionValue;
00425 }// end OSnLNodePlus::calculate
00426 
00427 
00428 AD<double> OSnLNodePlus::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00429         m_CppADTape = m_mChildren[0]->constructCppADTape( cppADIdx,  XAD) + m_mChildren[1]->constructCppADTape( cppADIdx,  XAD);
00430         return m_CppADTape;
00431 }// end OSnLNodePlus::constructCppADTape
00432 
00433 
00434 OSnLNode* OSnLNodePlus::cloneOSnLNode(){
00435         OSnLNode *nlNodePoint;
00436         nlNodePoint = new OSnLNodePlus();
00437         return  nlNodePoint;
00438 }//end OSnLNodePlus::cloneOSnLNode
00439 
00440 //
00441 // OSnLNodeSum Methods  
00442 OSnLNodeSum::OSnLNodeSum()
00443 {
00444         inumberOfChildren = 0;
00445         snodeName = "sum";
00446         inodeInt = 1002;
00447         inodeType = -1;
00448 }//end OSnLNodeSum
00449 
00450 OSnLNodeSum::~OSnLNodeSum(){
00451         #ifdef DEBUGOSNLNODE
00452         cout << "inside OSnLNodeSum destructor" << endl;
00453         #endif
00454         if(inumberOfChildren > 0){
00455                 for(int i = 0; i < inumberOfChildren; i++){
00456                         delete m_mChildren[ i];
00457                         m_mChildren[i] = NULL;
00458                 }
00459         }
00460         m_mChildren = NULL;
00461 }//end ~OSnLNodeSum
00462 
00463 double OSnLNodeSum::calculateFunction(double *x){
00464         m_dFunctionValue = 0.0;
00465         int i;
00466         for(i = 0; i < inumberOfChildren; i++){
00467                 m_dFunctionValue = m_dFunctionValue + m_mChildren[i]->calculateFunction(x);
00468         }
00469         return m_dFunctionValue;
00470 }// end OSnLNodeSum::calculate
00471 
00472 
00473 AD<double> OSnLNodeSum::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00474         m_CppADTape = 0.0;
00475         int i;
00476         for(i = 0; i < inumberOfChildren; i++){
00477                         m_CppADTape = m_CppADTape + m_mChildren[i]->constructCppADTape( cppADIdx, XAD);
00478         }
00479         return m_CppADTape;
00480 }// end OSnLNodeSum::constructCppADTape
00481 
00482 OSnLNode* OSnLNodeSum::cloneOSnLNode(){
00483         OSnLNode *nlNodePoint;
00484         nlNodePoint = new OSnLNodeSum();
00485         return  nlNodePoint;
00486 }//end OSnLNodeSum::cloneOSnLNode
00487 //end OSnLNodeSum methods
00488 
00489 
00490 //
00491 // OSnLNodeAllDiff Methods      
00492 OSnLNodeAllDiff::OSnLNodeAllDiff()
00493 {
00494         inumberOfChildren = 0;
00495         snodeName = "allDiff";
00496         inodeInt = 7016;
00497         inodeType = -1;
00498 }//end OSnLNodeAllDiff
00499 
00500 OSnLNodeAllDiff::~OSnLNodeAllDiff(){
00501         #ifdef DEBUGOSNLNODE
00502         cout << "inside OSnLNodeAllDiff destructor" << endl;
00503         #endif
00504         if(inumberOfChildren > 0){
00505                 for(int i = 0; i < inumberOfChildren; i++){
00506                         delete m_mChildren[ i];
00507                         m_mChildren[i] = NULL;
00508                 }
00509         }
00510         m_mChildren = NULL;
00511 }//end ~OSnLNodeAllDiff
00512 
00513 double OSnLNodeAllDiff::calculateFunction(double *x){
00514         m_dFunctionValue = 1;
00515         // return a false if not all all different
00516         int i, k;
00517         if(inumberOfChildren > 1){
00518                 for(i = 0; i < inumberOfChildren - 1; i++){
00519                         for(k = i + 1; k < inumberOfChildren; k++){
00520                                 if(m_mChildren[i]->calculateFunction(x) ==  
00521                                         m_mChildren[k]->calculateFunction(x)) return 0 ;
00522                         }
00523                 }
00524         }
00525         return m_dFunctionValue;
00526 }// end OSnLNodeAllDiff::calculate
00527 
00528 
00529 AD<double> OSnLNodeAllDiff::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00530         try{
00531                 throw ErrorClass("AllDifferent operator not supported by current Algorithmic Differentiation implementation");
00532                 return m_CppADTape;
00533         }
00534         catch(const ErrorClass& eclass){
00535                 throw ErrorClass( eclass.errormsg);
00536         }
00537         return m_CppADTape;
00538 }// end OSnLNodeAllDiff::constructCppADTape
00539 
00540 OSnLNode* OSnLNodeAllDiff::cloneOSnLNode(){
00541         OSnLNode *nlNodePoint;
00542         nlNodePoint = new OSnLNodeAllDiff();
00543         return  nlNodePoint;
00544 }//end OSnLNodeAllDiff::cloneOSnLNode
00545 //end OSnLNodeAllDiff methods
00546 
00547 
00548 
00549 //
00550 // OSnLNodeMax Methods  
00551 OSnLNodeMax::OSnLNodeMax()
00552 {
00553         inumberOfChildren = 0;
00554         snodeName = "max";
00555         inodeInt = 4011;
00556         inodeType = -1;
00557 }//end OSnLNodeMax
00558 
00559 OSnLNodeMax::~OSnLNodeMax(){
00560         #ifdef DEBUGOSNLNODE
00561         cout << "inside OSnLNodeMax destructor" << endl;
00562         #endif
00563         if(inumberOfChildren > 0){
00564                 for(int i = 0; i < inumberOfChildren; i++){
00565                         delete m_mChildren[ i];
00566                         m_mChildren[i] = NULL;
00567                 }
00568         }
00569         m_mChildren = NULL;
00570 }//end ~OSnLNodeMax
00571 
00572 double OSnLNodeMax::calculateFunction(double *x){
00573         m_dFunctionValue = m_mChildren[0]->calculateFunction(x);
00574         if(inumberOfChildren > 1){
00575                 for(int i = 1; i < inumberOfChildren; i++){
00576                         if(m_mChildren[i]->calculateFunction(x) > m_dFunctionValue){
00577                                 m_dFunctionValue =      m_mChildren[i]->calculateFunction(x);
00578                         }
00579                 }
00580         }
00581         return m_dFunctionValue;
00582 }// end OSnLNodeMax::calculate
00583 
00584 
00585 AD<double> OSnLNodeMax::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00586         //if not support in CppAD, throw an exception
00587         try{
00588                 throw ErrorClass("Max operator not supported by current Algorithmic Differentiation implementation");
00589                 return m_CppADTape;
00590         }
00591         catch(const ErrorClass& eclass){
00592                 throw ErrorClass( eclass.errormsg);
00593         }
00594 }// end OSnLNodeMax::constructCppADTape
00595 
00596 
00597 OSnLNode* OSnLNodeMax::cloneOSnLNode(){
00598         OSnLNode *nlNodePoint;
00599         nlNodePoint = new OSnLNodeMax();
00600         return  nlNodePoint;
00601 }//end OSnLNodeMax::cloneOSnLNode
00602 //
00603 
00604 
00605 
00606 //
00607 // OSnLNodeMin Methods  
00608 OSnLNodeMin::OSnLNodeMin()
00609 {
00610         inumberOfChildren = 0;
00611         snodeName = "min";
00612         inodeInt = 4010;
00613         inodeType = -1;
00614 }//end OSnLNodeMin
00615 
00616 OSnLNodeMin::~OSnLNodeMin(){
00617         #ifdef DEBUGOSNLNODE
00618         cout << "inside OSnLNodeMin destructor" << endl;
00619         #endif
00620         if(inumberOfChildren > 0){
00621                 for(int i = 0; i < inumberOfChildren; i++){
00622                         delete m_mChildren[ i];
00623                         m_mChildren[i] = NULL;
00624                 }
00625         }
00626         m_mChildren = NULL;
00627 }//end ~OSnLNodeMin
00628 
00629 double OSnLNodeMin::calculateFunction(double *x){
00630         m_dFunctionValue = m_mChildren[0]->calculateFunction(x);
00631         if(inumberOfChildren > 1){
00632                 for(int i = 1; i < inumberOfChildren; i++){
00633                         if(m_mChildren[i]->calculateFunction(x) < m_dFunctionValue){
00634                                 m_dFunctionValue =      m_mChildren[i]->calculateFunction(x);
00635                         }
00636                 }
00637         }
00638         return m_dFunctionValue;
00639 }// end OSnLNodeMin::calculate
00640 
00641 
00642 AD<double> OSnLNodeMin::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00643         //if not support in CppAD, throw an exception
00644         try{
00645                 throw ErrorClass("Min operator not supported by current Algorithmic Differentiation implementation");
00646                 return m_CppADTape;
00647         }
00648         catch(const ErrorClass& eclass){
00649                 throw ErrorClass( eclass.errormsg);
00650         }
00651 }// end OSnLNodeMin::constructCppADTape
00652 
00653 
00654 OSnLNode* OSnLNodeMin::cloneOSnLNode(){
00655         OSnLNode *nlNodePoint;
00656         nlNodePoint = new OSnLNodeMin();
00657         return  nlNodePoint;
00658 }//end OSnLNodeMin::cloneOSnLNode
00659 //
00660 
00661 
00662 //
00663 //
00664 // OSnLNodeMinus Methods        
00665 OSnLNodeMinus::OSnLNodeMinus()
00666 {
00667         inumberOfChildren = 2;
00668         m_mChildren = new OSnLNode*[2];
00669         m_mChildren[ 0] = NULL;
00670         m_mChildren[ 1] = NULL;
00671         snodeName = "minus";
00672         inodeInt = 1003;
00673         inodeType = 2;
00674 }//end OSnLNodeMinus
00675 
00676  
00677 OSnLNodeMinus::~OSnLNodeMinus(){
00678         #ifdef DEBUGOSNLNODE
00679         cout << "inside OSnLNodeMinus destructor" << endl;
00680         #endif
00681         for(int i = 0; i < inumberOfChildren; i++){
00682                 delete m_mChildren[ i];
00683                 m_mChildren[i] = NULL;
00684         }
00685         m_mChildren = NULL;
00686 }//end ~OSnLNodeMinus
00687 
00688 double OSnLNodeMinus::calculateFunction(double *x){
00689         m_dFunctionValue =  m_mChildren[0]->calculateFunction( x) - m_mChildren[1]->calculateFunction( x);
00690         return m_dFunctionValue;
00691 }// end OSnLNodeMinus::calculate
00692 
00693 
00694 AD<double> OSnLNodeMinus::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00695         m_CppADTape = m_mChildren[0]->constructCppADTape( cppADIdx, XAD) - m_mChildren[1]->constructCppADTape( cppADIdx, XAD);
00696         return m_CppADTape;
00697 }// end OSnLNodeMinus::constructCppADTape
00698 
00699 
00700 OSnLNode* OSnLNodeMinus::cloneOSnLNode(){
00701         OSnLNode *nlNodePoint;
00702         nlNodePoint = new OSnLNodeMinus();
00703         return  nlNodePoint;
00704 }//end OSnLNodeMinus::cloneOSnLNode
00705 //
00706 //
00707 
00708 
00709 //
00710 //
00711 // OSnLNodeNegate Methods       
00712 OSnLNodeNegate::OSnLNodeNegate()
00713 {
00714         inumberOfChildren = 1;
00715         m_mChildren = new OSnLNode*[1];
00716         m_mChildren[ 0] = NULL;
00717         snodeName = "negate";
00718         inodeInt = 1004;
00719         inodeType = 1;
00720 }//end OSnLNodeNegate
00721 
00722  
00723 OSnLNodeNegate::~OSnLNodeNegate(){
00724         #ifdef DEBUGOSNLNODE
00725         cout << "inside OSnLNodeNegate destructor" << endl;
00726         #endif
00727         for(int i = 0; i < inumberOfChildren; i++){
00728                 delete m_mChildren[ i];
00729                 m_mChildren[i] = NULL;
00730         }
00731         m_mChildren = NULL;
00732 }//end ~OSnLNodeNegate
00733 
00734 double OSnLNodeNegate::calculateFunction(double *x){
00735         m_dFunctionValue =  -m_mChildren[0]->calculateFunction( x) ;
00736         return m_dFunctionValue;
00737 }// end OSnLNodeMinus::calculate
00738 
00739 AD<double> OSnLNodeNegate::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00740         m_CppADTape = -m_mChildren[0]->constructCppADTape( cppADIdx, XAD);
00741         return m_CppADTape;
00742 }// end OSnLNodeNegate::constructCppADTape
00743 
00744 
00745 OSnLNode* OSnLNodeNegate::cloneOSnLNode(){
00746         OSnLNode *nlNodePoint;
00747         nlNodePoint = new OSnLNodeNegate();
00748         return  nlNodePoint;
00749 }//end OSnLNodeNegate::cloneOSnLNode
00750 //
00751 //
00752 
00753 // OSnLNodeTimes Methods        
00754 OSnLNodeTimes::OSnLNodeTimes()
00755 {
00756         inumberOfChildren = 2;
00757         m_mChildren = new OSnLNode*[2];
00758         m_mChildren[ 0] = NULL;
00759         m_mChildren[ 1] = NULL;
00760         snodeName = "times";
00761         inodeInt = 1005;
00762         inodeType = 2;
00763 }//end OSnLNodeTimes
00764 
00765  
00766 OSnLNodeTimes::~OSnLNodeTimes(){
00767         #ifdef DEBUGOSNLNODE
00768         cout << "inside OSnLNodeTimes destructor" << endl;
00769         #endif
00770         for(int i = 0; i < inumberOfChildren; i++){
00771                 delete m_mChildren[ i];
00772                 m_mChildren[i] = NULL;
00773         }
00774         m_mChildren = NULL;
00775 }//end ~OSnLNodeTimes
00776 
00777 double OSnLNodeTimes::calculateFunction(double *x){
00778         m_dFunctionValue = m_mChildren[0]->calculateFunction( x)*m_mChildren[1]->calculateFunction( x);
00779         return m_dFunctionValue;
00780 }// end OSnLNodeTimes::calculate
00781 
00782 
00783 AD<double> OSnLNodeTimes::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00784         m_CppADTape = m_mChildren[0]->constructCppADTape( cppADIdx, XAD) * m_mChildren[1]->constructCppADTape( cppADIdx, XAD);
00785         return m_CppADTape;
00786 }// end OSnLNodeTimes::constructCppADTape
00787 
00788 OSnLNode* OSnLNodeTimes::cloneOSnLNode(){
00789         OSnLNode *nlNodePoint;
00790         nlNodePoint = new OSnLNodeTimes();
00791         return  nlNodePoint;
00792 }//end OSnLNodeTimes::cloneOSnLNode
00793 
00794 //
00795 //
00796 // OSnLNodeDivide Methods       
00797 OSnLNodeDivide::OSnLNodeDivide()
00798 {
00799         inumberOfChildren = 2;
00800         m_mChildren = new OSnLNode*[2];
00801         m_mChildren[ 0] = NULL;
00802         m_mChildren[ 1] = NULL;
00803         snodeName = "divide";
00804         inodeInt = 1006;
00805         inodeType = 2;
00806 }//end OSnLNodeDivide
00807 
00808  
00809 OSnLNodeDivide::~OSnLNodeDivide(){
00810         #ifdef DEBUGOSNLNODE
00811         cout << "inside OSnLNodeDivide destructor" << endl;
00812         #endif
00813         for(int i = 0; i < inumberOfChildren; i++){
00814                 delete m_mChildren[ i];
00815                 m_mChildren[i] = NULL;
00816         }
00817         m_mChildren = NULL;
00818 }//end ~OSnLNodeDivide
00819 
00820 double OSnLNodeDivide::calculateFunction(double *x){
00821         // kipp throw error if we divide by 0
00822         m_dFunctionValue = m_mChildren[0]->calculateFunction( x)/m_mChildren[1]->calculateFunction( x);
00823         return m_dFunctionValue;
00824 }// end OSnLNodeDivide::calculate
00825 
00826 
00827 AD<double> OSnLNodeDivide::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00828         m_CppADTape = m_mChildren[0]->constructCppADTape( cppADIdx, XAD) / m_mChildren[1]->constructCppADTape( cppADIdx, XAD);
00829         return m_CppADTape;
00830 }// end OSnLNodeDivide::constructCppADTape
00831 
00832 
00833 OSnLNode* OSnLNodeDivide::cloneOSnLNode(){
00834         OSnLNode *nlNodePoint;
00835         nlNodePoint = new OSnLNodeDivide();
00836         return  nlNodePoint;
00837 }//end OSnLNodeDivide::cloneOSnLNode
00838 
00839 
00840 //
00841 // OSnLNodePower Methods        
00842 OSnLNodePower::OSnLNodePower()
00843 {
00844         inumberOfChildren = 2;
00845         m_mChildren = new OSnLNode*[2];
00846         m_mChildren[ 0] = NULL;
00847         m_mChildren[ 1] = NULL;
00848         snodeName = "power";
00849         inodeInt = 1009;
00850         inodeType = 2;
00851 }//end OSnLNodePower
00852 
00853  
00854 OSnLNodePower::~OSnLNodePower(){
00855         #ifdef DEBUGOSNLNODE
00856         cout << "inside OSnLNodePower destructor" << endl;
00857         #endif
00858         for(int i = 0; i < inumberOfChildren; i++){
00859                 delete m_mChildren[ i];
00860                 m_mChildren[i] = NULL;
00861         }
00862         m_mChildren = NULL;
00863 }//end ~OSnLNodePower 
00864 
00865 double OSnLNodePower::calculateFunction(double *x){
00866         // kipp throw error if operation not defined
00867         m_dFunctionValue =  pow(m_mChildren[0]->calculateFunction( x), m_mChildren[1]->calculateFunction( x));
00868         return  m_dFunctionValue;
00869 }// end OSnLNodePower::calculate
00870 
00871 //
00872 AD<double> OSnLNodePower::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00873         //if( typeid( *m_mChildren[1]) == typeid( OSnLNodeNumber) ) {
00874         if( this->m_mChildren[1]->inodeInt == 5001 ) {
00875                 OSnLNodeNumber *numberNode  =  (OSnLNodeNumber*)m_mChildren[1];
00876                 // we have a number node see if interger
00877                 if( (numberNode->value) == int( numberNode->value)){
00878                         m_CppADTape =  CppAD::pow(m_mChildren[0]->constructCppADTape( cppADIdx, XAD) ,  int( numberNode->value));
00879                 }       
00880                 else m_CppADTape = CppAD::pow(m_mChildren[0]->constructCppADTape( cppADIdx, XAD) , m_mChildren[1]->constructCppADTape( cppADIdx, XAD) );        
00881         }
00882         else{
00883                 m_CppADTape = CppAD::pow(m_mChildren[0]->constructCppADTape( cppADIdx, XAD) , m_mChildren[1]->constructCppADTape( cppADIdx, XAD) );     
00884         }
00885         return m_CppADTape;
00886 }// end OSnLNodePower::constructCppADTape
00887 
00888 
00889 
00890 //AD<double> OSnLNodePower::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){ 
00891 //              m_CppADTape = CppAD::pow(m_mChildren[0]->constructCppADTape( cppADIdx, XAD) , m_mChildren[1]->constructCppADTape( cppADIdx, XAD) );     
00892 //      return m_CppADTape;
00893 //}// end OSnLNodePower::constructCppADTape
00894 
00895 
00896 
00897 
00898 
00899 OSnLNode* OSnLNodePower::cloneOSnLNode(){
00900         OSnLNode *nlNodePoint;
00901         nlNodePoint = new OSnLNodePower();
00902         return  nlNodePoint;
00903 }//end OSnLNodePower::cloneOSnLNode
00904 //
00905 //
00906 
00907 
00908 //
00909 // OSnLNodePower Methods        
00910 OSnLNodeProduct::OSnLNodeProduct()
00911 {
00912         inumberOfChildren = 0;
00913         snodeName = "product";
00914         inodeInt = 1010;
00915         inodeType = -1;
00916 }//end OSnLNodeProduct
00917 
00918  
00919 OSnLNodeProduct::~OSnLNodeProduct(){
00920         #ifdef DEBUGOSNLNODE
00921         cout << "inside OSnLNodeProduct destructor" << endl;
00922         #endif
00923         if(inumberOfChildren > 0){
00924                 for(int i = 0; i < inumberOfChildren; i++){
00925                         delete m_mChildren[ i];
00926                         m_mChildren[i] = NULL;
00927                 }
00928         }
00929         m_mChildren = NULL;
00930 }//end ~OSnLNodeProduct
00931 
00932 double OSnLNodeProduct::calculateFunction(double *x){
00933         // kipp throw error if operation not defined
00934         m_dFunctionValue = 1.0;
00935         int i;
00936         for(i = 0; i < inumberOfChildren; i++){
00937                 m_dFunctionValue = m_dFunctionValue*m_mChildren[i]->calculateFunction(x);
00938         }
00939         return m_dFunctionValue;
00940 }// end OSnLNodeProduct::calculate
00941 
00942 
00943 AD<double> OSnLNodeProduct::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00944         m_CppADTape = 1.0;
00945         int i;
00946         for(i = 0; i < inumberOfChildren; i++){
00947                 m_CppADTape = m_CppADTape*m_mChildren[i]->constructCppADTape( cppADIdx, XAD);
00948         }
00949         return m_CppADTape;
00950 }// end OSnLNodeProduct::constructCppADTape
00951 
00952 
00953 OSnLNode* OSnLNodeProduct::cloneOSnLNode(){
00954         OSnLNode *nlNodePoint;
00955         nlNodePoint = new OSnLNodeProduct();
00956         return  nlNodePoint;
00957 }//end OSnLNodeProduct::cloneOSnLNode
00958 //
00959 //
00960 
00961 
00962 //
00963 // OSnLNodeLn Methods   
00964 OSnLNodeLn::OSnLNodeLn()
00965 {
00966         inumberOfChildren = 1;
00967         m_mChildren = new OSnLNode*[1];
00968         m_mChildren[ 0] = NULL;
00969         snodeName = "ln";
00970         inodeInt = 2007;
00971         inodeType = 1;
00972 }//end OSnLNodeLn
00973 
00974  
00975 OSnLNodeLn::~OSnLNodeLn(){
00976         #ifdef DEBUGOSNLNODE
00977         cout << "inside OSnLNodeLn destructor" << endl;
00978         #endif
00979         for(int i = 0; i < inumberOfChildren; i++){
00980                 delete m_mChildren[ i];
00981                 m_mChildren[i] = NULL;
00982         }
00983         m_mChildren = NULL;
00984 }//end ~OSnLNodeLn
00985 
00986 double OSnLNodeLn::calculateFunction(double *x){
00987         m_dFunctionValue = log(m_mChildren[0]->calculateFunction( x) );
00988         return m_dFunctionValue;
00989 }// end OSnLNodeLn::calculate
00990 
00991 
00992 AD<double> OSnLNodeLn::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
00993         m_CppADTape = CppAD::log( m_mChildren[0]->constructCppADTape( cppADIdx, XAD) );
00994         return m_CppADTape;
00995 }// end OSnLNodeLn::constructCppADTape
00996 
00997 OSnLNode* OSnLNodeLn::cloneOSnLNode(){
00998         OSnLNode *nlNodePoint;
00999         nlNodePoint = new OSnLNodeLn();
01000         return  nlNodePoint;
01001 }//end OSnLNodeLn::cloneOSnLNode
01002 
01003 
01004 
01005 
01006 
01007 //
01008 // OSnLNodeSqrt Methods 
01009 OSnLNodeSqrt::OSnLNodeSqrt()
01010 {
01011         inumberOfChildren = 1;
01012         m_mChildren = new OSnLNode*[1];
01013         m_mChildren[ 0] = NULL;
01014         snodeName = "sqrt";
01015         inodeInt = 2006;
01016         inodeType = 1;
01017 }//end OSnLNodeSqrt
01018 
01019  
01020 OSnLNodeSqrt::~OSnLNodeSqrt(){
01021         #ifdef DEBUGOSNLNODE
01022         cout << "inside OSnLNodeSqrt destructor" << endl;
01023         #endif
01024         for(int i = 0; i < inumberOfChildren; i++){
01025                 delete m_mChildren[ i];
01026                 m_mChildren[i] = NULL;
01027         }
01028         m_mChildren = NULL;
01029 }//end ~OSnLNodeSqrt
01030 
01031 double OSnLNodeSqrt::calculateFunction(double *x){
01032         m_dFunctionValue = sqrt(m_mChildren[0]->calculateFunction( x) );
01033         return m_dFunctionValue;
01034 }// end OSnLNodeSqrt::calculate
01035 
01036 
01037 AD<double> OSnLNodeSqrt::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01038         m_CppADTape = CppAD::sqrt( m_mChildren[0]->constructCppADTape( cppADIdx, XAD) );
01039         return m_CppADTape;
01040 }// end OSnLNodeSqrt::constructCppADTape
01041 
01042 OSnLNode* OSnLNodeSqrt::cloneOSnLNode(){
01043         OSnLNode *nlNodePoint;
01044         nlNodePoint = new OSnLNodeSqrt();
01045         return  nlNodePoint;
01046 }//end OSnLNodeSqrt::cloneOSnLNode
01047 
01048 
01049 
01050 //
01051 //
01052 // OSnLNodeSquare Methods       
01053 OSnLNodeSquare::OSnLNodeSquare()
01054 {
01055         inumberOfChildren = 1;
01056         m_mChildren = new OSnLNode*[1];
01057         m_mChildren[ 0] = NULL;
01058         snodeName = "square";
01059         inodeInt = 2005;
01060         inodeType = 1;
01061 }//end OSnLNodeSquare
01062 
01063  
01064 OSnLNodeSquare::~OSnLNodeSquare(){
01065         #ifdef DEBUGOSNLNODE
01066         cout << "inside OSnLNodeSquare destructor" << endl;
01067         #endif
01068         for(int i = 0; i < inumberOfChildren; i++){
01069                 delete m_mChildren[ i];
01070                 m_mChildren[i] = NULL;
01071         }
01072         m_mChildren = NULL;
01073 }//end ~OSnLNodeSquare
01074 
01075 double OSnLNodeSquare::calculateFunction(double *x){
01076         m_dFunctionValue = pow( (m_mChildren[0]->calculateFunction( x) ), 2);
01077         return m_dFunctionValue;
01078 }// end OSnLNodeSquare::calculate
01079 
01080 
01081 AD<double> OSnLNodeSquare::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01082         m_CppADTape = CppAD::pow( m_mChildren[0]->constructCppADTape( cppADIdx, XAD), int( 2) );
01083         return m_CppADTape;
01084 }// end OSnLNodeSquare::constructCppADTape
01085 
01086 OSnLNode* OSnLNodeSquare::cloneOSnLNode(){
01087         OSnLNode *nlNodePoint;
01088         nlNodePoint = new OSnLNodeSquare();
01089         return  nlNodePoint;
01090 }//end OSnLNodeSquare::cloneOSnLNode
01091 
01092 //
01093 //
01094 // OSnLNodeSin Methods  
01095 OSnLNodeSin::OSnLNodeSin()
01096 {
01097         inumberOfChildren = 1;
01098         m_mChildren = new OSnLNode*[1];
01099         m_mChildren[ 0] = NULL;
01100         snodeName = "sin";
01101         inodeInt = 3001;
01102         inodeType = 1;
01103 }//end OSnLNodeSin
01104 
01105  
01106 OSnLNodeSin::~OSnLNodeSin(){
01107         #ifdef DEBUGOSNLNODE
01108         cout << "inside OSnLNodeSin destructor" << endl;
01109         #endif
01110         for(int i = 0; i < inumberOfChildren; i++){
01111                 delete m_mChildren[ i];
01112                 m_mChildren[i] = NULL;
01113         }
01114         m_mChildren = NULL;
01115 }//end ~OSnLNodeSin
01116 
01117 double OSnLNodeSin::calculateFunction(double *x){
01118         m_dFunctionValue = sin(m_mChildren[0]->calculateFunction( x) );
01119         return m_dFunctionValue;
01120 }// end OSnLNodeSin::calculate
01121 
01122 
01123 AD<double> OSnLNodeSin::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01124         m_CppADTape = CppAD::sin( m_mChildren[0]->constructCppADTape( cppADIdx, XAD) );
01125         return m_CppADTape;
01126 }// end OSnLNodeSin::constructCppADTape
01127 
01128 OSnLNode* OSnLNodeSin::cloneOSnLNode(){
01129         OSnLNode *nlNodePoint;
01130         nlNodePoint = new OSnLNodeSin();
01131         return  nlNodePoint;
01132 }//end OSnLNodeSin::cloneOSnLNode
01133 
01134 
01135 //
01136 //
01137 // OSnLNodeCos Methods  
01138 OSnLNodeCos::OSnLNodeCos()
01139 {
01140         inumberOfChildren = 1;
01141         m_mChildren = new OSnLNode*[1];
01142         m_mChildren[ 0] = NULL;
01143         snodeName = "cos";
01144         inodeInt = 3002;
01145         inodeType = 1;
01146 }//end OSnLNodeCos
01147 
01148  
01149 OSnLNodeCos::~OSnLNodeCos(){
01150         #ifdef DEBUGOSNLNODE
01151         cout << "inside OSnLNodeCos destructor" << endl;
01152         #endif
01153         for(int i = 0; i < inumberOfChildren; i++){
01154                 delete m_mChildren[ i];
01155                 m_mChildren[i] = NULL;
01156         }
01157         m_mChildren = NULL;
01158 }//end ~OSnLNodeCos
01159 
01160 double OSnLNodeCos::calculateFunction(double *x){
01161         m_dFunctionValue = cos(m_mChildren[0]->calculateFunction( x) );
01162         return m_dFunctionValue;
01163 }// end OSnLNodeCos::calculate
01164 
01165 
01166 AD<double> OSnLNodeCos::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01167         m_CppADTape = CppAD::cos( m_mChildren[0]->constructCppADTape( cppADIdx, XAD) );
01168         return m_CppADTape;
01169 }// end OSnLNodeCos::constructCppADTape
01170 
01171 OSnLNode* OSnLNodeCos::cloneOSnLNode(){
01172         OSnLNode *nlNodePoint;
01173         nlNodePoint = new OSnLNodeCos();
01174         return  nlNodePoint;
01175 }//end OSnLNodeCos::cloneOSnLNode
01176 
01177 
01178 
01179 
01180 //
01181 //
01182 // OSnLNodeExp Methods  
01183 OSnLNodeExp::OSnLNodeExp()
01184 {
01185         inumberOfChildren = 1;
01186         m_mChildren = new OSnLNode*[1];
01187         m_mChildren[ 0] = NULL;
01188         snodeName = "exp";
01189         inodeInt = 2010;
01190         inodeType = 1;
01191 }//end OSnLNodeExp
01192 
01193  
01194 OSnLNodeExp::~OSnLNodeExp(){
01195         #ifdef DEBUGOSNLNODE
01196         cout << "inside OSnLNodeExp destructor" << endl;
01197         #endif
01198         for(int i = 0; i < inumberOfChildren; i++){
01199                 delete m_mChildren[ i];
01200                 m_mChildren[i] = NULL;
01201         }
01202         m_mChildren = NULL;
01203 }//end ~OSnLNodeExp
01204 
01205 double OSnLNodeExp::calculateFunction(double *x){
01206         m_dFunctionValue = exp(m_mChildren[0]->calculateFunction( x) );
01207         return m_dFunctionValue;
01208 }// end OSnLNodeExp::calculate
01209 
01210 
01211 AD<double> OSnLNodeExp::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01212         m_CppADTape = CppAD::exp( m_mChildren[0]->constructCppADTape( cppADIdx, XAD) );
01213         return m_CppADTape;
01214 }// end OSnLNodeExp::constructCppADTape
01215 
01216 OSnLNode* OSnLNodeExp::cloneOSnLNode(){
01217         OSnLNode *nlNodePoint;
01218         nlNodePoint = new OSnLNodeExp();
01219         return  nlNodePoint;
01220 }//end OSnLNodeExp::cloneOSnLNode
01221 //
01222 //
01223 
01224 
01225 
01226 //
01227 // OSnLNodeAbs Methods  
01228 OSnLNodeAbs::OSnLNodeAbs()
01229 {
01230         inumberOfChildren = 1;
01231         m_mChildren = new OSnLNode*[1];
01232         m_mChildren[ 0] = NULL;
01233         snodeName = "abs";
01234         inodeInt = 2001;
01235         inodeType = 1;
01236 }//end OSnLNodeLn
01237 
01238  
01239 OSnLNodeAbs::~OSnLNodeAbs(){
01240         #ifdef DEBUGOSNLNODE
01241         cout << "inside OSnLNodeAbs destructor" << endl;
01242         #endif
01243         for(int i = 0; i < inumberOfChildren; i++){
01244                 delete m_mChildren[ i];
01245                 m_mChildren[i] = NULL;
01246         }
01247         m_mChildren = NULL;
01248 }//end ~OSnLNodeAbs
01249 
01250 double OSnLNodeAbs::calculateFunction(double *x){
01251         m_dFunctionValue = fabs(m_mChildren[0]->calculateFunction( x) );
01252         return m_dFunctionValue;
01253 }// end OSnLNodeAbs::calculate
01254 
01255 
01256 AD<double> OSnLNodeAbs::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01257         m_CppADTape = CppAD::abs( m_mChildren[0]->constructCppADTape( cppADIdx, XAD) );
01258         return m_CppADTape;
01259 }// end OSnLNodeAbs::constructCppADTape
01260 
01261 OSnLNode* OSnLNodeAbs::cloneOSnLNode(){
01262         OSnLNode *nlNodePoint;
01263         nlNodePoint = new OSnLNodeAbs();
01264         return  nlNodePoint;
01265 }//end OSnLNodeAbs::cloneOSnLNode
01266 //
01267 //
01268 
01269 
01270 //
01271 // OSnLNodeIf Methods   
01272 OSnLNodeIf::OSnLNodeIf()
01273 {
01274         inumberOfChildren = 3;
01275         m_mChildren = new OSnLNode*[3];
01276         m_mChildren[ 0] = NULL;
01277         m_mChildren[ 1] = NULL;
01278         m_mChildren[ 2] = NULL;
01279         snodeName = "if";
01280         inodeInt = 7001;
01281         inodeType = 3;
01282 }//end OSnLNodeIf
01283 
01284  
01285 OSnLNodeIf::~OSnLNodeIf(){
01286         #ifdef DEBUGOSNLNODE
01287         cout << "inside OSnLNodeIf destructor" << endl;
01288         #endif 
01289         for(int i = 0; i < inumberOfChildren; i++){
01290                 delete m_mChildren[ i];
01291                 m_mChildren[i] = NULL;
01292         }
01293         m_mChildren = NULL;
01294 }//end ~OSnLNodeIf
01295 
01296 double OSnLNodeIf::calculateFunction(double *x){
01297         if(m_mChildren[0]->calculateFunction( x)  >= 0) m_dFunctionValue = m_mChildren[ 1]->calculateFunction( x);
01298                 else m_dFunctionValue = m_mChildren[ 2]->calculateFunction( x);
01299         return m_dFunctionValue;
01300 }// end OSnLNodeIf::calculate
01301 
01302 AD<double> OSnLNodeIf::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01303         //if not support in CppAD, throw an exception
01304         try{
01305                 throw ErrorClass("if operator not supported by current Algorithmic Differentiation implementation");
01306                 return m_CppADTape;
01307         }
01308         catch(const ErrorClass& eclass){
01309                 throw ErrorClass( eclass.errormsg);
01310         }
01311 }// end OSnLNodeIf::constructCppADTape
01312 
01313 OSnLNode* OSnLNodeIf::cloneOSnLNode(){
01314         OSnLNode *nlNodePoint;
01315         nlNodePoint = new OSnLNodeIf();
01316         return  nlNodePoint;
01317 }//end OSnLNodeIf::cloneOSnLNode
01318 //
01319 //
01320 
01321 
01322 // OSnLNodeNumber Methods       
01323 OSnLNodeNumber::OSnLNodeNumber()
01324 {
01325         inodeInt = 5001;
01326         inumberOfChildren = 0;
01327         m_mChildren = NULL;
01328         snodeName = "number";
01329         inodeType = 0;  
01330         value = 0.0;
01331         type = "real";
01332         id = "";
01333 
01334 }//end OSnLNodeNumber
01335 
01336 OSnLNodeNumber::~OSnLNodeNumber(){
01337         #ifdef DEBUGOSNLNODE
01338         cout << "inside OSnLNodeNumber destructor" << endl;
01339         #endif
01340         m_mChildren = NULL;
01341 }//end ~OSnLNodeNumber
01342 
01343 
01344 std::string OSnLNodeNumber::getTokenNumber(){
01345         ostringstream outStr;
01346         outStr << inodeInt;
01347         outStr << ":" ;
01348         outStr << value ;
01349         //if(type.length() > 0){
01350                 outStr << ":" ;
01351                 outStr << type ;
01352         //}
01353         //if(id.length() > 0){
01354                 outStr << ":" ;
01355                 outStr << id;
01356         //}
01357         return outStr.str();
01358 }//getTokenNumber
01359 
01360 
01361 std::string OSnLNodeNumber::getTokenName(){
01362         ostringstream outStr;
01363         outStr << snodeName;
01364         outStr << ":" ;
01365         outStr << value ;
01366         //if(type.length() > 0){
01367                 outStr << ":" ;
01368                 outStr << type ;
01369         //}
01370         //if(id.length() > 0){
01371                 outStr << ":" ;
01372                 outStr << id;
01373         //}
01374         return outStr.str();
01375 }//getTokenNumber
01376 
01377 
01378 std::string OSnLNodeNumber::getNonlinearExpressionInXML(){
01379         ostringstream outStr;
01380         outStr << "<" ;
01381         outStr << snodeName;
01382                 outStr << "  value=\"";
01383                 outStr << value ;
01384                 outStr << "\"";
01385                 outStr << " type=\"";
01386                 outStr << type ;
01387                 outStr << "\"";
01388                 if(id.length() > 0){
01389                         outStr << "  id=\"";
01390                         outStr << id ;
01391                         outStr << "\"";
01392                 }
01393                 outStr << "/>";
01394         return outStr.str();
01395 }//getNonlinearExpressionInXML()
01396 
01397 
01398 double OSnLNodeNumber::calculateFunction(double *x){
01399         m_dFunctionValue = this->value;
01400         return m_dFunctionValue;
01401 }// end OSnLNodeNumber::calculate
01402 
01403 AD<double> OSnLNodeNumber::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01404         m_CppADTape =  this->value;
01405         return m_CppADTape;
01406 }// end OSnLNodeNumber::constructCppADTape
01407 
01408 OSnLNode* OSnLNodeNumber::cloneOSnLNode(){
01409         OSnLNode *nlNodePoint;
01410         nlNodePoint = new OSnLNodeNumber();
01411         return  nlNodePoint;
01412 }//end OSnLNodeNumber::cloneOSnLNode
01413 // edn OSnLNodeNumber methods
01414 
01415 
01416 // OSnLNodeE Methods    
01417 OSnLNodeE::OSnLNodeE()
01418 {
01419         inodeInt = 5004;
01420         inumberOfChildren = 0;
01421         m_mChildren = NULL;
01422         snodeName = "E";
01423         inodeType = 0;  
01424         //value = 0.0;
01425         //type = "real";
01426         //id = "";
01427 
01428 }//end OSnLNodeE
01429 
01430 OSnLNodeE::~OSnLNodeE(){
01431         #ifdef DEBUGOSNLNODE
01432         cout << "inside OSnLNodeE destructor" << endl;
01433         #endif
01434         m_mChildren = NULL;
01435 }//end ~OSnLNodeE
01436 
01437 
01438 std::string OSnLNodeE::getTokenNumber(){
01439         ostringstream outStr;
01440         outStr << inodeInt;
01441         //outStr << ":" ;
01442         //outStr << value ;
01443         //if(type.length() > 0){
01444         //      outStr << ":" ;
01445         //      outStr << type ;
01446         //}
01447         //if(id.length() > 0){
01448         //      outStr << ":" ;
01449         //      outStr << id;
01450         //}
01451         return outStr.str();
01452 }//getTokenNumber
01453 
01454 
01455 std::string OSnLNodeE::getTokenName(){
01456         ostringstream outStr;
01457         outStr << snodeName;
01458         //outStr << ":" ;
01459         //outStr << value ;
01460         //if(type.length() > 0){
01461         //      outStr << ":" ;
01462         //      outStr << type ;
01463         //}
01464         //if(id.length() > 0){
01465         //      outStr << ":" ;
01466         //      outStr << id;
01467         //}
01468         return outStr.str();
01469 }//getTokenName
01470 
01471 
01472 std::string OSnLNodeE::getNonlinearExpressionInXML(){
01473         ostringstream outStr;
01474         outStr << "<" ;
01475         outStr << snodeName;
01476 //              outStr << "  value=\"";
01477 //              outStr << value ;
01478 //              outStr << "\"";
01479 //              outStr << " type=\"";
01480 //              outStr << type ;
01481 //              outStr << "\"";
01482 //              if(id.length() > 0){
01483 //                      outStr << "  id=\"";
01484 //                      outStr << id ;
01485 //                      outStr << "\"";
01486 //              }
01487                 outStr << "/>";
01488         return outStr.str();
01489 }//getNonlinearExpressionInXML()
01490 
01491 
01492 double OSnLNodeE::calculateFunction(double *x){
01493         m_dFunctionValue = OS_E_VALUE;
01494         return m_dFunctionValue;
01495 }// end OSnLNodeE::calculate
01496 
01497 AD<double> OSnLNodeE::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01498         m_CppADTape =  OS_E_VALUE;
01499         return m_CppADTape;
01500 }// end OSnLE::constructCppADTape
01501 
01502 OSnLNode* OSnLNodeE::cloneOSnLNode(){
01503         OSnLNode *nlNodePoint;
01504         nlNodePoint = new OSnLNodeE();
01505         return  nlNodePoint;
01506 }//end OSnLNodeE::cloneOSnLNode
01507 
01508 //end OSnLNodeE
01509 
01510 
01511 // OSnLNodePI Methods   
01512 OSnLNodePI::OSnLNodePI()
01513 {
01514         inodeInt = 5003;
01515         inumberOfChildren = 0;
01516         m_mChildren = NULL;
01517         snodeName = "PI";
01518         inodeType = 0;  
01519 
01520 
01521 }//end OSnLNodePI
01522 
01523 
01524 OSnLNodePI::~OSnLNodePI(){
01525         #ifdef DEBUGOSNLNODE
01526         cout << "inside OSnLNodePI destructor" << endl;
01527         #endif
01528         m_mChildren = NULL;
01529 }//end ~OSnLNodePI
01530 
01531 
01532 std::string OSnLNodePI::getTokenNumber(){
01533         ostringstream outStr;
01534         outStr << inodeInt;
01535         //outStr << ":" ;
01536         //outStr << value ;
01537         //if(type.length() > 0){
01538         //      outStr << ":" ;
01539         //      outStr << type ;
01540         //}
01541         //if(id.length() > 0){
01542         //      outStr << ":" ;
01543         //      outStr << id;
01544         //}
01545         return outStr.str();
01546 }//getTokenNumber
01547 
01548 
01549 std::string OSnLNodePI::getTokenName(){
01550         ostringstream outStr;
01551         outStr << snodeName;
01552         //outStr << ":" ;
01553         //outStr << value ;
01554         //if(type.length() > 0){
01555                 //outStr << ":" ;
01556                 //outStr << type ;
01557         //}
01558         //if(id.length() > 0){
01559                 //outStr << ":" ;
01560                 //outStr << id;
01561         //}
01562         return outStr.str();
01563 }//getTokenName
01564 
01565 
01566 std::string OSnLNodePI::getNonlinearExpressionInXML(){
01567         ostringstream outStr;
01568         outStr << "<" ;
01569         outStr << snodeName;
01570 //              outStr << "  value=\"";
01571 //              outStr << value ;
01572 //              outStr << "\"";
01573 //              outStr << " type=\"";
01574 //              outStr << type ;
01575 //              outStr << "\"";
01576 //              if(id.length() > 0){
01577 //                      outStr << "  id=\"";
01578 //                      outStr << id ;
01579 //                      outStr << "\"";
01580 //              }
01581                 outStr << "/>";
01582         return outStr.str();
01583 }//getNonlinearExpressionInXML()
01584 
01585 
01586 double OSnLNodePI::calculateFunction(double *x){
01587         m_dFunctionValue = OS_PI_VALUE;
01588         return m_dFunctionValue;
01589 }// end OSnLNodePI::calculate
01590 
01591 AD<double> OSnLNodePI::constructCppADTape(std::map<int, int> *cppADIdx, CppAD::vector< AD<double> > *XAD){
01592         m_CppADTape =  OS_PI_VALUE;
01593         return m_CppADTape;
01594 }// end OSnLE::constructCppADTape
01595 
01596 OSnLNode* OSnLNodePI::cloneOSnLNode(){
01597         OSnLNode *nlNodePoint;
01598         nlNodePoint = new OSnLNodePI();
01599         return  nlNodePoint;
01600 }//end OSnLNodePI::cloneOSnLNode
01601 
01602 //end OSnLNodePI methods
01603 
01604 // OSnLNodeVariable Methods     
01605 OSnLNodeVariable::OSnLNodeVariable()
01606 {
01607         inumberOfChildren = 0;
01608         m_mChildren = NULL;
01609         snodeName = "variable";
01610         inodeInt = 6001;
01611         inodeType = -1;
01612         coef = 1.0;
01613         idx = -1;
01614 }//end OSnLNodeVariable
01615 
01616 OSnLNodeVariable::~OSnLNodeVariable(){
01617         #ifdef DEBUGOSNLNODE
01618         cout << "inside OSnLNodeVariable destructor" << endl;
01619         cout << "number kids = " <<  inumberOfChildren << endl;
01620         #endif
01621         if(inumberOfChildren > 0){
01622                 for(int i = 0; i < inumberOfChildren; i++){
01623                         delete m_mChildren[ i];
01624                         m_mChildren[i] = NULL;
01625                 }
01626         }
01627         m_mChildren = NULL;
01628 }//end ~OSnLNodeVariable
01629 
01630 
01631 std::string OSnLNodeVariable::getTokenNumber(){
01632         ostringstream outStr;
01633         // put in an error if inodeInt is not 6001
01634         outStr << inodeInt;
01635         outStr << "[";
01636         outStr << inumberOfChildren ;
01637         outStr << "]";
01638         outStr << ":" ;
01639         outStr << idx;
01640         outStr << ":" ;
01641         outStr << coef;
01642         outStr << ":real:" ;
01643         return outStr.str();
01644 }//getTokenNumber
01645 
01646 
01647 std::string OSnLNodeVariable::getTokenName(){
01648         ostringstream outStr;
01649         // put in an error if inodeInt is not 6001
01650         outStr << snodeName;
01651         outStr << "[";
01652         outStr << inumberOfChildren ;
01653         outStr << "]";
01654         outStr << ":" ;
01655         outStr << idx;
01656         outStr << ":" ;
01657         outStr << coef;
01658         outStr << ":real:" ;
01659         return outStr.str();
01660 }//getTokenNumber
01661 
01662 
01663 std::string OSnLNodeVariable::getNonlinearExpressionInXML(){
01664         ostringstream outStr;
01665         outStr << "<" ;
01666         outStr << snodeName;
01667                 outStr << "  idx=\"";
01668                 outStr << idx ;
01669                 outStr << "\"";
01670                 outStr << "  coef=\"";
01671                 outStr << coef ;
01672                 outStr << "\"";
01673         if(inumberOfChildren > 0) {
01674                 outStr << ">";
01675         }
01676         else{
01677                 outStr << "/>";
01678         }
01679         if(inumberOfChildren > 0){
01680                 for(int i = 0; i < inumberOfChildren; i++){
01681                         outStr << m_mChildren[i]->getNonlinearExpressionInXML();
01682                 }
01683         }
01684         if(inumberOfChildren > 0) {
01685                 outStr << "</" ;
01686                 outStr << snodeName ;
01687                 outStr << ">" ;
01688         }
01689         return outStr.str();
01690 }//getPrefix
01691 
01692 double OSnLNodeVariable::calculateFunction(double *x){
01693         m_dFunctionValue = coef*x[idx];
01694         return m_dFunctionValue;
01695 }// end OSnLNodeVariable::calculate
01696 
01697 AD<double> OSnLNodeVariable::constructCppADTape(std::map<int, int> *varIdx, CppAD::vector< AD<double> > *XAD){
01698         m_CppADTape = coef;
01699         //std::cout << "Inside OSnLNodeVariable "<<  std::endl;
01700         //std::cout << "Value of OSiL index = " << idx << std::endl;
01701         //std::cout << "Value of CppAD index = " << (*varIdx)[ idx] << std::endl;
01702         //std::cout << "Value of CppAD variable = " << (*XAD)[ (*varIdx)[ idx] ] << std::endl;
01703         m_CppADTape = coef*(*XAD)[ (*varIdx)[ idx] ];
01704         return m_CppADTape;
01705 }// end OSnLNodeVariable::constructCppADTape
01706 
01707 
01708 void OSnLNodeVariable::getVariableIndexMap(std::map<int, int> *varIdx){
01709         int numVars;
01710         if( (*varIdx).find( idx) != (*varIdx).end() ){
01711                 //std::cout  << "Index already in the map " << idx <<  std::endl;
01712         }
01713         else{ // variable to map with variable index as the key
01714                 //std::cout << "Found a new index to add to the map " << idx << std::endl;
01715                 numVars = (*varIdx).size();
01716                 //std::cout << "numVars =  " << numVars << std::endl;
01717                 (*varIdx)[ idx] = numVars;
01718         }
01719         //std::cout << "Value of index = " << (*varIdx)[ idx] << std::endl;
01720 }//getVariableIndexMap
01721 
01722 
01723 OSnLNode* OSnLNodeVariable::cloneOSnLNode(){
01724         OSnLNode *nlNodePoint;
01725         nlNodePoint = new OSnLNodeVariable();
01726         return  nlNodePoint;
01727 }//end OSnLNodeVariable::cloneOSnLNode
01728            
01729 
01730 
01731 
01732 
01733 
01734 

Generated on Thu May 15 22:15:05 2008 by  doxygen 1.4.7