36 #define SET_MAX_LINE_LEN 500 39 #define strncasecmp _strnicmp 204 description[
SoPlex::SCALER] =
"scaling (0 - off, 1 - uni-equilibrium, 2 - bi-equilibrium, 3 - geometric, 4 - iterated geometric, 5 - least squares)";
211 description[
SoPlex::STARTER] =
"crash basis generated when starting from scratch (0 - none, 1 - weight, 2 - sum, 3 - vector)";
218 description[
SoPlex::PRICER] =
"pricing method (0 - auto, 1 - dantzig, 2 - parmult, 3 - devex, 4 - quicksteep, 5 - steep)";
246 description[
SoPlex::SOLVEMODE] =
"mode for iterative refinement strategy (0 - floating-point solve, 1 - auto, 2 - exact rational solve)";
253 description[
SoPlex::CHECKMODE] =
"mode for a posteriori feasibility checks (0 - floating-point check, 1 - auto, 2 - exact rational check)";
421 description[
SoPlex::LIFTMINVAL] =
"lower threshold in lifting (nonzero matrix coefficients with smaller absolute value will be reformulated)";
428 description[
SoPlex::LIFTMAXVAL] =
"lower threshold in lifting (nonzero matrix coefficients with smaller absolute value will be reformulated)";
497 #ifdef SOPLEX_WITH_RATIONALPARAM 498 SoPlex::Settings::RationalParam::RationalParam() {}
512 #ifdef SOPLEX_WITH_RATIONALPARAM
513 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
514 _rationalParamValues[i] = rationalParam.defaultValue[i];
534 #ifdef SOPLEX_WITH_RATIONALPARAM
535 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
536 _rationalParamValues[i] = settings._rationalParamValues[i];
545 #ifdef SOPLEX_WITH_RATIONALPARAM 546 SoPlex::Settings::RationalParam SoPlex::Settings::rationalParam;
1069 assert(ncols ==
_solver.
nCols() || (ncols == 0 && intInfo == NULL));
1693 if( i < _rationalLP->nRows() )
1719 for(
int i = 0; i < oldsize; i++ )
1785 if( i < _rationalLP->nCols() )
1811 for(
int i = 0; i < oldsize; i++ )
1917 #ifdef SOPLEX_WITH_GMP 1919 void SoPlex::addRowRational(
const mpq_t* lhs,
const mpq_t* rowValues,
const int* rowIndices,
const int rowSize,
const mpq_t* rhs)
1939 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)
1946 _rationalLP->
addRows(lhs, rowValues, rowIndices, rowStarts, rowLengths, numRows, numValues, rhs);
2001 #ifdef SOPLEX_WITH_GMP 2003 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)
2024 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)
2031 _rationalLP->
addCols(obj, lower, colValues, colIndices, colStarts, colLengths, numCols, numValues, upper);
2127 #ifdef SOPLEX_WITH_GMP 2168 #ifdef SOPLEX_WITH_GMP 2177 for(
int i = 0; i < rhsSize; i++ )
2250 #ifdef SOPLEX_WITH_GMP 2330 #ifdef SOPLEX_WITH_GMP 2390 #ifdef SOPLEX_WITH_GMP 2450 #ifdef SOPLEX_WITH_GMP 2507 #ifdef SOPLEX_WITH_GMP 2544 #ifdef SOPLEX_WITH_GMP 2573 if( i < _rationalLP->nRows() )
2600 for(
int i = 0; i < oldsize; i++ )
2668 if( i < _rationalLP->nCols() )
2695 for(
int i = 0; i < oldsize; i++ )
2836 #ifdef SOPLEX_DEBUG // this check will remove scaling of the realLP 2847 #ifdef ENABLE_ADDITIONAL_CHECKS 2855 #ifdef ENABLE_ADDITIONAL_CHECKS 2863 #ifdef ENABLE_ADDITIONAL_CHECKS 3054 Real viol = lower - primal[i];
3058 if( viol > maxviol )
3062 viol = primal[i] - upper;
3066 if( viol > maxviol )
3096 Real viol = lhs - activity[i];
3100 if( viol > maxviol )
3104 viol = activity[i] - rhs;
3108 if( viol > maxviol )
3139 sumviol += -redcost[c];
3140 if( redcost[c] < -maxviol )
3141 maxviol = -redcost[c];
3145 sumviol += redcost[c];
3146 if( redcost[c] > maxviol )
3147 maxviol = redcost[c];
3154 sumviol += redcost[c];
3155 if( redcost[c] > maxviol )
3156 maxviol = redcost[c];
3160 sumviol += -redcost[c];
3161 if( redcost[c] < -maxviol )
3162 maxviol = -redcost[c];
3193 sumviol += -dual[r];
3194 if( dual[r] < -maxviol )
3200 if( dual[r] > maxviol )
3209 if( dual[r] > maxviol )
3214 sumviol += -dual[r];
3215 if( dual[r] < -maxviol )
3375 if( viol > maxviol )
3388 if( viol > maxviol )
3428 if( viol > maxviol )
3441 if( viol > maxviol )
3492 sumviol += -redcost[c];
3493 if( redcost[c] < -maxviol )
3495 MSG_DEBUG( std::cout <<
"increased reduced cost violation for column " << c <<
" not on upper bound: " <<
rationalToString(-redcost[c]) <<
"\n" );
3496 maxviol = -redcost[c];
3501 sumviol += redcost[c];
3502 if( redcost[c] > maxviol )
3504 MSG_DEBUG( std::cout <<
"increased reduced cost violation for column " << c <<
" not on lower bound: " <<
rationalToString(redcost[c]) <<
"\n" );
3505 maxviol = redcost[c];
3513 sumviol += redcost[c];
3514 if( redcost[c] > maxviol )
3516 MSG_DEBUG( std::cout <<
"increased reduced cost violation for column " << c <<
" not on upper bound: " <<
rationalToString(redcost[c]) <<
"\n" );
3517 maxviol = redcost[c];
3522 sumviol += -redcost[c];
3523 if( redcost[c] < -maxviol )
3525 MSG_DEBUG( std::cout <<
"increased reduced cost violation for column " << c <<
" not on lower bound: " <<
rationalToString(-redcost[c]) <<
"\n" );
3526 maxviol = -redcost[c];
3573 sumviol += -dual[r];
3574 if( dual[r] < -maxviol )
3576 MSG_DEBUG( std::cout <<
"increased dual violation for row " << r <<
" not on upper bound: " <<
rationalToString(-dual[r])
3587 if( dual[r] > maxviol )
3589 MSG_DEBUG( std::cout <<
"increased dual violation for row " << r <<
" not on lower bound: " <<
rationalToString(dual[r])
3603 if( dual[r] > maxviol )
3605 MSG_DEBUG( std::cout <<
"increased dual violation for row " << r <<
" not on upper bound: " <<
rationalToString(dual[r])
3615 sumviol += -dual[r];
3616 if( dual[r] < -maxviol )
3618 MSG_DEBUG( std::cout <<
"increased dual violation for row " << r <<
" not on lower bound: " <<
rationalToString(-dual[r])
3634 #ifdef SOPLEX_WITH_GMP 4106 int size = x.
size();
4108 for(
int i = 0; i < size; i++ )
4125 if( ninds != 0 && inds != 0 )
4130 for(
int i = 0; i < *ninds; ++i )
4180 for(
int i = 0; i < rhs.size(); ++i)
4217 if(
id.isSPxRowId() )
4224 coef[rowindex] = y[i];
4234 assert(coef[index] == 0.0);
4287 int size = x.
size();
4289 for(
int i = 0; i < size; i++ )
4316 if( ninds != 0 && inds != 0 )
4321 for(
int i = 0; i < *ninds; ++i )
4386 int size = rhs.size();
4389 for(
int i = 0; i < size; i++ )
4392 rhs.value(i) *=
spxLdexp(1.0, scaleExp);
4400 for(
int i = 0; i < size; i++ )
4427 if(
id.isSPxRowId() )
4440 assert(coef[index] == 0.0);
4486 for(
int i = 0; i < v.
dim(); ++i)
4497 for(
int i = 0; i < x.
dim(); i++ )
4542 if(
id.isSPxRowId() )
4551 rowrhs.add(i,
spxLdexp(v[idx], scaleExp));
4558 assert(rowrhs[i] == 0.0);
4607 x[i] =
spxLdexp(y[index], scaleExp);
4645 for(
int i = 0; i < basisdim; ++i)
4654 vec[i] =
spxLdexp(vec[i], scaleExp);
4658 for(
int i = 0; i < basisdim; ++i)
4661 vec[i] =
spxLdexp(vec[i], -scaleExp);
4676 Vector x(colbasisdim, vec);
4686 for(
int i = 0; i < colbasisdim; ++i)
4755 for(
int i = 0; i < basisdim; ++i)
4760 vec[i] =
spxLdexp(vec[i], scaleExp);
4764 for(
int i = 0; i < basisdim; ++i)
4773 vec[i] =
spxLdexp(vec[i], scaleExp);
4787 Vector x(colbasisdim, vec);
4797 for(
int i = 0; i < colbasisdim; ++i)
4924 MSG_INFO1(
spxout,
spxout <<
"Caught exception <" << E.
what() <<
"> while computing rational basis inverse column.\n" );
4949 MSG_INFO1(
spxout,
spxout <<
"Caught exception <" << E.
what() <<
"> during right solve with rational basis inverse.\n" );
5017 std::stringstream s;
5022 <<
"Solution time : " << std::setw(10) << std::fixed << std::setprecision(2) <<
solveTime() << std::endl
5023 <<
"Iterations : " << std::setw(10) <<
numIterations() << std::endl;
5083 bool success =
false;
5085 success =
_readFileReal(filename, rowNames, colNames, intVars);
5110 origLP->
writeFile(filename, rowNames, colNames, intVars);
5111 origLP->~SPxLPReal();
5163 assert(filename != 0);
5189 assert(filename != 0);
5205 const NameSet* colNamesPtr = colNames;
5209 std::stringstream name;
5212 tmpColNames =
new (tmpColNames)
NameSet();
5213 tmpColNames->
reMax(numCols);
5215 for(
int j = 0; j < numCols; ++j )
5218 tmpColNames->
add(name.str().c_str());
5221 colNamesPtr = tmpColNames;
5225 const NameSet* rowNamesPtr = rowNames;
5227 if( rowNamesPtr == 0 )
5229 std::stringstream name;
5232 tmpRowNames =
new (tmpRowNames)
NameSet();
5233 tmpRowNames->
reMax(numRows);
5235 for(
int i = 0; i < numRows; ++i )
5238 tmpRowNames->
add(name.str().c_str());
5241 rowNamesPtr = tmpRowNames;
5248 for(
int i = 0; i < numRows; i++ )
5251 for(
int i = 0; i < numCols; i++ )
5272 if( mps.
field0() != 0 && !strcmp(mps.
field0(),
"ENDATA") )
5284 if( *mps.
field1() ==
'X' )
5290 if( !strcmp(mps.
field1(),
"XU") )
5300 else if( !strcmp(mps.
field1(),
"XL") )
5310 else if( !strcmp(mps.
field1(),
"UL") )
5314 else if( !strcmp(mps.
field1(),
"LL") )
5353 assert(filename != 0);
5359 std::ofstream file(filename);
5363 file.setf(std::ios::left);
5364 file <<
"NAME " << filename <<
"\n";
5378 for(
int col = 0; col < numCols; col++ )
5385 for( ; row < numRows; row++ )
5392 assert(row != numRows);
5399 file << std::setw(8);
5400 if( colNames != 0 && colNames->
has(col) )
5401 file << (*colNames)[col];
5406 if( rowNames != 0 && rowNames->
has(row) )
5407 file << (*rowNames)[row];
5420 file << std::setw(8);
5421 if( colNames != 0 && colNames->
has(col) )
5422 file << (*colNames)[col];
5435 for( ; row < numRows; row++ )
5454 ofname = std::string(filename) +
".set";
5458 ofname = std::string(filename) + ((cpxFormat) ?
".lp" :
".mps");
5462 ofname = std::string(filename) +
".bas";
5475 ofname = std::string(filename) +
".set";
5479 ofname = std::string(filename) + ((cpxFormat) ?
".lp" :
".mps");
5483 ofname = std::string(filename) +
".bas";
5519 #ifdef SOPLEX_WITH_RATIONALPARAM 5521 Rational SoPlex::rationalParam(
const RationalParam param)
const 5524 assert(param < RATIONALPARAM_COUNT);
5546 if( !init && value ==
boolParam(param) )
5600 if( !init && value ==
intParam(param) )
5942 if( !init && value ==
realParam(param) )
5952 #ifndef SOPLEX_WITH_GMP 5965 #ifndef SOPLEX_WITH_GMP 6086 #ifdef SOPLEX_WITH_RATIONALPARAM 6088 bool SoPlex::setRationalParam(
const RationalParam param,
const Rational value,
const bool init)
6091 assert(param < RATIONALPARAM_COUNT);
6094 if( !init && value == rationalParam(param) )
6097 if( value < _currentSettings->rationalParam.lower[param] || value >
_currentSettings->rationalParam.upper[param] )
6119 bool success =
true;
6132 #ifdef SOPLEX_WITH_RATIONALPARAM 6133 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
6134 success &= setRationalParam((RationalParam)i,
_currentSettings->_rationalParamValues[i], init);
6154 #ifdef SOPLEX_WITH_RATIONALPARAM 6155 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
6156 success &= setRationalParam((RationalParam)i,
_currentSettings->rationalParam.defaultValue[i], init);
6164 bool printedValue =
false;
6172 printedValue =
true;
6181 printedValue =
true;
6190 printedValue =
true;
6193 #ifdef SOPLEX_WITH_RATIONALPARAM 6194 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
6200 printedValue =
true;
6207 printedValue =
true;
6219 assert(filename != 0);
6221 std::ofstream file(filename);
6225 file.setf(std::ios::left);
6227 #if SOPLEX_SUBVERSION > 0 6267 #ifdef SOPLEX_WITH_RATIONALPARAM 6268 for(
int i = 0; i < SoPlex::RATIONALPARAM_COUNT; i++ )
6276 <<
"], default " <<
_currentSettings->rationalParam.defaultValue[i] <<
"\n";
6284 file <<
"# initial random seed used for perturbation\n";
6297 assert(filename != 0);
6316 bool readError =
false;
6317 bool parseError =
false;
6319 while( !readError && !parseError)
6322 readError = !file.getline(line,
sizeof(line));
6326 readError = readError && !file.eof();
6332 else if( readError )
6346 assert(
string != 0);
6354 char* line = parseString;
6357 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6359 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
6361 char* paramTypeString = line;
6364 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
':' )
6377 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6381 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: no ':' separating parameter type and name.\n" );
6388 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6390 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
6395 char* paramName = line;
6398 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
'=' )
6411 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6422 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6424 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
6429 char* paramValueString = line;
6432 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' )
6439 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
6441 if( *line !=
'\0' && *line !=
'\n' && *line !=
'#' )
6443 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: additional character '" << *line <<
"' after parameter value.\n" );
6449 if( strncmp(paramTypeString,
"bool", 4) == 0 )
6451 for(
int param = 0; ; param++ )
6455 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: unknown parameter name <" << paramName <<
">.\n" );
6460 if( strncasecmp(paramValueString,
"true", 4) == 0
6461 || strncasecmp(paramValueString,
"TRUE", 4) == 0
6462 || strncasecmp(paramValueString,
"t", 4) == 0
6463 || strncasecmp(paramValueString,
"T", 4) == 0
6464 || strtol(paramValueString, NULL, 4) == 1 )
6469 else if( strncasecmp(paramValueString,
"false", 5) == 0
6470 || strncasecmp(paramValueString,
"FALSE", 5) == 0
6471 || strncasecmp(paramValueString,
"f", 5) == 0
6472 || strncasecmp(paramValueString,
"F", 5) == 0
6473 || strtol(paramValueString, NULL, 5) == 0 )
6480 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid value <" << paramValueString <<
"> for bool parameter <" << paramName <<
">.\n" );
6490 if( strncmp(paramTypeString,
"int", 3) == 0 )
6492 for(
int param = 0; ; param++ )
6496 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: unknown parameter name <" << paramName <<
">.\n" );
6507 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid value <" << paramValueString <<
"> for int parameter <" << paramName <<
">.\n" );
6517 if( strncmp(paramTypeString,
"real", 4) == 0 )
6519 for(
int param = 0; ; param++ )
6523 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: unknown parameter name <" << paramName <<
">.\n" );
6534 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid value <" << paramValueString <<
"> for real parameter <" << paramName <<
">.\n" );
6543 #ifdef SOPLEX_WITH_RATIONALPARAM 6545 if( strncmp(paramTypeString,
"rational", 8) == 0 )
6547 for(
int param = 0; ; param++ )
6549 if( param >= SoPlex::RATIONALPARAM_COUNT )
6551 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: unknown parameter name <" << paramName <<
">.\n" );
6558 if(
readStringRational(paramValueString, value) && setRationalParam((SoPlex::RationalParam)param, value) )
6562 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid value <" << paramValueString <<
"> for rational parameter <" << paramName <<
">.\n" );
6573 if( strncmp(paramTypeString,
"uint", 4) == 0 )
6575 if( strncmp(paramName,
"random_seed", 11) == 0 )
6579 if( sscanf(paramValueString,
"%u", &value) == 1 )
6590 MSG_INFO1(
spxout,
spxout <<
"Error parsing setting string: invalid parameter type <" << paramTypeString <<
"> for parameter <" << paramName <<
">.\n" );
6601 int prec = (int) os.precision();
6604 os << std::scientific << std::setprecision(8)
6605 <<
"Solution (real) : \n" 6610 os <<
"Solution (rational) : \n" 6612 os <<
"Size (base 2/10) : \n" 6622 os <<
"Solution : \n" 6623 <<
" Objective value : -\n";
6632 os <<
"Violation (rational): \n";
6636 os <<
" Max/sum bound : - / -\n";
6640 os <<
" Max/sum row : - / -\n";
6644 os <<
" Max/sum redcost : - / -\n";
6648 os <<
" Max/sum dual : - / -\n";
6655 os <<
"Violations (real) : \n";
6657 os <<
" Max/sum bound : " << maxviol <<
" / " << sumviol <<
"\n";
6659 os <<
" Max/sum bound : - / -\n";
6661 os <<
" Max/sum row : " << maxviol <<
" / " << sumviol <<
"\n";
6663 os <<
" Max/sum row : - / -\n";
6665 os <<
" Max/sum redcost : " << maxviol <<
" / " << sumviol <<
"\n";
6667 os <<
" Max/sum redcost : - / -\n";
6669 os <<
" Max/sum dual : " << maxviol <<
" / " << sumviol <<
"\n";
6671 os <<
" Max/sum dual : - / -\n";
6673 os << std::setprecision(prec);
6693 <<
"Objective value : " << std::scientific << std::setprecision(8) <<
objValueReal() << std::fixed <<
"\n";
6701 int prec = (int) os.precision();
6702 os << std::setprecision(2);
6706 os <<
"Original problem : \n";
6720 os << std::setprecision(prec);
6728 os <<
"SoPlex status : ";
6733 os <<
"error [unspecified]";
6736 os <<
"error [no ratiotester loaded]";
6739 os <<
"error [no pricer loaded]";
6742 os <<
"error [no linear solver loaded]";
6745 os <<
"error [not initialized]";
6748 os <<
"solving aborted [cycling]";
6751 os <<
"solving aborted [time limit reached]";
6754 os <<
"solving aborted [iteration limit reached]";
6757 os <<
"solving aborted [objective limit reached]";
6760 os <<
"no problem loaded";
6763 os <<
"basis is regular";
6766 os <<
"basis is singular";
6769 os <<
"problem is solved [optimal]";
6772 os <<
"problem is solved [unbounded]";
6775 os <<
"problem is solved [infeasible]";
6778 os <<
"problem is solved [infeasible or unbounded]";
6795 #if (SOPLEX_SUBVERSION > 0) 6814 #ifdef SOPLEX_WITH_GMP 6835 bool nRowsMatch =
true;
6836 bool nColsMatch =
true;
6837 bool rhsDimMatch =
true;
6838 bool lhsDimMatch =
true;
6839 bool maxObjDimMatch =
true;
6840 bool upperDimMatch =
true;
6841 bool lowerDimMatch =
true;
6846 MSG_INFO1(
spxout,
spxout <<
"The number of Rows in the Real LP does not match the one in the Rational LP." 6855 MSG_INFO1(
spxout,
spxout <<
"The number of Columns in the Real LP does not match the one in the Rational LP." 6864 MSG_INFO1(
spxout,
spxout <<
"The number of nonZeros in the Real LP does not match the one in the Rational LP." 6872 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." 6875 rhsDimMatch =
false;
6882 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." 6885 lhsDimMatch =
false;
6891 MSG_INFO1(
spxout,
spxout <<
"The dimension of the objective function vector of the Real LP does not match the one of the Rational LP." 6894 maxObjDimMatch =
false;
6900 MSG_INFO1(
spxout,
spxout <<
"The objective function sense of the Real LP does not match the one of the Rational LP." 6909 MSG_INFO1(
spxout,
spxout <<
"The dimension of the upper bound vector of the Real LP does not match the one of the Rational LP." 6912 upperDimMatch =
false;
6918 MSG_INFO1(
spxout,
spxout <<
"The dimension of the lower bound vector of the Real LP does not match the one of the Rational LP." 6921 lowerDimMatch =
false;
6927 bool rhsValMatch =
true;
6928 bool lhsValMatch =
true;
6929 bool maxObjValMatch =
true;
6930 bool upperValMatch =
true;
6931 bool lowerValMatch =
true;
6936 for(
int i = 0; i <
_realLP->
rhs().dim(); i++ )
6944 MSG_INFO1(
spxout,
spxout <<
"Entries number " << i <<
" of the right hand side vectors don't match." 6947 rhsValMatch =
false;
6952 if( !rhsValMatch && quiet )
6954 MSG_INFO1(
spxout,
spxout <<
"The values of the right hand side vectors don't match." << std::endl );
6961 for(
int i = 0; i <
_realLP->
lhs().dim(); i++ )
6969 MSG_INFO1(
spxout,
spxout <<
"Entries number " << i <<
" of the left hand side vectors don't match." 6972 lhsValMatch =
false;
6977 if( !lhsValMatch && quiet )
6979 MSG_INFO1(
spxout,
spxout <<
"The values of the left hand side vectors don't match." << std::endl );
6984 if( maxObjDimMatch )
6992 MSG_INFO1(
spxout,
spxout <<
"Entries number " << i <<
" of the objective function vectors don't match." 6995 maxObjValMatch =
false;
7000 if( !maxObjValMatch && quiet )
7002 MSG_INFO1(
spxout,
spxout <<
"The values of the objective function vectors don't match." << std::endl );
7020 upperValMatch =
false;
7025 if( !upperValMatch && quiet )
7045 lowerValMatch =
false;
7050 if( !lowerValMatch && quiet )
7058 if( checkMatVals && nRowsMatch && nColsMatch )
7060 bool matrixValMatch =
true;
7073 matrixValMatch =
false;
7079 if( !matrixValMatch && quiet )
7109 assert(newmax > vec.
size());
7120 assert(idxSize >= 0);
7122 assert(permSize >= 0);
7124 for(
int i = 0; i < permSize; i++ )
7127 for(
int i = 0; i < idxSize; i++ )
7129 assert(idx[i] >= 0);
7130 assert(idx[i] < permSize);
7141 assert(permSize >= 0);
7143 for(
int i = 0; i < permSize; i++ )
7144 perm[i] = (i < start || i > end) ? i : -1;
7185 return stoppedTime || stoppedIter;
7193 assert(lower <= upper);
7206 else if( lower == upper )
7218 assert(lower <= upper);
7231 else if( lower == upper )
7377 for(
int i = 0; i < lpcolset.
num(); i++ )
7778 else if( perm[i] >= 0 && perm[i] != i )
7781 assert(perm[perm[i]] < 0);
7842 else if( perm[i] >= 0 && perm[i] != i )
7845 assert(perm[perm[i]] < 0);
8097 bool success =
_realLP->
readFile(filename, rowNames, colNames, intVars);
8303 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8305 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
8307 char* paramTypeString = line;
8310 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
':' )
8323 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8327 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: no ':' separating parameter type and name in line " << lineNumber <<
".\n" );
8334 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8336 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
8338 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: no parameter name in line " << lineNumber <<
".\n");
8341 char* paramName = line;
8344 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
'=' )
8357 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8361 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: no '=' after parameter name in line " << lineNumber <<
".\n" );
8368 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8370 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
8372 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: no parameter value in line " << lineNumber <<
".\n");
8375 char* paramValueString = line;
8378 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' )
8385 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
8387 if( *line !=
'\0' && *line !=
'\n' && *line !=
'#' )
8389 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: additional character '" << *line <<
"' after parameter value in line " << lineNumber <<
".\n" );
8395 if( strncmp(paramTypeString,
"bool", 4) == 0 )
8397 for(
int param = 0; ; param++ )
8401 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: unknown parameter name <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8406 if( strncasecmp(paramValueString,
"true", 4) == 0
8407 || strncasecmp(paramValueString,
"TRUE", 4) == 0
8408 || strncasecmp(paramValueString,
"t", 4) == 0
8409 || strncasecmp(paramValueString,
"T", 4) == 0
8410 || strtol(paramValueString, NULL, 4) == 1 )
8415 else if( strncasecmp(paramValueString,
"false", 5) == 0
8416 || strncasecmp(paramValueString,
"FALSE", 5) == 0
8417 || strncasecmp(paramValueString,
"f", 5) == 0
8418 || strncasecmp(paramValueString,
"F", 5) == 0
8419 || strtol(paramValueString, NULL, 5) == 0 )
8426 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid value <" << paramValueString <<
"> for bool parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8436 if( strncmp(paramTypeString,
"int", 3) == 0 )
8438 for(
int param = 0; ; param++ )
8442 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: unknown parameter name <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8453 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid value <" << paramValueString <<
"> for int parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8463 if( strncmp(paramTypeString,
"real", 4) == 0 )
8465 for(
int param = 0; ; param++ )
8469 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: unknown parameter name <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8480 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid value <" << paramValueString <<
"> for real parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8489 #ifdef SOPLEX_WITH_RATIONALPARAM 8491 if( strncmp(paramTypeString,
"rational", 8) == 0 )
8493 for(
int param = 0; ; param++ )
8495 if( param >= SoPlex::RATIONALPARAM_COUNT )
8497 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: unknown parameter name <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8504 if(
readStringRational(paramValueString, value) && setRationalParam((SoPlex::RationalParam)param, value) )
8508 MSG_INFO1(
spxout,
spxout <<
"Error parsing settings file: invalid value <" << paramValueString <<
"> for rational parameter <" << paramName <<
"> in line " << lineNumber <<
".\n" );
8519 if( strncmp(paramTypeString,
"uint", 4) == 0 )
8521 if( strncmp(paramName,
"random_seed", 11) == 0 )
8525 if( sscanf(paramValueString,
"%u", &value) == 1 )
8536 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
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
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
bool writeFileReal(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *intvars=0, const bool unscale=false) const
writes real LP to file; LP or MPS format is chosen from the extension in filename; if rowNames and co...
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.
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
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 real solution with rational solution, i.e., copies real solution to rational solution ...
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
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?
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.
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 rational solution with real solution, i.e., copies (rounded) rational solution to real s...
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.
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.
minimize number of basic slack variables, i.e. more variables between bounds
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
const VectorRational & upperRational() const
returns upper bound vector
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.
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
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.
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.
maximize number of basic slack variables, i.e. more variables on bounds
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