43 int main(
int argc,
char* argv[]);
51 " --readbas=<basfile> read starting basis from file\n" 52 " --writebas=<basfile> write terminal basis to file\n" 53 " --writefile=<lpfile> write LP to file in LP or MPS format depending on extension\n" 54 " --writedual=<lpfile> write the dual LP to a file in LP or MPS formal depending on extension\n" 55 " --<type>:<name>=<val> change parameter value using syntax of settings file entries\n" 56 " --loadset=<setfile> load parameters from settings file (overruled by command line parameters)\n" 57 " --saveset=<setfile> save parameters to settings file\n" 58 " --diffset=<setfile> save modified parameters to settings file\n" 59 " --extsol=<value> external solution for soplex to use for validation\n" 61 "limits and tolerances:\n" 62 " -t<s> set time limit to <s> seconds\n" 63 " -i<n> set iteration limit to <n>\n" 64 " -f<eps> set primal feasibility tolerance to <eps>\n" 65 " -o<eps> set dual feasibility (optimality) tolerance to <eps>\n" 66 " -l<eps> set validation tolerance to <eps>\n" 68 "algorithmic settings (* indicates default):\n" 69 " --readmode=<value> choose reading mode for <lpfile> (0* - floating-point, 1 - rational)\n" 70 " --solvemode=<value> choose solving mode (0 - floating-point solve, 1* - auto, 2 - force iterative refinement)\n" 71 " --arithmetic=<value> choose base arithmetic type (0 - double, 1 - quadprecision, 2 - higher multiprecision)\n" 72 #ifdef SOPLEX_WITH_MPFR 73 " --precision=<value> choose precision for multiprecision solve (only active when arithmetic=2 minimal value = 50)\n" 75 #ifdef SOPLEX_WITH_CPPMPF 76 " --precision=<value> choose precision for multiprecision solve (only active when arithmetic=2, possible values 50,100,200, compile with mpfr for arbitrary precision)\n" 78 " -s<value> choose simplifier/presolver (0 - off, 1* - internal, 2*- PaPILO)\n" 79 " -g<value> choose scaling (0 - off, 1 - uni-equilibrium, 2* - bi-equilibrium, 3 - geometric, 4 - iterated geometric, 5 - least squares, 6 - geometric-equilibrium)\n" 80 " -p<value> choose pricing (0* - auto, 1 - dantzig, 2 - parmult, 3 - devex, 4 - quicksteep, 5 - steep)\n" 81 " -r<value> choose ratio tester (0 - textbook, 1 - harris, 2 - fast, 3* - boundflipping)\n" 84 " -v<level> set verbosity to <level> (0 - error, 3 - normal, 5 - high)\n" 85 " -x=<solfile> print primal solution to file (or just -x to print to terminal)\n" 86 " -y=<solfile> print dual multipliers to file (or just -y to print to terminal)\n" 87 " -X=<solfile> print primal solution in rational numbers to file (or just -X to print to terminal)\n" 88 " -Y=<solfile> print dual multipliers in rational numbers to file (or just -Y to print to terminal)\n" 89 " -q display detailed statistics\n" 90 " -c perform final check of optimal solution in original problem\n" 94 std::cerr <<
"missing input file\n\n";
96 std::cerr <<
"invalid option \"" << argv[idx] <<
"\"\n\n";
98 std::cerr <<
"usage: " << argv[0] <<
" " <<
"[options] <lpfile>\n" 99 #ifdef SOPLEX_WITH_ZLIB 100 <<
" <lpfile> linear program as .mps[.gz] or .lp[.gz] file\n\n" 102 <<
" <lpfile> linear program as .mps or .lp file\n\n" 109 void freeStrings(
char*& s1,
char*& s2,
char*& s3,
char*& s4,
char*& s5)
158 R maxviol = boundviol > rowviol ? boundviol : rowviol;
160 soplex.
spxout <<
"Primal solution " << (feasible ?
"feasible" :
"infeasible")
161 <<
" in original problem (max. violation = " << std::scientific << maxviol
162 << std::setprecision(8) << std::fixed <<
").\n");
183 R maxviol = redcostviol > dualviol ? redcostviol : dualviol;
185 soplex.
spxout <<
"Dual solution " << (feasible ?
"feasible" :
"infeasible")
186 <<
" in original problem (max. violation = " << std::scientific << maxviol
187 << std::setprecision(8) << std::fixed <<
").\n" 216 Rational maxviol = boundviol > rowviol ? boundviol : rowviol;
218 soplex.
spxout <<
"Primal solution " << (feasible ?
"feasible" :
"infeasible") <<
219 " in original problem (max. violation = " << maxviol <<
").\n" 242 Rational maxviol = redcostviol > dualviol ? redcostviol : dualviol;
244 soplex.
spxout <<
"Dual solution " << (feasible ?
"feasible" :
"infeasible") <<
245 " in original problem (max. violation = " << maxviol <<
").\n" 281 bool real =
true,
bool rational =
false,
bool append =
false)
286 printwidth = printprec + 10;
287 std::ofstream outfile;
290 outfile.open(filename, std::ios::app);
292 outfile.open(filename);
300 outfile <<
"\nPrimal ray (name, value):\n";
302 for(
int i = 0; i < soplex.
numCols(); ++i)
304 if(isNotZero(primal[i], soplex.
tolerances()->epsilon()))
306 outfile << colnames[i] <<
"\t" 307 << std::setw(printwidth) << std::setprecision(printprec)
308 << primal[i] << std::endl;
312 outfile <<
"All other entries are zero (within " 313 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
314 << std::setprecision(8) << std::fixed
315 <<
")." << std::endl;
320 outfile <<
"\nPrimal solution (name, value):\n";
322 for(
int i = 0; i < soplex.
numCols(); ++i)
324 if(isNotZero(primal[i], soplex.
tolerances()->epsilon()))
326 outfile << colnames[i] <<
"\t" 327 << std::setw(printwidth) << std::setprecision(printprec)
328 << primal[i] << std::endl;
333 outfile <<
"All other variables are zero (within " 334 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
335 << std::setprecision(8) << std::fixed
336 <<
"). Solution has " << nNonzeros <<
" nonzero entries." << std::endl;
339 outfile <<
"No primal information available.\n";
348 outfile <<
"\nPrimal ray (name, value):\n";
350 for(
int i = 0; i < soplex.
numCols(); ++i)
354 outfile << colnames[i] <<
"\t" 355 << std::setw(printwidth) << std::setprecision(printprec)
356 << primal[i] << std::endl;
360 outfile <<
"All other entries are zero." << std::endl;
366 outfile <<
"\nPrimal solution (name, value):\n";
372 outfile << colnames[i] <<
"\t" << primal[i] << std::endl;
377 outfile <<
"All other variables are zero. Solution has " 378 << nNonzeros <<
" nonzero entries." << std::endl;
381 outfile <<
"No primal (rational) solution available.\n";
389 bool real =
true,
bool rational =
false,
bool append =
false)
394 printwidth = printprec + 10;
396 std::ofstream outfile;
399 outfile.open(filename, std::ios::app);
401 outfile.open(filename);
409 outfile <<
"\nDual ray (name, value):\n";
411 for(
int i = 0; i < soplex.
numRows(); ++i)
413 if(isNotZero(dual[i], soplex.
tolerances()->epsilon()))
415 outfile << rownames[i] <<
"\t" 416 << std::setw(printwidth) << std::setprecision(printprec)
417 << dual[i] << std::endl;
421 outfile <<
"All other entries are zero (within " 422 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
423 << std::setprecision(8) << std::fixed <<
")." << std::endl;
427 outfile <<
"\nDual solution (name, value):\n";
429 for(
int i = 0; i < soplex.
numRows(); ++i)
431 if(isNotZero(dual[i], soplex.
tolerances()->epsilon()))
433 outfile << rownames[i] <<
"\t" 434 << std::setw(printwidth) << std::setprecision(printprec)
435 << dual[i] << std::endl;
439 outfile <<
"All other dual values are zero (within " 440 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
441 << std::setprecision(8) << std::fixed <<
")." << std::endl;
447 outfile <<
"\nReduced costs (name, value):\n";
449 for(
int i = 0; i < soplex.
numCols(); ++i)
451 if(isNotZero(redcost[i], soplex.
tolerances()->epsilon()))
453 outfile << colnames[i] <<
"\t" 454 << std::setw(printwidth) << std::setprecision(printprec)
455 << redcost[i] << std::endl;
459 outfile <<
"All other reduced costs are zero (within " 460 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
461 << std::setprecision(8) << std::fixed <<
")." << std::endl;
465 outfile <<
"No dual information available.\n";
474 outfile <<
"\nDual ray (name, value):\n";
476 for(
int i = 0; i < soplex.
numRows(); ++i)
480 outfile << rownames[i] <<
"\t" 481 << std::setw(printwidth)
482 << std::setprecision(printprec)
483 << dual[i] << std::endl;
487 outfile <<
"All other entries are zero." << std::endl;
492 outfile <<
"\nDual solution (name, value):\n";
497 outfile << rownames[i] <<
"\t" << dual[i] << std::endl;
500 outfile <<
"All other dual values are zero." << std::endl;
506 outfile <<
"\nReduced costs (name, value):\n";
508 for(
int i = 0; i < soplex.
numCols(); ++i)
511 outfile << colnames[i] <<
"\t" << redcost[i] << std::endl;
514 outfile <<
"All other reduced costs are zero." << std::endl;
518 outfile <<
"No dual (rational) solution available.\n";
525 bool real =
true,
bool rational =
false)
530 printwidth = printprec + 10;
540 for(
int i = 0; i < soplex.
numCols(); ++i)
542 if(isNotZero(primal[i], soplex.
tolerances()->epsilon()))
545 << std::setw(printwidth) << std::setprecision(printprec)
546 << primal[i] << std::endl;)
551 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
552 << std::setprecision(8) << std::fixed
553 <<
")." << std::endl;)
560 for(
int i = 0; i < soplex.
numCols(); ++i)
562 if(isNotZero(primal[i], soplex.
tolerances()->epsilon()))
565 << std::setw(printwidth) << std::setprecision(printprec)
566 << primal[i] << std::endl;)
572 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
573 << std::setprecision(8) << std::fixed
574 <<
"). Solution has " << nNonzeros <<
" nonzero entries." << std::endl;)
588 for(
int i = 0; i < soplex.
numCols(); ++i)
593 << std::setw(printwidth) << std::setprecision(printprec)
594 << primal[i] << std::endl;)
616 << nNonzeros <<
" nonzero entries." << std::endl;)
627 bool real =
true,
bool rational =
false)
632 printwidth = printprec + 10;
642 for(
int i = 0; i < soplex.
numRows(); ++i)
644 if(isNotZero(dual[i], soplex.
tolerances()->epsilon()))
647 << std::setw(printwidth) << std::setprecision(printprec)
648 << dual[i] << std::endl;)
653 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
654 << std::setprecision(8) << std::fixed <<
")." << std::endl;)
660 for(
int i = 0; i < soplex.
numRows(); ++i)
662 if(isNotZero(dual[i], soplex.
tolerances()->epsilon()))
665 << std::setw(printwidth) << std::setprecision(printprec)
666 << dual[i] << std::endl;)
671 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
672 << std::setprecision(8) << std::fixed <<
")." << std::endl;)
680 for(
int i = 0; i < soplex.
numCols(); ++i)
682 if(isNotZero(redcost[i], soplex.
tolerances()->epsilon()))
685 << std::setw(printwidth) << std::setprecision(printprec)
686 << redcost[i] << std::endl;)
691 << std::setprecision(1) << std::scientific << soplex.
tolerances()->epsilon()
692 << std::setprecision(8) << std::fixed <<
")." << std::endl;)
707 for(
int i = 0; i < soplex.
numRows(); ++i)
712 << std::setw(printwidth)
713 << std::setprecision(printprec)
714 << dual[i] << std::endl;)
739 for(
int i = 0; i < soplex.
numCols(); ++i)
759 Timer* readingTime =
nullptr;
763 const char* lpfilename =
nullptr;
764 char* readbasname =
nullptr;
765 char* writebasname =
nullptr;
766 char* writefilename =
nullptr;
767 char* writedualfilename =
nullptr;
768 char* loadsetname =
nullptr;
769 char* savesetname =
nullptr;
770 char* diffsetname =
nullptr;
771 bool printPrimal =
false;
772 bool printPrimalRational =
false;
773 bool printDual =
false;
774 bool printDualRational =
false;
775 bool displayStatistics =
false;
776 bool checkSol =
false;
778 char* primalSolName =
nullptr;
779 char* dualSolName =
nullptr;
782 char* primalSolNameRational =
nullptr;
783 char* dualSolNameRational =
nullptr;
801 validation =
nullptr;
814 for(optidx = 1; optidx < argc; optidx++)
816 char* option = argv[optidx];
821 lpfilename = argv[optidx];
829 || (option[2] ==
'\0' && strchr(
"xyXYqc", option[1]) ==
nullptr)
830 || (option[3] ==
'\0' && strchr(
"xyXY", option[1]) !=
nullptr))
834 goto TERMINATE_FREESTRINGS;
844 if(strncmp(option,
"readbas=", 8) == 0)
846 if(readbasname ==
nullptr)
848 char* filename = &option[8];
849 readbasname =
new char[strlen(filename) + 1];
850 spxSnprintf(readbasname, strlen(filename) + 1,
"%s", filename);
854 else if(strncmp(option,
"writebas=", 9) == 0)
856 if(writebasname ==
nullptr)
858 char* filename = &option[9];
859 writebasname =
new char[strlen(filename) + 1];
860 spxSnprintf(writebasname, strlen(filename) + 1,
"%s", filename);
864 else if(strncmp(option,
"writefile=", 10) == 0)
866 if(writefilename ==
nullptr)
868 char* filename = &option[10];
869 writefilename =
new char[strlen(filename) + 1];
870 spxSnprintf(writefilename, strlen(filename) + 1,
"%s", filename);
874 else if(strncmp(option,
"writedual=", 10) == 0)
876 if(writedualfilename ==
nullptr)
878 char* dualfilename = &option[10];
879 writedualfilename =
new char[strlen(dualfilename) + 1];
880 spxSnprintf(writedualfilename, strlen(dualfilename) + 1,
"%s", dualfilename);
884 else if(strncmp(option,
"loadset=", 8) == 0)
886 if(loadsetname ==
nullptr)
888 char* filename = &option[8];
889 loadsetname =
new char[strlen(filename) + 1];
890 spxSnprintf(loadsetname, strlen(filename) + 1,
"%s", filename);
896 goto TERMINATE_FREESTRINGS;
906 else if(strncmp(option,
"saveset=", 8) == 0)
908 if(savesetname ==
nullptr)
910 char* filename = &option[8];
911 savesetname =
new char[strlen(filename) + 1];
912 spxSnprintf(savesetname, strlen(filename) + 1,
"%s", filename);
916 else if(strncmp(option,
"diffset=", 8) == 0)
918 if(diffsetname ==
nullptr)
920 char* filename = &option[8];
921 diffsetname =
new char[strlen(filename) + 1];
922 spxSnprintf(diffsetname, strlen(filename) + 1,
"%s", filename);
926 else if(strncmp(option,
"readmode=", 9) == 0)
932 goto TERMINATE_FREESTRINGS;
936 else if(strncmp(option,
"solvemode=", 10) == 0)
942 goto TERMINATE_FREESTRINGS;
953 else if(strncmp(option,
"extsol=", 7) == 0)
955 char* input = &option[7];
961 goto TERMINATE_FREESTRINGS;
965 else if(strncmp(option,
"arithmetic=", 11) == 0)
970 else if(strncmp(option,
"precision=", 10) == 0)
979 goto TERMINATE_FREESTRINGS;
992 goto TERMINATE_FREESTRINGS;
1004 goto TERMINATE_FREESTRINGS;
1016 goto TERMINATE_FREESTRINGS;
1028 goto TERMINATE_FREESTRINGS;
1040 goto TERMINATE_FREESTRINGS;
1052 goto TERMINATE_FREESTRINGS;
1064 goto TERMINATE_FREESTRINGS;
1076 goto TERMINATE_FREESTRINGS;
1088 goto TERMINATE_FREESTRINGS;
1100 goto TERMINATE_FREESTRINGS;
1109 if(strncmp(option,
"-x=", 3) == 0)
1111 if(primalSolName ==
nullptr)
1113 char* filename = &option[3];
1114 primalSolName =
new char[strlen(filename) + 1];
1115 spxSnprintf(primalSolName, strlen(filename) + 1,
"%s", filename);
1123 printPrimalRational =
true;
1125 if(strncmp(option,
"-X=", 3) == 0)
1127 if(primalSolNameRational ==
nullptr)
1129 char* filename = &option[3];
1130 primalSolNameRational =
new char[strlen(filename) + 1];
1131 spxSnprintf(primalSolNameRational, strlen(filename) + 1,
"%s", filename);
1141 if(strncmp(option,
"-y=", 3) == 0)
1143 if(dualSolName ==
nullptr)
1145 char* filename = &option[3];
1146 dualSolName =
new char[strlen(filename) + 1];
1147 spxSnprintf(dualSolName, strlen(filename) + 1,
"%s", filename);
1155 printDualRational =
true;
1157 if(strncmp(option,
"-Y=", 3) == 0)
1159 if(dualSolNameRational ==
nullptr)
1161 char* filename = &option[3];
1162 dualSolNameRational =
new char[strlen(filename) + 1];
1163 spxSnprintf(dualSolNameRational, strlen(filename) + 1,
"%s", filename);
1171 displayStatistics =
true;
1194 goto TERMINATE_FREESTRINGS;
1202 if(lpfilename ==
nullptr && savesetname ==
nullptr && diffsetname ==
nullptr)
1206 goto TERMINATE_FREESTRINGS;
1213 "Error: manual synchronization is invalid on command line. Change parameter int:syncmode.\n");
1215 goto TERMINATE_FREESTRINGS;
1219 if(savesetname !=
nullptr)
1227 SPX_MSG_ERROR(std::cerr <<
"Error writing parameters to file <" << savesetname <<
">\n");
1231 if(diffsetname !=
nullptr)
1234 diffsetname <<
"> . . .\n");
1238 SPX_MSG_ERROR(std::cerr <<
"Error writing modified parameters to file <" << diffsetname <<
">\n");
1243 if(lpfilename ==
nullptr)
1245 if(loadsetname !=
nullptr || savesetname !=
nullptr || diffsetname !=
nullptr)
1250 goto TERMINATE_FREESTRINGS;
1254 readingTime->
start();
1267 <<
" LP file <" << lpfilename <<
"> . . .\n");
1269 if(!soplex->
readFile(lpfilename, &rownames, &colnames))
1271 SPX_MSG_ERROR(std::cerr <<
"Error while reading file <" << lpfilename <<
">.\n");
1273 goto TERMINATE_FREESTRINGS;
1277 if(writefilename !=
nullptr)
1279 if(!soplex->
writeFile(writefilename, &rownames, &colnames))
1281 SPX_MSG_ERROR(std::cerr <<
"Error while writing file <" << writefilename <<
">.\n\n");
1283 goto TERMINATE_FREESTRINGS;
1293 if(writedualfilename !=
nullptr)
1297 SPX_MSG_ERROR(std::cerr <<
"Error while writing dual file <" << writedualfilename <<
">.\n\n");
1299 goto TERMINATE_FREESTRINGS;
1309 if(readbasname !=
nullptr)
1314 if(!soplex->
readBasisFile(readbasname, &rownames, &colnames))
1316 SPX_MSG_ERROR(std::cerr <<
"Error while reading file <" << readbasname <<
">.\n");
1318 goto TERMINATE_FREESTRINGS;
1322 readingTime->
stop();
1326 soplex->
spxout <<
"Reading took " 1327 << std::fixed << std::setprecision(2) << readingTime->
time()
1328 << std::scientific << std::setprecision(
int(prec))
1329 <<
" seconds.\n\n");
1332 << soplex->
numCols() <<
" columns and " << soplex->
numNonzeros() <<
" nonzeros.\n\n");
1338 if(primalSolName ==
nullptr && primalSolNameRational ==
nullptr)
1342 if(primalSolName !=
nullptr)
1348 if(primalSolNameRational !=
nullptr)
1350 append = primalSolName !=
nullptr && strcmp(primalSolName, primalSolNameRational) == 0;
1351 writePrimalSolution(*soplex, primalSolNameRational, colnames, rownames,
false,
true, append);
1355 if(dualSolName ==
nullptr && dualSolNameRational ==
nullptr)
1359 if(dualSolName !=
nullptr)
1361 append = primalSolName !=
nullptr && strcmp(dualSolName, primalSolName) == 0;
1362 append = append || (primalSolNameRational !=
nullptr 1363 && strcmp(dualSolName, primalSolNameRational) == 0);
1364 writeDualSolution(*soplex, dualSolName, colnames, rownames,
true,
false, append);
1368 if(dualSolNameRational !=
nullptr)
1370 append = (primalSolName !=
nullptr && strcmp(dualSolNameRational, primalSolName) == 0);
1371 append = append || (primalSolNameRational !=
nullptr 1372 && strcmp(dualSolNameRational, primalSolNameRational) == 0);
1373 append = append || (dualSolName !=
nullptr && strcmp(dualSolNameRational, dualSolName) == 0);
1374 writeDualSolution(*soplex, dualSolNameRational, colnames, rownames,
false,
true, append);
1378 checkSolution<R>(*soplex);
1380 if(displayStatistics)
1382 SPX_MSG_INFO1(soplex->spxout, soplex->spxout <<
"Statistics\n==========\n\n");
1383 soplex->printStatistics(soplex->spxout.getStream(
SPxOut::INFO1));
1390 if(writebasname !=
nullptr)
1392 if(!soplex->hasBasis())
1395 "No basis information available. Could not write file <" << writebasname <<
">\n\n");
1397 else if(!soplex->writeBasisFile(writebasname, &rownames, &colnames))
1399 SPX_MSG_ERROR(std::cerr <<
"Error while writing file <" << writebasname <<
">.\n\n");
1401 goto TERMINATE_FREESTRINGS;
1405 SPX_MSG_INFO1(soplex->spxout, soplex->spxout <<
"Written basis information to file <" <<
1415 goto TERMINATE_FREESTRINGS;
1418 TERMINATE_FREESTRINGS:
1419 freeStrings(readbasname, writebasname, loadsetname, savesetname, diffsetname);
1420 freeStrings(primalSolName, dualSolName, primalSolName, primalSolName, primalSolName);
1427 if(
nullptr != soplex)
1433 if(
nullptr != validation)
1439 if(
nullptr != readingTime)
1464 for(optidx = 1; optidx < argc; optidx++)
1466 char* option = argv[optidx];
1469 if(option[0] !=
'-')
1475 if(option[1] ==
'\0' 1476 || (option[2] ==
'\0' && strchr(
"xyXYqc", option[1]) ==
nullptr)
1477 || (option[3] ==
'\0' && strchr(
"xyXY", option[1]) !=
nullptr))
1486 option = &option[2];
1490 if(strncmp(option,
"arithmetic=", 11) == 0)
1492 if(option[11] ==
'1')
1494 #ifndef SOPLEX_WITH_FLOAT128 1496 "Cannot set arithmetic type to quadprecision - Soplex compiled without quadprecision support\n";)
1503 else if(option[11] ==
'2')
1505 #ifndef SOPLEX_WITH_BOOST 1507 "Cannot set arithmetic type to multiprecision - Soplex compiled without boost\n";)
1521 else if(strncmp(option,
"precision=", 10) == 0)
1523 precision = atoi(option + 10);
1524 #ifndef SOPLEX_WITH_BOOST 1525 SPX_MSG_ERROR(std::cerr <<
"Setting precision to non-default value without Boost has no effect\n";)
1536 if(precision != 0 && arithmetic != 2)
1539 "Setting precision to non-default value without enabling multiprecision solve has no effect\n";)
1545 runSoPlex<Real>(argc, argv);
1548 #ifdef SOPLEX_WITH_BOOST 1549 #ifdef SOPLEX_WITH_FLOAT128 1552 #if BOOST_VERSION < 107000 1553 std::cerr <<
"Error: Boost version too old." << std:: endl <<
1554 "In order to use the quadprecision feature of SoPlex," <<
1555 " Boost Version 1.70.0 or higher is required." << std::endl << \
1556 "Included Boost version is " << BOOST_VERSION / 100000 <<
"." 1557 << BOOST_VERSION / 100 % 1000 <<
"." 1558 << BOOST_VERSION % 100
1562 using Quad = boost::multiprecision::float128;
1563 runSoPlex<Quad>(argc, argv);
1571 #if BOOST_VERSION < 107000 1572 std::cerr <<
"Error: Boost version too old." << std:: endl <<
1573 "In order to use the multiprecision feature of SoPlex," <<
1574 " Boost Version 1.70.0 or higher is required." << std::endl << \
1575 "Included Boost version is " << BOOST_VERSION / 100000 <<
"." 1576 << BOOST_VERSION / 100 % 1000 <<
"." 1577 << BOOST_VERSION % 100
1580 #ifdef SOPLEX_WITH_MPFR 1586 using multiprecision = number<mpfr_float_backend<0>, et_off>;
1587 multiprecision::default_precision(precision);
1588 runSoPlex<multiprecision>(argc, argv);
1589 #endif // SOPLEX_WITH_MPFR 1591 #ifdef SOPLEX_WITH_CPPMPF 1595 using multiprecision1 = number<cpp_dec_float<50>, et_off>;
1596 using multiprecision2 = number<cpp_dec_float<100>, et_off>;
1597 using multiprecision3 = number<cpp_dec_float<200>, et_off>;
1600 runSoPlex<multiprecision1>(argc, argv);
1601 else if(precision <= 100)
1602 runSoPlex<multiprecision2>(argc, argv);
1604 runSoPlex<multiprecision3>(argc, argv);
1606 #endif // SOPLEX_WITH_CPPMPF 1613 std::cerr <<
"Wrong value for the arithmetic mode\n";
bool writeFile(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *intvars=0, const bool unscale=true) const
Templated write function Real writes real LP to file; LP or MPS format is chosen from the extension i...
virtual ~SoPlexBase()
destructor
number< gmp_rational, et_off > Rational
#define SPX_MSG_WARNING(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::WARNING.
bool getBoundViolationRational(Rational &maxviol, Rational &sumviol)
Dense vector.Class VectorBase provides dense linear algebra vectors. Internally, VectorBase wraps std...
bool getDualRational(VectorRational &vector)
int numNonzeros() const
returns number of nonzeros
int numRowsRational() const
bool getPrimalRational(VectorRational &vector)
dual feasibility tolerance
bool writeDualFileReal(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *intvars=0) const
writes the dual of the real LP to file; LP or MPS format is chosen from the extension in filename; if...
#define SPX_MSG_ERROR(x)
Prints out message x if the verbosity level is at least SPxOut::ERROR.
bool isDualFeasible() const
is stored dual solution feasible?
bool updateValidationTolerance(const std::string &tolerance)
updates the tolerance used for validation
static void checkSolutionReal(SoPlexBase< R > &soplex)
performs external feasibility check with real type
bool getDual(VectorBase< R > &vector)
gets the dual solution vector if available; returns true on success
bool getRowViolationRational(Rational &maxviol, Rational &sumviol)
SPxSolverBase< R >::Status optimize(volatile bool *interrupt=NULL)
optimize the given LP
bool getPrimalRay(VectorBase< R > &vector)
gets the primal ray if available; returns true on success
bool getRedCostViolation(R &maxviol, R &sumviol)
gets violation of reduced costs; returns true on success
void validateSolveReal(SoPlexBase< R > &soplex)
validates the soplex solution using the external solution
virtual const std::string what() const
returns exception message
bool parseSettingsString(char *str)
parses one setting string and returns true on success; note that string is modified ...
virtual void start()=0
start timer, resume accounting user, system and real time.
virtual Real stop()=0
stop timer, return accounted user time.
void spx_alloc(T &p, int n=1)
Allocate memory.
user sync of real and rational LP
int main(int argc, char *argv[])
runs SoPlexBase command line
bool getDualViolationRational(Rational &maxviol, Rational &sumviol)
bool getRedCostRational(VectorRational &vector)
int runSoPlex(int argc, char *argv[])
static void printUsage(const char *const argv[], int idx)
int intParam(const IntParam param) const
returns integer parameter value
bool getDualFarkas(VectorBase< R > &vector)
gets the Farkas proof if available; returns true on success
Real realParam(const RealParam param) const
returns real parameter value
iteration limit (-1 if unlimited)
bool getBoundViolation(R &maxviol, R &sumviol)
gets violation of bounds; returns true on success
primal feasibility tolerance
bool hasDual() const
deprecated: use hasSol() instead
int spxSnprintf(char *t, size_t len, const char *s,...)
safe version of snprintf
bool saveSettingsFile(const char *filename, const bool onlyChanged=false, int solvemode=1) const
writes settings file; returns true on success
bool getPrimal(VectorBase< R > &vector)
gets the primal solution vector if available; returns true on success
bool readBasisFile(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0)
reads basis information from filename and returns true on success; if rowNames and colNames are NULL...
bool hasPrimal() const
deprecated: use hasSol() instead
automatic sync of real and rational LP
bool getDualFarkasRational(VectorRational &vector)
int numCols() const
Templated function that returns number of columns.
static void checkSolutionRational(SoPlexBase< R > &soplex)
performs external feasibility check with rational type
virtual Real time() const =0
bool getRedCostViolationRational(Rational &maxviol, Rational &sumviol)
static Timer * createTimer(Timer::TYPE ttype)
create timers and allocate memory for them
static void writeDualSolution(SoPlexBase< R > &soplex, const char *filename, NameSet &colnames, NameSet &rownames, bool real=true, bool rational=false, bool append=false)
bool setRealParam(const RealParam param, const Real value, const bool init=true)
sets real parameter value; returns true on success
Preconfigured SoPlex LP solver.
Set of strings.Class NameSet implements a symbol or name table. It allows to store or remove names (i...
bool getDualViolation(R &maxviol, R &sumviol)
gets violation of dual multipliers; returns true on success
void checkSolution(SoPlexBase< R > &soplex)
performs external feasibility check according to check mode
bool validate
should the soplex solution be validated?
Exception base class.This class implements a base class for our SoPlex exceptions We provide a what()...
Everything should be within this namespace.
static void printPrimalSolution(SoPlexBase< R > &soplex, NameSet &colnames, NameSet &rownames, bool real=true, bool rational=false)
mode for iterative refinement strategy
apply standard floating-point algorithm
bool getRowViolation(R &maxviol, R &sumviol)
gets violation of constraints; returns true on success
int numRows() const
returns number of rows
time limit in seconds (INFTY if unlimited)
mode for reading LP files
#define SPX_MSG_INFO1(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO1.
std::streamsize precision() const
static void printDualSolution(SoPlexBase< R > &soplex, NameSet &colnames, NameSet &rownames, bool real=true, bool rational=false)
bool readFile(const char *filename, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
reads LP file in LP or MPS format according to READMODE parameter; gets row names, column names, and integer variables if desired; returns true on success
~Validation()
default destructor
void printVersion() const
prints version and compilation options
bool updateExternalSolution(const std::string &solution)
updates the external solution used for validation
bool getPrimalRayRational(VectorRational &vector)
int numColsRational() const
static void writePrimalSolution(SoPlexBase< R > &soplex, const char *filename, NameSet &colnames, NameSet &rownames, bool real=true, bool rational=false, bool append=false)
bool isPrimalFeasible() const
is stored primal solution feasible?
Validation object for soplex solutions.
static void freeStrings(char *&s1, char *&s2, char *&s3, char *&s4, char *&s5)
standard floating-point parsing
bool setIntParam(const IntParam param, const int value, const bool init=true)
sets integer parameter value; returns true on success
const std::shared_ptr< Tolerances > tolerances() const
returns current tolerances
mode for synchronizing real and rational LP
Wrapper for the system time query methods.
void spx_free(T &p)
Release memory.
bool loadSettingsFile(const char *filename)
reads settings file; returns true on success
bool getRedCost(VectorBase< R > &vector)
gets the vector of reduced cost values if available; returns true on success
void printUserSettings()
print non-default parameter values