/Users/kmartin/Documents/files/code/cpp/OScpp/COIN-OS/OS/test/unitTest.cpp

Go to the documentation of this file.
00001 
00099 #include <cppad/cppad.hpp> 
00100 //#include "CoinUtilsConfig.h"
00101 #include "OSCoinSolver.h"
00102 #include "OSConfig.h"
00103 #include "OSmps2osil.h" 
00104 #include "OSResult.h" 
00105 #include "OSiLReader.h"        
00106 #include "OSiLWriter.h" 
00107 #include "OSrLReader.h"          
00108 #include "OSrLWriter.h"      
00109 #include "OSInstance.h"  
00110 #include "OSFileUtil.h"  
00111 #include "OSConfig.h" 
00112 
00113 #include "OSDefaultSolver.h"  
00114 #include "OSWSUtil.h" 
00115 #include "OSSolverAgent.h"   
00116 #include "OShL.h"     
00117 #include "OSErrorClass.h"
00118 #include "OSmps2osil.h"   
00119 #include "OSBase64.h"
00120 #include "OSCommonUtil.h"
00121 
00122 
00123 #include <CoinMpsIO.hpp>
00124 #include <CoinPackedMatrix.hpp>
00125     
00126  
00127 #ifdef COIN_HAS_KNITRO    
00128 #include "OSKnitroSolver.h"
00129 #endif 
00130 
00131 #include "OSMathUtil.h"
00132 
00133 #ifdef COIN_HAS_GLPK
00134 #include <OsiGlpkSolverInterface.hpp>
00135 #endif
00136 
00137 
00138 
00139 #ifdef COIN_HAS_LINDO    
00140 #include "OSLindoSolver.h"
00141 #endif  
00142 
00143 
00144  
00145 #ifdef COIN_HAS_ASL
00146 #include "OSnl2osil.h"
00147 #endif
00148 
00149 
00150 #ifdef COIN_HAS_IPOPT  
00151         #ifndef COIN_HAS_ASL
00152                 #include "OSIpoptSolver.h"
00153                 #undef COIN_HAS_ASL
00154         #else
00155                 #include "OSIpoptSolver.h"
00156         #endif
00157 #endif
00158 
00159 //#ifdef COIN_HAS_IPOPT  
00160 //#include "OSIpoptSolver.h"
00161 //#endif
00162 
00163   
00164 
00165 #ifdef HAVE_CTIME
00166 # include <ctime>
00167 #else
00168 # ifdef HAVE_TIME_H
00169 #  include <time.h>
00170 # else
00171 #  error "don't have header file for time"
00172 # endif
00173 #endif
00174 
00175 
00176 #ifdef HAVE_CMATH
00177 # include <cmath>
00178 #else
00179 # ifdef HAVE_CMATH_H
00180 #  include <cmath.h>
00181 # endif
00182 #endif
00183 
00184 
00185 
00186 #ifdef HAVE_CSTDIO
00187 # include <cstdio>
00188 #else
00189 # ifdef HAVE_STDIO_H
00190 #  include <stdio.h>
00191 # else
00192 #  error "don't have header file for stdio"
00193 # endif
00194 #endif
00195 
00196 #undef COIN_HAS_ASL
00197 using std::cout;   
00198 using std::endl;
00199 using std::ostringstream; 
00200 
00201 int main(int argC, char* argV[])
00202 {
00203         double getObjVal(std::string osrl);
00204         //using CppAD::NearEqual;
00205         bool ok;
00206         double check;
00207         
00208         
00209         //return 0;
00210         cout << "START UNIT TEST" << endl;
00211         // define the classes
00212         FileUtil *fileUtil = NULL;  
00213         #ifdef COIN_HAS_ASL
00214         OSnl2osil *nl2osil = NULL;
00215         #endif 
00216         OSmps2osil *mps2osil = NULL;
00217         DefaultSolver *solver  = NULL;
00218         OSrLWriter *osrlwriter = NULL;
00219         OSrLReader *osrlreader = NULL;
00220         // end classes    
00221         std::string osilFileName;
00222         std::string osrlFileName;
00223         std::string nlFileName; 
00224         std::string mpsFileName;     
00225         std::string osil;
00226         ostringstream unitTestResult;
00227         ostringstream unitTestResultFailure;
00228         // get the input files
00229          const char dirsep =  CoinFindDirSeparator();
00230         // Set directory containing mps data files.
00231         std::string dataDir;
00232     dataDir = dirsep == '/' ? "../data/" : "..\\data\\";
00233         std::string osol = "<osol></osol>";
00234         nlFileName =  dataDir  + "amplFiles" + dirsep + "parinc.nl";
00235         mpsFileName =  dataDir + "mpsFiles" + dirsep + "parinc.mps";
00236         fileUtil = new FileUtil();
00237         // 
00238         unitTestResult << "HERE ARE THE UNIT TEST RESULTS:" << std::endl << std::endl;
00239         
00240         //first make sure we can read files
00241         try{
00242                 osilFileName =  dataDir  + "osilFiles" + dirsep +  "parincLinearByRow.osil";
00243                 //osilFileName =  dataDir  + "osilFiles" + dirsep +  "parincLinear.osil";
00244                 std::cout << "Try to read a sample file" << std::endl;
00245                 std::cout << "The file is: " ;
00246                 std::cout <<  osilFileName << std::endl;
00247                 osil = fileUtil->getFileAsString( osilFileName.c_str() );
00248                 std::cout << "Done reading the test file" << std::endl;
00249                 OSiLReader *osilreader = NULL;
00250                 osilreader = new OSiLReader(); 
00251                 //OSInstance *osinstance = osilreader->readOSiL( osil);
00252                 //osinstance->initForAlgDiff();
00253                 unitTestResult << "Reading files successfully" << std::endl;
00254                 OSiLWriter osilwriter;
00255                 osilwriter.m_bWhiteSpace = true;
00256                 //std::cout << osilwriter.writeOSiL( osinstance) << std::endl;
00257                 delete osilreader;
00258                 osilreader = NULL;
00259                 //cout << "The unitTest passed the following" << endl << endl;
00260                 //cout << unitTestResult.str() << endl << endl;
00261                 /*
00262                 // below is just a bunch of misc. stuff kipp is testing
00263                 //
00264                 // Create a problem pointer.  We use the base class here.
00265                 OsiSolverInterface *si, *si2;
00266                 // When we instantiate the object, we need a specific derived class.
00267                 si = new OsiCbcSolverInterface;
00268                 // Read in an mps file.  This one's from the MIPLIB library.
00269                 si->readMps( mpsFileName.c_str());
00270                 // get the problem
00271                 // variable upper and lower bounds
00272                  const double *collb = si->getColLower();
00273                  const double *colub = si->getColUpper();               
00274                 // constraint upper and lower bound     
00275                 const  double *rowlb = si->getRowLower();
00276                 const  double *rowub = si->getRowUpper();               
00277                 //the Coin packed matrix
00278                 const CoinPackedMatrix *m_CoinPackedMatrix =  si->getMatrixByCol();             
00279                 //finally the objective function coefficients           
00280                 const double *objcoef = si->getObjCoefficients();
00281                 //delete si;
00282                 si2 = new OsiCbcSolverInterface;
00283                 std::cout << objcoef[ 0] << std::endl;
00284                 // now load the problem
00285                 si2->loadProblem(*m_CoinPackedMatrix, collb, colub,  objcoef, rowlb, rowub);            
00286                 // Solve the (relaxation of the) problem
00287                 //si2->branchAndBound();        
00288                 delete si;
00289                 delete si2;
00290                 */
00291                 
00292                 
00293                 
00294                 //mpsFileName =  dataDir + "mpsFiles" + dirsep + "testfile2.mps";
00295                 mpsFileName =  dataDir + "mpsFiles" + dirsep + "parinc.mps";
00296                 mps2osil = new OSmps2osil( mpsFileName);
00297                 // create the first in-memory OSInstance
00298                 mps2osil->createOSInstance() ;
00299                 // write the instance to a string
00300                 OSInstance *osinstance1 = mps2osil->osinstance;
00301                 std::string sOSiL = osilwriter.writeOSiL( osinstance1  );
00302                 //cout << sOSiL << endl;
00303                 //fileUtil->writeFileFromString("p0201.osil", sOSiL);
00304                 // now create a second object
00305                 osilreader = new OSiLReader();
00306                 OSInstance *osinstance2 = osilreader->readOSiL( sOSiL);
00307                 // now compare the elements in the A matrix for the two intances
00308                 int nvals = osinstance1->instanceData->linearConstraintCoefficients->numberOfValues;
00309                 double theDiff, theMax;
00310                 int theIndex = -1;
00311                 theMax = 0;
00312                 for(int i = 0; i < nvals; i++){
00313                         theDiff = fabs(osinstance1->instanceData->linearConstraintCoefficients->value->el[ i] -
00314                                 osinstance2->instanceData->linearConstraintCoefficients->value->el[ i])/ fabs(osinstance1->instanceData->linearConstraintCoefficients->value->el[ i]);
00315                         if(theDiff > theMax){
00316                                 theMax = theDiff;
00317                                 theIndex = i;
00318                         }
00319                         //std::cout << theDiff << std::endl;
00320                 }
00321                 std::cout << "MAXIMUM DIFF = " << theMax << std::endl;
00322                 std::cout << "MAXIMUM DIFF INDEX  = " << theIndex << std::endl;
00323                 if(theMax > 0) unitTestResult << "WARNING:  you do not have lossless IO" << std::endl;
00324                 else unitTestResult << "passed lossless IO test" << std::endl;
00325                 delete mps2osil;
00326                 delete osilreader;
00327                 //nl2osil = new OSnl2osil( nlFileName);
00328             //return 0; 
00329                 /*
00330                 //using os_dtoa_format
00331                 MathUtil *mathUtil = new MathUtil();
00332             int decimalPoint; // where the decimal point goes
00333             int sign; // 1 if negative, 0 if positive
00334             double d ;
00335             d = -2./3.;
00336             //d = 123.4567;
00337             d = 1.23456589e-2;
00338             d = .00001123;
00339             char *result = os_dtoa(d, 0, 0, &decimalPoint, &sign, NULL);
00340             for(int kj = 5; kj < 9; kj++){
00341                 d = pow(10. ,kj) + pow(10., (kj-1));
00342                 //d = 57.7;
00343                 result =os_dtoa(d, 0, 0, &decimalPoint, &sign, NULL);
00344                 printf("HERE IS THE RESULT  %s\n\n", result);
00345                 printf("HERE IS THE RESULT of sign  %d\n\n", sign);
00346                 printf("HERE IS THE RESULT decimal point  %i\n\n", decimalPoint);
00347                 printf("HERE IS THE LENGTH OF THE RESULT  %d\n\n",  strlen(result));
00348                 std::cout << "HERE IS THE RESULT OF OS os_dtoa_format: " << os_dtoa_format( d) << std::endl;
00349             }
00350             d = .00001123;
00351             d = -2./3.;
00352             d = 100;
00353             result = os_dtoa(DBL_MAX, 0, 0, &decimalPoint, &sign, NULL);
00354         printf("HERE IS THE RESULT  %s\n\n", result);
00355         printf("HERE IS THE RESULT of sign  %d\n\n", sign);
00356         printf("HERE IS THE RESULT decimal point  %i\n\n", decimalPoint);
00357         printf("HERE IS THE LENGTH OF THE RESULT  %d\n\n",  strlen(result));
00358         std::cout << "HERE IS THE RESULT OF OS os_dtoa_format: " << os_dtoa_format( OSDBL_MAX) << std::endl;    
00359         d = .000234;
00360             result = os_dtoa(d, 0, 0, &decimalPoint, &sign, NULL);
00361         printf("HERE IS THE RESULT  %s\n\n", result);
00362         printf("HERE IS THE RESULT of sign  %d\n\n", sign);
00363         printf("HERE IS THE RESULT decimal point  %i\n\n", decimalPoint);
00364         printf("HERE IS THE LENGTH OF THE RESULT  %d\n\n",  strlen(result));
00365         std::cout << "HERE IS THE RESULT OF OS os_dtoa_format: " << os_dtoa_format( d) << std::endl;
00366         //
00367         char sInput[] = "77.77 99.99";
00368         char *pEnd;
00369         double d1, d2;
00370         d1 = os_strtod (sInput,  &pEnd);
00371         d2 = os_strtod (pEnd,NULL);
00372         std::cout << d1 << std::endl;
00373         std::cout << d2 << std::endl;
00374         
00375         std::cout << "HERE IS THE RESULT OF OS os_dtoa_format OSDBL_MAX: " << os_dtoa_format( OSDBL_MAX) << std::endl;
00376         std::cout << "HERE IS THE RESULT OF OS os_dtoa_format OSDBL_MAX: " << OSDBL_MAX << std::endl;
00377         std::cout << "HERE IS THE RESULT OF OS os_dtoa_format DBL_MAX: " << os_dtoa_format( DBL_MAX) << std::endl;
00378         std::cout << "HERE IS THE RESULT OF OS os_dtoa_format DBL_MAX: " <<  DBL_MAX << std::endl;
00379         d1 = os_strtod(os_dtoa_format( OSDBL_MAX).c_str(),     NULL);
00380         if(d1 == DBL_MAX )std::cout <<  "SUCCESS" << endl;
00381         else std::cout <<  "FAILURE" << endl;
00382         */
00383         //nl2osil = new OSnl2osil( nlFileName);
00384                 //cout << "All tests completed successfully" <<  endl <<  endl;
00385             //return 0;
00386     
00387         }
00388         catch(const ErrorClass& eclass){
00389                 unitTestResultFailure << "Sorry Unit Test Failed Reading a file: "  + eclass.errormsg<< endl; 
00390                 //no point continuing we can't even read a file
00391                 unitTestResultFailure << "Since we can't read files we are terminating"  << endl; 
00392                 cout << unitTestResultFailure.str() << endl << endl;
00393                 cout << "Conclusion: FAILURE" << endl;
00394                 return 1;
00395         }       
00396         // solve using using the osil file
00397         #ifdef COIN_HAS_IPOPT
00398         IpoptSolver *ipoptSolver  =  NULL;      
00399         try{
00400             ipoptSolver  = new IpoptSolver();
00401                 cout << "create a new IPOPT Solver for OSiL string solution" << endl;
00402                 ok = true;
00403                 OSiLReader *osilreader = NULL;
00404                 osilFileName =  dataDir  + "osilFiles" + dirsep +  "avion2.osil";
00405                 osil = fileUtil->getFileAsString(  osilFileName.c_str() );
00406                 cout << "IPOPT Solver created for OSiL string solution" << endl;
00407                 ipoptSolver->osol = osol;
00408                 osilreader = new OSiLReader(); 
00409                 ipoptSolver->osinstance = osilreader->readOSiL( osil);
00410                 cout << "call the IPOPT Solver" << endl;        
00411                 ipoptSolver->buildSolverInstance();
00412                 ipoptSolver->solve();
00413                 cout << "Here is the IPOPT solver solution for avion2" << endl;
00414                 check = 9.46801e+07;
00415                 //ok &= NearEqual(getObjVal( ipoptSolver->osrl) , check,  1e-10 , 1e-10);
00416                 ok = ( fabs(check - getObjVal( ipoptSolver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00417                 if(ok == false) throw ErrorClass(" Fail unit test with Ipopt on avion2");
00418                 delete osilreader;
00419                 osilreader = NULL;
00420                 delete ipoptSolver;
00421                 ipoptSolver = NULL;
00422                 unitTestResult << "Solved problem avion2.osil with Ipopt" << std::endl;
00423                 // solve another problem
00424                 cout << "create a new IPOPT Solver for OSiL string solution" << endl;
00425                 ipoptSolver  = new IpoptSolver();
00426                 // a problem with all nonlinear terms no linear terms
00427                 osilFileName =  dataDir  + "osilFiles" + dirsep + "HS071_NLPMod.osil";
00428                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00429                 cout << "IPOPT Solver created for OSiL string solution" << endl;
00430                 ipoptSolver->osol = osol;
00431                 osilreader = new OSiLReader(); 
00432                 ipoptSolver->osinstance = osilreader->readOSiL( osil);
00433                 ipoptSolver->buildSolverInstance();
00434                 ipoptSolver->solve();
00435                 cout << "Here is the IPOPT solver solution for HS071_NLP" << endl;
00436                 check = 17.014;
00437                 //ok &= NearEqual(getObjVal( ipoptSolver->osrl) , check,  1e-10 , 1e-10);
00438                 ok = ( fabs(check - getObjVal( ipoptSolver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00439                 if(ok == false) throw ErrorClass(" Fail unit test with Ipopt on HS071_NLP");
00440                 delete osilreader;
00441                 osilreader = NULL;
00442                 unitTestResult << "Solved problem HS071.osil with Ipopt" << std::endl;
00443                 delete ipoptSolver;
00444                 ipoptSolver = NULL;
00445                 cout << "create a new IPOPT Solver for OSiL string solution" << endl;
00446                 ipoptSolver  = new IpoptSolver();
00447                 // solve another problem
00448                 // a problem with both quadratic terms and general nonlinear terms
00449                 osilFileName =  dataDir  + "osilFiles" + dirsep + "rosenbrockmod.osil";
00450                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00451                 cout << "IPOPT Solver created for OSiL string solution" << endl;
00452                 ipoptSolver->osol = osol;
00453                 osilreader = new OSiLReader(); 
00454                 ipoptSolver->osinstance = osilreader->readOSiL( osil);
00455                 cout << "call the IPOPT Solver" << endl;
00456                 ipoptSolver->buildSolverInstance();
00457                 ipoptSolver->solve();
00458                 check = 6.7279;
00459                 //ok &= NearEqual(getObjVal( ipoptSolver->osrl) , check,  1e-10 , 1e-10);
00460                 ok = ( fabs(check - getObjVal( ipoptSolver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00461                 if(ok == false) throw ErrorClass(" Fail unit test with Ipopt on rosenbrock");
00462                 delete osilreader;
00463                 osilreader = NULL;
00464                 unitTestResult << "Solved problem rosenbrockmod.osil with Ipopt" << std::endl;
00465                 delete ipoptSolver;
00466                 ipoptSolver = NULL;
00467                 cout << "create a new IPOPT Solver for OSiL string solution" << endl;
00468                 ipoptSolver  = new IpoptSolver();
00469                 // solve another problem
00470                 // a problem that is a pure quadratic
00471                 osilFileName =  dataDir  + "osilFiles" + dirsep + "parincQuadratic.osil";
00472                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00473                 cout << "IPOPT Solver created for OSiL string solution" << endl;
00474                 ipoptSolver->osol = osol;
00475                 osilreader = new OSiLReader(); 
00476                 ipoptSolver->osinstance = osilreader->readOSiL( osil);
00477                 cout << "call the IPOPT Solver" << endl;
00478                 ipoptSolver->buildSolverInstance();
00479                 ipoptSolver->solve();
00480                 cout << "Here is the IPOPT solver solution for parincQuadratic" << endl;
00481                 check = 49920.5;
00482                 //ok &= NearEqual(getObjVal( ipoptSolver->osrl) , check,  1e-10 , 1e-10);
00483                 ok = ( fabs(check - getObjVal( ipoptSolver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00484                 if(ok == false) throw ErrorClass(" Fail unit test with Ipopt on parincQuadradic");
00485                 delete osilreader;
00486                 osilreader = NULL;      
00487                 unitTestResult << "Solved problem parincQuadratic.osil with Ipopt" << std::endl;
00488                 delete ipoptSolver;
00489                 ipoptSolver = NULL;
00490                 cout << "create a new IPOPT Solver for OSiL string solution" << endl;
00491                 ipoptSolver  = new IpoptSolver();
00492                 // solve another problem
00493                 // try a pure linear program
00494                 osilFileName =  dataDir  + "osilFiles" + dirsep + "parincLinear.osil";
00495                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00496                 cout << "IPOPT Solver created for OSiL string solution" << endl;
00497                 ipoptSolver->osol = osol; 
00498                 osilreader = new OSiLReader(); 
00499                 ipoptSolver->osinstance = osilreader->readOSiL( osil);
00500                 cout << "call the IPOPT Solver" << endl;
00501                 ipoptSolver->buildSolverInstance();
00502                 ipoptSolver->solve();
00503                 cout << "Here is the IPOPT solver solution for parincLinear" << endl;
00504                 check = 7668;
00505                 //ok &= NearEqual(getObjVal( ipoptSolver->osrl) , check,  1e-1 , 1e-1);
00506                 ok = ( fabs(check - getObjVal( ipoptSolver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00507                 if(ok == false) throw ErrorClass(" Fail unit test with Ipopt on parincLinear");
00508                 delete osilreader;
00509                 osilreader = NULL;      
00510                 unitTestResult << "Solved problem parincLinear.osil with Ipopt" << std::endl;
00511                 delete ipoptSolver;
00512                 ipoptSolver = NULL;
00513                 cout << "create a new IPOPT Solver for OSiL string solution" << endl;
00514                 ipoptSolver  = new IpoptSolver();
00515                 // solve another problem
00516                 // callBackTest.osil
00517                 osilFileName =  dataDir  + "osilFiles" + dirsep + "callBackTest.osil";
00518                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00519                 cout << "IPOPT Solver created for OSiL string solution" << endl;
00520                 ipoptSolver->osol = osol;
00521                 osilreader = new OSiLReader(); 
00522                 ipoptSolver->osinstance = osilreader->readOSiL( osil);
00523                 //OSiLWriter osilwriter;
00524                 //cout << osilwriter.writeOSiL( ipoptSolver->osinstance) << endl;
00525                 //return 0;
00526                 cout << "call the IPOPT Solver" << endl;
00527                 ipoptSolver->buildSolverInstance();
00528                 ipoptSolver->solve();
00529                 cout << "Here is the IPOPT solver solution for callBackTest" << endl;
00530                 check = 1.00045e+06;
00531                 //ok &= NearEqual(getObjVal( ipoptSolver->osrl) , check,  1e-10 , 1e-10);
00532                 ok = ( fabs(check - getObjVal( ipoptSolver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00533                 if(ok == false) throw ErrorClass(" Fail unit test with Ipopt on parincLinear");
00534                 delete osilreader;
00535                 osilreader = NULL;      
00536                 unitTestResult << "Solved problem callBack.osil with Ipopt" << std::endl;       
00537                 delete ipoptSolver;
00538                 ipoptSolver = NULL;
00539                 cout << "create a new IPOPT Solver for OSiL string solution" << endl;
00540                 ipoptSolver  = new IpoptSolver();
00541                 // solve another problem
00542                 // callBackTest.osil
00543                 osilFileName =  dataDir  + "osilFiles" + dirsep + "callBackTestRowMajor.osil";
00544                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00545                 cout << "IPOPT Solver created for OSiL string solution" << endl;
00546                 ipoptSolver->osol = osol;
00547                 osilreader = new OSiLReader(); 
00548                 ipoptSolver->osinstance = osilreader->readOSiL( osil);
00549                 //OSiLWriter osilwriter;
00550                 //cout << osilwriter.writeOSiL( ipoptSolver->osinstance) << endl;
00551                 //return 0;
00552                 cout << "call the IPOPT Solver" << endl;
00553                 ipoptSolver->buildSolverInstance();
00554                 ipoptSolver->solve();
00555                 cout << "Here is the IPOPT solver solution for callBackTestRowMajor" << endl;
00556                 check = 1.00045e+06;
00557                 //ok &= NearEqual(getObjVal( ipoptSolver->osrl) , check,  1e-10 , 1e-10);
00558                 ok = ( fabs(check - getObjVal( ipoptSolver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00559                 if(ok == false) throw ErrorClass(" Fail unit test with Ipopt on parincLinear");
00560                 delete osilreader;
00561                 osilreader = NULL;      
00562                 delete ipoptSolver;
00563                 ipoptSolver = NULL;     
00564                 unitTestResult << "Solved problem callBackRowMajor.osil with Ipopt" << std::endl;
00565         }
00566         catch(const ErrorClass& eclass){
00567                 unitTestResultFailure << "Sorry Unit Test Failed Testing the Ipopt Solver:"  + eclass.errormsg<< endl; 
00568         }
00569         #endif
00570         try{
00571                 ok = true; 
00572                 std::cout << "create a new COIN Clp for OSiL string solution" << std::endl;
00573                 osilFileName = dataDir  + "osilFiles" + dirsep + "parincLinearByRow.osil";
00574                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00575                 std::cout << "create a new Solver object" << std::endl;
00576                 OSiLReader *osilreader = NULL;
00577                 osilreader = new OSiLReader(); 
00578                 //std::cout <<  osil  << std::endl;
00579                 OSInstance *osinstance = osilreader->readOSiL( osil);
00580                 std::cout << " Done reading the OSiL" << std::endl;
00581                 // now write it again as a string
00582                 OSiLWriter *osilwriter;
00583                 osilwriter = new OSiLWriter();
00584                 osilwriter->m_bWhiteSpace = true;
00585                 std::cout << " Write the OSiL" << std::endl;
00586                 osil = osilwriter->writeOSiL( osinstance) ;
00587                 //std::cout <<  osil  << std::endl;
00588                 std::cout << " Done writing the OSiL" << std::endl;
00589                 solver = new CoinSolver();
00590                 solver->sSolverName = "clp";
00591                 solver->osil = osil;
00592                 solver->osol = osol;  
00593                 solver->osinstance = NULL; 
00594                 cout << "call the COIN - clp Solver for parincLinearbyRow" << endl;
00595                 //solver->buildSolverInstance();
00596                 solver->solve();
00597                 cout << "Here is the COIN clp solver solution for parincLinearByRow" << endl;
00598                 cout << solver->osrl << endl;
00599                 check = 7668;
00600                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00601                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-1 , 1e-1);
00602                 if(ok == false) throw ErrorClass(" Fail unit test with clp on parincLinear");
00603                 // parse the osrl file
00604                 osrlreader =  new OSrLReader();
00605                 osrlreader->readOSrL( solver->osrl);
00606                 delete osilreader;
00607                 osilreader = NULL;      
00608                 delete solver;
00609                 solver = NULL;
00610                 delete osilwriter;
00611                 osilwriter = NULL;
00612                 delete osrlreader;
00613                 osrlreader = NULL;
00614                 unitTestResult << "Solved problem parincLinearByRow.osil with Clp" << std::endl;
00615                 // now solve another problem -- try an integer program
00616                 // this problem is also stored in base64 binary
00617         }
00618         catch(const ErrorClass& eclass){
00619                 unitTestResultFailure << "Sorry Unit Test Failed Testing Clp Solver:"  + eclass.errormsg<< endl;
00620         }
00621         try{
00622                 std::cout << "create a new COIN Cbc for OSiL string solution" << std::endl;
00623                 ok = true;
00624                 osilFileName = dataDir  + "osilFiles" + dirsep + "p0033.osil";
00625                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00626                 solver = new CoinSolver();
00627                 solver->sSolverName ="cbc";
00628                 solver->osil = osil;
00629                 solver->osol = osol;  
00630                 solver->osinstance = NULL; 
00631                 cout << "call the COIN - Cbc Solver for p0033" << endl;
00632                 solver->buildSolverInstance();
00633                 solver->solve();
00634                 cout << "Here is the COIN Cbc solver solution for p0033" << endl;
00635                 //cout << solver->osrl << endl;
00636                 check = 3089;
00637                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00638                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00639                 if(ok == false) throw ErrorClass(" Fail unit test with Cbc on p0033");
00640                 delete solver;
00641                 solver = NULL;
00642                 unitTestResult << "Solved problem p0033.osil with Cbc" << std::endl;
00643                 // now test p0201.osil
00644                 /*
00645                 ok = true;
00646                 osilFileName = dataDir  + "osilFiles" + dirsep + "p0201.osil";
00647                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00648                 solver = new CoinSolver();
00649                 solver->sSolverName ="cbc";
00650                 solver->osil = osil;
00651                 solver->osol = osol;  
00652                 solver->osinstance = NULL; 
00653                 cout << "call the COIN - Cbc Solver for p0201" << endl;
00654                 solver->solve();
00655                 cout << "Here is the COIN Cbc solver solution for p0201" << endl;
00656                 check = 7615;
00657                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00658                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00659                 if(ok == false) throw ErrorClass(" Fail unit test with Cbc on p0548");
00660                 delete solver;
00661                 solver = NULL;
00662                 unitTestResult << "Solved problem p0201.osil with Cbc" << std::endl;
00663                 */
00664         }
00665         catch(const ErrorClass& eclass){
00666                 unitTestResultFailure << "Sorry Unit Test Failed Testing Cbc Solver:"  + eclass.errormsg<< endl;
00667         }
00668         
00669         //
00670         //
00671         #ifdef COIN_HAS_KNITRO
00672         try{
00673                 ok = true; 
00674                 osilFileName = dataDir  + "osilFiles" + dirsep + "rosenbrockmod.osil";
00675                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00676                 solver = new KnitroSolver();
00677                 solver->osrl = "";      
00678                 solver->osil = osil;
00679                 solver->osol = osol;
00680                 solver->osinstance = NULL;
00681                 cout << "call the KNITRO Solver" << endl;
00682                 solver->solve();
00683                 cout << "Here is the KNITRO solver solution" << endl;   
00684                 check = 6.7279;
00685                 cout << solver->osrl << endl;
00686                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00687                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00688                 if(ok == false) throw ErrorClass(" Fail unit test with Knitro on rosenbrockmod");
00689                 delete solver;
00690                 solver = NULL;
00691                 unitTestResult << "Solved problem rosenbrockmod.osil with Knitro" << std::endl;
00692                 //
00693                 // now solve callBackTest.osil
00694                 osilFileName = dataDir  + "osilFiles" + dirsep + "callBackTest.osil";
00695                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00696                 solver = new KnitroSolver();
00697                 solver->osrl = "";              
00698                 solver->osil = osil;            
00699                 solver->osol = osol;
00700                 cout << "call the KNITRO Solver" << endl;
00701                 solver->solve();
00702                 cout << "Here is the KNITRO solver solution" << endl;
00703                 check = 1.00045e+06; 
00704                 cout << solver->osrl << endl;
00705                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00706                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00707                 if(ok == false) throw ErrorClass(" Fail unit test with Knitro callBackTest.osil");
00708                 delete solver;
00709                 solver = NULL;  
00710                 unitTestResult << "Solved problem callBackTest.osil with Knitro" << std::endl;          
00711                 //
00712                 // now solve a pure quadratic
00713                 osilFileName = dataDir  + "osilFiles" + dirsep + "parincQuadratic.osil";
00714                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00715                 solver = new KnitroSolver();    
00716                 solver->osil = osil;
00717                 solver->osol = osol;
00718                 solver->osinstance = NULL;
00719                 cout << "call the Knitro Solver" << endl;
00720                 solver->solve();
00721                 cout << "Here is the Knitro solver solution" << endl;
00722                 cout << solver->osrl << endl;
00723                 check = 49920.5;
00724                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00725                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00726                 if(ok == false) throw ErrorClass(" Fail unit test with Knitro on parincQuadratic");
00727                 delete solver;
00728                 solver = NULL;
00729                 unitTestResult << "Solved problem parincQuadratic.osil with Knitro" << std::endl;
00730                 //
00731                 // now solve a HS071_NLP.osil
00732                 osilFileName = dataDir  + "osilFiles" + dirsep + "HS071_NLP.osil";
00733                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00734                 solver = new KnitroSolver();    
00735                 solver->osil = osil;
00736                 solver->osol = osol;
00737                 solver->osinstance = NULL;
00738                 cout << "call the Knitro Solver" << endl;
00739                 solver->solve();                
00740                 cout << "Here is the Knitro solver solution" << endl;
00741                 cout << solver->osrl << endl;
00742                 check = 17.014;
00743                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00744                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00745                 if(ok == false) throw ErrorClass(" Fail unit test with Knitro on HS071_NLP");
00746                 delete solver;
00747                 solver = NULL;
00748                 unitTestResult << "Solved problem HS071_NLP.osil with Knitro" << std::endl;
00749         }
00750         catch(const ErrorClass& eclass){
00751                 cout << "OSrL =  " <<  solver->osrl <<  endl;           
00752                 cout << endl << endl << endl;
00753                 unitTestResultFailure  << "Sorry Unit Test Failed Testing the Knitro Solver: "  + eclass.errormsg << endl;
00754         }       
00755         #endif
00756         //
00757         //
00758         
00759         //
00760         //
00761         #ifdef COIN_HAS_SYMPHONY
00762         try{
00763                 ok = true; 
00764                 osilFileName = dataDir  + "osilFiles" + dirsep + "p0033.osil";
00765                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00766                 solver = new CoinSolver();
00767                 solver->sSolverName = "symphony";
00768                 solver->osil = osil;
00769                 solver->osol = osol;  
00770                 solver->osinstance = NULL; 
00771                 cout << "call the COIN - SYMPHONY Solver for p0033" << endl;
00772                 solver->buildSolverInstance();
00773                 solver->solve();
00774                 cout << "Here is the COIN SYMPHONY solver solution for p0033" << endl;
00775                 cout << solver->osrl << endl;
00776                 check = 3089;
00777                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00778                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00779                 if(ok == false) throw ErrorClass(" Fail unit test with SYMPHONY on p0033.osil");
00780                 delete solver;
00781                 solver = NULL;
00782                 unitTestResult << "Solved problem p0033.osil with SYMPHONY" << std::endl;
00783         }
00784         catch(const ErrorClass& eclass){
00785                 cout << "OSrL =  " <<  solver->osrl <<  endl;
00786                 cout << endl << endl << endl;
00787                 unitTestResultFailure  << "Sorry Unit Test Failed Testing the SYMPHONY Solver:"  + eclass.errormsg << endl;
00788         }       
00789         #endif
00790         //
00791         //
00792         //
00793         //
00794         #ifdef COIN_HAS_DYLP
00795         try{
00796                 ok = true; 
00797                 osilFileName = dataDir  + "osilFiles" + dirsep + "parincLinear.osil";
00798                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00799                 solver = new CoinSolver();
00800                 solver->sSolverName = "dylp";
00801                 solver->osil = osil;
00802                 solver->osol = osol;   
00803                 solver->osinstance = NULL; 
00804                 cout << "call the COIN - DyLP solver for parincLinear" << endl;
00805                 solver->buildSolverInstance();
00806                 solver->solve();
00807                 cout << "Here is the COIN - DyLP solver solution for parincLinear" << endl;
00808                 cout << solver->osrl << endl;
00809                 check = 7668;
00810                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-1 , 1e-1);
00811                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00812                 if(ok == false) throw ErrorClass(" Fail unit test with DyLP on parincLinear.osil");
00813                 delete solver;
00814                 solver = NULL;
00815                 unitTestResult << "Solved problem parincLinear.osil with DyLP" << std::endl;
00816         }
00817         catch(const ErrorClass& eclass){
00818                 cout << "OSrL =  " <<  solver->osrl <<  endl;
00819                 cout << endl << endl << endl;
00820                 unitTestResultFailure  <<"Sorry Unit Test Failed Testing the DyLP Solver:"  + eclass.errormsg << endl;
00821         }       
00822         #endif
00823         //
00824         //
00825         //
00826         
00827         #ifdef COIN_HAS_VOL
00828         try{
00829                 ok = true; 
00830                 osilFileName = dataDir  + "osilFiles" + dirsep + "volumeTest.osil";
00831                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00832                 solver = new CoinSolver();
00833                 solver->sSolverName = "vol";
00834                 solver->osil = osil;
00835                 solver->osol = osol;  
00836                 solver->osinstance = NULL; 
00837                 cout << "call the COIN - Vol solver for parincLinear" << endl;
00838                 solver->buildSolverInstance();
00839                 solver->solve();
00840                 cout << "Here is the COIN - Vol solver solution for parincLinear" << endl;
00841                 cout << solver->osrl << endl;
00842                 check = 7;
00843                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-1 , 1e-1);
00844                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00845                 if(ok == false) throw ErrorClass(" Fail unit test with Vol on volumeTest.osil");
00846                 delete solver;
00847                 solver = NULL;
00848                 unitTestResult << "Solved problem volumeTest.osil with Vol" << std::endl;
00849         }
00850         catch(const ErrorClass& eclass){
00851                 cout << "OSrL =  " <<  solver->osrl <<  endl;
00852                 cout << endl << endl << endl;
00853                 unitTestResultFailure  <<"Sorry Unit Test Failed Testing the Vol Solver:"  + eclass.errormsg << endl;
00854         }       
00855         #endif
00856         //
00857         //
00858         //
00859         //
00860         #ifdef COIN_HAS_GLPK
00861         try{
00862                 ok = true; 
00863                 osilFileName = dataDir  + "osilFiles" + dirsep + "p0033.osil";
00864                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00865                 solver = new CoinSolver();
00866                 solver->sSolverName = "glpk";
00867                 solver->osil = osil;
00868                 solver->osol = osol;  
00869                 solver->osinstance = NULL; 
00870                 cout << "call the GLPK Solver for p0033" << endl;
00871                 solver->buildSolverInstance();
00872                 solver->solve();
00873                 cout << "Here is the GLPK solver solution for p0033" << endl;
00874                 cout << solver->osrl << endl;
00875                 check = 3089;
00876                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00877                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00878                 if(ok == false) throw ErrorClass(" Fail unit test with GLPK on p0033.osil");
00879                 delete solver;
00880                 solver = NULL;
00881                 unitTestResult << "Solved problem p0033.osil with GLPK" << std::endl;
00882         }
00883         catch(const ErrorClass& eclass){
00884                 cout << "OSrL =  " <<  solver->osrl <<  endl;
00885                 cout << endl << endl << endl;
00886                 unitTestResultFailure  <<"Sorry Unit Test Failed Testing the Glpk Solver:"  + eclass.errormsg << endl;
00887         }       
00888         #endif
00889         //
00890         //
00891         //
00892         #ifdef COIN_HAS_CPX
00893         try{
00894                 ok = true; 
00895                 osilFileName = dataDir  + "osilFiles" + dirsep + "p0033.osil";
00896                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00897                 solver = new CoinSolver();
00898                 solver->sSolverName = "cplex";
00899                 solver->osil = osil;
00900                 solver->osol = osol;  
00901                 solver->osinstance = NULL; 
00902                 cout << "call the CPLEX Solver for p0033" << endl;
00903                 solver->buildSolverInstance();
00904                 solver->solve();
00905                 cout << "Here is the CPLEX solver solution for p0033" << endl;
00906                 cout << solver->osrl << endl;
00907                 check = 3089;
00908                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00909                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00910                 if(ok == false) throw ErrorClass(" Fail unit test with CPLEX on p0033.osil");
00911                 delete solver;
00912                 solver = NULL;
00913                 unitTestResult << "Solved problem p0033.osil with CPLEX" << std::endl;
00914         }
00915         catch(const ErrorClass& eclass){
00916                 cout << "OSrL =  " <<  solver->osrl <<  endl;
00917                 cout << endl << endl << endl;
00918                 unitTestResultFailure  <<"Sorry Unit Test Failed Testing the Cplex Solver:"  + eclass.errormsg << endl;
00919         }       
00920         #endif
00921         
00922         //
00923         #ifdef COIN_HAS_LINDO
00924         try{
00925                 ok = true;
00926                 osilFileName = dataDir  + "osilFiles" + dirsep + "lindoapiaddins.osil";
00927                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00928                 cout << "create a new LINDO Solver for OSiL string solution" << endl;
00929                 solver = new LindoSolver();     
00930                 solver->osil = osil;
00931                 solver->osol = osol;
00932                 solver->osinstance = NULL;
00933                 cout << "call the LINDO Solver" << endl;
00934                 solver->buildSolverInstance();
00935                 solver->solve();
00936                 cout << "Here is the LINDO solver solution" << endl;
00937                 cout << solver->osrl << endl;
00938                 check = 99;
00939                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00940                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00941                 if(ok == false) throw ErrorClass(" Fail unit test with LINDO on lindoapiaddins");
00942                 solver->osinstance = NULL;
00943                 delete solver;
00944                 solver = NULL;
00945                 unitTestResult << "Solved problem lindoapiaddins.osil with Lindo" << std::endl;
00946                 // now solve the rosenbrock problem from the OSiL paper
00947                 osilFileName = dataDir  + "osilFiles" + dirsep + "rosenbrockmod.osil";
00948                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00949                 solver = new LindoSolver();     
00950                 solver->osil = osil;
00951                 solver->osol = osol;
00952                 solver->osinstance = NULL;
00953                 cout << "call the LINDO Solver" << endl;
00954                 solver->buildSolverInstance();
00955                 solver->solve();
00956                 cout << "Here is the LINDO solver solution" << endl;
00957                 cout << solver->osrl << endl;
00958                 check = 6.7279;
00959                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00960                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00961                 if(ok == false) throw ErrorClass(" Fail unit test with LINDO on rosenbrockmod");
00962                 solver->osinstance = NULL;
00963                 delete solver;
00964                 solver = NULL;
00965                 unitTestResult << "Solved problem rosenbrockmod.osil with Lindo" << std::endl;
00966                 // now solve a pure quadratic
00967                 osilFileName = dataDir  + "osilFiles" + dirsep + "parincQuadratic.osil";
00968                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00969                 solver = new LindoSolver();     
00970                 solver->osil = osil;
00971                 solver->osol = osol;
00972                 solver->osinstance = NULL;
00973                 cout << "call the LINDO Solver" << endl;
00974                 solver->buildSolverInstance();
00975                 solver->solve();
00976                 cout << "Here is the LINDO solver solution" << endl;
00977                 cout << solver->osrl << endl;
00978                 check = 49920.5;
00979                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
00980                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
00981                 if(ok == false) throw ErrorClass(" Fail unit test with LINDO on parincQuadratic");
00982                 delete solver;
00983                 solver = NULL;
00984                 unitTestResult << "Solved problem parincQuadratic.osil with Lindo" << std::endl;
00985                 // now solve a quadratic binary problem
00986                 // wayneQuadratic.osil
00987                 /*
00988                 osilFileName = dataDir  + "osilFiles" + dirsep + "wayneQuadratic.osil";
00989                 osil = fileUtil->getFileAsString( osilFileName.c_str());
00990                 solver = new LindoSolver();     
00991                 solver->osil = osil;
00992                 solver->osol = osol;
00993                 solver->osinstance = NULL;
00994                 cout << "call the LINDO Solver" << endl;
00995                 solver->buildSolverInstance();
00996                 solver->solve();
00997                 cout << "Here is the LINDO solver solution" << endl;
00998                 cout << solver->osrl << endl;
00999                 check = 2.925;
01000                 std::cout << "CALL NEAR_EQUSL" << std::endl;
01001                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-10 , 1e-10);
01002                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01003                 std::cout << "CALL NEAR_EQUSL" << std::endl;
01004                 if(ok == false) throw ErrorClass(" Fail unit test with LINDO on wayneQuadratic");
01005                 delete solver;
01006                 solver = NULL;
01007                 unitTestResult << "Solved problem wayneQuadratic.osil with Lindo" << std::endl;
01008                 */
01009                 
01010         }
01011         catch(const ErrorClass& eclass){
01012                 //cout << "OSrL =  " <<  solver->osrl <<  endl;
01013                 cout << endl << endl << endl;
01014                 unitTestResultFailure  <<"Sorry Unit Test Failed Testing the LINDO Solver:"  + eclass.errormsg << endl << endl;
01015         }
01016         #endif
01017         // end solving using the osil file
01018         // now solve with an OSInstance created from an MPS file
01019         try{
01020                 ok = true;
01021                 cout << endl;
01022                 cout << "START MPS TESTING" << endl << endl;
01023                 cout << "create a COIN Solver for MPS - OSInstance solution" << endl;
01024                 solver = new CoinSolver();
01025                 solver->sSolverName = "cbc";
01026                 mps2osil = new OSmps2osil( mpsFileName);
01027                 mps2osil->createOSInstance() ;
01028                 solver->osinstance = mps2osil->osinstance;
01029                 solver->osol = osol;
01030                 cout << "call COIN Solve" << endl;
01031                 solver->buildSolverInstance();
01032                 solver->solve();
01033                 cout << "Here is the COIN solver solution" << endl;
01034                 cout << solver->osrl << endl;
01035                 check = -7668;
01036                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-1 , 1e-1);
01037                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01038                 if(ok == false) throw ErrorClass(" Fail unit test with COIN Solver on MPS test problem parincLinear.mps");
01039                 delete solver;
01040                 solver = NULL;
01041                 delete mps2osil; 
01042                 mps2osil = NULL;
01043                 cout << endl;
01044                 cout << "DONE WITH MPS TESTING" << endl;
01045                 unitTestResult << "Test the MPS -> OSiL converter on parinc.mps using Cbc" << std::endl;
01046         }
01047         catch(const ErrorClass& eclass){
01048                 cout << "OSrL =  " <<  solver->osrl <<  endl;
01049                 cout << endl << endl << endl;
01050                 unitTestResultFailure  <<"Sorry Unit Test Failed Testing the MPS converter:"  + eclass.errormsg << endl;
01051         }
01052         // now solve with an OSInstance created from an AMPL nl file
01053         try{
01054                 ok = true;
01055                 cout << endl;
01056                 cout << "START AMPL TESTING" << endl << endl;
01057 #ifdef COIN_HAS_ASL
01058                 cout << "create a cbc Solver for AMPL nl - OSInstance solution" << endl;
01059                 solver = new CoinSolver();
01060                 solver->sSolverName = "cbc";
01061                 nl2osil = new OSnl2osil( nlFileName); 
01062                 nl2osil->createOSInstance() ;
01063                 solver->osinstance = nl2osil->osinstance;       
01064                 solver->osol = osol;
01065                 cout << "call Cbc Solve" << endl;
01066                 solver->buildSolverInstance();
01067                 solver->solve();
01068                 cout << "Here is the Cbc solver solution" << endl;
01069                 cout << solver->osrl << endl;
01070                 check = 7668;
01071                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-1 , 1e-1);
01072                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01073                 if(ok == false) throw ErrorClass(" Fail unit test with OSnl2osil on problem parinc.nl");
01074                 solver->osinstance = NULL;
01075                 delete solver;
01076                 solver = NULL;
01077                 cout << "call delete nl2osil" << endl;
01078                 delete nl2osil;
01079                 nl2osil = NULL; 
01080                 unitTestResult << "Test the AMPL nl -> OSiL converter on parinc.nl using Cbc" << std::endl; 
01081 #endif
01082                 cout << "END AMPL TESTING" << endl << endl;
01083         }       
01084                 catch(const ErrorClass& eclass){
01085                 cout << "OSrL =  " <<  solver->osrl <<  endl;
01086                 cout << endl << endl << endl;
01087                 unitTestResultFailure  <<"Sorry Unit Test Failed Testing AMPL:"  + eclass.errormsg << endl;
01088         }
01089         //
01090         // Now test the b64 feature
01091         //
01092         try{
01093                 ok = true;
01094                 cout << endl;
01095                 cout << endl;
01096                 cout << "TESTING BASE 64 WITH A COIN SOLVER"<< endl;
01097                 cout << endl;
01098                 OSiLWriter osilwriter;
01099                 osilwriter.m_bWriteBase64 = true;
01100                 solver = new CoinSolver();
01101                 solver->sSolverName = "cbc";
01102                 mps2osil = new OSmps2osil( mpsFileName);
01103                 solver->osinstance = NULL;
01104                 solver->osol = osol;
01105                 mps2osil->createOSInstance() ;
01106                 solver->osil = osilwriter.writeOSiL( mps2osil->osinstance) ;
01107                 std::cout << solver->osil << std::endl;
01108                 solver->buildSolverInstance();
01109                 solver->solve();
01110                 cout << endl << endl;
01111                 cout << "COIN solution of a OSiL string in b64 format" << endl;
01112                 cout << solver->osrl;
01113                 check = -7668;
01114                 //ok &= NearEqual(getObjVal( solver->osrl) , check,  1e-1 , 1e-1);
01115                 ok = ( fabs(check - getObjVal( solver->osrl) )/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01116                 if(ok == false) throw ErrorClass(" Fail unit test with COIN Cbc cSolver on b64 test problem parincLinear.mps");
01117                 solver->osinstance = NULL;
01118                 delete solver;
01119                 solver = NULL;
01120                 delete mps2osil;
01121                 mps2osil = NULL;
01122                 unitTestResult << "Test a problem written in b64 and then converted to OSInstance" << std::endl;
01123         }       
01124         catch(const ErrorClass& eclass){
01125                 cout << endl << endl;
01126                 cout << eclass.errormsg <<  endl << endl;
01127                 cout << "OSrL =  " <<  solver->osrl <<  endl;
01128                 cout << endl << endl << endl;
01129                 unitTestResultFailure   << "Sorry Unit Test Failed Testing Use of Base 64" << endl;
01130 
01131         }  
01132         //
01133         // Now just test the OSiL parser
01134         try{ 
01135                 cout << endl;
01136                 clock_t start, finish;
01137                 double duration;
01138                 OSiLWriter *osilwriter = NULL;
01139                 osilwriter = new OSiLWriter();
01140                 //delete fileUtil;
01141                 //fileUtil = NULL;
01142                 //fileUtil = new FileUtil();
01143                 cout << "TEST PARSING A MODEL" << endl;
01144                 cout << "FIRST READ THE FILE INTO A STRING" << endl;
01145                 start = clock();
01146                 osilFileName = dataDir  + "osilFiles" + dirsep + "parincLinear.osil";
01147                 osil = fileUtil->getFileAsString( osilFileName.c_str());
01148                 finish = clock();
01149                 duration = (double) (finish - start) / CLOCKS_PER_SEC;
01150                 cout << "Reading the file into a string took (seconds): "<< duration << endl;
01151                 OSiLReader *osilreader = NULL;
01152                 osilreader = new OSiLReader(); 
01153                 start = clock();
01154                 cout << "PARSE THE OSIL STRING INTO AN OSINSTANCE OBJECT" << endl;
01155                 osilreader->readOSiL( osil);
01156                 //cout << osilwriter->writeOSiL( osilreader->readOSiL( osil)) << endl;
01157                 delete osilreader;
01158                 osilreader = 0;
01159                 delete osilwriter;
01160                 osilwriter = NULL;
01161                 finish = clock();
01162                 duration = (double) (finish - start) / CLOCKS_PER_SEC;
01163                 cout << "Parsing took (seconds): "<< duration << endl;
01164                 unitTestResult << "Successful test of OSiL parser on problem parincLinear.osil" << std::endl;
01165 
01166         }       
01167                 catch(const ErrorClass& eclass){
01168                 cout << endl << endl << endl;
01169                 cout << eclass.errormsg << endl;
01170                 unitTestResultFailure << "Sorry Unit Test Failed Testing An OSiL Parser" << endl;
01171                 
01172         }       
01173         
01174         //
01175         // Now just test the OSrL parser
01176         try{ 
01177                 cout << endl;
01178                 clock_t start, finish;
01179                 double duration;
01180                 osrlwriter = new OSrLWriter();
01181                 osrlreader = new OSrLReader();
01182                 OSResult *osresult = NULL;
01183                 //osresult = new OSResult(); 
01184                 cout << "TEST PARSING AN OSrL FILE" << endl;
01185                 cout << "FIRST READ THE OSrL FILE INTO A STRING" << endl;
01186                 osrlFileName = dataDir  + "osrlFiles" + dirsep + "parincLinear.osrl"; 
01187                 start = clock();
01188                 std::string osrl = fileUtil->getFileAsString( osrlFileName.c_str() );
01189                 finish = clock();
01190                 duration = (double) (finish - start) / CLOCKS_PER_SEC;
01191                 cout << "Reading the file into a string took (seconds): "<< duration << endl;
01192                 start = clock();
01193                 cout << "PARSE THE OSRL STRING INTO AN OSRESULT OBJECT" << endl;
01194                 osresult = osrlreader->readOSrL( osrl);
01195                 cout << osrlwriter->writeOSrL( osresult) << endl;
01196                 delete osrlwriter;
01197                 osrlwriter = NULL;
01198                 delete osrlreader;
01199                 osrlreader = NULL;
01200                 finish = clock();
01201                 duration = (double) (finish - start) / CLOCKS_PER_SEC;
01202                 cout << "Parsing took (seconds): "<< duration << endl;
01203                 unitTestResult << "Successful test of OSrL parser on problem parincLinear.osrl" << std::endl;
01204 
01205         }       
01206                 catch(const ErrorClass& eclass){
01207                 cout << endl << endl << endl;
01208                 if(osrlwriter != NULL) delete osrlwriter;
01209                 if(osrlreader != NULL) delete osrlreader;
01210                 // " Problem with the test reading OSrL data";
01211                 unitTestResultFailure << eclass.errormsg << endl;
01212                 unitTestResultFailure << "There was a failure in the test for reading OSrL" << endl;
01213         }
01214         // now test postfix and prefix routines
01215         try{
01216                 std::string expTreeTest =  dataDir  + "osilFiles" + dirsep + "rosenbrockmod.osil";
01217                 osil = fileUtil->getFileAsString( expTreeTest.c_str() ) ;
01218                 OSInstance *osinstance = NULL;
01219                 //osinstance = new OSInstance();
01220                 OSiLReader *osilreader = NULL;
01221                 osilreader = new OSiLReader();
01222                 //create an osinstance
01223                 osinstance = osilreader->readOSiL( osil);
01224                 OSExpressionTree* expTree = osinstance->getNonlinearExpressionTree( -1);
01225                 if(expTree == NULL) throw ErrorClass(" Null expression tree when testing prefix and postfix routines");
01226                 std::vector<OSnLNode*> postfixVec;
01227                 //postfixVec = expTree->m_treeRoot->getPostfixFromExpressionTree();
01228                 postfixVec = osinstance->getNonlinearExpressionTreeInPostfix( -1);
01229         
01230                 unsigned int n = postfixVec.size();
01231                 unsigned int i;
01232                 std::string *nodeNames1 = new std::string[ n];
01233                 std::string *nodeNames2 = new std::string[ n];
01234                 for (i = 0 ; i < n; i++){
01235                         std::cout << postfixVec[i]->snodeName << std::endl;
01236                         nodeNames1[i] = postfixVec[i]->snodeName;
01237                 }
01238                 
01239                 // now create back the expression tree 
01240                 expTree->m_treeRoot = postfixVec[ n - 1]->createExpressionTreeFromPostfix( postfixVec);
01241         
01242                 // now get in prefix
01243                 std::vector<OSnLNode*> prefixVec;
01244                 //prefixVec = expTree->m_treeRoot->getPrefixFromExpressionTree();
01245                 prefixVec = osinstance->getNonlinearExpressionTreeInPrefix( -1);
01246                 
01247                 // now create back the expression tree
01248                 expTree->m_treeRoot = prefixVec[ 0]->createExpressionTreeFromPrefix( prefixVec);
01249                 
01250                 // now get postfix vector again and compare with original
01251                 postfixVec = expTree->m_treeRoot->getPostfixFromExpressionTree();
01252                 //postfixVec = osinstance->getNonlinearExpressionTreeInPostfix( -1);
01253                 if(postfixVec.size() != n) throw ErrorClass(" Problem with creating expression trees");
01254                 std::cout << std::endl << std::endl;
01255                 for (i = 0 ; i < n; i++){
01256                         //std::cout << postfixVec[i]->snodeName << std::endl;
01257                         nodeNames2[i] = postfixVec[i]->snodeName;
01258                         if( nodeNames1[i] != nodeNames2[ i]) throw ErrorClass(" Problem with creating expression trees");
01259                 }       
01260                 
01261                 //delete osinstance;
01262                 delete[] nodeNames1;
01263                 delete[] nodeNames2; 
01264 
01265                 delete osilreader;
01266                 osilreader = NULL;
01267                 osinstance = NULL;              
01268                 unitTestResult << "Successful test of prefix and postfix conversion routines on problem rosenbrockmod.osil" << std::endl;
01269                 
01270         }
01271         catch(const ErrorClass& eclass){
01272                 cout << endl << endl << endl;
01273                 unitTestResultFailure << eclass.errormsg << endl;
01274         }
01275         // now test the nonlinear operators     
01276         try{
01277                 ok = true;
01278                 std::cout << "Test nonlinear operators" << std::endl;
01279                 std::string operatorTest =  dataDir  + "osilFiles" + dirsep + "testOperators.osil";
01280                 osil = fileUtil->getFileAsString( operatorTest.c_str() );
01281                 OSInstance *osinstance = NULL;
01282                 //osinstance = new OSInstance();
01283                 OSiLReader *osilreader = NULL;
01284                 osilreader = new OSiLReader();
01285                 OSiLWriter *osilwriter = NULL;
01286                 osilwriter = new OSiLWriter();
01287                 osinstance = osilreader->readOSiL( osil);
01288                 OSExpressionTree* expTree = osinstance->getNonlinearExpressionTree( -1);
01289                 std::vector<OSnLNode*> postfixVec;
01290                 postfixVec = expTree->m_treeRoot->getPostfixFromExpressionTree();
01291                 int n = postfixVec.size();
01292                 std::string *nodeNames1 = new std::string[ n];
01293                 for (int i = 0 ; i < n; i++){
01294                         std::cout << postfixVec[i]->snodeName << std::endl;
01295                         nodeNames1[i] = postfixVec[i]->snodeName;
01296                 }
01297                 std::cout << std::endl << std::endl;
01298                 std::cout << osilwriter->writeOSiL( osinstance) << std::endl;
01299                 // now test value
01300                 double *x = NULL;
01301                 x = new double[2];
01302                 x[0] = 1;
01303                 x[1] = 2;
01304                 double parserTestVal = expTree->m_treeRoot->calculateFunction( x);
01305                 std::cout << "ParserTest Val = " << parserTestVal << std::endl;
01306                 check = 11;
01307                 //ok &= NearEqual(expTree->m_treeRoot->calculateFunction( x) , check,  1e-10 , 1e-10);
01308                 ok = ( fabs(check -  expTree->m_treeRoot->calculateFunction( x))/(fabs( check) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01309                 if(ok == false) throw ErrorClass(" Problem evaluating expression tree");
01310                 delete[] x;
01311                 delete[] nodeNames1;
01312                 delete osilreader;
01313                 osilreader = NULL;
01314                 delete osilwriter;
01315                 osilwriter = NULL;
01316                 osinstance = NULL;
01317                 //create an osinstance
01318                 unitTestResult << "Successful test of all of the nonlinear operators on file testOperators.osil" << std::endl;
01319         }
01320         catch(const ErrorClass& eclass){
01321                 cout << endl << endl << endl;
01322                 unitTestResultFailure << eclass.errormsg << endl;
01323         }
01324         // 
01325         // now solve on a remote server
01326         /*
01327         try{
01328                 //return 0;
01329                 OSSolverAgent* osagent = NULL;
01330                 //osagent = new OSSolverAgent("128.135.130.17/axis/OSSolverService");
01331                 //osagent = new OSSolverAgent("gsbkip.chicagogsb.edu:80/os/ossolver/COINSolverService.jws");
01332                 //osagent = new OSSolverAgent("localhost/os/ossolver/COINSolverService.jws");
01333                 //osagent = new OSSolverAgent("localhost/axis/OSSolverService");
01334                 osagent = new OSSolverAgent("http://127.0.0.1:8080/os/ossolver/CoinSolverService.jws");
01335                 //osagent = new OSSolverAgent("128.135.130.17:8080/os/ossolver/CoinSolverService.jws");
01336                 //osagent = new OSSolverAgent("127.0.0.1:8080/web-services-examples/ted/VrptsSolverService.jws");
01337                 cout << "Place remote synchronous call" << endl;
01338                 nl2osil = new OSnl2osil( nlFileName);
01339                 nl2osil->createOSInstance() ;
01340                 OSiLWriter *osilwriter = NULL;
01341                 osilwriter = new OSiLWriter();
01342                 osil = osilwriter->writeOSiL( nl2osil->osinstance) ;
01343                 string osrl = osagent->solve(osil, osol);
01344                 cout << "READ THE OSrL and WRITE IT AGAIN" << endl;
01345                 cout << osrl  << endl;
01346                 OSrLReader *osrlreader = NULL;
01347                 OSResult *osresult = NULL;
01348                 osrlreader = new OSrLReader();
01349                 osresult = osrlreader->readOSrL( osrl);
01350                 OSrLWriter *osrlwriter;
01351                 if(osresult != NULL){
01352                         osrlwriter = new OSrLWriter();
01353                         osrl = osrlwriter->writeOSrL( osresult);
01354                 }
01355                 cout << osrl << endl;
01356                 //
01357                 delete nl2osil;
01358                 nl2osil = NULL;
01359                 delete osilwriter;
01360                 osilwriter = NULL;
01361         }       
01362                 catch(const ErrorClass& eclass){
01363                 cout <<  eclass.errormsg <<  endl;
01364         }       
01365         */
01366         try{
01367                 std::cout << std::endl << std::endl;
01368                 std::cout << "Testing AD Features " << std::endl;
01369                 std::string expTreeTest =  dataDir  + "osilFiles" + dirsep + "CppADTestLag.osil";
01370                 /*
01371                 min x0^2 + 9*x1   -- w[0]
01372                 s.t. 
01373                 33 - 105 + 1.37*x1 + 2*x3 + 5*x1 <= 10  -- y[0]
01374                 ln(x0*x3)  + 7*x2 >= 10  -- y[1]
01375                 Note: in the first constraint 33 is a constant term and 105 
01376                 is part of the nl node
01377                 */
01378                 osil = fileUtil->getFileAsString( expTreeTest.c_str() );
01379                 OSInstance *osinstance = NULL;
01380                 //osinstance = new OSInstance();
01381                 OSiLReader *osilreader = NULL;
01382                 osilreader = new OSiLReader();
01383                 //create an osinstance
01384                 osinstance = osilreader->readOSiL( osil);
01385                 double *x;
01386                 x = new double[ 4];
01387                 x[0] = 1;
01388                 x[1] = 5;
01389                 x[2] = 10;
01390                 x[3] = 5;
01391                 SparseVector *sp;
01392                 // get the gradient for constraint 1
01393                 osinstance->getJacobianSparsityPattern();
01394                 sp = osinstance->calculateConstraintFunctionGradient(x, 1, true);
01395                 int i;
01396                 for(i = 0; i < sp->number; i++){
01397                         std::cout << "gradient value " << sp->values[i] << std::endl;
01398                 }
01399                 ok = true;
01400                 //check gradient for constraint with index 1
01401                 double checkPartial2Con1 = 7.0 ;
01402                 //ok &= NearEqual( sp->values[ 0], checkPartial2Con1, 1e-10, 1e-10); 
01403                 ok = ( fabs(checkPartial2Con1 - sp->values[ 0] )/(fabs( checkPartial2Con1) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01404                 if(ok == false) throw ErrorClass(" Fail testing gradient calculation");
01405                 double checkPartial0Con1 = (1./x[0])  ;
01406                 //ok &= NearEqual(sp->values[ 1], checkPartial0Con1, 1e-10, 1e-10); 
01407                 ok = ( fabs(checkPartial0Con1 - sp->values[ 1] )/(fabs( checkPartial0Con1) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01408                 if(ok == false) throw ErrorClass(" Fail testing gradient calculation");
01409                 double checkPartial3Con1 = (1./x[3]) ;
01410                 //ok &= NearEqual( sp->values[ 2], checkPartial3Con1, 1e-10, 1e-10); 
01411                 ok = ( fabs(checkPartial3Con1 - sp->values[ 2] )/(fabs( checkPartial3Con1) + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01412                 if(ok == false) throw ErrorClass(" Fail testing gradient calculation");
01413                 delete sp;
01414                 SparseHessianMatrix *sh;
01415                 // calcuate Hessian of objective function (index = -1)
01416                 osinstance->getLagrangianHessianSparsityPattern( );
01417                 sh = osinstance->calculateHessian(x, -1, true);
01418                 for(i = 0; i < sh->hessDimension; i++){
01419                         std::cout << "Hessian value " << sh->hessValues[i] << std::endl;
01420                 }
01421                 //ok &= NearEqual( sh->hessValues[ 0], 2., 1e-10, 1e-10);
01422                 ok = ( fabs(2. - sh->hessValues[0] )/(2. + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01423                 if(ok == false) throw ErrorClass(" Fail testing Hessian calculation"); 
01424                 //ok &= NearEqual( sh->hessValues[ 1], 0., 1e-10, 1e-10);
01425                 ok = ( fabs(0. - sh->hessValues[ 1] )/(0. + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01426                 if(ok == false) throw ErrorClass(" Fail testing Hessian calculation");
01427                 //ok &= NearEqual( sh->hessValues[ 2], 0., 1e-10, 1e-10);
01428                 ok = ( fabs(0. - sh->hessValues[2] )/(0. + OS_NEAR_EQUAL) <= OS_NEAR_EQUAL) ? true : false;
01429                 if(ok == false) throw ErrorClass(" Fail testing Hessian calculation");
01430                 unitTestResult << "Successful test of AD gradient and Hessian calculations on problem CppADTestLag.osil" << std::endl;
01431                 delete[] x;
01432                 delete osilreader;
01433                 osilreader = NULL;
01434         }       
01435         catch(const ErrorClass& eclass){
01436                 cout << endl << endl << endl;
01437                 unitTestResultFailure << eclass.errormsg << endl;
01438         }
01439         delete fileUtil;
01440         fileUtil = NULL;
01441             
01442         if(unitTestResultFailure.str().length() > 0){
01443                 cout << "The unitTest passed the following" << endl << endl;
01444                 cout << unitTestResult.str() << endl << endl;
01445                 cout << "Unfortunately, you failed on the following:" << endl << endl;
01446                 cout << unitTestResultFailure.str() << endl << endl;
01447                 cout << "Conclusion: FAILURE" << endl;
01448                 return 1;
01449         }
01450         else{
01451                 cout << "The unitTest passed the following" << endl << endl;
01452                 cout << unitTestResult.str() << endl << endl;
01453                 cout << "All tests completed successfully" <<  endl <<  endl;
01454                 return 0;
01455         }
01456 }//ennd main
01457 
01458 double getObjVal( std::string osrl){
01459         std::string sObjVal;
01460         double dObjVal;
01461         string::size_type pos2;
01462         string::size_type pos1 = osrl.find( "<obj ");
01463         if(pos1 != std::string::npos){
01464                 // get the end of the obj start tag
01465                 pos1 = osrl.find(">", pos1 + 1);
01466                 if(pos1 != std::string::npos){
01467                         // get the start of obj end tag
01468                         pos2 = osrl.find( "</obj", pos1 + 1);
01469                         if( pos2 != std::string::npos){
01470                                 // get the substring
01471                                 sObjVal = osrl.substr( pos1 + 1, pos2 - pos1 - 1);
01472                                 //std::cout << "HERE IS THE OBJECTIVE FUNCTION VALUE SUBSTRING  " << sObjVal<< std::endl; 
01473                                 // return dObjVal = strtod(sObjVal.c_str(), NULL);
01474 
01475                                 return dObjVal = os_strtod( sObjVal.c_str(), NULL); 
01476                         }
01477                         else return OSNAN;
01478                 }
01479                 else return OSNAN;
01480         }
01481         else return OSNAN;
01482 }

Generated on Sat Mar 29 22:38:03 2008 by  doxygen 1.5.3