107 #define COMPONENT_DEBUG // program logic, especially parser testing
110 #include <cppad/cppad.hpp>
125 #include "CoinError.hpp"
133 #include "OSCommonUtil.h"
137 #include <CoinMpsIO.hpp>
138 #include <CoinPackedMatrix.hpp>
144 #include <OsiGlpkSolverInterface.hpp>
147 #ifdef COIN_HAS_COUENNE
152 #include "OSnl2osil.h"
155 #ifdef COIN_HAS_LINDO
159 #ifdef COIN_HAS_IPOPT
163 #ifdef COIN_HAS_BONMIN
176 # error "don't have header file for time"
197 # error "don't have header file for stdio"
207 using std::ostringstream;
212 int main(
int argC,
char* argV[])
217 WindowsErrorPopupBlocker();
224 cout <<
"START UNIT TEST" << endl;
229 OSnl2osil *nl2osil = NULL;
239 std::string osilFileName;
240 std::string osolFileName;
241 std::string osrlFileName;
242 std::string nlFileName;
243 std::string mpsFileName;
246 ostringstream unitTestResult;
247 ostringstream unitTestResultFailure;
249 const char dirsep = CoinFindDirSeparator();
252 dataDir = dirsep ==
'/' ?
"../data/" :
"..\\data\\";
253 nlFileName = dataDir +
"amplFiles" + dirsep +
"parinc.nl";
254 mpsFileName = dataDir +
"mpsFiles" + dirsep +
"parinc.mps";
258 #ifdef INSTALLATION_TEST
262 std::cout << endl <<
"TEST " << ++nOfTest <<
": Try to read a sample file" << endl << endl;
263 osilFileName = dataDir +
"osilFiles" + dirsep +
"parincLinearByRow.osil";
265 std::cout <<
"The file is: " ;
266 std::cout << osilFileName << std::endl;
268 std::cout <<
"Done reading the test file" << std::endl;
272 unitTestResult <<
"Reading files successfully" << std::endl;
273 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
313 cout << endl <<
"TEST " << ++nOfTest <<
": Lossless I/O" << endl << endl;
315 mpsFileName = dataDir +
"mpsFiles" + dirsep +
"parinc.mps";
321 std::string sOSiL = osilwriter.
writeOSiL( osinstance1 );
329 double theDiff, theMax;
332 for(
int i = 0; i < nvals; i++){
335 if(theDiff > theMax){
341 std::cout <<
"MAXIMUM DIFF = " << theMax << std::endl;
342 std::cout <<
"MAXIMUM DIFF INDEX = " << theIndex << std::endl;
343 if(theMax > 0) unitTestResult <<
"WARNING: you do not have lossless IO" << std::endl;
345 { unitTestResult <<
"Passed lossless IO test" << std::endl;
346 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
411 unitTestResultFailure <<
"Sorry Unit Test Failed Reading a file: " + eclass.
errormsg<< endl;
413 unitTestResultFailure <<
"Since we can't read files we are terminating" << endl;
414 cout << unitTestResultFailure.str() << endl << endl;
415 cout <<
"Conclusion: FAILURE" << endl;
420 cout << endl <<
"TEST " << ++nOfTest <<
": Clp solver on parincLinearByRow.osil" << endl << endl;
422 std::cout <<
"create a new COIN Clp for OSiL string solution" << std::endl;
423 osilFileName = dataDir +
"osilFiles" + dirsep +
"parincLinearByRow.osil";
424 osolFileName = dataDir +
"osolFiles" + dirsep +
"parincLinearByRow_clp.osol";
428 std::cout <<
"create a new Solver object" << std::endl;
434 std::cout <<
" Done reading the OSiL" << std::endl;
439 std::cout <<
" Write the OSiL" << std::endl;
442 std::cout <<
" Done writing the OSiL" << std::endl;
444 cout <<
"call the COIN - clp Solver for parincLinearbyRow" << endl;
447 cout <<
"Here is the COIN clp solver solution for parincLinearByRow" << endl;
448 cout << solver->
osrl << endl;
452 if(ok ==
false)
throw ErrorClass(
" Fail unit test with clp on parincLinearByRow.osil");
455 cout <<
"First osrl file\n" << solver->
osrl << endl;
457 cout <<
"read successfully" << endl;
459 cout <<
"osilreader successfully deleted" << endl;
462 cout <<
"osolreader successfully deleted" << endl;
465 cout <<
"solver successfully deleted" << endl;
468 cout <<
"osilwriter successfully deleted" << endl;
471 cout <<
"osrlreader successfully deleted" << endl;
473 unitTestResult <<
"Solved problem parincLinearByRow.osil with Clp" << std::endl;
474 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
477 unitTestResultFailure <<
"Sorry Unit Test Failed Testing Clp Solver:" + eclass.
errormsg<< endl;
482 cout << endl <<
"TEST " << ++nOfTest <<
": Cbc solver on p0033.osil" << endl << endl;
483 std::cout <<
"create a new COIN Cbc for OSiL string solution" << std::endl;
485 osilFileName = dataDir +
"osilFiles" + dirsep +
"p0033.osil";
486 osolFileName = dataDir +
"osolFiles" + dirsep +
"p0033_cbc.osol";
497 cout <<
"call the COIN - Cbc Solver for p0033" << endl;
500 cout <<
"Here is the COIN Cbc solver solution for p0033" << endl;
505 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Cbc on p0033.osil");
512 unitTestResult <<
"Solved problem p0033.osil with Cbc" << std::endl;
513 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
516 unitTestResultFailure <<
"Sorry Unit Test Failed Testing Cbc Solver:" + eclass.
errormsg<< endl;
522 cout << endl <<
"TEST " << ++nOfTest <<
": Cbc solver on p0201.osil" << endl << endl;
524 osilFileName = dataDir +
"osilFiles" + dirsep +
"p0201.osil";
525 osolFileName = dataDir +
"osolFiles" + dirsep +
"p0201_cbc.osol";
536 cout <<
"call the COIN - Cbc Solver for p0201" << endl;
538 cout <<
"Here is the COIN Cbc solver solution for p0201" << endl;
542 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Cbc on p0201.osil");
549 unitTestResult <<
"Solved problem p0201.osil with Cbc" << std::endl;
550 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
553 unitTestResultFailure <<
"Sorry Unit Test Failed Testing Cbc Solver:" + eclass.
errormsg<< endl;
556 cout << endl <<
"TEST " << ++nOfTest <<
": Cbc solver on parincInteger.osil" << endl << endl;
558 osilFileName = dataDir +
"osilFiles" + dirsep +
"parincInteger.osil";
559 osolFileName = dataDir +
"osolFiles" + dirsep +
"parincInteger_cbc.osol";
569 cout <<
"call the COIN - Cbc Solver for parincInteger" << endl;
572 cout <<
"Here is the Cbc solver solution for parincInteger" << endl;
576 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Cbc on parincInteger.osil");
577 unitTestResult <<
"Solved problem parincInteger.osil with Cbc" << std::endl;
584 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
589 #ifdef COIN_HAS_IPOPT
592 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver with avion2.osil" << endl << endl;
594 cout <<
"create a new IPOPT Solver for OSiL string solution" << endl;
600 osilFileName = dataDir +
"osilFiles" + dirsep +
"avion2.osil";
601 osolFileName = dataDir +
"osolFiles" + dirsep +
"avion2_ipopt.osol";
604 cout <<
"IPOPT Solver created for OSiL string solution" << endl;
605 ipoptSolver->
osol = osol;
609 ipoptSolver->
osol = osol;
610 cout <<
"call the IPOPT Solver" << endl;
612 ipoptSolver->
solve();
613 cout <<
"Here is the IPOPT solver solution for avion2" << endl;
617 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Ipopt on avion2.osil");
624 unitTestResult <<
"Solved problem avion2.osil with Ipopt" << std::endl;
625 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
630 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver with HS071_NLPMod.osil" << endl << endl;
631 cout <<
"create a new IPOPT Solver for OSiL string solution" << endl;
634 osilFileName = dataDir +
"osilFiles" + dirsep +
"HS071_NLPMod.osil";
635 osolFileName = dataDir +
"osolFiles" + dirsep +
"HS071_NLPMod_ipopt.osol";
638 cout <<
"IPOPT Solver created for OSiL string solution" << endl;
644 ipoptSolver->
osol = osol;
646 ipoptSolver->
solve();
647 cout <<
"Here is the IPOPT solver solution for HS071_NLP" << endl;
657 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Ipopt on HS071_NLP.osil");
658 unitTestResult <<
"Solved problem HS071.osil with Ipopt" << std::endl;
659 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
661 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver on rosenbrockmod.osil" << endl << endl;
662 cout <<
"create a new IPOPT Solver for OSiL string solution" << endl;
666 osilFileName = dataDir +
"osilFiles" + dirsep +
"rosenbrockmod.osil";
667 osolFileName = dataDir +
"osolFiles" + dirsep +
"rosenbrockmod_ipopt.osol";
670 cout <<
"IPOPT Solver created for OSiL string solution" << endl;
673 ipoptSolver->
osil = osil;
675 cout <<
"call the IPOPT Solver" << endl;
677 ipoptSolver->
solve();
682 throw ErrorClass(
" Fail unit test with Ipopt on rosenbrockmod.osil");
687 unitTestResult <<
"Solved problem rosenbrockmod.osil with Ipopt" << std::endl;
690 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
692 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver on parincQuadratic.osil" << endl << endl;
693 cout <<
"create a new IPOPT Solver for OSiL string solution" << endl;
697 osilFileName = dataDir +
"osilFiles" + dirsep +
"parincQuadratic.osil";
698 osolFileName = dataDir +
"osolFiles" + dirsep +
"parincQuadratic_ipopt.osol";
701 cout <<
"IPOPT Solver created for OSiL string solution" << endl;
705 ipoptSolver->
osil = osil;
706 ipoptSolver->
osol = osol;
707 cout <<
"call the IPOPT Solver" << endl;
709 ipoptSolver->
solve();
710 cout <<
"Here is the IPOPT solver solution for parincQuadratic" << endl;
714 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Ipopt on parincQuadradic.osil");
719 unitTestResult <<
"Solved problem parincQuadratic.osil with Ipopt" << std::endl;
722 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
724 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver on parincLinear.osil" << endl << endl;
725 cout <<
"create a new IPOPT Solver for OSiL string solution" << endl;
729 osilFileName = dataDir +
"osilFiles" + dirsep +
"parincLinear.osil";
730 osolFileName = dataDir +
"osolFiles" + dirsep +
"parincLinear_ipopt.osol";
733 cout <<
"IPOPT Solver created for OSiL string solution" << endl;
738 ipoptSolver->
osol =
"";
739 cout <<
"call the IPOPT Solver" << endl;
741 ipoptSolver->
solve();
742 cout <<
"Here is the IPOPT solver solution for parincLinear" << endl;
746 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Ipopt on parincLinear.osil");
747 unitTestResult <<
"Solved problem parincLinear.osil with Ipopt" << std::endl;
754 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
756 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver on callBackTest.osil" << endl << endl;
757 cout <<
"create a new IPOPT Solver for OSiL string solution" << endl;
761 osilFileName = dataDir +
"osilFiles" + dirsep +
"callBackTest.osil";
762 osolFileName = dataDir +
"osolFiles" + dirsep +
"callBackTest_ipopt.osol";
765 cout <<
"IPOPT Solver created for OSiL string solution" << endl;
770 ipoptSolver->
osol = osol;
771 cout <<
"call the IPOPT Solver" << endl;
773 ipoptSolver->
solve();
774 cout <<
"Here is the IPOPT solver solution for callBackTest" << endl;
778 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Ipopt on callBackTest.osil");
779 unitTestResult <<
"Solved problem callBackTest.osil with Ipopt" << std::endl;
786 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
788 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver on callBackTestRowMajor.osil" << endl << endl;
789 cout <<
"create a new IPOPT Solver for OSiL string solution" << endl;
793 osilFileName = dataDir +
"osilFiles" + dirsep +
"callBackTestRowMajor.osil";
794 osolFileName = dataDir +
"osolFiles" + dirsep +
"callBackTestRowMajor_ipopt.osol";
797 cout <<
"IPOPT Solver created for OSiL string solution" << endl;
802 ipoptSolver->
osil = osil;
803 ipoptSolver->
osol = osol;
804 cout <<
"call the IPOPT Solver" << endl;
806 ipoptSolver->
solve();
807 cout <<
"Here is the IPOPT solver solution for callBackTestRowMajor" << endl;
811 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Ipopt on callBackTestRowMajor.osil");
818 unitTestResult <<
"Solved problem callBackRowMajor.osil with Ipopt" << std::endl;
819 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
821 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver on nonconvex.osil" << endl << endl;
826 osilFileName = dataDir +
"osilFiles" + dirsep +
"nonconvex.osil";
837 cout <<
"call the COIN - Ipopt Solver for nonconvex.osil" << endl;
840 std::cout <<
" CALL SOLVE " << std::endl;
843 cout <<
"Here is the Ipopt solver solution for nonconvex.osil" << endl;
851 cout << solver->
osrl << endl << endl;
860 unitTestResult <<
"Solved problem nonconvex.osil with Ipopt" << std::endl;
867 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
869 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver on rosenbrockorig.osil" << endl << endl;
874 osilFileName = dataDir +
"osilFiles" + dirsep +
"rosenbrockorig.osil";
885 cout <<
"call the COIN - Ipopt Solver for rosenbrockorig" << endl;
888 std::cout <<
" CALL SOLVE " << std::endl;
891 cout <<
"Here is the Ipopt solver solution for rosenbrockorig" << endl;
899 cout << solver->
osrl << endl << endl;
908 unitTestResult <<
"Solved problem rosenbrockorig.osil with Ipopt" << std::endl;
915 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
917 cout << endl <<
"TEST " << ++nOfTest <<
": Ipopt solver on HS071_feas.osil" << endl << endl;
922 osilFileName = dataDir +
"osilFiles" + dirsep +
"HS071_feas.osil";
933 cout <<
"call the COIN - Ipopt Solver for HS071_feas.osil" << endl;
936 std::cout <<
" CALL SOLVE " << std::endl;
942 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Ipopt on HS071_feas.osil");
945 cout <<
"Received error message from Ipopt: \"Ipopt NEEDS AN OBJECTIVE FUNCTION\"" << endl;
946 unitTestResult <<
"Correctly diagnosed problem HS071_feas with Ipopt" << std::endl;
955 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
957 #endif // end of #ifdef THOROUGH
960 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the Ipopt Solver:" + eclass.
errormsg<< endl;
962 #endif // end of #ifdef COIN_HAS_IPOPT
965 #ifdef COIN_HAS_BONMIN
967 cout << endl <<
"TEST " << ++nOfTest <<
": Bonmin solver on bonminEx1.osil" << endl << endl;
972 osilFileName = dataDir +
"osilFiles" + dirsep +
"bonminEx1.osil";
973 osolFileName = dataDir +
"osolFiles" + dirsep +
"bonminEx1_Bonmin.osol";
981 cout <<
"call the COIN - Bonmin Solver for bonminEx1" << endl;
984 cout <<
"Here is the Bonmin solver solution for bonminEx1" << endl;
985 cout << solver->
osrl << endl;
989 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Bonmin on bonminEx1.osil");
992 unitTestResult <<
"Solved problem bonminEx1.osil with Bonmin" << std::endl;
997 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1000 cout << endl <<
"TEST " << ++nOfTest <<
": Bonmin solver on wayneQuadratic.osil" << endl << endl;
1002 osilFileName = dataDir +
"osilFiles" + dirsep +
"wayneQuadratic.osil";
1003 osolFileName = dataDir +
"osolFiles" + dirsep +
"wayneQuadratic_Bonmin1.osol";
1008 solver->
osol = osol;
1010 cout <<
"call the Bonmin Solver for wayneQuadratic" << endl;
1014 cout <<
"Here is the Bonmin solver solution" << endl;
1015 cout << solver->
osrl << endl;
1017 std::cout <<
"CALL NEAR_EQUAL" << std::endl;
1020 std::cout <<
"CALL NEAR_EQUAL" << std::endl;
1021 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Bonmin on wayneQuadratic.osil");
1026 unitTestResult <<
"Solved problem wayneQuadratic.osil with Bonmin" << std::endl;
1027 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1029 cout << endl <<
"TEST " << ++nOfTest <<
": Bonmin solver on wayneQuadratic.osil" << endl << endl;
1031 osilFileName = dataDir +
"osilFiles" + dirsep +
"wayneQuadratic.osil";
1032 osolFileName = dataDir +
"osolFiles" + dirsep +
"wayneQuadratic_Bonmin2.osol";
1038 solver->
osol = osol;
1041 cout <<
"call the Bonmin Solver for wayneQuadratic" << endl;
1045 cout <<
"Here is the Bonmin solver solution" << endl;
1046 cout << solver->
osrl << endl;
1048 std::cout <<
"CALL NEAR_EQUAL" << std::endl;
1051 std::cout <<
"CALL NEAR_EQUAL" << std::endl;
1052 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Bonmin on wayneQuadratic.osil");
1059 unitTestResult <<
"Solved problem wayneQuadratic.osil with Bonmin" << std::endl;
1060 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1065 cout << endl <<
"TEST " << ++nOfTest <<
": Bonmin solver on rosenbrockorig.osil" << endl << endl;
1067 osilFileName = dataDir +
"osilFiles" + dirsep +
"rosenbrockorig.osil";
1077 cout <<
"call the Bonmin Solver for rosenbrockorig" << endl;
1080 cout <<
"Here is the Bonmin solver solution" << endl;
1081 cout << solver->
osrl << endl;
1083 std::cout <<
"CALL NEAR_EQUAL" << std::endl;
1086 std::cout <<
"CALL NEAR_EQUAL" << std::endl;
1087 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Bonmin on rosenbrockorig.osil");
1094 unitTestResult <<
"Solved problem rosenbrockorig.osil with Bonmin" << std::endl;
1095 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1099 cout << endl <<
"TEST " << ++nOfTest <<
": Bonmin solver on rosenbrockinteger.osil" << endl << endl;
1101 osilFileName = dataDir +
"osilFiles" + dirsep +
"rosenbrockinteger.osil";
1111 cout <<
"call the Bonmin Solver for rosenbrockinteger" << endl;
1114 cout <<
"Here is the Bonmin solver solution" << endl;
1115 cout << solver->
osrl << endl;
1117 std::cout <<
"CALL NEAR_EQUAL" << std::endl;
1120 std::cout <<
"CALL NEAR_EQUAL" << std::endl;
1121 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Bonmin on rosenbrockinteger.osil");
1128 unitTestResult <<
"Solved problem rosenbrockinteger.osil with Bonmin" << std::endl;
1129 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1131 #endif // end of #ifdef THOROUGH
1134 cout <<
"OSrL = " << solver->
osrl << endl;
1135 cout << endl << endl << endl;
1136 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the Bonmin Solver:" + eclass.
errormsg << endl;
1138 #endif // end of #ifdef COIN_HAS_BONMIN
1141 #ifdef COIN_HAS_COUENNE
1143 cout << endl <<
"TEST " << ++nOfTest <<
": Couenne solver on bonminEx1.osil" << endl << endl;
1150 osilFileName = dataDir +
"osilFiles" + dirsep +
"bonminEx1.osil";
1151 osolFileName = dataDir +
"osolFiles" + dirsep +
"bonminEx1_Couenne.osol";
1156 solver->
osil = osil;
1157 solver->
osol = osol;
1160 cout <<
"call the COIN - Couenne Solver for bonminEx1" << endl;
1163 std::cout <<
" CALL SOLVE " << std::endl;
1166 cout <<
"Here is the Couenne solver solution for bonminEx1" << endl;
1176 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Couenne on bonminEx1.osil");
1180 unitTestResult <<
"Solved problem bonminEx1.osil with Couenne" << std::endl;
1187 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1190 cout << endl <<
"TEST " << ++nOfTest <<
": Couenne solver on bonminEx1_Nonlinear.osil" << endl << endl;
1195 osilFileName = dataDir +
"osilFiles" + dirsep +
"bonminEx1_Nonlinear.osil";
1202 solver->
osil = osil;
1203 solver->
osol = osol;
1206 cout <<
"call the COIN - Couenne Solver for bonminEx1_Nonlinear" << endl;
1209 std::cout <<
" CALL SOLVE " << std::endl;
1212 cout <<
"Here is the Couenne solver solution for bonminEx1_Nonlinear.osil" << endl;
1220 cout << solver->
osrl << endl << endl;
1229 unitTestResult <<
"Solved problem bonminEx1_Nonlinear with Couenne" << std::endl;
1236 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1239 cout << endl <<
"TEST " << ++nOfTest <<
": Couenne solver on nonconvex.osil" << endl << endl;
1244 osilFileName = dataDir +
"osilFiles" + dirsep +
"nonconvex.osil";
1251 solver->
osil = osil;
1252 solver->
osol = osol;
1255 cout <<
"call the COIN - Couenne Solver for nonconvex.osil" << endl;
1258 std::cout <<
" CALL SOLVE " << std::endl;
1261 cout <<
"Here is the Couenne solver solution for nonconvex.osil" << endl;
1269 cout << solver->
osrl << endl << endl;
1278 unitTestResult <<
"Solved problem nonconvex.osil with Couenne" << std::endl;
1285 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1287 cout << endl <<
"TEST " << ++nOfTest <<
": Couenne solver on rosenbrockorig.osil" << endl << endl;
1292 osilFileName = dataDir +
"osilFiles" + dirsep +
"rosenbrockorig.osil";
1299 solver->
osil = osil;
1300 solver->
osol = osol;
1303 cout <<
"call the COIN - Couenne Solver for rosenbrockorig" << endl;
1306 std::cout <<
" CALL SOLVE " << std::endl;
1309 cout <<
"Here is the Couenne solver solution for rosenbrockorig" << endl;
1317 cout << solver->
osrl << endl << endl;
1326 unitTestResult <<
"Solved problem rosenbrockorig.osil with Couenne" << std::endl;
1333 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1337 cout << endl <<
"TEST " << ++nOfTest <<
": Couenne solver on rosenbrockinteger.osil" << endl << endl;
1342 osilFileName = dataDir +
"osilFiles" + dirsep +
"rosenbrockinteger.osil";
1349 solver->
osil = osil;
1350 solver->
osol = osol;
1353 cout <<
"call the COIN - Couenne Solver for rosenbrockinteger" << endl;
1356 std::cout <<
" CALL SOLVE " << std::endl;
1359 cout <<
"Here is the Couenne solver solution for rosenbrockinteger" << endl;
1367 cout << solver->
osrl << endl << endl;
1376 unitTestResult <<
"Solved problem rosenbrockinteger.osil with Couenne" << std::endl;
1383 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1386 cout << endl <<
"TEST " << ++nOfTest <<
": Couenne solver on HS071_feas.osil" << endl << endl;
1391 osilFileName = dataDir +
"osilFiles" + dirsep +
"HS071_feas.osil";
1398 solver->
osil = osil;
1399 solver->
osol = osol;
1402 cout <<
"call the COIN - Couenne Solver for HS071_feas.osil" << endl;
1405 std::cout <<
" CALL SOLVE " << std::endl;
1408 cout <<
"Here is the Couenne solver solution for HS071_feas" << endl;
1416 cout << solver->
osrl << endl << endl;
1425 unitTestResult <<
"Solved problem HS071_feas with Couenne" << std::endl;
1432 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1438 cout <<
"OSrL = " << solver->
osrl << endl;
1439 cout << endl << endl << endl;
1440 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the Couenne Solver:" + eclass.
errormsg << endl;
1447 #ifdef COIN_HAS_SYMPHONY
1449 cout << endl <<
"TEST " << ++nOfTest <<
": SYMPHONY solver on p0033.osil" << endl << endl;
1451 osilFileName = dataDir +
"osilFiles" + dirsep +
"p0033.osil";
1452 osolFileName = dataDir +
"osolFiles" + dirsep +
"p0033_sym.osol";
1458 solver->
osil = osil;
1461 cout <<
"build the solver instance for COIN - SYMPHONY" << endl;
1465 cout <<
"Here is the COIN SYMPHONY solver solution for p0033" << endl;
1466 cout << solver->
osrl << endl;
1470 if(ok ==
false)
throw ErrorClass(
" Fail unit test with SYMPHONY on p0033.osil");
1475 unitTestResult <<
"Solved problem p0033.osil with SYMPHONY" << std::endl;
1476 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1479 cout <<
"OSrL = " << solver->
osrl << endl;
1480 cout << endl << endl << endl;
1481 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the SYMPHONY Solver:" + eclass.
errormsg << endl;
1487 #ifdef COIN_HAS_DYLP
1489 cout << endl <<
"TEST " << ++nOfTest <<
": DyLP solver on parincLinear.osil" << endl << endl;
1491 osilFileName = dataDir +
"osilFiles" + dirsep +
"parincLinear.osil";
1492 osolFileName = dataDir +
"osolFiles" + dirsep +
"parincLinear_dylp.osol";
1498 solver->
osol = osol;
1500 cout <<
"call the COIN - DyLP solver for parincLinear" << endl;
1503 cout <<
"Here is the COIN - DyLP solver solution for parincLinear" << endl;
1504 cout << solver->
osrl << endl;
1508 if(ok ==
false)
throw ErrorClass(
" Fail unit test with DyLP on parincLinear.osil");
1513 unitTestResult <<
"Solved problem parincLinear.osil with DyLP" << std::endl;
1514 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1517 cout <<
"OSrL = " << solver->
osrl << endl;
1518 cout << endl << endl << endl;
1519 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the DyLP Solver:" + eclass.
errormsg << endl;
1526 cout << endl <<
"TEST " << ++nOfTest <<
": Vol solver on volumeTest.osil" << endl << endl;
1528 osilFileName = dataDir +
"osilFiles" + dirsep +
"volumeTest.osil";
1529 osolFileName = dataDir +
"osolFiles" + dirsep +
"volumeTest_vol.osol";
1535 solver->
osil = osil;
1538 cout <<
"call the COIN - Vol solver for volumeTest" << endl;
1541 cout <<
"Here is the COIN - Vol solver solution for parincLinear" << endl;
1542 cout << solver->
osrl << endl;
1546 if(ok ==
false)
throw ErrorClass(
" Fail unit test with Vol on volumeTest.osil");
1551 unitTestResult <<
"Solved problem volumeTest.osil with Vol" << std::endl;
1552 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1555 cout <<
"OSrL = " << solver->
osrl << endl;
1556 cout << endl << endl << endl;
1557 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the Vol Solver:" + eclass.
errormsg << endl;
1561 #ifdef COIN_HAS_GLPK
1563 cout << endl <<
"TEST " << ++nOfTest <<
": GLPK solver on p0033.osil" << endl << endl;
1565 osilFileName = dataDir +
"osilFiles" + dirsep +
"p0033.osil";
1566 osolFileName = dataDir +
"osolFiles" + dirsep +
"p0033_glpk.osol";
1575 cout <<
"call the GLPK Solver for p0033" << endl;
1578 cout <<
"Here is the GLPK solver solution for p0033" << endl;
1579 cout << solver->
osrl << endl;
1583 if(ok ==
false)
throw ErrorClass(
" Fail unit test with GLPK on p0033.osil");
1590 unitTestResult <<
"Solved problem p0033.osil with GLPK" << std::endl;
1591 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1594 cout <<
"OSrL = " << solver->
osrl << endl;
1595 cout << endl << endl << endl;
1596 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the Glpk Solver:" + eclass.
errormsg << endl;
1604 cout << endl <<
"TEST " << ++nOfTest <<
": Cplex solver on p0033.osil" << endl << endl;
1606 osilFileName = dataDir +
"osilFiles" + dirsep +
"p0033.osil";
1607 osolFileName = dataDir +
"osolFiles" + dirsep +
"p0033_cpx.osol";
1612 solver->
osil = osil;
1613 solver->
osol = osol;
1615 cout <<
"call the CPLEX Solver for p0033" << endl;
1618 cout <<
"Here is the CPLEX solver solution for p0033" << endl;
1619 cout << solver->
osrl << endl;
1623 if(ok ==
false)
throw ErrorClass(
" Fail unit test with CPLEX on p0033.osil");
1626 unitTestResult <<
"Solved problem p0033.osil with CPLEX" << std::endl;
1627 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1630 cout <<
"OSrL = " << solver->
osrl << endl;
1631 cout << endl << endl << endl;
1632 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the Cplex Solver:" + eclass.
errormsg << endl;
1637 #ifdef COIN_HAS_LINDO
1639 cout << endl <<
"TEST " << ++nOfTest <<
": Lindo solver on lindoapiaddins.osil" << endl << endl;
1641 osilFileName = dataDir +
"osilFiles" + dirsep +
"lindoapiaddins.osil";
1642 osolFileName = dataDir +
"osolFiles" + dirsep +
"lindoapiaddins_lindo.osol";
1646 cout <<
"create a new LINDO Solver for OSiL string solution" << endl;
1649 solver->
osol = osol;
1650 cout <<
"call the LINDO Solver" << endl;
1653 cout <<
"Here is the LINDO solver solution" << endl;
1654 cout << solver->
osrl << endl;
1658 if(ok ==
false)
throw ErrorClass(
" Fail unit test with LINDO on lindoapiaddins.osil");
1664 unitTestResult <<
"Solved problem lindoapiaddins.osil with Lindo" << std::endl;
1665 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1669 cout << endl <<
"TEST " << ++nOfTest <<
": Lindo solver on rosenbrockmod.osil" << endl << endl;
1670 osilFileName = dataDir +
"osilFiles" + dirsep +
"rosenbrockmod.osil";
1671 osolFileName = dataDir +
"osolFiles" + dirsep +
"rosenbrockmod_lindo.osol";
1675 solver->
osil = osil;
1676 solver->
osol = osol;
1678 cout <<
"call the LINDO Solver" << endl;
1681 cout <<
"Here is the LINDO solver solution" << endl;
1682 cout << solver->
osrl << endl;
1686 if(ok ==
false)
throw ErrorClass(
" Fail unit test with LINDO on rosenbrockmod.osil");
1690 unitTestResult <<
"Solved problem rosenbrockmod.osil with Lindo" << std::endl;
1691 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1694 cout << endl <<
"TEST " << ++nOfTest <<
": Lindo solver on parincQuadratic.osil" << endl << endl;
1695 osilFileName = dataDir +
"osilFiles" + dirsep +
"parincQuadratic.osil";
1696 osolFileName = dataDir +
"osolFiles" + dirsep +
"parincQuadratic_lindo.osol";
1701 solver->
osil = osil;
1702 solver->
osol = osol;
1705 cout <<
"call the LINDO Solver" << endl;
1708 cout <<
"Here is the LINDO solver solution" << endl;
1709 cout << solver->
osrl << endl;
1713 if(ok ==
false)
throw ErrorClass(
" Fail unit test with LINDO on parincQuadratic.osil");
1718 unitTestResult <<
"Solved problem parincQuadratic.osil with Lindo" << std::endl;
1719 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1756 cout << endl << endl << endl;
1757 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the LINDO Solver:" + eclass.
errormsg << endl << endl;
1766 cout << endl <<
"TEST " << ++nOfTest <<
": Cbc solver using MPS file" << endl << endl;
1770 cout <<
"create a COIN Solver for MPS - OSInstance solution" << endl;
1776 osol =
"<osol t></osol>";
1777 solver->
osol = osol;
1778 cout <<
"call COIN Solve" << endl;
1781 cout <<
"Here is the COIN solver solution" << endl;
1782 cout << solver->
osrl << endl;
1786 if(ok ==
false)
throw ErrorClass(
" Fail unit test with COIN Solver on MPS test problem parincLinear.mps");
1793 unitTestResult <<
"Test the MPS -> OSiL converter on parinc.mps using Cbc" << std::endl;
1794 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1797 cout <<
"OSrL = " << solver->
osrl << endl;
1798 cout << endl << endl << endl;
1799 unitTestResultFailure <<
"Sorry Unit Test Failed Testing the MPS converter:" + eclass.
errormsg << endl;
1805 cout << endl <<
"TEST " << ++nOfTest <<
": AMPL solver interface" << endl << endl;
1807 cout <<
"create a cbc Solver for AMPL nl - OSInstance solution" << endl;
1810 nl2osil =
new OSnl2osil( nlFileName);
1811 nl2osil->createOSInstance() ;
1814 solver->
osol = osol;
1815 cout <<
"call Cbc Solve" << endl;
1818 cout <<
"Here is the Cbc solver solution" << endl;
1819 cout << solver->
osrl << endl;
1823 if(ok ==
false)
throw ErrorClass(
" Fail unit test with OSnl2osil on problem parinc.nl");
1827 cout <<
"call delete nl2osil" << endl;
1830 unitTestResult <<
"Test the AMPL nl -> OSiL converter on parinc.nl using Cbc" << std::endl;
1831 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1835 cout <<
"OSrL = " << solver->
osrl << endl;
1836 cout << endl << endl << endl;
1837 unitTestResultFailure <<
"Sorry Unit Test Failed Testing AMPL:" + eclass.
errormsg << endl;
1844 cout << endl <<
"TEST " << ++nOfTest <<
": b64 operations" << endl << endl;
1852 osol =
"<osol></osol>";
1853 solver->
osol = osol;
1856 std::cout << solver->
osil << std::endl;
1859 cout << endl << endl;
1860 cout <<
"COIN solution of a OSiL string in b64 format" << endl;
1861 cout << solver->
osrl;
1865 if(ok ==
false)
throw ErrorClass(
" Fail unit test with COIN Cbc cSolver on b64 test problem parincLinear.mps");
1871 unitTestResult <<
"Test a problem written in b64 and then converted to OSInstance" << std::endl;
1872 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1875 cout << endl << endl;
1876 cout << eclass.
errormsg << endl << endl;
1877 cout <<
"OSrL = " << solver->
osrl << endl;
1878 cout << endl << endl << endl;
1879 unitTestResultFailure <<
"Sorry Unit Test Failed Testing Use of Base 64" << endl;
1882 #endif //INSTALLATION_TEST
1885 #ifdef COMPONENT_DEBUG
1889 cout << endl <<
"TEST " << ++nOfTest <<
": postfix and prefix routines" << endl << endl;
1890 std::string expTreeTest = dataDir +
"osilFiles" + dirsep +
"rosenbrockmod.osil";
1897 osinstance = osilreader->
readOSiL( osil);
1899 if(expTree == NULL)
throw ErrorClass(
" Null expression tree when testing prefix and postfix routines");
1900 std::vector<OSnLNode*> postfixVec;
1904 unsigned int n = postfixVec.size();
1906 std::string *nodeNames1 =
new std::string[
n];
1907 std::string *nodeNames2 =
new std::string[
n];
1908 for (
int i = 0 ; i <
n; i++){
1909 std::cout << postfixVec[i]->snodeName << std::endl;
1910 nodeNames1[i] = postfixVec[i]->snodeName;
1914 expTree->m_treeRoot = postfixVec[ n - 1]->createExpressionTreeFromPostfix( postfixVec);
1917 std::vector<OSnLNode*> prefixVec;
1922 expTree->m_treeRoot = prefixVec[ 0]->createExpressionTreeFromPrefix( prefixVec);
1925 postfixVec = expTree->m_treeRoot->getPostfixFromExpressionTree();
1927 if(postfixVec.size() !=
n)
throw ErrorClass(
" Problem with creating expression trees");
1928 std::cout << std::endl << std::endl;
1929 for (
int i = 0 ; i <
n; i++){
1931 nodeNames2[i] = postfixVec[i]->snodeName;
1932 if( nodeNames1[i] != nodeNames2[ i])
throw ErrorClass(
" Problem with creating expression trees");
1936 delete[] nodeNames1;
1937 delete[] nodeNames2;
1942 unitTestResult <<
"Successful test of prefix and postfix conversion routines" << std::endl;
1943 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1947 cout << endl << endl << endl;
1948 unitTestResultFailure << eclass.
errormsg << endl;
1952 cout << endl <<
"TEST " << ++nOfTest <<
": nonlinear operators" << endl << endl;
1954 std::string operatorTest = dataDir +
"osilFiles" + dirsep +
"testOperators.osil";
1963 osinstance = osilreader->
readOSiL( osil);
1966 std::vector<OSnLNode*> postfixVec;
1967 postfixVec = expTree->m_treeRoot->getPostfixFromExpressionTree();
1968 int n = postfixVec.size();
1969 std::string *nodeNames1 =
new std::string[
n];
1970 for (
int i = 0 ; i <
n; i++){
1971 std::cout << postfixVec[i]->snodeName << std::endl;
1972 nodeNames1[i] = postfixVec[i]->snodeName;
1974 std::cout << std::endl << std::endl;
1975 std::cout << osilwriter->
writeOSiL( osinstance) << std::endl;
1981 double parserTestVal = expTree->m_treeRoot->calculateFunction( x);
1982 std::cout <<
"ParserTest Val = " << parserTestVal << std::endl;
1985 ok = ( fabs(check - expTree->m_treeRoot->calculateFunction( x))/(fabs( check) +
OS_NEAR_EQUAL) <=
OS_NEAR_EQUAL) ?
true :
false;
1986 if(ok ==
false)
throw ErrorClass(
" Problem evaluating expression tree");
1988 delete[] nodeNames1;
1995 unitTestResult <<
"Successful test of nonlinear operators using file testOperators.osil" << std::endl;
1996 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
1999 cout << endl << endl << endl;
2000 unitTestResultFailure << eclass.
errormsg << endl;
2004 cout << endl <<
"TEST " << ++nOfTest <<
": Automatic differentiation" << endl << endl;
2007 std::string expTreeTest = dataDir +
"osilFiles" + dirsep +
"CppADTestLag.osil";
2022 osinstance = osilreader->
readOSiL( osil);
2033 for(
int i = 0; i < sp->
number; i++){
2034 std::cout <<
"gradient value " << sp->
values[i] << std::endl;
2038 double checkPartial2Con1 = 7.0 ;
2041 if(ok ==
false)
throw ErrorClass(
" Fail testing gradient calculation");
2042 double checkPartial0Con1 = (1./x[0]) ;
2045 if(ok ==
false)
throw ErrorClass(
" Fail testing gradient calculation");
2046 double checkPartial3Con1 = (1./x[3]) ;
2049 if(ok ==
false)
throw ErrorClass(
" Fail testing gradient calculation");
2056 std::cout <<
"Hessian value " << sh->
hessValues[i] << std::endl;
2060 if(ok ==
false)
throw ErrorClass(
" Fail testing Hessian calculation");
2063 if(ok ==
false)
throw ErrorClass(
" Fail testing Hessian calculation");
2066 if(ok ==
false)
throw ErrorClass(
" Fail testing Hessian calculation");
2067 unitTestResult <<
"Successful test of AD gradient and Hessian calculations" << std::endl;
2071 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
2074 cout << endl << endl << endl;
2075 unitTestResultFailure << eclass.
errormsg << endl;
2080 cout << endl <<
"TEST " << ++nOfTest <<
": OSiL parser" << endl << endl;
2081 clock_t start, finish;
2088 cout <<
"TEST PARSING A MODEL" << endl;
2089 cout <<
"FIRST READ THE FILE INTO A STRING" << endl;
2091 osilFileName = dataDir +
"osilFiles" + dirsep +
"parincLinear.osil";
2094 duration = (double) (finish - start) / CLOCKS_PER_SEC;
2095 cout <<
"Reading the file into a string took (seconds): "<< duration << endl;
2099 cout <<
"PARSE THE OSIL STRING INTO AN OSINSTANCE OBJECT" << endl;
2107 duration = (double) (finish - start) / CLOCKS_PER_SEC;
2108 cout <<
"Parsing took (seconds): "<< duration << endl;
2109 unitTestResult <<
"Successful test of OSiL parser on problem parincLinear.osil" << std::endl;
2110 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
2113 cout << endl << endl << endl;
2115 unitTestResultFailure <<
"Sorry Unit Test Failed Testing An OSiL Parser" << endl;
2123 cout << endl <<
"TEST " << ++nOfTest <<
": Stochastic extensions to OSiL" << endl << endl;
2124 clock_t start, finish;
2131 cout <<
"\nTEST PARSING A STOCHASTIC MODEL" << endl;
2132 cout <<
"FIRST READ THE FILE INTO A STRING" << endl;
2134 osilFileName = dataDir +
"osilFiles" + dirsep +
"finplan1.osil";
2137 duration = (double) (finish - start) / CLOCKS_PER_SEC;
2138 cout <<
"Reading the file into a string took (seconds): "<< duration << endl;
2142 cout <<
"PARSE THE OSIL STRING INTO AN OSINSTANCE OBJECT" << endl;
2150 duration = (double) (finish - start) / CLOCKS_PER_SEC;
2151 cout <<
"Parsing took (seconds): "<< duration << endl;
2152 unitTestResult <<
"Successful test of OSiL parser on problem finplan1.osil" << std::endl;
2153 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
2156 cout << endl << endl << endl;
2158 unitTestResultFailure <<
"Error parsing an osil file with time domain information" << endl;
2164 cout << endl <<
"TEST " << ++nOfTest <<
": GET() AND SET() METHODS FOR TimeDomain OBJECT" << endl << endl;
2170 osinstance = osilreader->
readOSiL( osil);
2172 ok = (f ==
"stages");
2176 std::string* sncheck =
new std::string[6];
2180 sncheck[3] =
"test";
2181 sncheck[4] =
"Wha'zzup?";
2186 for (
int i = 0; i < 6; i++)
2187 ok &= (sn[i] == sncheck[i]);
2191 int* nvcheck =
new int[6];
2199 for (
int i = 0; i < 6; i++)
2200 ok &= (nv[i] == nvcheck[i]);
2204 int* nccheck =
new int[6];
2212 for (
int i = 0; i < 6; i++)
2213 ok &= (nc[i] == nccheck[i]);
2217 int* nocheck =
new int[6];
2225 for (
int i = 0; i < 6; i++)
2226 ok &= (no[i] == nocheck[i]);
2232 int** lvcheck =
new int*[6];
2233 int** lccheck =
new int*[6];
2234 int** locheck =
new int*[6];
2235 for (
int i = 0; i < 6; i++) {
2236 lvcheck[i] =
new int[2];
2237 lccheck[i] =
new int[2];
2238 locheck[i] =
new int[2];
2258 for (
int i = 0; i < 6; i++) {
2259 for (
int j = 0;
j < nv[i];
j++)
2260 ok &= (lvcheck[i][
j] == lv[i][
j]);
2261 for (
int j = 0; j < nc[i]; j++)
2262 ok &= (lccheck[i][j] == lc[i][j]);
2263 for (
int j = 0; j < no[i]; j++)
2264 ok &= (locheck[i][j] == lo[i][j]);
2267 std::string* sn1 =
new std::string[6];
2268 int* nv1 =
new int[6];
2269 int* nc1 =
new int[6];
2270 int* no1 =
new int[6];
2271 int**
lv1 =
new int*[6];
2272 int**
lc1 =
new int*[6];
2273 int** lo1 =
new int*[6];
2274 for (
int i = 0; i < 6; i++) {
2275 lv1[i] =
new int[2];
2276 lc1[i] =
new int[2];
2277 lo1[i] =
new int[2];
2279 for (
int i = 0; i < 6; i++) {
2284 for (
int j = 0;
j < nv[i];
j++) {
2285 lv1[i][
j] = lv[i][
j];
2287 for (
int j = 0;
j < nc[i];
j++) {
2288 lc1[i][
j] = lc[i][
j];
2290 for (
int j = 0;
j < no[i];
j++) {
2291 lo1[i][
j] = lo[i][
j];
2303 int *nelem, *startIdx, **VI;
2305 startIdx =
new int[4];
2307 for (
int i = 0; i < 4; i++)
2316 for (
int i = 0; i < 4; i++)
2322 for (
int i = 0; i < 4; i++)
2334 ok &= (lower == 0.0);
2336 ok &= (upper == 1.0);
2353 for (
int i = 0; i < n2; i++)
2354 { ok &= (sn2[i] == sncheck[i]);
2355 ok &= (nv2[i] == nvcheck[i]);
2356 ok &= (nc2[i] == nccheck[i]);
2357 ok &= (no2[i] == nocheck[i]);
2358 for (
int j = 0;
j < nv2[i];
j++)
2359 ok &= (lv2[i][
j] == lvcheck[i][
j]);
2360 for (
int j = 0; j < nc2[i]; j++)
2361 ok &= (lc2[i][j] == lccheck[i][j]);
2362 for (
int j = 0; j < no2[i]; j++)
2363 ok &= (lo2[i][j] == locheck[i][j]);
2373 for (
int i = 0; i < 6; i++) {
2374 delete [] lvcheck[i];
2375 delete [] lccheck[i];
2376 delete [] locheck[i];
2405 for (
int i = 0; i < 4; i++) {
2411 unitTestResult <<
"Successful test of osinstance get() and set() methods" << std::endl;
2412 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
2415 cout << endl << endl << endl;
2417 unitTestResultFailure <<
"Sorry Unit Test Failed osinstance get() and set() Methods" << endl;
2441 cout << endl <<
"TEST " << ++nOfTest <<
": OSoL parser" << endl << endl;
2442 std::string tmpOSoL;
2443 clock_t start, finish;
2449 cout <<
"TEST PARSING AN OSoL FILE" << endl;
2450 cout <<
"FIRST READ THE OSoL FILE INTO A STRING" << endl;
2451 osolFileName = dataDir +
"osolFiles" + dirsep +
"parsertest.osol";
2455 duration = (double) (finish - start) / CLOCKS_PER_SEC;
2456 cout <<
"Reading the file into a string took (seconds): "<< duration << endl;
2458 cout <<
"PARSE THE OSOL STRING INTO AN OSOPTION OBJECT" << endl;
2459 osoption = osolreader->
readOSoL( osol);
2462 cout << endl <<
"Test the add() methods" << endl;
2500 cout << endl <<
"another SOS has been added" << endl << endl;
2505 varopt->
name =
"testVarOpt";
2513 objopt->
name =
"testObjOpt";
2524 conopt->
name =
"testObjOpt";
2541 throw ErrorClass(
" Could not add to osoption data structure");
2544 std::string optionstring;
2549 cout << endl <<
"transfer osoption to another OSOption object" << endl;
2555 throw ErrorClass(
" error in get/set ServiceURI");
2562 throw ErrorClass(
" error in get/set ServiceName");
2569 throw ErrorClass(
" error in get/set InstanceName");
2576 throw ErrorClass(
" error in get/set InstanceLocation");
2583 throw ErrorClass(
" error in get/set InstanceLocationtype");
2586 optionstring = osoption->
getJobID();
2587 ok = osoption2->
setJobID(optionstring) && ok;
2597 throw ErrorClass(
" error in get/set SolverToInvoke");
2604 throw ErrorClass(
" error in get/set InstanceLocationType");
2611 throw ErrorClass(
" error in get/set UserName");
2617 throw ErrorClass(
" error in get/set Password");
2622 ok = osoption2->
setContact(optionstring) && ok;
2625 throw ErrorClass(
" error in get/set Contact");
2632 throw ErrorClass(
" error in get/set TransportType");
2642 throw ErrorClass(
" error in get/set OtherGeneralOption");
2649 throw ErrorClass(
" error in get/set MinDiskSpace");
2656 throw ErrorClass(
" error in get/set MinDiskSpaceUnit");
2663 throw ErrorClass(
" error in get/set MinMemorySize");
2670 throw ErrorClass(
" error in get/set MinMemoryUnit");
2677 throw ErrorClass(
" error in get/set MinCPUSpeed");
2684 throw ErrorClass(
" error in get/set MinCPUSpeedUnit");
2691 throw ErrorClass(
" error in get/set MinCPUNumber");
2700 throw ErrorClass(
" error in get/set OtherSystemOptions");
2708 throw ErrorClass(
" error in get/set ServiceType");
2717 throw ErrorClass(
" error in get/set OtherServiceOptions");
2725 throw ErrorClass(
" error in get/set MaxTime");
2732 throw ErrorClass(
" error in get/set MaxTimeUnit");
2739 throw ErrorClass(
" error in get/set RequestedStartTime");
2747 throw ErrorClass(
" error in get/set JobDependencies");
2755 throw ErrorClass(
" error in get/set RequiredDirectories");
2763 throw ErrorClass(
" error in get/set RequiredFiles");
2771 throw ErrorClass(
" error in get/set DirectoriesToMake");
2779 throw ErrorClass(
" error in get/set FilesToMake");
2787 throw ErrorClass(
" error in get/set InputDirectoriesToMove");
2795 throw ErrorClass(
" error in get/set InputFilesToMove");
2803 throw ErrorClass(
" error in get/set OutputFilesToMove");
2811 throw ErrorClass(
" error in get/set OutputDirectoriesToMove");
2819 throw ErrorClass(
" error in get/set FilesToDelete");
2827 throw ErrorClass(
" error in get/set DirectoriesToDelete");
2835 throw ErrorClass(
" error in get/set ProcessesToKill");
2844 throw ErrorClass(
" error in get/set OtherJobOptions");
2847 int nvar, nobj, ncon;
2856 throw ErrorClass(
" error in get/set problem dimensions");
2865 throw ErrorClass(
" error in get/set InitVarValues");
2874 throw ErrorClass(
" error in get/set InitVarValuesString");
2882 throw ErrorClass(
" error in get/set InitBasisStatus");
2890 throw ErrorClass(
" error in get/set IntegerVariableBranchingWeights");
2899 throw ErrorClass(
" error in get/set SOSVariableBranchingWeights");
2908 throw ErrorClass(
" error in get/set OtherVariableOptions");
2916 throw ErrorClass(
" error in get/set InitObjValues");
2925 throw ErrorClass(
" error in get/set InitObjBounds");
2934 throw ErrorClass(
" error in get/set OtherObjectiveOptions");
2943 throw ErrorClass(
" error in get/set InitConValues");
2952 throw ErrorClass(
" error in get/set InitDualVarValues");
2961 throw ErrorClass(
" error in get/set OtherConstraintOptions");
2970 throw ErrorClass(
" error in get/set SolverOptions");
2973 ok = osoption->
IsEqual(osoption2) && ok;
2975 throw ErrorClass(
" OSOption get() and set() methods do not work correctly");
2977 cout << endl <<
"delete osoption2" << endl;
2980 cout <<
"osoption2 deleted" << endl << endl;
2982 cout <<
"Write the content to a new file" <<endl;
2983 tmpOSoL = osolwriter->
writeOSoL( osoption);
2984 cout << endl <<
"Here is tmpOSoL:" <<endl;
2985 cout << endl << endl << tmpOSoL << endl;
2986 cout <<
"-----------------------------------------" << endl << endl;
2993 cout <<
"Read the string back" << endl;
2996 osoption3 = osolreader2->
readOSoL( tmpOSoL);
2998 ok = osoption->
IsEqual(osoption3);
3000 throw ErrorClass(
" Loss of information in OSoL write/read");
3009 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
3013 cout << endl <<
"TEST " << ++nOfTest <<
": Parse another .osol file" << endl << endl;
3016 cout <<
"First read the OSoL file into a string" << endl;
3017 osolFileName = dataDir +
"osolFiles" + dirsep +
"parsertest2.osol";
3020 duration = (double) (finish - start) / CLOCKS_PER_SEC;
3021 cout <<
"Reading the file into a string took (seconds): "<< duration << endl;
3022 cout <<
"Parse the OSoL string into an OSOption object" << endl;
3023 osoption = osolreader->
readOSoL( osol);
3024 tmpOSoL = osolwriter->
writeOSoL( osoption) ;
3035 cout <<
"Test parsing another OSoL file" << endl;
3038 cout <<
"First read the OSoL file into a string" << endl;
3039 osolFileName = dataDir +
"osolFiles" + dirsep +
"parsertest3.osol";
3042 duration = (double) (finish - start) / CLOCKS_PER_SEC;
3043 cout <<
"Reading the file into a string took (seconds): "<< duration << endl;
3044 cout <<
"Parse the OSoL string into an OSOption object" << endl;
3045 osoption = osolreader->
readOSoL( osol);
3046 tmpOSoL = osolwriter->
writeOSoL( osoption) ;
3058 cout <<
"Test parsing a trivial string" << endl;
3060 osol =
"<osol></osol>";
3061 cout <<
"Parse the OSoL string into an OSOption object" << endl;
3062 osoption = osolreader->
readOSoL( osol);
3068 "Successful test of OSoL parser on file parsertest.osol"
3070 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
3076 cout << endl << endl << endl;
3077 if(osolwriter != NULL)
delete osolwriter;
3078 if(osolreader != NULL)
delete osolreader;
3080 unitTestResultFailure << eclass.
errormsg << endl;
3081 unitTestResultFailure <<
"There was a failure in the test for reading OSoL" << endl;
3097 cout << endl <<
"TEST " << ++nOfTest <<
": OSrL parser" << endl << endl;
3098 std::string tmpOSrL;
3099 clock_t start, finish;
3105 cout <<
"TEST PARSING AN OSrL FILE" << endl;
3106 cout <<
"FIRST READ THE OSrL FILE INTO A STRING" << endl;
3108 osrlFileName = dataDir +
"osrlFiles" + dirsep +
"parserTest.osrl";
3112 duration = (double) (finish - start) / CLOCKS_PER_SEC;
3113 cout <<
"Reading the file into a string took (seconds): "<< duration << endl;
3114 cout << osrl << endl;
3116 cout <<
"PARSE THE OSRL STRING INTO AN OSRESULT OBJECT" << endl;
3117 osresult = osrlreader->
readOSrL( osrl);
3118 cout <<
"Finished read; write OSResult object to temporary string" << endl;
3119 tmpOSrL = osrlwriter->
writeOSrL( osresult) ;
3120 cout << tmpOSrL << endl;
3125 cout <<
"Parse temporary string" << endl;
3156 "Successful test of OSrL parser on problems parincLinear.osrl and errorExample.osrl"
3158 cout << endl <<
"TEST " << nOfTest <<
": Completed successfully" << endl << endl;
3161 cout << endl << endl << endl;
3162 if(osrlwriter != NULL)
delete osrlwriter;
3163 if(osrlreader != NULL)
delete osrlreader;
3165 unitTestResultFailure << eclass.
errormsg << endl;
3166 unitTestResultFailure <<
"There was a failure in the test for reading OSrL" << endl;
3173 #endif // COMPONENT_DEBUG
3183 if(unitTestResultFailure.str().length() > 0){
3184 cout << endl <<
"THE UNIT TEST PASSED THE FOLLOWING:" << endl << endl;
3185 cout << unitTestResult.str() << endl << endl;
3186 cout <<
"UNFORTUNATELY, YOU FAILED ON THE FOLLOWING:" << endl << endl;
3187 cout << unitTestResultFailure.str() << endl << endl;
3188 cout <<
"Conclusion: FAILURE" << endl;
3192 cout << endl <<
"THE UNIT TEST PASSED THE FOLLOWING:" << endl << endl;
3193 cout << unitTestResult.str() << endl << endl;
3194 cout <<
"All tests completed successfully" << endl << endl;
3200 std::string sObjVal;
3202 string::size_type pos2;
3203 string::size_type pos1 = osrl.find(
"<obj ");
3204 if(pos1 != std::string::npos){
3206 pos1 = osrl.find(
">", pos1 + 1);
3207 if(pos1 != std::string::npos){
3209 pos2 = osrl.find(
"</obj", pos1 + 1);
3210 if( pos2 != std::string::npos){
3212 sObjVal = osrl.substr( pos1 + 1, pos2 - pos1 - 1);
3215 return dObjVal =
os_strtod(sObjVal.c_str(), NULL);
int getNumberOfOutputFilesToMove()
Get the number of output files to move.
bool setAnotherSOSVariableBranchingWeight(int sosIdx, int nvar, double weight, int *idx, double *value, std::string *name)
std::string getJobID()
Get the job ID.
int * getTimeDomainStageNumberOfConstraints()
Get the number of constraints contained in each time stage.
std::string getGeneralMessage()
Get the general message.
bool setOtherJobOptions(int numberOfOptions, OtherOption **other)
bool setAnotherFileToDelete(std::string path)
double os_strtod(const char *s00, char **se)
the OtherConstraintOption class.
OtherObjectiveOption ** getAllOtherObjectiveOptions()
Get all <other> objective options.
bool setInitBasisStatusDense(int numberOfVar, std::string *var)
the LindoSolver class solves problems using Lindo.
ScalarExpressionTree * getNonlinearExpressionTree(int rowIdx)
Get the expression tree for a given row index.
double getMaxTime()
Get the maximum allowed time.
int getOptionInt(std::string optionName)
Get any of the integer-valued options.
bool setAnOtherGeneralOption(std::string name, std::string value, std::string description)
Add another general option to the <other> option array.
bool setAnotherInitVarValue(int idx, double value)
int * getTimeDomainStageNumberOfVariables()
Get the number of variables contained in each time stage.
std::string getInstanceLocationType()
Get the location type.
int getNumberOfSOS()
Get the number of special ordered sets for which branching weights are provided.
int getNumberOfOtherConstraintOptions()
Get the number of other constraint options.
int numberOfCon
number of <con> children
bool setInitObjBoundsSparse(int numberOfObj, InitObjBound **obj)
std::string getInstanceName()
Get the instance name.
bool setSolverOptions(int numberOfSolverOptions, SolverOption **solverOption)
bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx)
This sets the objectives associated with each time domain stage in temporal order.
bool setInitObjValuesDense(int numberOfObj, double *value)
The CouenneSolver class solves problems using Ipopt.
std::string value
value of the option
bool setAnotherJobDependency(std::string jobID)
bool setAnotherSolverOption(std::string name, std::string value, std::string solver, std::string category, std::string type, std::string description)
int getNumberOfRequiredFiles()
Get the number of required files.
bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex)
This sets the variables associated with each time domain stage in srbitrary order.
std::string osrl
osrl holds the solution or result of the model
bool setMinDiskSpace(std::string unit, std::string description, double value)
Set the minimum disk space required for the current job.
SparseHessianMatrix * calculateHessian(double *x, int idx, bool new_x)
Calculate the Hessian of a constraint or objective function.
std::string osil
osil holds the problem instance as a std::string
std::string errormsg
errormsg is the error that is causing the exception to be thrown
bool setMinMemorySize(std::string unit, std::string description, double value)
Set the minimum memory size required for the current job.
bool setAnOtherVariableOption(OtherVariableOption *varOption)
SOSVariableBranchingWeights * sosVariableBranchingWeights
branching weights for SOS variables and groups
bool setSOSVariableBranchingWeights(int numberOfSOS, SOSWeights **sos)
int main(int argc, char *argv[])
virtual void solve()
solve results in an instance being read into the Couenne data structrues and optimized ...
bool setNumberOfConstraints(int numberOfConstraints)
bool setUserName(std::string userName)
Set the username.
bool setInitVarValuesDense(int numberOfVar, double *value)
double getObjVal(std::string osrl)
OSResult * readOSrL(const std::string &posrl)
Get an OSResult object from an OSrL string.
std::string getMinMemoryUnit()
Get the memory unit.
std::string getSolverToInvoke()
Get the solver name.
bool m_bWriteBase64
m_bWriteBase64 is set to true if we encode the linear constraint coefficients in base64 binary ...
bool setInitVarValuesStringSparse(int numberOfVar, InitVarValueString **var)
bool setAnotherInputFileToMove(std::string fromPath, std::string toPath, bool makeCopy)
PathPair ** getInputDirectoriesToMove()
Get the array of input directories to move.
bool setAnOtherJobOption(std::string name, std::string value, std::string description)
int getNumberOfJobDependencies()
Get the number of job dependencies.
Take an OSResult object and write a string that validates against OSrL.
bool setRequiredDirectories(int numberOfPaths, std::string *paths)
OSResult * osresult
osresult holds the solution or result of the model in-memory as an OSResult object ...
std::string name
name of the option
bool setMinDiskSpaceUnit(std::string unit)
int getNumberOfRequiredDirectories()
Get the number of required directories.
bool setSolverToInvoke(std::string solverToInvoke)
Set the solver to be invoked.
bool setOutputFilesToMove(int numberOfPathPairs, PathPair **pathPair)
std::string name
name of the option
Take an OSOption object and write a string that validates against the OSoL schema.
std::string * getRequiredFiles()
Get the array of required files.
std::string getContactTransportType()
Get the transport type.
std::string lbValue
lower bound of the option
std::string getServiceURI()
Get the service URI.
std::string getServiceType()
Get the service type.
virtual void solve()
solve results in an instance being read into the Ipopt data structures and optimize ...
bool setAnOtherServiceOption(std::string name, std::string value, std::string description)
int getNumberOfDirectoriesToMake()
Get the number of directories to make.
OSInstance * readOSiL(const std::string &osil)
parse the OSiL model instance.
The IpoptSolver class solves problems using Ipopt.
bool setInputDirectoriesToMove(int numberOfPathPairs, PathPair **pathPair)
bool setAnOtherObjectiveOption(OtherObjectiveOption *objOption)
OtherVariableOption ** getAllOtherVariableOptions()
Get all <other> variable options.
std::string * getRequiredDirectories()
Get the array of required directories.
bool setNumberOfVariables(int numberOfVariables)
bool setRequestedStartTime(std::string time)
std::string writeOSrL(OSResult *theosresult)
create an osrl string from an OSResult object
InitDualVarValue ** getInitDualVarValuesSparse()
Get the initial bounds associated with the dual variables in sparse form.
bool setFilesToMake(int numberOfPaths, std::string *paths)
int getNumberOfOutputDirectoriesToMove()
Get the number of output directories to move.
void fint fint fint real fint real real real real * f
std::string name
name of the option
bool setAnotherDirectoryToDelete(std::string path)
bool setAnotherIntegerVariableBranchingWeight(int idx, double value)
bool setTimeDomainStages(int number, std::string *names)
This sets the number (and optionally names) of the time stages.
std::string * getProcessesToKill()
Get the array of processes to kill.
bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex)
This sets the constraints associated with each time domain stage in srbitrary order.
std::string osol
osol holds the options for the solver
virtual void solve()=0
solve is a virtual function – the actual solvers will implement their own solve method ...
std::string getContact()
Get the contact information.
int getNumberOfOtherObjectiveOptions()
Get the number of other objective options.
SparseJacobianMatrix * getJacobianSparsityPattern()
int numberOfVar
number of child elements
double getTimeDomainIntervalStart()
Get the start for the time domain interval.
std::string * getDirectoriesToMake()
Get the array of directories to make.
bool setMaxTime(double value, std::string unit)
bool setMinMemoryUnit(std::string unit)
PathPair ** getOutputFilesToMove()
Get the array of output files to move.
std::string getMinCPUSpeedUnit()
Get the CPU speed unit.
bool setServiceName(std::string serviceName)
Set the service name.
int getNumberOfInitDualVarValues()
Get the number of initial dual variable values.
std::string * getJobDependencies()
Get the array of job dependencies.
std::string * getFilesToMake()
Get the array of files to make.
BranchingWeight ** var
branching weights for individual variables
Used to read an OSiL string.
bool setOtherObjectiveOptions(int numberOfObj, OtherObjectiveOption **obj)
bool setDirectoriesToDelete(int numberOfPaths, std::string *paths)
double * getInitVarValuesDense()
Get the initial values associated with the variables in dense form.
DoubleVector * value
a pointer to the array of nonzero values being stored
double * getInitConValuesDense()
Get the initial values associated with the constraints in dense form.
bool setOtherGeneralOptions(int numberOfOptions, OtherOption **other)
Set the other general options as an entire array.
bool setAnotherInitDualVarValue(int idx, double lbValue, double ubValue)
int getNumberOfOtherGeneralOptions()
Get the number of <other> options in the <general> element.
bool setAnotherInitConValue(int idx, double value)
double getMinDiskSpace()
Get the minimum required disk space.
OtherOption ** getOtherServiceOptions()
Get the array of other options associated with the <service> element.
bool setAnotherRequiredFile(std::string path)
bool setJobDependencies(int numberOfDependencies, std::string *jobDependencies)
bool setAnotherOutputDirectoryToMove(std::string fromPath, std::string toPath, bool makeCopy)
double value
branching weight
the OtherObjectiveOption class.
bool setServiceURI(std::string serviceURI)
Set the serviceURI.
SolverOption ** getAllSolverOptions()
Get all solver options.
int hessDimension
hessDimension is the number of nonzeros in each array.
std::string writeOSoL(OSOption *theosoption)
create an osol string from an OSOption object
SparseVector * calculateConstraintFunctionGradient(double *x, double *objLambda, double *conLambda, int idx, bool new_x, int highestOrder)
Calculate the gradient of the constraint function indexed by idx.
int idx
index of the variable
SparseHessianMatrix * getLagrangianHessianSparsityPattern()
double * getInitObjValuesDense()
Get the initial values associated with the objectives in dense form.
bool setAnotherInitBasisStatus(int type, int idx, int status)
Set the basis status for another variable, objective or constraint/slack.
OSOption * osoption
osoption holds the solver options in-memory as an OSOption object
The Default Solver Class.
bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex)
This sets the objectives associated with each time domain stage in arbitrary order.
bool setInstanceLocationType(std::string locationType)
Set the instance location type.
int numberOfValues
numberOfValues is the number of nonzero elements stored in the <linearConstraintCoefficients> element...
std::string getServiceName()
Get the service name.
bool setTimeDomain(std::string format)
This sets the format of the time domain ("stages"/"interval"/"none")
bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx)
This sets the constraints associated with each time domain stage in temporal order.
PathPair ** getInputFilesToMove()
Get the array of input files to move.
a sparse vector data structure
double * hessValues
hessValues is a double array of the Hessian values.
PathPair ** getOutputDirectoriesToMove()
Get the array of output directories to move.
bool setInputFilesToMove(int numberOfPathPairs, PathPair **pathPair)
bool setNumberOfObjectives(int numberOfObjectives)
OtherOption ** getOtherSystemOptions()
Get the array of other options associated with the <system> element.
int getNumberOfInitObjBounds()
Get the number of initial objective bounds.
int getTimeDomainStageNumber()
Get the number of stages that make up the time domain.
OSOption * readOSoL(const std::string &osol)
parse the OSoL solver options.
bool setAnotherInitVarValueString(int idx, std::string value)
bool setOtherVariableOptions(int numberOfVar, OtherVariableOption **var)
bool m_bWhiteSpace
m_bWhiteSpace is set to true if we write white space in the file
OSInstance * osinstance
osinstance holds the problem instance in-memory as an OSInstance object
OtherOption ** getOtherJobOptions()
Get the array of other options associated with the <job> element.
double * getIntegerVariableBranchingWeightsDense()
Get the integer branching weights in dense form.
std::string getMaxTimeUnit()
Get the time unit.
bool setAnOtherSystemOption(std::string name, std::string value, std::string description)
int getNumberOfInputFilesToMove()
Get the number of input files to move.
InstanceData * instanceData
A pointer to an InstanceData object.
bool setAnotherFileToMake(std::string path)
#define OS_NEAR_EQUAL
we use OS_NEAR_EQUAL in unitTest to see if we are close to the optimal obj value
bool IsEqual(OSOption *that)
A function to check for the equality of two objects.
std::string getUserName()
Get the user name.
VariableOption * variables
the options for the variables
int ** getTimeDomainStageConList()
Get the list of constraints in each stage.
SOSWeights ** getSOSVariableBranchingWeightsSparse()
Get the SOS branching weights in sparse form.
int number
number is the number of elements in the indexes and values arrays.
bool setServiceType(std::string serviceType)
set() options in the <service> element
OtherOption ** getOtherGeneralOptions()
Get the array of other options associated with the <general> element.
bool setIntegerVariableBranchingWeightsDense(int numberOfVar, double *value)
std::string sSolverName
sSolverName is the name of the Coin solver used, e.g.
double getTimeDomainIntervalHorizon()
Get the horizon for the time domain interval.
OtherConOption ** con
array of option values
bool setAnotherProcessToKill(std::string process)
int getNumberOfInitVarValuesString()
Get the number of initial variable strings.
bool createOSInstance()
create an OSInstance from the MPS instance representation
SOSWeights ** sos
branching weights for the SOS
std::string * getTimeDomainStageNames()
Get the names of the stages (NULL or empty string ("") if a stage has not been given a name...
bool setOtherServiceOptions(int numberOfOptions, OtherOption **other)
int getNumberOfProcessesToKill()
Get the number of processes to kill.
int getNumberOfSolverOptions()
Get the number of solver options.
std::string writeOSiL(const OSInstance *theosinstance)
create an osil string from an OSInstance object
the InitDualVarValue class.
int getNumberOfFilesToDelete()
Get the number of files to delete.
int getMinCPUNumber()
Get the minimum required number of CPUs.
bool setMinCPUSpeed(std::string unit, std::string description, double value)
Set the minimum CPU speed required for the current job.
Used to read an OSoL string.
int getNumberOfOtherSystemOptions()
Get the number of <other> options in the <system> element.
std::vector< ExprNode * > getNonlinearExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
Implements a solve method for the Coin solvers.
std::string getFileAsString(const char *fname)
read a file and return contents as a string.
int ** getTimeDomainStageObjList()
Get the list of objectives in each stage.
int getNumberOfOtherJobOptions()
Get the number of <other> options in the <job> element.
double * values
values holds a double array of nonzero values.
bool setAnotherInputDirectoryToMove(std::string fromPath, std::string toPath, bool makeCopy)
int numberOfObj
number of <obj> children
std::string getRequestedStartTime()
Get the requested starting time.
int ** getTimeDomainStageVarList()
Get the list of variables in each stage.
bool setJobID(std::string jobID)
Set the job ID.
InitVarValueString ** getInitVarValuesStringSparse()
Get the initial value strings associated with the variables in sparse form.
OptimizationOption * optimization
optimizationOption holds the fifth child of the OSOption specified by the OSoL Schema.
bool setProcessesToKill(int numberOfProcesses, std::string *processes)
The BonminSolver class solves problems using Ipopt.
the OtherVariableOption class.
bool setDirectoriesToMake(int numberOfPaths, std::string *paths)
bool setInitConValuesDense(int numberOfCon, double *value)
bool setAnotherDirectoryToMake(std::string path)
std::string ubValue
upper bound of the option
int getNumberOfOtherVariableOptions()
Get the number of other variable options.
bool setMinCPUNumber(int number, std::string description)
Set the minimum number of CPU cores required for the current job.
virtual void buildSolverInstance()=0
buildSolverInstance is a virtual function – the actual solvers will implement their own buildSolverIn...
bool setOtherConstraintOptions(int numberOfOptions, OtherConstraintOption **other)
bool setInstanceLocation(std::string instanceLocation)
Set the instance location.
double getMinCPUSpeed()
Get the minimum required CPU speed.
bool setContactTransportType(std::string transportType)
Set the transport type for contact.
std::string * getFilesToDelete()
Get the array of files to delete.
bool setAnOtherConstraintOption(OtherConstraintOption *optionValue)
int getNumberOfInputDirectoriesToMove()
Get the number of input directories to move.
The in-memory representation of an OSiL instance..
double getMinMemorySize()
Get the minimum required memory.
the InitVarValueString class.
class used to make it easy to read and write files.
bool setAnotherOutputFileToMove(std::string fromPath, std::string toPath, bool makeCopy)
virtual void buildSolverInstance()
buildSolverInstance is a virtual function – the actual solvers will implement their own buildSolverIn...
bool setTimeDomainInterval(double start, double horizon)
This sets the start and end of the time interval.
OSInstance * osinstance
osinstance is a pointer to the OSInstance object that gets created from the instance represented in N...
bool setRequiredFiles(int numberOfPaths, std::string *paths)
int * getTimeDomainStageNumberOfObjectives()
Get the number of objectives contained in each time stage.
std::string * getDirectoriesToDelete()
Get the array of directories to delete.
The in-memory representation of a SparseHessianMatrix..
Used to hold the instance in memory.
int getNumberOfFilesToMake()
Get the number of files to make.
bool setMinCPUSpeedUnit(std::string unit)
int getNumberOfOtherServiceOptions()
Get the number of <other> options in the <service> element.
bool setInitDualVarValuesSparse(int numberOfCon, InitDualVarValue **con)
bool setFilesToDelete(int numberOfPaths, std::string *paths)
used for throwing exceptions.
the OtherConOption class.
bool setInstanceName(std::string instanceName)
Set the instance name.
int getNumberOfDirectoriesToDelete()
Get the number of directories to delete.
OtherConstraintOption ** getAllOtherConstraintOptions()
Get all <other> constraint options.
std::string getMinDiskSpaceUnit()
Get the disk space unit.
bool setMaxTimeUnit(std::string unit)
LinearConstraintCoefficients * linearConstraintCoefficients
linearConstraintCoefficients is a pointer to a LinearConstraintCoefficients object ...
Take an OSInstance object and write a string that validates against the OSiL schema.
std::string getPassword()
Get the password.
bool setOtherSystemOptions(int numberOfOptions, OtherOption **other)
bool setOutputDirectoriesToMove(int numberOfPathPairs, PathPair **pathPair)
InitObjBound ** getInitObjBoundsSparse()
Get the initial bounds associated with the objectives in sparse form.
virtual void buildSolverInstance()
The implementation of the virtual functions.
void fint fint fint real fint real * x
bool setContact(std::string contact)
Set the contact information.
std::string getTimeDomainFormat()
Get the format of the time domain ("stages"/"interval")
bool setAnotherRequiredDirectory(std::string path)
bool setPassword(std::string password)
Set the password.
std::string getInstanceLocation()
Get the instance location.
std::vector< ExprNode * > getNonlinearExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.
std::string * getInitBasisStatusDense()
Get the initial basis information in dense form.