43int 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"
109void freeStrings(
char*& s1,
char*& s2,
char*& s3,
char*& s4,
char*& s5)
155 if(
soplex.getBoundViolation(boundviol, sumviol) &&
soplex.getRowViolation(rowviol, sumviol))
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");
180 if(
soplex.getRedCostViolation(redcostviol, sumviol) &&
soplex.getDualViolation(dualviol, sumviol))
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"
212 if(
soplex.getBoundViolationRational(boundviol, sumviol)
213 &&
soplex.getRowViolationRational(rowviol, sumviol))
216 Rational maxviol = boundviol > rowviol ? boundviol : rowviol;
218 soplex.spxout <<
"Primal solution " << (feasible ?
"feasible" :
"infeasible") <<
219 " in original problem (max. violation = " << maxviol <<
").\n"
238 if(
soplex.getRedCostViolationRational(redcostviol, sumviol)
239 &&
soplex.getDualViolationRational(dualviol, sumviol))
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)
285 printprec = (int) - log10(
Real(
soplex.tolerances()->epsilon()));
286 printwidth = printprec + 10;
287 std::ofstream outfile;
290 outfile.open(filename, std::ios::app);
292 outfile.open(filename);
298 if(
soplex.getPrimalRay(primal))
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;
317 else if(
soplex.isPrimalFeasible() &&
soplex.getPrimal(primal))
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";
346 if(
soplex.getPrimalRayRational(primal))
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;
363 if(
soplex.isPrimalFeasible() &&
soplex.getPrimalRational(primal))
366 outfile <<
"\nPrimal solution (name, value):\n";
368 for(
int i = 0; i <
soplex.numColsRational(); ++i)
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)
393 printprec = (int) - log10(
Real(
soplex.tolerances()->epsilon()));
394 printwidth = printprec + 10;
396 std::ofstream outfile;
399 outfile.open(filename, std::ios::app);
401 outfile.open(filename);
407 if(
soplex.getDualFarkas(dual))
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;
425 else if(
soplex.isDualFeasible() &&
soplex.getDual(dual))
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;
445 if(
soplex.getRedCost(redcost))
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";
472 if(
soplex.getDualFarkasRational(dual))
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;
490 if(
soplex.isDualFeasible() &&
soplex.getDualRational(dual))
492 outfile <<
"\nDual solution (name, value):\n";
494 for(
int i = 0; i <
soplex.numRowsRational(); ++i)
497 outfile << rownames[i] <<
"\t" << dual[i] << std::endl;
500 outfile <<
"All other dual values are zero." << std::endl;
504 if(
soplex.getRedCostRational(redcost))
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)
529 printprec = (int) - log10(
Real(
soplex.tolerances()->epsilon()));
530 printwidth = printprec + 10;
536 if(
soplex.getPrimalRay(primal))
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;)
555 else if(
soplex.isPrimalFeasible() &&
soplex.getPrimal(primal))
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;)
584 if(
soplex.getPrimalRayRational(primal))
588 for(
int i = 0; i <
soplex.numCols(); ++i)
593 << std::setw(printwidth) << std::setprecision(printprec)
594 << primal[i] << std::endl;)
601 if(
soplex.isPrimalFeasible() &&
soplex.getPrimalRational(primal))
606 for(
int i = 0; i <
soplex.numColsRational(); ++i)
616 << nNonzeros <<
" nonzero entries." << std::endl;)
627 bool real =
true,
bool rational =
false)
631 printprec = (int) - log10(
Real(
soplex.tolerances()->epsilon()));
632 printwidth = printprec + 10;
638 if(
soplex.getDualFarkas(dual))
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;)
656 else if(
soplex.isDualFeasible() &&
soplex.getDual(dual))
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;)
676 if(
soplex.getRedCost(redcost))
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;)
703 if(
soplex.getDualFarkasRational(dual))
707 for(
int i = 0; i <
soplex.numRows(); ++i)
712 << std::setw(printwidth)
713 << std::setprecision(printprec)
714 << dual[i] << std::endl;)
721 if(
soplex.isDualFeasible() &&
soplex.getDualRational(dual))
725 for(
int i = 0; i <
soplex.numRowsRational(); ++i)
735 if(
soplex.getRedCostRational(redcost))
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;
793 readingTime = TimerFactory::createTimer(Timer::USER_TIME);
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);
892 if(!
soplex->loadSettingsFile(loadsetname))
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)
928 if(!
soplex->setIntParam(
soplex->READMODE, option[9] -
'0'))
932 goto TERMINATE_FREESTRINGS;
936 else if(strncmp(option,
"solvemode=", 10) == 0)
938 if(!
soplex->setIntParam(
soplex->SOLVEMODE, option[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)
975 else if(!
soplex->parseSettingsString(option))
979 goto TERMINATE_FREESTRINGS;
988 if(!
soplex->setRealParam(
soplex->TIMELIMIT, atoi(&option[2])))
992 goto TERMINATE_FREESTRINGS;
1000 if(!
soplex->setIntParam(
soplex->ITERLIMIT, atoi(&option[2])))
1004 goto TERMINATE_FREESTRINGS;
1012 if(!
soplex->setRealParam(
soplex->FEASTOL, atof(&option[2])))
1016 goto TERMINATE_FREESTRINGS;
1024 if(!
soplex->setRealParam(
soplex->OPTTOL, atof(&option[2])))
1028 goto TERMINATE_FREESTRINGS;
1040 goto TERMINATE_FREESTRINGS;
1048 if(!
soplex->setIntParam(
soplex->SIMPLIFIER, option[2] -
'0'))
1052 goto TERMINATE_FREESTRINGS;
1060 if(!
soplex->setIntParam(
soplex->SCALER, option[2] -
'0'))
1064 goto TERMINATE_FREESTRINGS;
1072 if(!
soplex->setIntParam(
soplex->PRICER, option[2] -
'0'))
1076 goto TERMINATE_FREESTRINGS;
1084 if(!
soplex->setIntParam(
soplex->RATIOTESTER, option[2] -
'0'))
1088 goto TERMINATE_FREESTRINGS;
1096 if(!
soplex->setIntParam(
soplex->VERBOSITY, option[2] -
'0'))
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;
1182 if(!
soplex->saveSettingsFile(
nullptr,
false))
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)
1225 if(!
soplex->saveSettingsFile(savesetname,
false))
1227 SPX_MSG_ERROR(std::cerr <<
"Error writing parameters to file <" << savesetname <<
">\n");
1231 if(diffsetname !=
nullptr)
1234 diffsetname <<
"> . . .\n");
1236 if(!
soplex->saveSettingsFile(diffsetname,
true))
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();
1266 << (
soplex->intParam(
soplex->READMODE) ==
soplex->READMODE_REAL ?
"(real)" :
"(rational)")
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)
1295 if(!
soplex->writeDualFileReal(writedualfilename, &rownames, &colnames))
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();
1325 std::streamsize prec =
soplex->spxout.precision();
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;
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);
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);
1378 checkSolution<R>(*
soplex);
1380 if(displayStatistics)
1383 soplex->printStatistics(
soplex->spxout.getStream(SPxOut::INFO1));
1390 if(writebasname !=
nullptr)
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;
1415 goto TERMINATE_FREESTRINGS;
1418TERMINATE_FREESTRINGS:
1419 freeStrings(readbasname, writebasname, loadsetname, savesetname, diffsetname);
1420 freeStrings(primalSolName, dualSolName, primalSolName, primalSolName, primalSolName);
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
1561 using namespace boost::multiprecision;
1562 using Quad = boost::multiprecision::float128;
1563 runSoPlex<Quad>(argc, argv);
1569 using namespace boost::multiprecision;
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);
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);
1613 std::cerr <<
"Wrong value for the arithmetic mode\n";
virtual const std::string what() const
returns exception message
Wrapper for the system time query methods.
virtual Real time() const =0
virtual void start()=0
start timer, resume accounting user, system and real time.
virtual Real stop()=0
stop timer, return accounted user time.
bool updateValidationTolerance(const std::string &tolerance)
updates the tolerance used for validation
bool validate
should the soplex solution be validated?
bool updateExternalSolution(const std::string &solution)
updates the external solution used for validation
~Validation()
default destructor
void validateSolveReal(SoPlexBase< R > &soplex)
validates the soplex solution using the external solution
Everything should be within this namespace.
number< gmp_rational, et_off > Rational
void spx_free(T &p)
Release memory.
int spxSnprintf(char *t, size_t len, const char *s,...)
safe version of snprintf
void spx_alloc(T &p, int n=1)
Allocate memory.
Preconfigured SoPlex LP solver.
int main(int argc, char *argv[])
runs SoPlexBase command line
static void printUsage(const char *const argv[], int idx)
static void writePrimalSolution(SoPlexBase< R > &soplex, const char *filename, NameSet &colnames, NameSet &rownames, bool real=true, bool rational=false, bool append=false)
static void printDualSolution(SoPlexBase< R > &soplex, NameSet &colnames, NameSet &rownames, bool real=true, bool rational=false)
int runSoPlex(int argc, char *argv[])
static void checkSolutionRational(SoPlexBase< R > &soplex)
performs external feasibility check with rational type
void checkSolution(SoPlexBase< R > &soplex)
performs external feasibility check according to check mode
static void writeDualSolution(SoPlexBase< R > &soplex, const char *filename, NameSet &colnames, NameSet &rownames, bool real=true, bool rational=false, bool append=false)
static void freeStrings(char *&s1, char *&s2, char *&s3, char *&s4, char *&s5)
static void checkSolutionReal(SoPlexBase< R > &soplex)
performs external feasibility check with real type
static void printPrimalSolution(SoPlexBase< R > &soplex, NameSet &colnames, NameSet &rownames, bool real=true, bool rational=false)
#define SPX_MSG_ERROR(x)
Prints out message x if the verbosity level is at least SPxOut::ERROR.
#define SPX_MSG_WARNING(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::WARNING.
#define SPX_MSG_INFO1(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO1.
Validation object for soplex solutions.