36 #define SET_MAX_LINE_LEN 500 38 #define DEFAULT_REFACTOR_INTERVAL 200 41 #define strncasecmp _strnicmp 206 description[
SoPlex::SCALER] =
"scaling (0 - off, 1 - uni-equilibrium, 2 - bi-equilibrium, 3 - geometric, 4 - iterated geometric, 5 - least squares)";
213 description[
SoPlex::STARTER] =
"crash basis generated when starting from scratch (0 - none, 1 - weight, 2 - sum, 3 - vector)";
220 description[
SoPlex::PRICER] =
"pricing method (0 - auto, 1 - dantzig, 2 - parmult, 3 - devex, 4 - quicksteep, 5 - steep)";
248 description[
SoPlex::SOLVEMODE] =
"mode for iterative refinement strategy (0 - floating-point solve, 1 - auto, 2 - exact rational solve)";
255 description[
SoPlex::CHECKMODE] =
"mode for a posteriori feasibility checks (0 - floating-point check, 1 - auto, 2 - exact rational check)";
325 description[
SoPlex::PRINTCONDITION] =
"print condition number during the solve (0 - off, 1 - ratio estimate , 2 - sum estimate, 3 - product estimate, 4 - exact)";
430 description[
SoPlex::LIFTMINVAL] =
"lower threshold in lifting (nonzero matrix coefficients with smaller absolute value will be reformulated)";
437 description[
SoPlex::LIFTMAXVAL] =
"lower threshold in lifting (nonzero matrix coefficients with smaller absolute value will be reformulated)";
506 #ifdef SOPLEX_WITH_RATIONALPARAM 507 SoPlex::Settings::RationalParam::RationalParam() {}
521 #ifdef SOPLEX_WITH_RATIONALPARAM
522 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
523 _rationalParamValues[i] = rationalParam.defaultValue[i];
543 #ifdef SOPLEX_WITH_RATIONALPARAM
544 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
545 _rationalParamValues[i] = settings._rationalParamValues[i];
554 #ifdef SOPLEX_WITH_RATIONALPARAM 555 SoPlex::Settings::RationalParam SoPlex::Settings::rationalParam;
1078 assert(ncols ==
_solver.
nCols() || (ncols == 0 && intInfo == NULL));
1702 if( i < _rationalLP->nRows() )
1728 for(
int i = 0; i < oldsize; i++ )
1794 if( i < _rationalLP->nCols() )
1820 for(
int i = 0; i < oldsize; i++ )
1926 #ifdef SOPLEX_WITH_GMP 1928 void SoPlex::addRowRational(
const mpq_t* lhs,
const mpq_t* rowValues,
const int* rowIndices,
const int rowSize,
const mpq_t* rhs)
1948 void SoPlex::addRowsRational(
const mpq_t* lhs,
const mpq_t* rowValues,
const int* rowIndices,
const int* rowStarts,
const int* rowLengths,
const int numRows,
const int numValues,
const mpq_t* rhs)
1955 _rationalLP->
addRows(lhs, rowValues, rowIndices, rowStarts, rowLengths, numRows, numValues, rhs);
2010 #ifdef SOPLEX_WITH_GMP 2012 void SoPlex::addColRational(
const mpq_t* obj,
const mpq_t* lower,
const mpq_t* colValues,
const int* colIndices,
const int colSize,
const mpq_t* upper)
2033 void SoPlex::addColsRational(
const mpq_t* obj,
const mpq_t* lower,
const mpq_t* colValues,
const int* colIndices,
const int* colStarts,
const int* colLengths,
const int numCols,
const int numValues,
const mpq_t* upper)
2040 _rationalLP->
addCols(obj, lower, colValues, colIndices, colStarts, colLengths, numCols, numValues, upper);
2136 #ifdef SOPLEX_WITH_GMP 2177 #ifdef SOPLEX_WITH_GMP 2186 for(
int i = 0; i < rhsSize; i++ )
2259 #ifdef SOPLEX_WITH_GMP 2339 #ifdef SOPLEX_WITH_GMP 2399 #ifdef SOPLEX_WITH_GMP 2459 #ifdef SOPLEX_WITH_GMP 2516 #ifdef SOPLEX_WITH_GMP 2553 #ifdef SOPLEX_WITH_GMP 2582 if( i < _rationalLP->nRows() )
2609 for(
int i = 0; i < oldsize; i++ )
2677 if( i < _rationalLP->nCols() )
2704 for(
int i = 0; i < oldsize; i++ )
2845 #ifdef SOPLEX_DEBUG // this check will remove scaling of the realLP 2856 #ifdef ENABLE_ADDITIONAL_CHECKS 2864 #ifdef ENABLE_ADDITIONAL_CHECKS 2872 #ifdef ENABLE_ADDITIONAL_CHECKS 3075 Real viol = lower - primal[i];
3079 if( viol > maxviol )
3083 viol = primal[i] - upper;
3087 if( viol > maxviol )
3117 Real viol = lhs - activity[i];
3121 if( viol > maxviol )
3125 viol = activity[i] - rhs;
3129 if( viol > maxviol )
3160 sumviol += -redcost[c];
3161 if( redcost[c] < -maxviol )
3162 maxviol = -redcost[c];
3166 sumviol += redcost[c];
3167 if( redcost[c] > maxviol )
3168 maxviol = redcost[c];
3175 sumviol += redcost[c];
3176 if( redcost[c] > maxviol )
3177 maxviol = redcost[c];
3181 sumviol += -redcost[c];
3182 if( redcost[c] < -maxviol )
3183 maxviol = -redcost[c];
3214 sumviol += -dual[r];
3215 if( dual[r] < -maxviol )
3221 if( dual[r] > maxviol )
3230 if( dual[r] > maxviol )
3235 sumviol += -dual[r];
3236 if( dual[r] < -maxviol )
3391 if( viol > maxviol )
3404 if( viol > maxviol )
3444 if( viol > maxviol )
3457 if( viol > maxviol )
3508 sumviol += -redcost[c];
3509 if( redcost[c] < -maxviol )
3511 MSG_DEBUG( std::cout <<
"increased reduced cost violation for column " << c <<
" not on upper bound: " <<
rationalToString(-redcost[c]) <<
"\n" );
3512 maxviol = -redcost[c];
3517 sumviol += redcost[c];
3518 if( redcost[c] > maxviol )
3520 MSG_DEBUG( std::cout <<
"increased reduced cost violation for column " << c <<
" not on lower bound: " <<
rationalToString(redcost[c]) <<
"\n" );
3521 maxviol = redcost[c];
3529 sumviol += redcost[c];
3530 if( redcost[c] > maxviol )
3532 MSG_DEBUG( std::cout <<
"increased reduced cost violation for column " << c <<
" not on upper bound: " <<
rationalToString(redcost[c]) <<
"\n" );
3533 maxviol = redcost[c];
3538 sumviol += -redcost[c];
3539 if( redcost[c] < -maxviol )
3541 MSG_DEBUG( std::cout <<
"increased reduced cost violation for column " << c <<
" not on lower bound: " <<
rationalToString(-redcost[c]) <<
"\n" );
3542 maxviol = -redcost[c];
3589 sumviol += -dual[r];
3590 if( dual[r] < -maxviol )
3592 MSG_DEBUG( std::cout <<
"increased dual violation for row " << r <<
" not on upper bound: " <<
rationalToString(-dual[r])
3603 if( dual[r] > maxviol )
3605 MSG_DEBUG( std::cout <<
"increased dual violation for row " << r <<
" not on lower bound: " <<
rationalToString(dual[r])
3619 if( dual[r] > maxviol )
3621 MSG_DEBUG( std::cout <<
"increased dual violation for row " << r <<
" not on upper bound: " <<
rationalToString(dual[r])
3631 sumviol += -dual[r];
3632 if( dual[r] < -maxviol )
3634 MSG_DEBUG( std::cout <<
"increased dual violation for row " << r <<
" not on lower bound: " <<
rationalToString(-dual[r])
3650 #ifdef SOPLEX_WITH_GMP 4139 int size = x.
size();
4141 for(
int i = 0; i < size; i++ )
4158 if( ninds != 0 && inds != 0 )
4163 for(
int i = 0; i < *ninds; ++i )
4213 for(
int i = 0; i < rhs.size(); ++i)
4250 if(
id.isSPxRowId() )
4257 coef[rowindex] = y[i];
4267 assert(coef[index] == 0.0);
4320 int size = x.
size();
4322 for(
int i = 0; i < size; i++ )
4349 if( ninds != 0 && inds != 0 )
4354 for(
int i = 0; i < *ninds; ++i )
4419 int size = rhs.size();
4422 for(
int i = 0; i < size; i++ )
4425 rhs.value(i) *=
spxLdexp(1.0, scaleExp);
4433 for(
int i = 0; i < size; i++ )
4460 if(
id.isSPxRowId() )
4473 assert(coef[index] == 0.0);
4519 for(
int i = 0; i < v.
dim(); ++i)
4530 for(
int i = 0; i < x.
dim(); i++ )
4575 if(
id.isSPxRowId() )
4584 rowrhs.add(i,
spxLdexp(v[idx], scaleExp));
4591 assert(rowrhs[i] == 0.0);
4640 x[i] =
spxLdexp(y[index], scaleExp);
4678 for(
int i = 0; i < basisdim; ++i)
4687 vec[i] =
spxLdexp(vec[i], scaleExp);
4691 for(
int i = 0; i < basisdim; ++i)
4694 vec[i] =
spxLdexp(vec[i], -scaleExp);
4709 Vector x(colbasisdim, vec);
4719 for(
int i = 0; i < colbasisdim; ++i)
4788 for(
int i = 0; i < basisdim; ++i)
4793 vec[i] =
spxLdexp(vec[i], scaleExp);
4797 for(
int i = 0; i < basisdim; ++i)
4806 vec[i] =
spxLdexp(vec[i], scaleExp);
4820 Vector x(colbasisdim, vec);
4830 for(
int i = 0; i < colbasisdim; ++i)
4957 MSG_INFO1(
spxout,
spxout <<
"Caught exception <" << E.
what() <<
"> while computing rational basis inverse column.\n" );
4982 MSG_INFO1(
spxout,
spxout <<
"Caught exception <" << E.
what() <<
"> during right solve with rational basis inverse.\n" );
5050 std::stringstream s;
5055 <<
"Solution time : " << std::setw(10) << std::fixed << std::setprecision(2) <<
solveTime() << std::endl
5056 <<
"Iterations : " << std::setw(10) <<
numIterations() << std::endl;
5116 bool success =
false;
5118 success =
_readFileReal(filename, rowNames, colNames, intVars);
5143 origLP->
writeFile(filename, rowNames, colNames, intVars);
5144 origLP->~SPxLPReal();
5184 dualLP.
writeFile(filename, colNames, rowNames);
5197 assert(filename != 0);
5223 assert(filename != 0);
5239 const NameSet* colNamesPtr = colNames;
5243 std::stringstream name;
5246 tmpColNames =
new (tmpColNames)
NameSet();
5247 tmpColNames->
reMax(numCols);
5249 for(
int j = 0; j < numCols; ++j )
5252 tmpColNames->
add(name.str().c_str());
5255 colNamesPtr = tmpColNames;
5259 const NameSet* rowNamesPtr = rowNames;
5261 if( rowNamesPtr == 0 )
5263 std::stringstream name;
5266 tmpRowNames =
new (tmpRowNames)
NameSet();
5267 tmpRowNames->
reMax(numRows);
5269 for(
int i = 0; i < numRows; ++i )
5272 tmpRowNames->
add(name.str().c_str());
5275 rowNamesPtr = tmpRowNames;
5282 for(
int i = 0; i < numRows; i++ )
5285 for(
int i = 0; i < numCols; i++ )
5306 if( mps.
field0() != 0 && !strcmp(mps.
field0(),
"ENDATA") )
5318 if( *mps.
field1() ==
'X' )
5324 if( !strcmp(mps.
field1(),
"XU") )
5334 else if( !strcmp(mps.
field1(),
"XL") )
5344 else if( !strcmp(mps.
field1(),
"UL") )
5348 else if( !strcmp(mps.
field1(),
"LL") )
5387 assert(filename != 0);
5393 std::ofstream file(filename);
5397 file.setf(std::ios::left);
5398 file <<
"NAME " << filename <<
"\n";
5412 for(
int col = 0; col < numCols; col++ )
5419 for( ; row < numRows; row++ )
5426 assert(row != numRows);
5433 file << std::setw(8);
5434 if( colNames != 0 && colNames->
has(col) )
5435 file << (*colNames)[col];
5440 if( rowNames != 0 && rowNames->
has(row) )
5441 file << (*rowNames)[row];
5454 file << std::setw(8);
5455 if( colNames != 0 && colNames->
has(col) )
5456 file << (*colNames)[col];
5469 for( ; row < numRows; row++ )
5488 ofname = std::string(filename) +
".set";
5492 ofname = std::string(filename) + ((cpxFormat) ?
".lp" :
".mps");
5496 ofname = std::string(filename) +
".bas";
5509 ofname = std::string(filename) +
".set";
5513 ofname = std::string(filename) + ((cpxFormat) ?
".lp" :
".mps");
5517 ofname = std::string(filename) +
".bas";
5553 #ifdef SOPLEX_WITH_RATIONALPARAM 5555 Rational SoPlex::rationalParam(
const RationalParam param)
const 5558 assert(param < RATIONALPARAM_COUNT);
5580 if( !init && value ==
boolParam(param) )
5634 if( !init && value ==
intParam(param) )
5985 if( !init && value ==
realParam(param) )
5995 #ifndef SOPLEX_WITH_GMP 6008 #ifndef SOPLEX_WITH_GMP 6129 #ifdef SOPLEX_WITH_RATIONALPARAM 6131 bool SoPlex::setRationalParam(
const RationalParam param,
const Rational value,
const bool init)
6134 assert(param < RATIONALPARAM_COUNT);
6137 if( !init && value == rationalParam(param) )
6140 if( value < _currentSettings->rationalParam.lower[param] || value >
_currentSettings->rationalParam.upper[param] )
6162 bool success =
true;
6175 #ifdef SOPLEX_WITH_RATIONALPARAM 6176 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
6177 success &= setRationalParam((RationalParam)i,
_currentSettings->_rationalParamValues[i], init);
6197 #ifdef SOPLEX_WITH_RATIONALPARAM 6198 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
6199 success &= setRationalParam((RationalParam)i,
_currentSettings->rationalParam.defaultValue[i], init);
6207 bool printedValue =
false;
6215 printedValue =
true;
6224 printedValue =
true;
6233 printedValue =
true;
6236 #ifdef SOPLEX_WITH_RATIONALPARAM 6237 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
6243 printedValue =
true;
6250 printedValue =
true;
6262 assert(filename != 0);
6264 std::ofstream file(filename);
6268 file.setf(std::ios::left);
6270 #if SOPLEX_SUBVERSION > 0 6310 #ifdef SOPLEX_WITH_RATIONALPARAM 6311 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
6319 <<
"], default " <<
_currentSettings->rationalParam.defaultValue[i] <<
"\n";
6327 file <<
"# initial random seed used for perturbation\n";
6340 assert(filename != 0);
6359 bool readError =
false;
6360 bool parseError =
false;
6362 while( !readError && !parseError)
6365 readError = !file.getline(line,
sizeof(line));
6369 readError = readError && !file.eof();
6375 else if( readError )
6389 assert(
string != 0);
6397 char* line = parseString;
6400 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6402 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
6404 char* paramTypeString = line;
6407 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
':' )
6420 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6424 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: no ':' separating parameter type and name.\n" );
6431 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6433 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
6438 char* paramName = line;
6441 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
'=' )
6454 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6465 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6467 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
6472 char* paramValueString = line;
6475 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' )
6482 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6484 if( *line !=
'\0' && *line !=
'\n' && *line !=
'#' )
6486 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: additional character '" << *line <<
"' after parameter value.\n" );
6492 if( strncmp(paramTypeString,
"bool", 4) == 0 )
6494 for(
int param = 0; ; param++ )
6498 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: unknown parameter name <" << paramName <<
">.\n" );
6503 if( strncasecmp(paramValueString,
"true", 4) == 0
6504 || strncasecmp(paramValueString,
"TRUE", 4) == 0
6505 || strncasecmp(paramValueString,
"t", 4) == 0
6506 || strncasecmp(paramValueString,
"T", 4) == 0
6507 || strtol(paramValueString, NULL, 4) == 1 )
6512 else if( strncasecmp(paramValueString,
"false", 5) == 0
6513 || strncasecmp(paramValueString,
"FALSE", 5) == 0
6514 || strncasecmp(paramValueString,
"f", 5) == 0
6515 || strncasecmp(paramValueString,
"F", 5) == 0
6516 || strtol(paramValueString, NULL, 5) == 0 )
6523 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid value <" << paramValueString <<
"> for bool parameter <" << paramName <<
">.\n" );
6533 if( strncmp(paramTypeString,
"int", 3) == 0 )
6535 for(
int param = 0; ; param++ )
6539 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: unknown parameter name <" << paramName <<
">.\n" );
6550 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid value <" << paramValueString <<
"> for int parameter <" << paramName <<
">.\n" );
6560 if( strncmp(paramTypeString,
"real", 4) == 0 )
6562 for(
int param = 0; ; param++ )
6566 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: unknown parameter name <" << paramName <<
">.\n" );
6577 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid value <" << paramValueString <<
"> for real parameter <" << paramName <<
">.\n" );
6586 #ifdef SOPLEX_WITH_RATIONALPARAM 6588 if( strncmp(paramTypeString,
"rational", 8) == 0 )
6590 for(
int param = 0; ; param++ )
6592 if( param >= SoPlex::RATIONALPARAM_COUNT )
6594 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: unknown parameter name <" << paramName <<
">.\n" );
6601 if(
readStringRational(paramValueString, value) && setRationalParam((SoPlex::RationalParam)param, value) )
6605 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid value <" << paramValueString <<
"> for rational parameter <" << paramName <<
">.\n" );
6616 if( strncmp(paramTypeString,
"uint", 4) == 0 )
6618 if( strncmp(paramName,
"random_seed", 11) == 0 )
6622 if( sscanf(paramValueString,
"%u", &value) == 1 )
6633 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid parameter type <" << paramTypeString <<
"> for parameter <" << paramName <<
">.\n" );
6644 int prec = (int) os.precision();
6647 os << std::scientific << std::setprecision(8)
6648 <<
"Solution (real) : \n" 6653 os <<
"Solution (rational) : \n" 6655 os <<
"Size (base 2/10) : \n" 6665 os <<
"Solution : \n" 6666 <<
" Objective value : -\n";
6675 os <<
"Violation (rational): \n";
6679 os <<
" Max/sum bound : - / -\n";
6683 os <<
" Max/sum row : - / -\n";
6687 os <<
" Max/sum redcost : - / -\n";
6691 os <<
" Max/sum dual : - / -\n";
6698 os <<
"Violations (real) : \n";
6700 os <<
" Max/sum bound : " << maxviol <<
" / " << sumviol <<
"\n";
6702 os <<
" Max/sum bound : - / -\n";
6704 os <<
" Max/sum row : " << maxviol <<
" / " << sumviol <<
"\n";
6706 os <<
" Max/sum row : - / -\n";
6708 os <<
" Max/sum redcost : " << maxviol <<
" / " << sumviol <<
"\n";
6710 os <<
" Max/sum redcost : - / -\n";
6712 os <<
" Max/sum dual : " << maxviol <<
" / " << sumviol <<
"\n";
6714 os <<
" Max/sum dual : - / -\n";
6716 os << std::setprecision(prec);
6736 <<
"Objective value : " << std::scientific << std::setprecision(8) <<
objValueReal() << std::fixed <<
"\n";
6744 int prec = (int) os.precision();
6745 os << std::setprecision(2);
6749 os <<
"Original problem : \n";
6763 os << std::setprecision(prec);
6771 os <<
"SoPlex status : ";
6776 os <<
"error [unspecified]";
6779 os <<
"error [no ratiotester loaded]";
6782 os <<
"error [no pricer loaded]";
6785 os <<
"error [no linear solver loaded]";
6788 os <<
"error [not initialized]";
6791 os <<
"solving aborted [cycling]";
6794 os <<
"solving aborted [time limit reached]";
6797 os <<
"solving aborted [iteration limit reached]";
6800 os <<
"solving aborted [objective limit reached]";
6803 os <<
"no problem loaded";
6806 os <<
"basis is regular";
6809 os <<
"basis is singular";
6812 os <<
"problem is solved [optimal]";
6815 os <<
"problem is solved [unbounded]";
6818 os <<
"problem is solved [infeasible]";
6821 os <<
"problem is solved [infeasible or unbounded]";
6838 #if (SOPLEX_SUBVERSION > 0) 6857 #ifdef SOPLEX_WITH_GMP 6878 bool nRowsMatch =
true;
6879 bool nColsMatch =
true;
6880 bool rhsDimMatch =
true;
6881 bool lhsDimMatch =
true;
6882 bool maxObjDimMatch =
true;
6883 bool upperDimMatch =
true;
6884 bool lowerDimMatch =
true;
6889 MSG_INFO1(
spxout,
spxout <<
"The number of Rows in the Real LP does not match the one in the Rational LP." 6898 MSG_INFO1(
spxout,
spxout <<
"The number of Columns in the Real LP does not match the one in the Rational LP." 6907 MSG_INFO1(
spxout,
spxout <<
"The number of nonZeros in the Real LP does not match the one in the Rational LP." 6915 MSG_INFO1(
spxout,
spxout <<
"The dimension of the right hand side vector of the Real LP does not match the one of the Rational LP." 6918 rhsDimMatch =
false;
6925 MSG_INFO1(
spxout,
spxout <<
"The dimension of the left hand side vector of the Real LP does not match the one of the Rational LP." 6928 lhsDimMatch =
false;
6934 MSG_INFO1(
spxout,
spxout <<
"The dimension of the objective function vector of the Real LP does not match the one of the Rational LP." 6937 maxObjDimMatch =
false;
6943 MSG_INFO1(
spxout,
spxout <<
"The objective function sense of the Real LP does not match the one of the Rational LP." 6952 MSG_INFO1(
spxout,
spxout <<
"The dimension of the upper bound vector of the Real LP does not match the one of the Rational LP." 6955 upperDimMatch =
false;
6961 MSG_INFO1(
spxout,
spxout <<
"The dimension of the lower bound vector of the Real LP does not match the one of the Rational LP." 6964 lowerDimMatch =
false;
6970 bool rhsValMatch =
true;
6971 bool lhsValMatch =
true;
6972 bool maxObjValMatch =
true;
6973 bool upperValMatch =
true;
6974 bool lowerValMatch =
true;
6979 for(
int i = 0; i <
_realLP->
rhs().dim(); i++ )
6987 MSG_INFO1(
spxout,
spxout <<
"Entries number " << i <<
" of the right hand side vectors don't match." 6990 rhsValMatch =
false;
6995 if( !rhsValMatch && quiet )
6997 MSG_INFO1(
spxout,
spxout <<
"The values of the right hand side vectors don't match." << std::endl );
7004 for(
int i = 0; i <
_realLP->
lhs().dim(); i++ )
7012 MSG_INFO1(
spxout,
spxout <<
"Entries number " << i <<
" of the left hand side vectors don't match." 7015 lhsValMatch =
false;
7020 if( !lhsValMatch && quiet )
7022 MSG_INFO1(
spxout,
spxout <<
"The values of the left hand side vectors don't match." << std::endl );
7027 if( maxObjDimMatch )
7035 MSG_INFO1(
spxout,
spxout <<
"Entries number " << i <<
" of the objective function vectors don't match." 7038 maxObjValMatch =
false;
7043 if( !maxObjValMatch && quiet )
7045 MSG_INFO1(
spxout,
spxout <<
"The values of the objective function vectors don't match." << std::endl );
7063 upperValMatch =
false;
7068 if( !upperValMatch && quiet )
7088 lowerValMatch =
false;
7093 if( !lowerValMatch && quiet )
7101 if( checkMatVals && nRowsMatch && nColsMatch )
7103 bool matrixValMatch =
true;
7116 matrixValMatch =
false;
7122 if( !matrixValMatch && quiet )
7152 assert(newmax > vec.
size());
7163 assert(idxSize >= 0);
7165 assert(permSize >= 0);
7167 for(
int i = 0; i < permSize; i++ )
7170 for(
int i = 0; i < idxSize; i++ )
7172 assert(idx[i] >= 0);
7173 assert(idx[i] < permSize);
7184 assert(permSize >= 0);
7186 for(
int i = 0; i < permSize; i++ )
7187 perm[i] = (i < start || i > end) ? i : -1;
7228 return stoppedTime || stoppedIter;
7236 assert(lower <= upper);
7249 else if( lower == upper )
7261 assert(lower <= upper);
7274 else if( lower == upper )
7420 for(
int i = 0; i < lpcolset.
num(); i++ )
7821 else if( perm[i] >= 0 && perm[i] != i )
7824 assert(perm[perm[i]] < 0);
7885 else if( perm[i] >= 0 && perm[i] != i )
7888 assert(perm[perm[i]] < 0);
8140 bool success =
_realLP->
readFile(filename, rowNames, colNames, intVars);
8346 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8348 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
8350 char* paramTypeString = line;
8353 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
':' )
8366 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8370 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: no ':' separating parameter type and name in line " << lineNumber <<
".\n" );
8377 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8379 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
8381 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: no parameter name in line " << lineNumber <<
".\n");
8384 char* paramName = line;
8387 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
'=' )
8400 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8404 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: no '=' after parameter name in line " << lineNumber <<
".\n" );
8411 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8413 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
8415 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: no parameter value in line " << lineNumber <<
".\n");
8418 char* paramValueString = line;
8421 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' )
8428 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8430 if( *line !=
'\0' && *line !=
'\n' && *line !=
'#' )
8432 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: additional character '" << *line <<
"' after parameter value in line " << lineNumber <<
".\n" );
8438 if( strncmp(paramTypeString,
"bool", 4) == 0 )
8440 for(
int param = 0; ; param++ )
8444 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: unknown parameter name <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8449 if( strncasecmp(paramValueString,
"true", 4) == 0
8450 || strncasecmp(paramValueString,
"TRUE", 4) == 0
8451 || strncasecmp(paramValueString,
"t", 4) == 0
8452 || strncasecmp(paramValueString,
"T", 4) == 0
8453 || strtol(paramValueString, NULL, 4) == 1 )
8458 else if( strncasecmp(paramValueString,
"false", 5) == 0
8459 || strncasecmp(paramValueString,
"FALSE", 5) == 0
8460 || strncasecmp(paramValueString,
"f", 5) == 0
8461 || strncasecmp(paramValueString,
"F", 5) == 0
8462 || strtol(paramValueString, NULL, 5) == 0 )
8469 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid value <" << paramValueString <<
"> for bool parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8479 if( strncmp(paramTypeString,
"int", 3) == 0 )
8481 for(
int param = 0; ; param++ )
8485 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: unknown parameter name <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8496 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid value <" << paramValueString <<
"> for int parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8506 if( strncmp(paramTypeString,
"real", 4) == 0 )
8508 for(
int param = 0; ; param++ )
8512 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: unknown parameter name <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8523 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid value <" << paramValueString <<
"> for real parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8532 #ifdef SOPLEX_WITH_RATIONALPARAM 8534 if( strncmp(paramTypeString,
"rational", 8) == 0 )
8536 for(
int param = 0; ; param++ )
8538 if( param >= SoPlex::RATIONALPARAM_COUNT )
8540 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: unknown parameter name <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8547 if(
readStringRational(paramValueString, value) && setRationalParam((SoPlex::RationalParam)param, value) )
8551 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid value <" << paramValueString <<
"> for rational parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8562 if( strncmp(paramTypeString,
"uint", 4) == 0 )
8564 if( strncmp(paramName,
"random_seed", 11) == 0 )
8568 if( sscanf(paramValueString,
"%u", &value) == 1 )
8579 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid parameter type <" << paramTypeString <<
"> for parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
const VectorBase< R > & rhs() const
Returns right hand side vector.
void changeLhsRational(const VectorRational &lhs)
changes left-hand side vector for constraints to lhs
virtual void buildDualProblem(SPxLPBase< R > &dualLP, SPxRowId primalRowIds[]=0, SPxColId primalColIds[]=0, SPxRowId dualRowIds[]=0, SPxColId dualColIds[]=0, int *nprimalrows=0, int *nprimalcols=0, int *ndualrows=0, int *ndualcols=0)
Building the dual problem from a given LP.
const VectorRational & rhsRational() const
returns right-hand side vector
bool isNotZero(Real a, Real eps=Param::epsilon())
returns true iff |a| > eps
RangeType
type of bounds and sides
SPxLPBase< Real > SPxLPReal
const char * getRatiotesterName()
name of currently loaded ratiotester
textbook ratio test without stabilization
void getRowsRational(int start, int end, LPRowSetRational &lprowset) const
gets rows start, ..., end.
const VectorReal & maxObjRealInternal() const
returns objective function vector after transformation to a maximization problem; since this is how i...
void _computeBasisInverseRational()
computes rational inverse of basis matrix as defined by _rationalLUSolverBind
int getSolveCount() const
number of solves performed
bool multBasisTranspose(Real *vec, bool unscale=true)
multiply with transpose of basis matrix; vec * B^T (inplace)
void _changeUpperReal(const VectorReal &upper)
changes vector of upper bounds to upper and adjusts basis
bool getDual(VectorBase< R > &vector) const
gets the dual solution vector; returns true on success
void getRhsUnscaled(VectorBase< Real > &vec) const
Gets unscaled right hand side vector.
accuracy of conjugate gradient method in least squares scaling (higher value leads to more iterations...
Vector & multWithBase(Vector &x) const
Vector-basis product.
virtual void removeRow(int i)
Removes i 'th row.
int iterations() const
get number of iterations of current solution.
zero tolerance used in factorization
void getRow(int i, LPRowBase< R > &row) const
Gets i 'th row.
void getUpperReal(DVectorReal &upper) const
gets upper bound vector
Rational _rationalMaxscaleincr
free variable fixed to zero.
int totalSizeDual(const int base=2) const
returns total size of dual solution
#define DEFAULT_EPS_FACTOR
void printVersion() const
prints version and compilation options
SoPlex()
default constructor
bool getDualViolationRational(Rational &maxviol, Rational &sumviol)
gets violation of dual multipliers; returns true on success
bool GE(Real a, Real b, Real eps=Param::epsilon())
returns true iff a >= b + eps
void printSolutionStatistics(std::ostream &os)
prints solution statistics
refactor threshold for memory growth in factorization since last refactorization
DVectorBase< R > _dualFarkas
Timer * syncTime
time for synchronization between real and rational LP (included in solving time)
void setRep(Representation p_rep)
switch to ROW or COLUMN representation if not already used.
Basis is not known to be dual nor primal feasible.
No matrix has yet been loaded.
void coSolve(Vector &x, const Vector &rhs)
Cosolves linear system with basis matrix.
bool getDualNorms(int &nnormsRow, int &nnormsCol, Real *norms) const
gets steepest edge norms and returns false if they are not available
const VectorBase< R > & lower() const
void _addColReal(const LPColReal &lpcol)
adds a single column to the real LP and adjusts basis
int numRowsReal() const
returns number of rows
bool getBasisInverseRowReal(int r, Real *coef, int *inds=NULL, int *ninds=NULL, bool unscale=true)
computes row r of basis inverse; returns true on success
Rational minAbsNonzeroRational() const
returns smallest non-zero element in absolute value
static void setEpsilon(Real eps)
void removeRowsRational(int perm[])
removes all rows with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates the n...
type of starter used to create crash basis
void removeColsReal(int perm[])
removes all columns with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates th...
bool getDualNorms(int &nnormsRow, int &nnormsCol, Real *norms) const
get dual norms
The time limit has been hit.
const VectorBase< R > & upper() const
Returns upper bound vector.
void _optimizeReal()
solves real LP
const Settings & settings() const
returns current parameter settings
upper limit on objective value
void getNdualNorms(int &nnormsRow, int &nnormsCol) const
get number of dual norms
void _changeElementReal(int i, int j, const Real &val)
changes matrix entry in row i and column j to val and adjusts basis
virtual R minAbsNzo(bool unscaled=true) const
Absolute smallest non-zero element in (possibly scaled) LP.
THREADLOCAL const Real infinity
void getRows(int start, int end, LPRowSetBase< R > &set) const
Gets rows start, ... end.
mode for solution polishing
void setOutstream(SPxOut &newOutstream)
Real _realParamValues[SoPlex::REALPARAM_COUNT]
array of current real parameter values
void _changeRangeReal(const VectorReal &lhs, const VectorReal &rhs)
changes left- and right-hand side vectors and adjusts basis
const SPxRatioTester * ratiotester() const
return loaded SPxRatioTester.
void removeColReal(int i)
removes column i
maximum increase of scaling factors between refinements
virtual void getRowUnscaled(const SPxLPBase< Real > &lp, int i, DSVector &vec) const
returns unscaled row i
SPxMainSM _simplifierMainSM
Real maxAbsNonzeroReal() const
returns biggest non-zero element in absolute value
continue iterative refinement with exact basic solution if not optimal?
void setBasis(const VarStatus rows[], const VarStatus cols[])
set the lp solver's basis.
const SVectorReal & colVectorRealInternal(int i) const
returns vector of col i, ignoring scaling
void setMaxUpdates(int maxUp)
change maximum number of iterations until a refactorization is performed
void resetCounters()
reset timers and counters
number of real parameters
apply standard floating-point algorithm
type of computational form, i.e., column or row representation
int stallRefinements
number of refinement steps without pivots
int totalSizePrimal(const int base=2) const
returns total size of primal solution
void changeColRational(int i, const LPColRational &lpcol)
replaces column i with lpcol
bool getBasisIndRational(DataArray< int > &bind)
gets an array of indices for the columns of the rational basis matrix; bind[i] >= 0 means that the i-...
bool getPrimalReal(VectorReal &vector)
gets the primal solution vector if available; returns true on success
T * get_ptr()
get a C pointer to the data.
void reMax(int newmax=0)
resets max() to newmax.
int size() const
Number of used indices.
equilibrium scaling on rows or columns
pivot zero tolerance used in factorization
int numRowsRational() const
returns number of rows
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...
bool getDualRational(VectorRational &vector)
gets the dual solution vector if available; returns true on success
refinement limit (-1 if unlimited)
void setSolutionPolishing(SolutionPolish _polishObj)
set objective of solution polishing (0: off, 1: max_basic_slack, 2: min_basic_slack) ...
class of parameter settings
SPxLPRational * _rationalLP
void printShortStatistics(std::ostream &os)
prints short statistics
Status getBasis(VarStatus rows[], VarStatus cols[], const int rowsSize=-1, const int colsSize=-1) const
get current basis, and return solver status.
Real coefReal(int row, int col) const
returns (unscaled) coefficient
bool getSlacksRational(VectorRational &vector)
gets the vector of slack values if available; returns true on success
standard Harris ratio test
minimize number of basic slack variables, i.e. more variables in between bounds
bool multBasis(Real *vec, bool unscale=true)
multiply with basis matrix; B * vec (inplace)
void getColsRational(int start, int end, LPColSetRational &lpcolset) const
gets columns start, ..., end
bool getSlacks(VectorBase< R > &vector) const
gets the vector of slack values; returns true on success
int totalSizePrimalRational(const int base=2)
get size of primal solution
void _addColsReal(const LPColSetReal &lpcolset)
adds multiple columns to the real LP and adjusts basis
Basis is optimal, i.e. dual and primal feasible.
Real feastol() const
allowed primal feasibility tolerance.
unsigned int randomSeed() const
returns the current random seed of the solver instance
virtual void setBasisSolver(SLinSolver *slu, const bool destroy=false)
setup linear solver to use. If destroy is true, slusolver will be freed in destructor.
Real sumDualDegeneracy()
get the sum of dual degeneracy
time limit in seconds (INFTY if unlimited)
mode for iterative refinement strategy
void changeRangeReal(const VectorReal &lhs, const VectorReal &rhs)
changes left- and right-hand side vectors
virtual bool readFile(const char *filename, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
Reads LP from a file.
Rational _rationalFeastol
void writeStateReal(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const bool cpxFormat=false) const
writes internal LP, basis information, and parameter settings; if rowNames and colNames are NULL...
DVectorBase< R > _primalRay
bool isScaled() const
Returns true if and only if the LP is scaled.
void setUtype(UpdateType tp)
sets update type.
R rhsUnscaled(int i) const
Returns unscaled right hand side of row number i.
void _removeColsReal(int perm[])
removes all columns with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates th...
modified Harris ratio test
virtual void changeCol(int n, const LPColBase< R > &newCol, bool scale=false)
Replaces i 'th column of LP with newCol. scale determines whether the new data should be scaled...
virtual ~SoPlex()
destructor
virtual void removeCols(int perm[])
Removes multiple columns.
bool getRedCostRational(VectorRational &vector)
gets the vector of reduced cost values if available; returns true on success
bool LE(Real a, Real b, Real eps=Param::epsilon())
returns true iff a <= b + eps
DVectorBase< R > _redCost
crash basis from a greedy solution
Real getFactorTime() const
time spent in factorizations
primal feasibility tolerance
static struct soplex::SoPlex::Settings::RealParam realParam
void getObj(VectorBase< R > &pobj) const
Gets objective vector.
bool LT(Real a, Real b, Real eps=Param::epsilon())
returns true iff a < b + eps
void setType(Type tp)
set LEAVE or ENTER algorithm.
bound flipping ratio test for long steps in the dual simplex
void setFillFactor(Real f)
set refactor threshold for fill-in in current factor update compared to fill-in in last factorization...
bool writeBasisFile(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const bool cpxFormat=false) const
writes basis information to filename; if rowNames and colNames are NULL, default names are used; retu...
void _addRowReal(const LPRowReal &lprow)
adds a single row to the real LP and adjusts basis
bool defaultValue[SoPlex::BOOLPARAM_COUNT]
array of default values for boolean parameters
solve() aborted due to iteration limit.
R rhs() const
Right-hand side value.
std::string name[SoPlex::BOOLPARAM_COUNT]
array of names for boolean parameters
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...
void changeRangeRational(const VectorRational &lhs, const VectorRational &rhs)
changes left- and right-hand side vectors
mode for reading LP files
mode for synchronizing real and rational LP
void _syncLPReal(bool time=true)
synchronizes real LP with rational LP, i.e., copies (rounded) rational LP into real LP...
bool hasDualFarkas() const
is a dual farkas ray available?
void _optimizeRational()
solves rational LP
No Problem has been loaded.
bool getDualFarkasReal(VectorReal &vector)
gets the Farkas proof if available; returns true on success
void resetSettings(const bool quiet=false, const bool init=true)
resets default parameter settings
automatic sync of real and rational LP
void setValue(int i, R x)
Sets i 'th element to x.
void _recomputeRangeTypesRational()
recomputes range types from scratch using rational LP
iteration limit (-1 if unlimited)
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
void changeObjReal(const VectorReal &obj)
changes objective function vector to obj
void changeRowRational(int i, const LPRowRational &lprow)
replaces row i with lprow
void useBoundFlipsRow(bool bf)
bool getRowViolationReal(Real &maxviol, Real &sumviol)
gets violation of constraints; returns true on success
SPxFastRT _ratiotesterFast
should cycling solutions be accepted during iterative refinement?
void _disableSimplifierAndScaler()
disables simplifier and scaler
bool getRowViolationRational(Rational &maxviol, Rational &sumviol)
gets violation of constraints; returns true on success
static struct soplex::SoPlex::Settings::IntParam intParam
should the decomposition based dual simplex be used to solve the LP? Setting this to true forces the ...
void add(const LPColBase< R > &pcol)
Real lowerReal(int i) const
returns lower bound of column i
bool getBasisInverseRowRational(const int r, SSVectorRational &vec)
computes row r of basis inverse; performs rational factorization if not available; returns true on su...
Vector & multBaseWith(Vector &x) const
Basis-vector product.
void _removeRowReal(int i)
removes row i and adjusts basis
lower bound is finite, upper bound is infinite
bool _readFileReal(const char *filename, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
reads real LP in LP or MPS format from file and returns true on success; gets row names...
decide according to problem size
UnitVectorBase< Rational > UnitVectorRational
bool getRedCost(VectorBase< R > &vector) const
gets the vector of reduced cost values if available; returns true on success
Timer * simplexTime
simplex time
void addColsRational(const LPColSetRational &lpcolset)
adds multiple columns
int luSolvesReal
number of (forward and backward) solves with basis matrix in real precision
Real upperReal(int i) const
returns upper bound of column i
void getColRational(int i, LPColRational &lpcol) const
gets column i
int refinements
number of refinement steps
const char * getStarterName()
name of starter
void clear()
remove all elements.
variable fixed to identical bounds.
int luFactorizationsReal
number of basis matrix factorizations in real precision
Real getFastCondition(int type=0)
int getFactorCount() const
number of factorizations performed
#define DEFAULT_EPS_UPDATE
virtual void removeCol(int i)
Removes i 'th column.
LP has been proven to be primal infeasible.
R & value(int n)
Reference to value of n 'th nonzero.
void setComputeDegenFlag(bool computeDegen)
sets whether the degeneracy is computed at each iteration
Real defaultValue[SoPlex::REALPARAM_COUNT]
array of default values for real parameters
void _checkBasisScaling()
check correctness of (un)scaled basis matrix operations
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
void setSparsePricingFactor(Real fac)
int intParam(const IntParam param) const
returns integer parameter value
void setOpttol(Real d)
set parameter opttol.
void _ensureRationalLP()
ensures that the rational LP is available; performs no sync
minimum number of stalling refinements since last pivot to trigger rational factorization ...
minimal reduction (sum of removed rows/cols) to continue simplification
void getRowVectorReal(int i, DSVectorReal &row) const
gets vector of row i
Wrapper for GMP type mpq_class.We wrap mpq_class so that we can replace it by a double type if GMP is...
bool setSettings(const Settings &newSettings, const bool init=true)
sets parameter settings; returns true on success
void _changeRhsReal(const VectorReal &rhs)
changes right-hand side vector to rhs and adjusts basis
void changeElementReal(int i, int j, const Real &val)
changes matrix entry in row i and column j to val
void printStatistics(std::ostream &os)
prints complete statistics
std::string name[SoPlex::REALPARAM_COUNT]
array of names for real parameters
Real rhsReal(int i) const
returns right-hand side of row i
std::ostream & getStream(const Verbosity &verbosity) const
Returns the stream for the specified verbosity level.
should a rational factorization be performed after iterative refinement?
const SPxPricer * pricer() const
return loaded SPxPricer.
virtual bool readBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames)
mode for hyper sparse pricing
void getRhsReal(DVectorReal &rhs) const
gets right-hand side vector
void add(const LPRowBase< R > &row)
bool setDualNorms(int nnormsRow, int nnormsCol, Real *norms)
set dual norms
maximum number of updates without fresh factorization
int dlcmSizeDual(const int base=2) const
returns size of least common multiple of denominators in dual solution
void removeColRangeRational(int start, int end, int perm[]=0)
removes columns start to end including both; an array perm of size numColsRational() may be passed as...
virtual void setTerminationTime(Real time=infinity)
set time limit.
void changeUpperRational(const VectorRational &upper)
changes vector of upper bounds to upper
bool _boolParamValues[SoPlex::BOOLPARAM_COUNT]
array of current boolean parameter values
Rational _rationalPosInfty
number of integer parameters
bool getPrimal(VectorBase< R > &vector) const
gets the primal solution vector; returns true on success
virtual void changeObjOffset(const R &o)
bool setDualNorms(int nnormsRow, int nnormsCol, Real *norms)
sets steepest edge norms and returns false if that's not possible
static struct soplex::SoPlex::Settings::BoolParam boolParam
const VectorRational & lhsRational() const
returns left-hand side vector
virtual void removeRows(int perm[])
Removes multiple rows.
bool writeFileRational(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *intvars=0) const
writes rational LP to file; LP or MPS format is chosen from the extension in filename; if rowNames an...
void removeLast(int m=1)
remove m last elements.
maximize number of basic slack variables, i.e. more variables on bounds
SPxEquiliSC _scalerBiequi
int numNonzerosRational() const
returns number of nonzeros
steepest edge pricer with exact initialization of norms
void getObjUnscaled(VectorBase< Real > &pobj) const
Gets unscaled objective vector.
virtual const std::string what() const
returns exception message
bool isDualFeasible() const
is stored dual solution feasible?
void removeColRangeReal(int start, int end, int perm[]=0)
removes columns start to end including both; an array perm of size numColsReal() may be passed as buf...
void addColReal(const LPCol &lpcol)
adds a single column
int nRows() const
Returns number of rows in LP.
Rational objRational(int i) const
returns objective value of column i
void add(const SVectorBase< S > &vec)
Append nonzeros of sv.
void clearLPRational()
clears the LP
R lower() const
Gets lower bound.
void addRowsRational(const LPRowSetRational &lprowset)
adds multiple rows
void printOriginalProblemStatistics(std::ostream &os)
stores the problem statistics of the original problem
SPxSolver::Status optimize()
optimize the given LP
void getObjReal(VectorReal &obj) const
gets objective function vector
void getLowerReal(DVectorReal &lower) const
gets lower bound vector
virtual void start()=0
start timer, resume accounting user, system and real time.
#define HYPERPRICINGTHRESHOLD
void addRowRational(const LPRowRational &lprow)
adds a single row
void addColRational(const LPColRational &lpcol)
adds a single column
virtual Real stop()=0
stop timer, return accounted user time.
int dualDegeneratePivots()
get number of dual degenerate pivots
void spx_alloc(T &p, int n=1)
Allocate memory.
const UnitVectorRational * _unitVectorRational(const int i)
returns pointer to a constant unit vector available until destruction of the SoPlex class ...
void _rangeToPerm(int start, int end, int *perm, int permSize) const
creates a permutation for removing rows/columns from a range of indices
void _syncRealSolution()
synchronizes rational solution with real solution, i.e., copies (rounded) rational solution to real s...
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
void removeColsRational(int perm[])
removes all columns with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates th...
LP is primal infeasible or unbounded.
R objUnscaled(int i) const
Returns unscaled objective value of column i.
refactor threshold for fill-in in current factor update compared to fill-in in last factorization ...
int nNzos() const
Returns number of nonzeros in LP.
void changeRhsRational(const VectorRational &rhs)
changes right-hand side vector to rhs
virtual void setOutstream(SPxOut &newOutstream)
set message handler
standard floating-point parsing
int dmaxSizeDualRational(const int base=2)
get size of largest denominator in dual solution
void _ensureDSVectorRationalMemory(DSVectorRational &vec, const int newmax) const
extends sparse vector to hold newmax entries if and only if it holds no more free entries ...
Real luFactorizationTimeReal
time for factorizing bases matrices in real precision
void getLowerUnscaled(DVector &vec) const
Gets unscaled lower bound vector.
Real spxLdexp(Real x, int exp)
returns x * 2^exp
int dlcmSizePrimalRational(const int base=2)
get size of least common multiple of denominators in primal solution
Rational objValueRational()
returns the objective value if a primal solution is available
void getBasis(SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[]) const
gets current basis via arrays of statuses
void setNonzeroFactor(Real f)
set refactor threshold for nonzeros in last factorized basis matrix compared to updated basis matrix ...
DataArray< SPxSolver::VarStatus > _basisStatusCols
nothing known about basis status (possibly due to a singular basis in transformed problem) ...
decide depending on tolerances whether to apply iterative refinement
virtual void writeFile(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *p_intvars=0) const
Write loaded LP to filename.
void getLhsReal(DVectorReal &lhs) const
gets left-hand side vector
SPxStatus status() const
returns current SPxStatus.
Real upper[SoPlex::REALPARAM_COUNT]
array of upper bounds for real parameter values
decompStatus _currentProb
declaration of types for file output
bool isPrimalFeasible() const
is stored primal solution feasible?
DataArray< RangeType > _colTypes
automatic choice according to number of rows and columns
void maxObjUnscaled(VectorBase< Real > &vec) const
Returns unscaled objective vector for maximization problem.
void removeRowRangeReal(int start, int end, int perm[]=0)
removes rows start to end including both; an array perm of size numRowsReal() may be passed as buffer...
SPxBoundFlippingRT _ratiotesterBoundFlipping
SLUFactorRational _rationalLUSolver
geometric mean scaling on rows and columns, max 8 rounds
bool isColBasic(int i) const
is the i 'th column vector basic ?
void getRowRational(int i, LPRowRational &lprow) const
gets row i
void _solveRealLPAndRecordStatistics()
call floating-point solver and update statistics on iterations etc.
number of boolean parameters
SPxEquiliSC _scalerUniequi
Status status() const
Status of solution process.
Real sumPrimalDegeneracy()
get the sum of primal degeneracy
void printSolvingStatistics(std::ostream &os)
prints statistics on solving process
bool _readFileRational(const char *filename, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
reads rational LP in LP or MPS format from file and returns true on success; gets row names...
lower threshold in lifting (nonzero matrix coefficients with smaller absolute value will be reformula...
bool getPrimalRayReal(VectorReal &vector)
gets the primal ray if available; returns true on success
void getColVectorUnscaled(int i, DSVectorBase< Real > &vec) const
Gets column vector of column i.
bool hasPrimal() const
is a primal feasible solution available?
bool GT(Real a, Real b, Real eps=Param::epsilon())
returns true iff a > b + eps
SPxSense spxSense() const
Returns the optimization sense.
static void setEpsilonPivot(Real eps)
void changeLhsReal(const VectorReal &lhs)
changes left-hand side vector for constraints to lhs
DVectorBase< Real > DVectorReal
greedy crash basis weighted by objective, bounds, and sides
bool hasDualFarkas() const
is Farkas proof of infeasibility available?
virtual const char * getName() const
get name of simplifier.
std::string description[SoPlex::INTPARAM_COUNT]
array of descriptions for integer parameters
bool _isConsistent() const
checks consistency
void _changeLowerReal(const VectorReal &lower)
changes vector of lower bounds to lower and adjusts basis
R upperUnscaled(int i) const
Returns unscaled upper bound of column i.
R lhs() const
Left-hand side value.
the iteration frequency at which the decomposition solve output is displayed.
dual simplex algorithm, i.e., leaving for column and entering for row representation ...
steepest edge pricer with initialization to unit norms
LP has been solved to optimality.
Rational maxAbsNonzeroRational() const
returns biggest non-zero element in absolute value
VectorBase< Real > Vector
virtual void setPricer(SPxPricer *pricer, const bool destroy=false)
setup pricer to use. If destroy is true, pricer will be freed in destructor.
bool computeBasisInverseRational()
compute rational basis inverse; returns true on success
bool _upperFinite(const RangeType &rangeType) const
checks whether RangeType corresponds to finite upper bound
use bound flipping also for row representation?
bool hasBasis() const
is an advanced starting basis available?
void _invalidateSolution()
invalidates solution
bool getBasisInverseColReal(int c, Real *coef, int *inds=NULL, int *ninds=NULL, bool unscale=true)
computes column c of basis inverse; returns true on success
bool getDualViolationReal(Real &maxviol, Real &sumviol)
gets violation of dual multipliers; returns true on success
bool getBasisInverseColRational(const int c, SSVectorRational &vec)
computes column c of basis inverse; performs rational factorization if not available; returns true on...
Real sumPrimalDegen
the sum of the rate of primal degeneracy at each iteration
void append(const T &t)
append element t.
const char * getSimplifierName()
name of simplifier
void changeLowerReal(const VectorReal &lower)
changes vector of lower bounds to lower
DVectorBase< Rational > DVectorRational
virtual void addRows(const LPRowSetBase< R > &pset, bool scale=false)
const char * getPricerName()
name of currently loaded pricer
Class for collecting statistical information.
bool isSPxColId() const
is id a column id?
print condition number during the solve
void setDisplayFreq(int freq)
set display frequency
solve() aborted due to time limit.
round scaling factors for iterative refinement to powers of two?
const T * get_const_ptr() const
get a const C pointer to the data.
maximize number of basic slack variables, i.e. more variables on bounds
SPxBasis::SPxStatus basisStatus() const
returns the current basis status
virtual void setMinReduction(const Real minRed)
set minimal reduction threshold to continue simplification
void removeRowReal(int i)
removes row i
Forrest-Tomlin type update.
#define DEFAULT_EPS_ZERO
default allowed additive zero: 1.0 + EPS_ZERO == 1.0
bool getBasisInverseTimesVecReal(Real *rhs, Real *sol, bool unscale=true)
computes dense solution of basis matrix B * sol = rhs; returns true on success
int dlcmSizeDualRational(const int base=2)
get size of least common multiple of denominators in dual solution
virtual void changeLower(const VectorBase< R > &newLower, bool scale=false)
Changes vector of lower bounds to newLower. scale determines whether the new data should be scaled...
virtual void setVerbosity(const Verbosity &v)
LPRowBase< R >::Type rowType(int i) const
Returns the inequality type of the i'th LPRow.
SPxWeightST _starterWeight
Statistics * _statistics
statistics since last call to solveReal() or solveRational()
#define DEFAULT_EPS_PIVOT
virtual void changeRhs(const VectorBase< R > &newRhs, bool scale=false)
Changes right hand side vector for constraints to newRhs. scale determines whether the new data shoul...
bool isPrimalFeasible() const
is the stored solution primal feasible?
R obj(int i) const
Returns objective value of column i.
void getColVectorReal(int i, DSVectorReal &col) const
gets vector of col i
void solveRight(VectorRational &x, const VectorRational &b)
Solves .
const VectorBase< R > & lhs() const
Returns left hand side vector.
void _removeRowsReal(int perm[])
removes all rows with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates the n...
void _syncLPRational(bool time=true)
synchronizes rational LP with real LP, i.e., copies real LP to rational LP, without looking at the sy...
void printUserSettings()
print non-default parameter values
void changeBoundsReal(const VectorReal &lower, const VectorReal &upper)
changes vectors of column bounds to lower and upper
RangeType _rangeTypeRational(const Rational &lower, const Rational &upper) const
determines RangeType from rational bounds
SPxSteepPR _pricerQuickSteep
virtual int getColScaleExp(int i) const
returns scaling factor for column i
Real getEstimatedCondition()
int numColsRational() const
returns number of columns
void syncLPReal()
synchronizes real LP with rational LP, i.e., copies (rounded) rational LP into real LP...
SPxDantzigPR _pricerDantzig
SPxParMultPR _pricerParMult
bool getPrimalRational(VectorRational &vector)
gets the primal solution vector if available; returns true on success
void changeObjRational(const VectorRational &obj)
changes objective function vector to obj
std::string statisticString() const
statistical information in form of a string
RangeType _switchRangeType(const RangeType &rangeType) const
switches RANGETYPE_LOWER to RANGETYPE_UPPER and vice versa
variable set to its upper bound.
int primalDegeneratePivots()
get number of primal degenerate pivots
Dynamic index set.Class DIdxSet provides dynamic IdxSet in the sense, that no restrictions are posed ...
void clearBasis()
clears starting basis
const SVectorReal & rowVectorRealInternal(int i) const
returns vector of row i, ignoring scaling
void syncLPRational()
synchronizes rational LP with real LP, i.e., copies real LP to rational LP, if sync mode is manual ...
virtual void setRealParam(Real param, const char *name="realparam")
set real parameter
bool getRedCostReal(VectorReal &vector)
gets the vector of reduced cost values if available; returns true on success
virtual void changeBounds(const VectorBase< R > &newLower, const VectorBase< R > &newUpper, bool scale=false)
Changes variable bounds to newLower and newUpper. scale determines whether the new data should be sca...
void add(const char *str)
int polishIterations()
return number of iterations done with primal algorithm
void getCol(int i, LPColBase< R > &col) const
Gets i 'th column.
Real realParam(const RealParam param) const
returns real parameter value
virtual Real time() const =0
user sync of real and rational LP
SPxSteepExPR _pricerSteep
int boundFlips() const
get number of bound flips.
int degenPivotsDual
number of dual degenerate pivots
bool hasDual() const
is a dual feasible solution available?
void useFullPerturbation(bool full)
perturb entire problem or only the bounds relevant to the current pivot
bool parseSettingsString(char *line)
parses one setting string and returns true on success; note that string is modified ...
const VectorReal & upperRealInternal() const
returns upper bound vector
SPxLPBase< Rational > SPxLPRational
void changeBoundsRational(const VectorRational &lower, const VectorRational &upper)
changes vectors of column bounds to lower and upper
const SVectorRational & colVectorRational(int i) const
returns vector of column i
R lhsUnscaled(int i) const
Returns unscaled left hand side of row number i.
int index(int n) const
Returns index of the n 'th nonzero element.
int numIterations() const
number of iterations since last call to solve
SPxDefaultRT _ratiotesterTextbook
bool getPrimalRay(VectorBase< R > &vector) const
gets the primal unbounded ray if available; returns true on success
(In)equality for LPs.Class LPRowBase provides constraints for linear programs in the form where a is...
int dmaxSizeDual(const int base=2) const
returns size of largest denominator in dual solution
virtual void loadLP(const SPxLP &LP, bool initSlackBasis=true)
copy LP.
variable set to its lower bound.
Settings * _currentSettings
bool getBasisInverseTimesVecRational(const SVectorRational &rhs, SSVectorRational &sol)
computes solution of basis matrix B * sol = rhs; performs rational factorization if not available; re...
virtual const char * getName() const
get name of ratio tester.
Real lhsReal(int i) const
returns left-hand side of row i
LPRowReal::Type rowTypeReal(int i) const
returns inequality type of row i
Preconfigured SoPlex LP solver.
Sparse vector .A UnitVectorBase is an SVectorBase that can take only one nonzero value with value 1 b...
void _syncRationalSolution()
synchronizes real solution with rational solution, i.e., copies real solution to rational solution ...
int _intParamValues[SoPlex::INTPARAM_COUNT]
array of current integer parameter values
virtual void changeRow(int n, const LPRowBase< R > &newRow, bool scale=false)
Replaces i 'th row of LP with newRow. scale determines whether the new data should be scaled...
virtual void changeUpper(const VectorBase< R > &newUpper, bool scale=false)
Changes vector of upper bounds to newUpper. scale determines whether the new data should be scaled...
void reDim(int newdim)
Resets dimension to newdim.
virtual const char * getName() const
get name of scaler
bool areLPsInSync(const bool checkVecVals=true, const bool checkMatVals=false, const bool quiet=false) const
checks if real LP and rational LP are in sync; dimensions will always be compared, vector and matrix values only if the respective parameter is set to true. If quiet is set to true the function will only display which vectors are different.
Set of strings.Class NameSet implements a symbol or name table. It allows to store or remove names (i...
partial multiple pricer based on Dantzig pricing
lower and upper bound finite, but different
bool isDualFeasible() const
is a dual solution available?
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
virtual bool writeBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames, const bool cpxFormat=false) const
equilibrium scaling on rows and columns
Real luSolveTimeReal
time for solving linear systems in real precision
virtual void changeObj(const VectorBase< R > &newObj, bool scale=false)
Changes objective vector to newObj. scale determines whether the new data should be scaled...
R * get_ptr()
Only used in slufactor.cpp.
minimize number of basic slack variables, i.e. more variables between bounds
Rational _rationalNegInfty
const SVectorRational & rowVectorRational(int i) const
returns vector of row i
int dlcmSizePrimal(const int base=2) const
returns size of least common multiple of denominators in primal solution
void printStatus(std::ostream &os, SPxSolver::Status status)
prints status
virtual void setTerminationIter(int iteration=-1)
set iteration limit.
threshold on number of rows vs. number of columns for switching from column to row representations in...
lower bound equals upper bound
virtual void addCol(const LPColBase< R > &col, bool scale=false)
std::string description[SoPlex::REALPARAM_COUNT]
array of descriptions for real parameters
column representation Ax - s = 0, lower <= x <= upper, lhs <= s <= rhs
bool getSlacksReal(VectorReal &vector)
gets the vector of slack values if available; returns true on success
#define DEFAULT_RANDOM_SEED
int dim() const
Dimension of vector.
Exception base class.This class implements a base class for our SoPlex exceptions We provide a what()...
int size() const
Returns the number of nonzeros.
Everything should be within this namespace.
bool setRealParam(const RealParam param, const Real value, const bool init=true)
sets real parameter value; returns true on success
void _changeLhsReal(const VectorReal &lhs)
changes left-hand side vector for constraints to lhs and adjusts basis
working tolerance for feasibility in floating-point solver during iterative refinement ...
int max() const
Maximal number of indices.
bool _lowerFinite(const RangeType &rangeType) const
checks whether RangeType corresponds to finite lower bound
returns the current git hash of SoPlex
void getCols(int start, int end, LPColSetBase< R > &set) const
Gets columns start, ..., end.
the maximum number of rows that are added in each iteration of the decomposition based simplex ...
bool loadSettingsFile(const char *filename)
reads settings file; returns true on success
virtual void changeRange(const VectorBase< R > &newLhs, const VectorBase< R > &newRhs, bool scale=false)
Changes left and right hand side vectors. scale determines whether the new data should be scaled...
int numNonzerosReal() const
returns number of nonzeros
SoPlex & operator=(const SoPlex &rhs)
assignment operator
bool getRedCostViolationRational(Rational &maxviol, Rational &sumviol)
gets violation of reduced costs; returns true on success
void clear()
Remove all indices.
virtual void setTester(SPxRatioTester *tester, const bool destroy=false)
setup ratio-tester to use. If destroy is true, tester will be freed in destructor.
Real objReal(int i) const
returns objective value of column i
DataArray< RangeType > _rowTypes
void _removeColReal(int i)
removes column i
void _changeRowReal(int i, const LPRowReal &lprow)
replaces row i with lprow and adjusts basis
void setIntegralityInformation(int ncols, int *intInfo)
pass integrality information about the variables to the solver
bool readStringRational(const char *s, Rational &value)
read Rational from string
void getBasisInd(int *bind) const
gets the indices of the basic columns and rows; basic column n gives value n, basic row m gives value...
row representation (lower,lhs) <= (x,Ax) <= (upper,rhs)
apply rational reconstruction after each iterative refinement?
void _changeColReal(int i, const LPColReal &lpcol)
replaces column i with lpcol and adjusts basis
solve() aborted due to detection of cycling.
Real minAbsNonzeroReal() const
returns smallest non-zero element in absolute value
Saving LPs in a form suitable for SoPlex.Class SPxLPBase provides the data structures required for sa...
const VectorReal & lowerRealInternal() const
returns lower bound vector
bool getDualReal(VectorReal &vector)
gets the dual solution vector if available; returns true on success
SPxHarrisRT _ratiotesterHarris
DSVectorBase< Real > DSVectorReal
void changeColReal(int i, const LPColReal &lpcol)
replaces column i with lpcol
working tolerance for optimality in floating-point solver during iterative refinement ...
void clearLPReal()
clears the LP
Preconfigured SoPlex LP-solver.
should the dual of the complementary problem be used in the decomposition simplex?
void removeRowRational(int i)
removes row i
R lowerUnscaled(int i) const
Returns unscaled lower bound of column i.
#define MSG_WARNING(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::WARNING.
Type
(In)Equality type of an LP row.
int iterations
number of iterations/pivots
const VectorBase< R > & maxObj() const
Returns objective vector for maximization problem.
virtual const char * getName() const
get name of pricer.
R upper() const
Gets upper bound.
int upper[SoPlex::INTPARAM_COUNT]
array of upper bounds for int parameter values
Real lower[SoPlex::REALPARAM_COUNT]
array of lower bounds for real parameter values
SPxVectorST _starterVector
void setIntegralityInformation(int ncols, int *intInfo)
pass integrality information about the variables to the solver
void setup()
Initializes nonzero indices for elements with absolute values above epsilon and sets all other elemen...
#define SET_MAX_LINE_LEN
maximum length of lines in settings file
static void setEpsilonUpdate(Real eps)
bool getBoundViolationReal(Real &maxviol, Real &sumviol)
gets violation of bounds; returns true on success
bool writeFileReal(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *intvars=0, const bool unscale=true) const
writes real LP to file; LP or MPS format is chosen from the extension in filename; if rowNames and co...
const VectorRational & upperRational() const
returns upper bound vector
void setConditionInformation(int condInfo)
print condition number within the usual output
int boundflips
number of dual bound flips
decide according to READMODE
void clearAllData()
clears all statistics
const char * getGitHash()
mode for a posteriori feasibility checks
refactor threshold for nonzeros in last factorized basis matrix compared to updated basis matrix ...
nothing known on loaded problem.
don't perform modifications on optimal basis
VarStatus getBasisRowStatus(int row) const
gets basis status for a single row
LPRowRational::Type rowTypeRational(int i) const
returns inequality type of row i
type of algorithm, i.e., primal or dual
const SVectorBase< R > & rowVector(int i) const
Gets row vector of row i.
VarStatus getBasisColStatus(int col) const
gets basis status for a single column
void print(std::ostream &os)
prints statistics
void clearSolvingData()
clears statistics on solving process
void _recomputeRangeTypesReal()
recomputes range types from scratch using real LP
virtual void addRow(const LPRowBase< R > &row, bool scale=false)
std::string name[SoPlex::INTPARAM_COUNT]
array of names for integer parameters
#define DEFAULT_REFACTOR_INTERVAL
default setting for LU refactorization interval
DataArray< UnitVectorRational *> _unitMatrixRational
bool getDualFarkasRational(VectorRational &vector)
gets the Farkas proof if LP is infeasible; returns true on success
stalling refinement limit (-1 if unlimited)
int lower[SoPlex::INTPARAM_COUNT]
array of lower bounds for int parameter values
DataArray< SPxSolver::VarStatus > _basisStatusRows
std::ifstream spxifstream
Set of LP rows.Class LPRowSetBase implements a set of LPRowBase%s. Unless for memory limitations...
Timer * readingTime
reading time not included in solving time
int iterationsFromBasis
number of iterations from Basis
int iterationsPolish
number of iterations during solution polishing
SPxSolver::VarStatus basisColStatus(int col) const
returns basis status for a single column
void _solveDecompositionDualSimplex()
solves LP using the decomposition based dual simplex
void getNdualNorms(int &nnormsRow, int &nnormsCol) const
gets number of available dual norms
should dual infeasibility be tested in order to try to return a dual solution even if primal infeasib...
int defaultValue[SoPlex::INTPARAM_COUNT]
array of default values for integer parameters
virtual void changeSense(SPxSense sns)
Changes optimization sense to sns.
bool getFastCondition(Real &condition, int type=0)
compute condition number estimate based on the diagonal of the LU factorization; returns true on succ...
void getUpperUnscaled(DVector &vec) const
Gets unscaled upper bound vector.
uint32_t getSeed() const
returns the initial seed shift
Timer * solvingTime
solving time
int size() const
return nr. of elements.
generic solution-based crash basis
std::string description[SoPlex::BOOLPARAM_COUNT]
array of descriptions for boolean parameters
Type type() const
return current Type.
const VectorReal & rhsRealInternal() const
returns right-hand side vector, ignoring scaling
bool boolParam(const BoolParam param) const
returns boolean parameter value
void setSeed(uint32_t initshift)
initialize all seeds of the random number generator.
void unscaleLP()
unscales the lp and clears basis
virtual const char * getName() const
get name of starter.
the verbosity of the decomposition based simplex
const VectorBase< R > & upper() const
Real getSolveTime() const
time spent in solves
should lifting be used to reduce range of nonzero matrix coefficients?
void printProblemStatistics(std::ostream &os)
int dmaxSizePrimalRational(const int base=2)
get size of largest denominator in primal solution
bool getEstimatedCondition(Real &condition)
computes an estimated condition number for the current basis matrix using the power method; returns t...
int dmaxSizePrimal(const int base=2) const
returns size of largest denominator in primal solution
Real maxObjReal(int i) const
returns objective value of column i after transformation to a maximization problem; since this is how...
void setRandomSeed(unsigned int seed)
set the random seeds of the solver instance
DataArray< int > _rationalLUSolverBind
should the degeneracy be computed for each basis?
#define MSG_INFO1(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO1.
bool getExactCondition(Real &condition)
computes the exact condition number for the current basis matrix using the power method; returns true...
virtual int getRowScaleExp(int i) const
returns scaling factor for row i
const char * getScalerName()
name of scaling method
Real solveTime() const
time spent in last call to solve
void addColsReal(const LPColSetReal &lpcolset)
adds multiple columns
const SVectorBase< R > & colVector(int i) const
Returns column vector of column i.
Random random
The random number generator used throughout the whole computation. Its seed can be modified...
int nCols() const
Returns number of columns in LP.
virtual void changeElement(int i, int j, const R &val, bool scale=false)
Changes LP element (i, j) to val. scale determines whether the new data should be scaled...
SPxSolver::Status status() const
returns the current solver status
zero tolerance used in update of the factorization
int iterationsPrimal
number of iterations with Primal
void changeLowerRational(const VectorRational &lower)
changes vector of lower bounds to lower
lower limit on objective value
bool getRedCostViolationReal(Real &maxviol, Real &sumviol)
gets violation of reduced costs; returns true on success
BoolParam
boolean parameters
bool _isSolveStopped(bool &stoppedTime, bool &stoppedIter) const
should solving process be stopped?
virtual void changeLhs(const VectorBase< R > &newLhs, bool scale=false)
Changes left hand side vector for constraints to newLhs. scale determines whether the new data should...
virtual Real getCoefUnscaled(const SPxLPBase< Real > &lp, int row, int col) const
returns unscaled coefficient of lp
void _changeBoundsReal(const VectorReal &lower, const VectorReal &upper)
changes vectors of column bounds to lower and upper and adjusts basis
#define SOPLEX_SUBVERSION
Settings()
default constructor initializing default settings
maximum number of conjugate gradient iterations in least square scaling
sparse pricing threshold (#violations < dimension * SPARSITY_THRESHOLD activates sparse pricing) ...
Settings & operator=(const Settings &settings)
assignment operator
void setFeastol(Real d)
set parameter feastol.
bool getDualFarkas(VectorBase< R > &vector) const
gets the Farkas proof if available; returns true on success
void addRowReal(const LPRowReal &lprow)
adds a single row
static void setEpsilonFactorization(Real eps)
bool getPrimalRayRational(VectorRational &vector)
gets the primal ray if LP is unbounded; returns true on success
dual feasibility tolerance
void _ensureRealLPLoaded()
ensures that the real LP and the basis are loaded in the solver; performs no sync ...
void invalidate()
invalidate solution
void changeRowReal(int i, const LPRowReal &lprow)
replaces row i with lprow
void setBasis(const SPxSolver::VarStatus rows[], const SPxSolver::VarStatus cols[])
sets starting basis via arrays of statuses
bool hasPrimalRay() const
is a primal unbounded ray available?
bool setIntParam(const IntParam param, const int value, const bool init=true)
sets integer parameter value; returns true on success
void solve(Vector &x, const Vector &rhs)
void getLhsUnscaled(VectorBase< Real > &vec) const
Returns unscaled left hand side vector.
bool saveSettingsFile(const char *filename, const bool onlyChanged=false) const
writes settings file; returns true on success
UnitVectorBase< Real > UnitVectorReal
std::string rationalToString(const Rational &r, const int precision)
convert rational number to string
Real objValueReal()
returns the objective value if a primal solution is available
bool _parseSettingsLine(char *line, const int lineNumber)
parses one line in a settings file and returns true on success; note that the string is modified ...
void changeRhsReal(const VectorReal &rhs)
changes right-hand side vector to rhs
SPxLeastSqSC _scalerLeastsq
geometric frequency at which to apply rational reconstruction
Real opttol() const
allowed optimality, i.e., dual feasibility tolerance.
void changeElementRational(int i, int j, const Rational &val)
changes matrix entry in row i and column j to val
bool isRowBasic(int i) const
is the i 'th row vector basic ?
void hyperPricing(bool h)
enable or disable hyper sparse pricing
void writeStateRational(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const bool cpxFormat=false) const
writes internal LP, basis information, and parameter settings; if rowNames and colNames are NULL...
void _enableSimplifierAndScaler()
enables simplifier and scaler according to current parameters
primal simplex algorithm, i.e., entering for column and leaving for row representation ...
bool setBoolParam(const BoolParam param, const bool value, const bool init=true)
sets boolean parameter value; returns true on success
should LP be transformed to equality form before a rational solve?
void setOutstream(SPxOut &newOutstream)
Real sumDualDegen
the sum of the rate of dual degeneracy at each iteration
void _idxToPerm(int *idx, int idxSize, int *perm, int permSize) const
creates a permutation for removing rows/columns from an array of indices
virtual void clear()
clears the LP.
void setMemFactor(Real f)
set refactor threshold for memory growth in current factor update compared to the last factorization ...
void solveLeft(VectorRational &x, const VectorRational &b)
Solves .
int number(const DataKey &pkey) const
returns number of name with DataKey pkey in NameSet.
const SPxBasis & basis() const
Return current basis.
SPxSolver::VarStatus basisRowStatus(int row) const
returns basis status for a single row
the number of iterations before the decomposition simplex initialisation is terminated.
virtual void reLoad()
reload LP.
const VectorRational & maxObjRational() const
returns objective function vector after transformation to a maximization problem; since this is how i...
upper threshold in lifting (nonzero matrix coefficients with larger absolute value will be reformulat...
void _addRowsReal(const LPRowSetReal &lprowset)
adds multiple rows to the real LP and adjusts basis
int numColsReal() const
returns number of columns
virtual Status solve()
solve loaded LP.
LP has been proven to be primal unbounded.
void changeUpperReal(const VectorReal &upper)
changes vector of upper bounds to upper
void reSize(int newsize)
reset size to newsize.
bool hasPrimalRay() const
is a primal unbounded ray available?
void removeColRational(int i)
removes column i
IntParam
integer parameters
force iterative refinement
const VectorBase< R > & lower() const
Returns (internal and possibly scaled) lower bound vector.
SPxSolver::Status _status
void setTiming(Timer::TYPE ttype)
set timing type
virtual R maxAbsNzo(bool unscaled=true) const
Absolute biggest non-zero element in (in rational case possibly scaled) LP.
void getObjRational(VectorRational &obj) const
gets objective function vector
int num() const
Returns the number of LPColBases currently in LPColSetBase.
virtual void setIntParam(int param, const char *name="intparam")
set int parameter
virtual void computePrimalActivity(const VectorBase< R > &primal, VectorBase< R > &activity, const bool unscaled=true) const
Computes activity of the rows for a given primal vector; activity does not need to be zero...
LP column.Class LPColBase provides a datatype for storing the column of an LP a the form similar to ...
Representation rep() const
return the current basis representation.
RangeType _rangeTypeReal(const Real &lower, const Real &upper) const
determines RangeType from real bounds
void _completeRangeTypesRational()
completes range type arrays after adding columns and/or rows
const VectorReal & lhsRealInternal() const
returns left-hand side vector, ignoring scaling
solve() aborted due to objective limit.
columnwise representation.
void spx_free(T &p)
Release memory.
SPxSimplifier * _simplifier
void removeRowRangeRational(int start, int end, int perm[]=0)
removes rows start to end including both; an array perm of size numRowsRational() may be passed as bu...
void addRowsReal(const LPRowSetReal &lprowset)
adds multiple rows
bool has(int pnum) const
does NameSet has a name with number pnum?
geometric mean scaling on rows and columns, max 1 round
virtual void addCols(const LPColSetBase< R > &pset, bool scale=false)
void scaleValue(int i, int scaleExp)
Scale i 'th element by a.
perturb the entire problem or only the relevant bounds of s single pivot?
Basis is singular, numerical troubles?
R value(int n) const
Returns value of the n 'th nonzero element.
const SVector & unitVector(int i) const
return i 'th unit vector.
should row and bound violations be computed explicitly in the update of reduced problem in the decomp...
Basis is primal feasible.
upper bound is finite, lower bound is infinite
bool getBoundViolationRational(Rational &maxviol, Rational &sumviol)
gets violation of bounds; returns true on success
LP has a usable Basis (maybe LP is changed).
int num() const
Returns the number of LPRowBases in LPRowSetBase.
int primalIterations()
return number of iterations done with primal algorithm
void setMax(int newmax=1)
Reset nonzero memory to >= newmax.
LP has been proven to be primal unbounded.
int totalSizeDualRational(const int base=2)
get size of dual solution
int degenPivotsPrimal
number of primal degenerate pivots
LP has been proven to be primal infeasible.
No Problem has been loaded to the basis.
void removeRowsReal(int perm[])
removes all rows with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates the n...
const VectorRational & lowerRational() const
returns lower bound vector