39 #define STRONGBRANCH_RESTOREBASIS 47 #ifndef NO_CONFIG_HEADER 48 #include "scip/config.h" 52 #ifdef SCIP_WITH_LPSCHECK 55 #define CHECK_SPXSOLVE true 56 #define CHECK_SPXSTRONGBRANCH true 58 #define EXIT_AT_WRONG_RESULT false 59 #define EXIT_AT_CPXERROR false 61 #define CPX_CALL(x) do \ 64 if( (_cpxstat_ = (x)) != 0 ) \ 66 SCIPmessagePrintWarning(_messagehdlr, "CPLEX error <%d>; SoPlex result unchecked\n", _cpxstat_); \ 67 if( EXIT_AT_CPXERROR ) \ 81 #define CHECK_SOPLEX_PARAM(x) \ 84 SCIPmessagePrintWarning(_messagehdlr, "SoPlex: unsupported parameter value\n"); \ 94 #pragma GCC visibility push(default) 100 #ifndef SOPLEX_SUBVERSION 101 #define SOPLEX_SUBVERSION 0 104 #ifndef SOPLEX_APIVERSION 105 #define SOPLEX_APIVERSION 0 109 #if (SOPLEX_VERSION < 200 || (SOPLEX_VERSION == 200 && SOPLEX_SUBVERSION < 2) || (SOPLEX_VERSION > 200 && SOPLEX_VERSION < 201)) 110 #error "This interface is not compatible with SoPlex versions prior to 2.0.0.2" 113 #if (SOPLEX_APIVERSION <= 5) 114 #include "spxgithash.h" 125 #if defined(_MSC_VER) && _MSC_VER < 1900 127 #define snprintf _snprintf 131 #define SOPLEX_VERBLEVEL 5 152 #define SOPLEX_TRY(messagehdlr, x) do \ 158 catch( const SPxMemoryException& E ) \ 160 std::string s = E.what(); \ 161 SCIPerrorMessage("SoPlex threw a memory exception: %s\n", s.c_str()); \ 164 catch( const SPxException& E ) \ 166 std::string s = E.what(); \ 167 SCIPmessagePrintWarning((messagehdlr), "SoPlex threw an exception: %s\n", s.c_str()); \ 168 return SCIP_LPERROR; \ 174 #define SOPLEX_TRY(messagehdlr, x) do \ 180 catch( const SPxMemoryException& E ) \ 182 std::string s = E.what(); \ 183 SCIPerrorMessage("SoPlex threw a memory exception: %s\n", s.c_str()); \ 186 catch( const SPxException& ) \ 188 return SCIP_LPERROR; \ 197 #define SOPLEX_TRY_ABORT(x) do \ 203 catch( const SPxException& E ) \ 205 std::string s = E.what(); \ 206 SCIPerrorMessage("SoPlex threw an exception: %s\n", s.c_str()); \ 215 class SPxSCIP :
public SoPlex 221 DataArray<SPxSolver::VarStatus> _colStat;
222 DataArray<SPxSolver::VarStatus> _rowStat;
223 #ifdef SCIP_WITH_LPSCHECK 234 const char* probname =
NULL 241 _messagehdlr(messagehdlr)
243 if ( probname !=
NULL )
246 #if SOPLEX_APIVERSION >= 2 247 (void)setBoolParam(SoPlex::ENSURERAY,
true);
250 #ifdef SCIP_WITH_LPSCHECK 253 _doublecheck =
false;
254 _cpxenv = CPXopenCPLEX(&cpxstat);
255 assert(_cpxenv !=
NULL);
256 _cpxlp = CPXcreateprob(_cpxenv, &cpxstat, probname !=
NULL ? probname :
"spxcheck");
257 (void) CPXsetintparam(_cpxenv, CPX_PARAM_SCRIND, 0);
263 if( _probname !=
NULL )
266 freePreStrongbranchingBasis();
268 #ifdef SCIP_WITH_LPSCHECK 269 (void) CPXfreeprob(_cpxenv, &_cpxlp);
270 (void) CPXcloseCPLEX(&_cpxenv);
292 return realParam(OPTTOL);
304 Real getObjLimit()
const 306 return (intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE)
307 ? realParam(SoPlex::OBJLIMIT_UPPER)
308 : realParam(SoPlex::OBJLIMIT_LOWER);
312 bool getFromScratch()
const 317 void setFromScratch(
bool fs)
322 void setInterrupt(
bool interrupt)
324 _interrupt = interrupt;
333 bool getLpInfo()
const 338 void setLpInfo(
bool lpinfo)
344 void setProbname(
const char* probname)
348 assert(probname !=
NULL);
349 if( _probname !=
NULL )
352 len = strlen(probname);
353 spx_alloc(_probname, len + 1);
354 memcpy(_probname, probname, len + 1);
357 void setRep(SPxSolver::Representation p_rep)
359 if( p_rep == SPxSolver::COLUMN && intParam(REPRESENTATION) == REPRESENTATION_ROW )
364 else if( (p_rep == SPxSolver::ROW && intParam(REPRESENTATION) == REPRESENTATION_COLUMN) )
371 #ifdef SCIP_WITH_LPSCHECK 372 bool getDoubleCheck()
375 return _doublecheck && _checknum + 1 >= CHECK_START;
378 void setDoubleCheck(
bool dc)
383 const char* spxStatusString(
const SPxSolver::Status stat)
const 387 case SPxSolver::ABORT_TIME:
389 case SPxSolver::ABORT_ITER:
391 case SPxSolver::ABORT_VALUE:
392 return "ABORT_VALUE";
393 case SPxSolver::SINGULAR:
395 case SPxSolver::REGULAR:
399 case SPxSolver::OPTIMAL:
401 #if SOPLEX_APIVERSION >= 3 402 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
403 return "OPTIMAL_UNSCALED_VIOLATIONS";
405 case SPxSolver::UNBOUNDED:
407 case SPxSolver::INFEASIBLE:
414 const char* cpxStatusString(
const int stat)
const 418 case CPX_STAT_ABORT_TIME_LIM:
420 case CPX_STAT_ABORT_IT_LIM:
422 case CPX_STAT_ABORT_OBJ_LIM:
423 return "ABORT_VALUE";
424 case CPX_STAT_OPTIMAL:
426 case CPX_STAT_OPTIMAL_INFEAS:
427 return "CPX_STAT_OPTIMAL_INFEAS: OPT SOL INFEASIBLE AFTER UNSCALING";
428 case CPX_STAT_UNBOUNDED:
430 case CPX_STAT_INFEASIBLE:
432 case CPX_STAT_INForUNBD:
433 return "INFEASIBLE or UNBOUNDED";
434 case CPX_STAT_NUM_BEST:
435 return "CPX_STAT_NUM_BEST: SOL AVAILABLE BUT NOT PROVEN OPTIMAL DUE TO NUM TROUBLE";
443 bool checkConsistentBounds()
const 445 for(
int i = 0; i < numColsReal(); ++i )
447 if( lowerReal(i) > upperReal(i) + realParam(SoPlex::EPSILON_ZERO) )
449 SCIPerrorMessage(
"inconsistent bounds on column %d: lower=%.17g, upper=%.17g\n",
450 i, lowerReal(i), upperReal(i));
458 bool checkConsistentSides()
const 460 for(
int i = 0; i < numRowsReal(); ++i )
462 if( lhsReal(i) > rhsReal(i) + realParam(SoPlex::EPSILON_ZERO) )
465 i, lhsReal(i), rhsReal(i));
474 void trySolve(
bool printwarning =
true)
481 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 482 #if SOPLEX_APIVERSION > 11 491 catch(
const SPxException&
x)
493 std::string s = x.what();
503 assert(status() != SPxSolver::OPTIMAL);
506 assert(intParam(ITERLIMIT) < 0 || numIterations() <= intParam(ITERLIMIT));
509 timespent = solveTime();
513 timelimit = realParam(TIMELIMIT);
514 if( timelimit > timespent )
515 timelimit -= timespent;
519 assert(timelimit >= 0);
524 SPxSolver::Status doSolve(
bool printwarning =
true)
526 SPxOut::Verbosity verbosity;
528 SPxSolver::Status spxStatus;
531 verbosity = spxout.getVerbosity();
532 spxout.setVerbosity((SPxOut::Verbosity)(getLpInfo() ?
SOPLEX_VERBLEVEL : 0));
534 assert(checkConsistentBounds());
535 assert(checkConsistentSides());
537 #ifdef SCIP_WITH_LPSCHECK 539 if( getDoubleCheck() )
540 writeStateReal(
"spxcheck",
NULL,
NULL);
543 trySolve(printwarning);
544 spxStatus = status();
549 #ifdef SCIP_WITH_LPSCHECK 550 bool minimize = intParam(OBJSENSE) == OBJSENSE_MINIMIZE;
551 Real objLimitUpper = realParam(OBJLIMIT_UPPER);
552 Real objLimitLower = realParam(OBJLIMIT_LOWER);
555 if( getDoubleCheck() && (spxStatus == SPxSolver::OPTIMAL || spxStatus == SPxSolver::UNBOUNDED || spxStatus == SPxSolver::INFEASIBLE || spxStatus == SPxSolver::ABORT_VALUE) )
561 CPX_CALL( CPXreadcopyprob(_cpxenv, _cpxlp,
"spxcheck.mps",
NULL) );
562 CPX_CALL( CPXreadcopybase(_cpxenv, _cpxlp,
"spxcheck.bas") );
565 CPX_CALL( CPXsetdblparam(_cpxenv, CPX_PARAM_EPOPT,
MAX(opttol(), 1e-9)) );
566 CPX_CALL( CPXsetdblparam(_cpxenv, CPX_PARAM_EPRHS,
MAX(feastol(), 1e-9)) );
569 CPX_CALL( CPXlpopt(_cpxenv, _cpxlp) );
572 CPX_CALL( CPXsolution(_cpxenv, _cpxlp, &cpxstat, &cpxobj,
NULL,
NULL,
NULL,
NULL) );
577 if( cpxstat == CPX_STAT_OPTIMAL_INFEAS )
579 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s)\n",
580 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat));
581 if( EXIT_AT_CPXERROR )
584 else if( (spxStatus == SPxSolver::OPTIMAL && cpxstat != CPX_STAT_OPTIMAL)
585 || (spxStatus == SPxSolver::UNBOUNDED && cpxstat != CPX_STAT_UNBOUNDED)
586 || (spxStatus == SPxSolver::INFEASIBLE && cpxstat != CPX_STAT_INFEASIBLE) )
588 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
589 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
590 if( EXIT_AT_WRONG_RESULT )
593 else if( spxStatus == SPxSolver::ABORT_VALUE )
597 case CPX_STAT_OPTIMAL:
598 if( (minimize && LTrel(cpxobj, objLimitUpper, 2*opttol()))
599 || (!minimize && GTrel(cpxobj, objLimitLower, 2*opttol())) )
601 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
602 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize ?
"<" :
">",
603 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
604 if( EXIT_AT_WRONG_RESULT )
607 else if( (minimize && cpxobj < objLimitUpper) || (!minimize && cpxobj > objLimitLower) )
609 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
610 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize?
"<" :
">",
611 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
614 case CPX_STAT_OPTIMAL_INFEAS:
615 case CPX_STAT_NUM_BEST:
616 if( (minimize && cpxobj < objLimitUpper) || (!minimize && cpxobj > objLimitLower) )
618 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
619 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize ?
"<" :
">",
620 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
623 case CPX_STAT_INFEASIBLE:
625 case CPX_STAT_UNBOUNDED:
626 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
627 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
628 if( EXIT_AT_WRONG_RESULT )
631 case CPX_STAT_INForUNBD:
633 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
634 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
639 else if( spxStatus == SPxSolver::OPTIMAL )
641 if( (minimize && LTrel(objValueReal(), cpxobj, 2*opttol()))
642 || (!minimize && GTrel(objValueReal(), cpxobj, 2*opttol())) )
647 else if( (minimize && GTrel(objValueReal(), cpxobj, 2*opttol()))
648 || (!minimize && LTrel(objValueReal(), cpxobj, 2*opttol())) )
650 SCIPerrorMessage(
"In %s: LP optimal; SoPlex value=%.10f %s CPLEX value=%.10f suboptimal (checknum=%d)\n", _probname, objValueReal(),
651 minimize ?
">" :
"<", cpxobj, _checknum);
652 if( EXIT_AT_WRONG_RESULT )
662 spxout.setVerbosity(verbosity);
668 void savePreStrongbranchingBasis()
670 _rowStat.reSize(numRowsReal());
671 _colStat.reSize(numColsReal());
675 getBasis(_rowStat.get_ptr(), _colStat.get_ptr());
678 catch(
const SPxException&
x)
680 std::string s = x.what();
687 assert(status() != SPxSolver::OPTIMAL);
690 catch(
const SPxException&)
696 void restorePreStrongbranchingBasis()
698 assert(_rowStat.size() == numRowsReal());
699 assert(_colStat.size() == numColsReal());
703 setBasis(_rowStat.get_ptr(), _colStat.get_ptr());
706 catch(
const SPxException&
x)
708 std::string s = x.what();
711 catch(
const SPxException&)
718 assert(status() != SPxSolver::OPTIMAL);
723 void freePreStrongbranchingBasis()
730 bool preStrongbranchingBasisFreed()
const 732 return ((_rowStat.size() == 0 ) && (_colStat.size() == 0));
736 DataArray<SPxSolver::VarStatus>& rowStat()
742 DataArray<SPxSolver::VarStatus>& colStat()
760 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE 762 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE 786 COLPACKET* packcstat;
787 ROWPACKET* packrstat;
821 assert(num <= lpi->cstatsize);
843 assert(num <= lpi->rstatsize);
881 assert(lpistate !=
NULL);
897 assert(lpistate !=
NULL);
914 assert(lpistate !=
NULL);
915 assert(blkmem !=
NULL);
936 assert(blkmem !=
NULL);
937 assert(lpistate !=
NULL);
938 assert(*lpistate !=
NULL);
977 #if (SOPLEX_SUBVERSION > 0) 978 const static char spxname[20] = {
'S',
'o',
'p',
'l',
'e',
'x',
' ', SOPLEX_VERSION/100 +
'0',
'.', (SOPLEX_VERSION % 100)/10 +
'0',
'.', SOPLEX_VERSION % 10 +
'0',
'.',
SOPLEX_SUBVERSION +
'0'};
980 const static char spxname[20] = {
'S',
'o',
'p',
'l',
'e',
'x',
' ', SOPLEX_VERSION/100 +
'0',
'.', (SOPLEX_VERSION % 100)/10 +
'0',
'.', SOPLEX_VERSION % 10 +
'0'};
987 (void)snprintf(
spxdesc, 200,
"%s [GitHash: %s]",
"Linear Programming Solver developed at Zuse Institute Berlin (soplex.zib.de)" 988 #ifdef SCIP_WITH_LPSCHECK
989 " - including CPLEX double check" 1020 return (
void*) lpi->
spx;
1030 assert( lpi !=
NULL );
1031 assert( ncols >= 0 );
1032 assert( ncols == 0 || intInfo !=
NULL );
1034 #if (SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3)) 1035 assert(ncols == lpi->
spx->numColsReal() || (ncols == 0 && intInfo ==
NULL));
1036 lpi->
spx->setIntegralityInformation(ncols, intInfo);
1039 SCIPerrorMessage(
"SCIPlpiSetIntegralityInformation() has not been implemented yet.\n");
1088 assert(lpi !=
NULL);
1089 assert(name !=
NULL);
1096 SOPLEX_TRY( messagehdlr, (*lpi)->spx = new ((*lpi)->spx) SPxSCIP(messagehdlr, name) );
1097 (void) (*lpi)->spx->setIntParam(SoPlex::SYNCMODE, SoPlex::SYNCMODE_ONLYREAL);
1098 (void) (*lpi)->spx->setIntParam(SoPlex::SOLVEMODE, SoPlex::SOLVEMODE_REAL);
1099 (void) (*lpi)->spx->setIntParam(SoPlex::REPRESENTATION, SoPlex::REPRESENTATION_AUTO);
1102 #if SOPLEX_APIVERSION >= 10 1103 (void) (*lpi)->spx->setIntParam(SoPlex::STATTIMER, 0);
1106 (*lpi)->cstat =
NULL;
1107 (*lpi)->rstat =
NULL;
1108 (*lpi)->cstatsize = 0;
1109 (*lpi)->rstatsize = 0;
1111 (*lpi)->conditionlimit = -1.0;
1112 (*lpi)->checkcondition =
FALSE;
1113 (*lpi)->messagehdlr = messagehdlr;
1124 (*lpi)->spx->setInterrupt(
FALSE);
1125 SPxOut::Verbosity verbosity = (*lpi)->spx->spxout.getVerbosity();
1126 (*lpi)->spx->spxout.setVerbosity((SPxOut::Verbosity)((*lpi)->spx->getLpInfo() ?
SOPLEX_VERBLEVEL : 0));
1127 (*lpi)->spx->printVersion();
1128 (*lpi)->spx->spxout.setVerbosity(verbosity);
1139 assert(lpi !=
NULL);
1140 assert(*lpi !=
NULL);
1141 assert((*lpi)->spx !=
NULL);
1144 (*lpi)->spx->~SPxSCIP();
1189 for( j = 0; j < nnonz; j++ )
1190 assert( val[j] != 0 );
1196 assert(lpi !=
NULL);
1198 assert(lhs !=
NULL);
1199 assert(rhs !=
NULL);
1200 assert(obj !=
NULL);
1203 assert(beg !=
NULL);
1204 assert(ind !=
NULL);
1205 assert(val !=
NULL);
1208 assert(lpi->
spx->preStrongbranchingBasisFreed());
1212 SPxSCIP* spx = lpi->
spx;
1213 LPRowSet rows(nrows);
1214 DSVector emptyVector(0);
1220 (void) spx->setIntParam(SoPlex::OBJSENSE, (objsen ==
SCIP_OBJSEN_MINIMIZE ? SoPlex::OBJSENSE_MINIMIZE : SoPlex::OBJSENSE_MAXIMIZE));
1223 for( i = 0; i < nrows; ++i )
1224 rows.add(lhs[i], emptyVector, rhs[i]);
1225 spx->addRowsReal(rows);
1231 catch(
const SPxException&
x )
1233 std::string s =
x.what();
1236 catch(
const SPxException& )
1261 assert(lpi !=
NULL);
1263 assert(obj !=
NULL);
1266 assert(nnonz == 0 || beg !=
NULL);
1267 assert(nnonz == 0 || ind !=
NULL);
1268 assert(nnonz == 0 || val !=
NULL);
1274 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1280 int nrows = lpi->
spx->numRowsReal();
1281 for (
int j = 0; j < nnonz; ++j)
1283 assert( 0 <= ind[j] && ind[j] < nrows );
1284 assert( val[j] != 0.0 );
1289 SPxSCIP* spx = lpi->
spx;
1292 LPColSet cols(ncols);
1293 DSVector colVector(ncols);
1299 for( i = 0; i < ncols; ++i )
1305 last = (i == ncols-1 ? nnonz : beg[i+1]);
1306 colVector.add( last-start, &ind[start], &val[start] );
1308 cols.add(obj[i], lb[i], colVector, ub[i]);
1310 spx->addColsReal(cols);
1313 catch(
const SPxException&
x )
1315 std::string s =
x.what();
1318 catch(
const SPxException& )
1336 assert(lpi !=
NULL);
1338 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
1342 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1362 assert(lpi !=
NULL);
1364 assert(dstat !=
NULL);
1368 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1370 ncols = lpi->
spx->numColsReal();
1373 for( i = 0; i < ncols; ++i )
1396 assert(lpi !=
NULL);
1398 assert(lhs !=
NULL);
1399 assert(rhs !=
NULL);
1400 assert(nnonz == 0 || beg !=
NULL);
1401 assert(nnonz == 0 || ind !=
NULL);
1402 assert(nnonz == 0 || val !=
NULL);
1406 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1412 int ncols = lpi->
spx->numColsReal();
1413 for (
int j = 0; j < nnonz; ++j)
1415 assert( val[j] != 0.0 );
1416 assert( 0 <= ind[j] && ind[j] < ncols );
1423 SPxSCIP* spx = lpi->
spx;
1424 LPRowSet rows(nrows);
1431 for( i = 0; i < nrows; ++i )
1437 last = (i == nrows-1 ? nnonz : beg[i+1]);
1438 rowVector.add( last-start, &ind[start], &val[start] );
1440 rows.add(lhs[i], rowVector, rhs[i]);
1442 spx->addRowsReal(rows);
1445 catch(
const SPxException&
x )
1447 std::string s =
x.what();
1450 catch(
const SPxException& )
1468 assert(lpi !=
NULL);
1470 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
1474 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1494 assert(lpi !=
NULL);
1499 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1501 nrows = lpi->
spx->numRowsReal();
1504 for( i = 0; i < nrows; ++i )
1519 assert(lpi !=
NULL);
1524 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1543 assert(lpi !=
NULL);
1545 assert(ncols == 0 || (ind !=
NULL && lb !=
NULL && ub !=
NULL));
1551 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1555 for( i = 0; i < ncols; ++i )
1557 assert(0 <= ind[i] && ind[i] < lpi->
spx->numColsReal());
1561 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[i]);
1566 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[i]);
1570 lpi->
spx->changeBoundsReal(ind[i], lb[i], ub[i]);
1571 assert(lpi->
spx->lowerReal(ind[i]) <= lpi->
spx->upperReal(ind[i]) + lpi->
spx->realParam(SoPlex::EPSILON_ZERO));
1575 catch(
const SPxException&
x )
1577 std::string s =
x.what();
1580 catch(
const SPxException& )
1602 assert(lpi !=
NULL);
1604 assert(ind !=
NULL);
1605 assert(lhs !=
NULL);
1606 assert(rhs !=
NULL);
1612 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1616 for( i = 0; i < nrows; ++i )
1618 assert(0 <= ind[i] && ind[i] < lpi->
spx->numRowsReal());
1619 lpi->
spx->changeRangeReal(ind[i], lhs[i], rhs[i]);
1620 assert(lpi->
spx->lhsReal(ind[i]) <= lpi->
spx->rhsReal(ind[i]) + lpi->
spx->realParam(SoPlex::EPSILON_ZERO));
1624 catch(
const SPxException&
x )
1626 std::string s =
x.what();
1629 catch(
const SPxException& )
1648 assert(lpi !=
NULL);
1650 assert(0 <= row && row < lpi->spx->numRowsReal());
1651 assert(0 <= col && col < lpi->spx->numColsReal());
1655 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1670 assert(lpi !=
NULL);
1675 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1694 assert(lpi !=
NULL);
1696 assert(ind !=
NULL);
1697 assert(obj !=
NULL);
1701 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1705 for( i = 0; i < ncols; ++i )
1707 assert(0 <= ind[i] && ind[i] < lpi->
spx->numColsReal());
1708 lpi->
spx->changeObjReal(ind[i], obj[i]);
1712 catch(
const SPxException&
x )
1714 std::string s =
x.what();
1717 catch(
const SPxException& )
1738 assert(lpi !=
NULL);
1740 assert(scaleval != 0.0);
1746 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1749 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1750 SVector rowvec = lpi->
spx->rowVectorRealInternal(row);
1752 SVector rowvec = lpi->
spx->rowVectorReal(row);
1754 lhs = lpi->
spx->lhsReal(row);
1755 rhs = lpi->
spx->rhsReal(row);
1761 if( lhs > -lpi->
spx->realParam(SoPlex::INFTY) )
1763 else if( scaleval < 0.0 )
1764 lhs = lpi->
spx->realParam(SoPlex::INFTY);
1765 if( rhs < lpi->spx->realParam(SoPlex::INFTY) )
1767 else if( scaleval < 0.0 )
1768 rhs = -lpi->
spx->realParam(SoPlex::INFTY);
1769 if( scaleval < 0.0 )
1777 LPRow lprow(lhs, rowvec, rhs);
1780 lpi->
spx->changeRowReal(row, lprow);
1781 assert(lpi->
spx->lhsReal(row) <= lpi->
spx->rhsReal(row));
1784 catch(
const SPxException&
x )
1786 std::string s =
x.what();
1789 catch(
const SPxException& )
1813 assert(lpi !=
NULL);
1815 assert(scaleval != 0.0);
1821 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1824 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1825 SVector colvec = lpi->
spx->colVectorRealInternal(col);
1827 SVector colvec = lpi->
spx->colVectorReal(col);
1829 obj = lpi->
spx->objReal(col);
1830 lb = lpi->
spx->lowerReal(col);
1831 ub = lpi->
spx->upperReal(col);
1840 if( lb > -lpi->
spx->realParam(SoPlex::INFTY) )
1842 else if( scaleval < 0.0 )
1843 lb = lpi->
spx->realParam(SoPlex::INFTY);
1844 if( ub < lpi->spx->realParam(SoPlex::INFTY) )
1846 else if( scaleval < 0.0 )
1847 ub = -lpi->
spx->realParam(SoPlex::INFTY);
1848 if( scaleval < 0.0 )
1856 LPCol lpcol(obj, colvec, ub, lb);
1859 lpi->
spx->changeColReal(col, lpcol);
1860 assert(lpi->
spx->lowerReal(col) <= lpi->
spx->upperReal(col));
1863 catch(
const SPxException&
x )
1865 std::string s =
x.what();
1868 catch(
const SPxException& )
1897 assert(lpi !=
NULL);
1899 assert(nrows !=
NULL);
1901 *nrows = lpi->
spx->numRowsReal();
1914 assert(lpi !=
NULL);
1916 assert(ncols !=
NULL);
1918 *ncols = lpi->
spx->numColsReal();
1933 assert(lpi !=
NULL);
1935 assert(nnonz !=
NULL);
1939 if( lpi->
spx->numRowsReal() < lpi->
spx->numColsReal() )
1941 for( i = 0; i < lpi->
spx->numRowsReal(); ++i )
1943 (*nnonz) += lpi->
spx->rowVectorRealInternal(i).size();
1945 (*nnonz) += lpi->
spx->rowVectorReal(i).size();
1950 for( i = 0; i < lpi->
spx->numColsReal(); ++i )
1952 (*nnonz) += lpi->
spx->colVectorRealInternal(i).size();
1954 (*nnonz) += lpi->
spx->colVectorReal(i).size();
1982 assert(lpi !=
NULL);
1984 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
1990 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1991 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
1993 DVector lbvec(lpi->
spx->numColsReal());
1994 DVector ubvec(lpi->
spx->numColsReal());
1995 lpi->
spx->getLowerReal(lbvec);
1996 lpi->
spx->getUpperReal(ubvec);
1997 for( i = firstcol; i <= lastcol; ++i )
1999 lb[i-firstcol] = lbvec[i];
2000 ub[i-firstcol] = ubvec[i];
2005 const Vector& lbvec = lpi->
spx->lowerRealInternal();
2006 const Vector& ubvec = lpi->
spx->upperRealInternal();
2007 for( i = firstcol; i <= lastcol; ++i )
2009 lb[i-firstcol] = lbvec[i];
2010 ub[i-firstcol] = ubvec[i];
2014 const Vector& lbvec = lpi->
spx->lowerReal();
2015 const Vector& ubvec = lpi->
spx->upperReal();
2017 for( i = firstcol; i <= lastcol; ++i )
2019 lb[i-firstcol] = lbvec[i];
2020 ub[i-firstcol] = ubvec[i];
2028 for( i = firstcol; i <= lastcol; ++i )
2030 beg[i-firstcol] = *nnonz;
2032 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2033 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2036 lpi->
spx->getColVectorReal(i, cvec);
2037 for( j = 0; j < cvec.size(); ++j )
2039 ind[*nnonz] = cvec.index(j);
2040 val[*nnonz] = cvec.value(j);
2046 const SVector& cvec = lpi->
spx->colVectorRealInternal(i);
2047 for( j = 0; j < cvec.size(); ++j )
2049 ind[*nnonz] = cvec.index(j);
2050 val[*nnonz] = cvec.value(j);
2055 const SVector& cvec = lpi->
spx->colVectorReal(i);
2056 for( j = 0; j < cvec.size(); ++j )
2058 ind[*nnonz] = cvec.index(j);
2059 val[*nnonz] = cvec.value(j);
2090 assert(lpi !=
NULL);
2092 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
2098 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2099 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2101 DVector lhsvec(lpi->
spx->numRowsReal());
2102 DVector rhsvec(lpi->
spx->numRowsReal());
2103 lpi->
spx->getLhsReal(lhsvec);
2104 lpi->
spx->getRhsReal(rhsvec);
2105 for( i = firstrow; i <= lastrow; ++i )
2107 lhs[i-firstrow] = lhsvec[i];
2108 rhs[i-firstrow] = rhsvec[i];
2113 const Vector& lhsvec = lpi->
spx->lhsRealInternal();
2114 const Vector& rhsvec = lpi->
spx->rhsRealInternal();
2115 for( i = firstrow; i <= lastrow; ++i )
2117 lhs[i-firstrow] = lhsvec[i];
2118 rhs[i-firstrow] = rhsvec[i];
2122 const Vector& lhsvec = lpi->
spx->lhsReal();
2123 const Vector& rhsvec = lpi->
spx->rhsReal();
2124 for( i = firstrow; i <= lastrow; ++i )
2126 lhs[i-firstrow] = lhsvec[i];
2127 rhs[i-firstrow] = rhsvec[i];
2135 for( i = firstrow; i <= lastrow; ++i )
2137 beg[i-firstrow] = *nnonz;
2139 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2140 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2143 lpi->
spx->getRowVectorReal(i, rvec);
2144 for( j = 0; j < rvec.size(); ++j )
2146 ind[*nnonz] = rvec.index(j);
2147 val[*nnonz] = rvec.value(j);
2153 const SVector& rvec = lpi->
spx->rowVectorRealInternal(i);
2154 for( j = 0; j < rvec.size(); ++j )
2156 ind[*nnonz] = rvec.index(j);
2157 val[*nnonz] = rvec.value(j);
2162 const SVector& rvec = lpi->
spx->rowVectorReal(i);
2163 for( j = 0; j < rvec.size(); ++j )
2165 ind[*nnonz] = rvec.index(j);
2166 val[*nnonz] = rvec.value(j);
2183 int namestoragesize,
2187 assert( lpi !=
NULL );
2189 assert( colnames !=
NULL || namestoragesize == 0 );
2190 assert( namestorage !=
NULL || namestoragesize == 0 );
2191 assert( namestoragesize >= 0 );
2192 assert( storageleft !=
NULL );
2193 assert( 0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal() );
2209 int namestoragesize,
2213 assert( lpi !=
NULL );
2215 assert( rownames !=
NULL || namestoragesize == 0 );
2216 assert( namestorage !=
NULL || namestoragesize == 0 );
2217 assert( namestoragesize >= 0 );
2218 assert( storageleft !=
NULL );
2219 assert( 0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal() );
2236 assert(lpi !=
NULL);
2238 assert(objsen !=
NULL);
2257 assert(lpi !=
NULL);
2259 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
2260 assert(vals !=
NULL);
2262 for( i = firstcol; i <= lastcol; ++i )
2263 vals[i-firstcol] = lpi->
spx->objReal(i);
2281 assert(lpi !=
NULL);
2283 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
2285 for( i = firstcol; i <= lastcol; ++i )
2288 lbs[i-firstcol] = lpi->
spx->lowerReal(i);
2290 ubs[i-firstcol] = lpi->
spx->upperReal(i);
2309 assert(lpi !=
NULL);
2311 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
2313 for( i = firstrow; i <= lastrow; ++i )
2316 lhss[i-firstrow] = lpi->
spx->lhsReal(i);
2318 rhss[i-firstrow] = lpi->
spx->rhsReal(i);
2334 assert(lpi !=
NULL);
2336 assert(0 <= col && col < lpi->spx->numColsReal());
2337 assert(0 <= row && row < lpi->spx->numRowsReal());
2338 assert(val !=
NULL);
2340 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2341 *val = lpi->
spx->coefReal(row, col);
2343 *val = lpi->
spx->colVectorReal(col)[row];
2367 assert( lpi !=
NULL );
2370 SPxOut::Verbosity verbosity;
2372 verbosity = lpi->
spx->spxout.getVerbosity();
2375 SCIPdebugMessage(
"calling SoPlex solve(): %d cols, %d rows\n", lpi->
spx->numColsReal(), lpi->
spx->numRowsReal());
2379 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2381 #ifdef SCIP_WITH_LPSCHECK 2382 lpi->
spx->setDoubleCheck(CHECK_SPXSOLVE);
2386 if( lpi->
spx->getFromScratch() )
2390 lpi->
spx->clearBasis();
2393 catch(
const SPxException&
x)
2395 std::string s = x.what();
2398 catch(
const SPxException&)
2401 assert( lpi->
spx->status() != SPxSolver::OPTIMAL );
2405 assert(!lpi->
spx->getFromScratch() || lpi->
spx->status() == SPxSolver::NO_PROBLEM);
2407 SPxSolver::Status status = lpi->
spx->doSolve();
2408 SCIPdebugMessage(
" -> SoPlex status: %d, basis status: %d\n", lpi->
spx->status(), lpi->
spx->basisStatus());
2412 lpi->
spx->spxout.setVerbosity(verbosity);
2416 case SPxSolver::ABORT_TIME:
2417 case SPxSolver::ABORT_ITER:
2418 case SPxSolver::ABORT_VALUE:
2419 case SPxSolver::SINGULAR:
2420 case SPxSolver::REGULAR:
2422 case SPxSolver::OPTIMAL:
2423 #if SOPLEX_APIVERSION >= 3 2424 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2426 case SPxSolver::UNBOUNDED:
2427 case SPxSolver::INFEASIBLE:
2441 assert(lpi !=
NULL);
2444 (void) lpi->
spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_PRIMAL);
2455 assert(lpi !=
NULL);
2458 (void) lpi->
spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_DUAL);
2468 assert(lpi !=
NULL);
2482 assert(lpi !=
NULL);
2485 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2486 lpi->
spx->savePreStrongbranchingBasis();
2496 assert(lpi !=
NULL);
2499 assert( ! lpi->
spx->preStrongbranchingBasisFreed() );
2500 lpi->
spx->restorePreStrongbranchingBasis();
2501 lpi->
spx->freePreStrongbranchingBasis();
2522 assert(lpi !=
NULL);
2526 SPxSolver::Status status;
2531 bool fromparentbasis;
2534 SPxOut::Verbosity verbosity;
2537 verbosity = lpi->
spx->spxout.getVerbosity();
2540 SCIPdebugMessage(
"calling SCIPlpiStrongbranch() on variable %d (%d iterations)\n", col, itlim);
2542 assert(lpi !=
NULL);
2546 assert(downvalid !=
NULL);
2547 assert(upvalid !=
NULL);
2550 #ifndef STRONGBRANCH_RESTOREBASIS 2551 fromparentbasis =
false;
2554 oldItlim = spx->intParam(SoPlex::ITERLIMIT);
2557 oldlb = spx->lowerReal(col);
2558 oldub = spx->upperReal(col);
2567 (void) spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_DUAL);
2570 newub =
EPSCEIL(psol-1.0, lpi->
spx->feastol());
2571 if( newub >= oldlb - 0.5 && down !=
NULL )
2573 SCIPdebugMessage(
"strong branching down on x%d (%g) with %d iterations\n", col, psol, itlim);
2575 spx->changeUpperReal(col, newub);
2576 assert(spx->lowerReal(col) <= spx->upperReal(col));
2578 (void) spx->setIntParam(SoPlex::ITERLIMIT, itlim);
2581 #ifndef STRONGBRANCH_RESTOREBASIS 2584 #ifdef SCIP_WITH_LPSCHECK 2585 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
2587 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2588 #if SOPLEX_APIVERSION > 11 2589 status = spx->optimize(spx->getInterrupt());
2591 status = spx->optimize();
2594 status = spx->solve();
2599 case SPxSolver::OPTIMAL:
2600 *down = spx->objValueReal();
2604 case SPxSolver::ABORT_TIME:
2605 case SPxSolver::ABORT_ITER:
2606 case SPxSolver::ABORT_CYCLING:
2607 #if SOPLEX_APIVERSION >= 3 2608 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2610 *down = spx->objValueReal();
2612 case SPxSolver::ABORT_VALUE:
2613 case SPxSolver::INFEASIBLE:
2614 *down = spx->getObjLimit();
2622 (*iter) += spx->numIterations();
2624 #ifdef STRONGBRANCH_RESTOREBASIS 2626 assert( ! spx->preStrongbranchingBasisFreed() );
2627 spx->restorePreStrongbranchingBasis();
2628 fromparentbasis =
false;
2632 #if SOPLEX_APIVERSION >= 3 2633 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS
2634 || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->numIterations() < itlim);
2636 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR)
2637 && !fromparentbasis && spx->numIterations() < itlim);
2639 if( repeatstrongbranching )
2641 SCIPdebugMessage(
" --> Repeat strong branching down with %d iterations after restoring basis\n",
2642 itlim - spx->numIterations());
2643 spx->setIntParam(SoPlex::ITERLIMIT, itlim - spx->numIterations());
2644 spx->restorePreStrongbranchingBasis();
2645 fromparentbasis =
true;
2650 fromparentbasis =
false;
2653 while( fromparentbasis );
2655 spx->changeUpperReal(col, oldub);
2656 assert(spx->lowerReal(col) <= spx->upperReal(col));
2658 else if( down !=
NULL )
2660 *down = spx->getObjLimit();
2670 if( newlb <= oldub + 0.5 && up !=
NULL )
2672 SCIPdebugMessage(
"strong branching up on x%d (%g) with %d iterations\n", col, psol, itlim);
2674 spx->changeLowerReal(col, newlb);
2675 assert(spx->lowerReal(col) <= spx->upperReal(col));
2677 (void) spx->setIntParam(SoPlex::ITERLIMIT, itlim);
2680 #ifndef STRONGBRANCH_RESTOREBASIS 2683 #ifdef SCIP_WITH_LPSCHECK 2684 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
2686 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2687 #if SOPLEX_APIVERSION > 11 2688 status = spx->optimize(spx->getInterrupt());
2690 status = spx->optimize();
2693 status = spx->solve();
2698 case SPxSolver::OPTIMAL:
2699 *up = spx->objValueReal();
2703 case SPxSolver::ABORT_TIME:
2704 case SPxSolver::ABORT_ITER:
2705 case SPxSolver::ABORT_CYCLING:
2706 #if SOPLEX_APIVERSION >= 3 2707 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2709 *up = spx->objValueReal();
2711 case SPxSolver::ABORT_VALUE:
2712 case SPxSolver::INFEASIBLE:
2713 *up = spx->getObjLimit();
2721 (*iter) += spx->numIterations();
2723 #ifdef STRONGBRANCH_RESTOREBASIS 2725 assert( ! spx->preStrongbranchingBasisFreed() );
2726 spx->restorePreStrongbranchingBasis();
2727 fromparentbasis =
false;
2731 #if SOPLEX_APIVERSION >= 3 2732 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS
2733 || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->numIterations() < itlim);
2735 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR)
2736 && !fromparentbasis && spx->numIterations() < itlim);
2738 if( repeatstrongbranching )
2740 SCIPdebugMessage(
" --> Repeat strong branching up with %d iterations after restoring basis\n", itlim - spx->numIterations());
2741 spx->restorePreStrongbranchingBasis();
2742 spx->setIntParam(SoPlex::ITERLIMIT, itlim - spx->numIterations());
2744 fromparentbasis =
true;
2748 fromparentbasis =
false;
2751 while( fromparentbasis );
2753 spx->changeLowerReal(col, oldlb);
2754 assert(spx->lowerReal(col) <= spx->upperReal(col));
2756 else if( up !=
NULL )
2758 *up = spx->getObjLimit();
2766 (void) spx->setIntParam(SoPlex::ITERLIMIT, oldItlim);
2769 lpi->
spx->spxout.setVerbosity(verbosity);
2773 SCIPdebugMessage(
"SCIPlpiStrongbranch() returned SoPlex status %d\n",
int(status));
2798 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
2828 assert( cols !=
NULL );
2829 assert( psols !=
NULL );
2830 assert( down !=
NULL );
2831 assert( up !=
NULL );
2832 assert( downvalid !=
NULL );
2833 assert( upvalid !=
NULL );
2834 assert( down !=
NULL );
2839 for (
int j = 0; j < ncols; ++j)
2842 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
2872 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
2902 assert( cols !=
NULL );
2903 assert( psols !=
NULL );
2904 assert( down !=
NULL );
2905 assert( up !=
NULL );
2906 assert( downvalid !=
NULL );
2907 assert( upvalid !=
NULL );
2908 assert( down !=
NULL );
2913 for (
int j = 0; j < ncols; ++j)
2916 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
2945 assert(lpi !=
NULL);
2968 assert(lpi !=
NULL);
2969 assert(primalfeasible !=
NULL);
2970 assert(dualfeasible !=
NULL);
2987 assert(lpi !=
NULL);
2990 return (lpi->
spx->status() == SPxSolver::UNBOUNDED);
3002 assert(lpi !=
NULL);
3005 return lpi->
spx->hasPrimalRay();
3015 assert(lpi !=
NULL);
3018 assert(lpi->
spx->status() != SPxSolver::UNBOUNDED || lpi->
spx->basisStatus() == SPxBasis::UNBOUNDED);
3023 return lpi->
spx->status() == SPxSolver::UNBOUNDED;
3033 assert(lpi !=
NULL);
3036 return (lpi->
spx->status() == SPxSolver::INFEASIBLE);
3046 assert(lpi !=
NULL);
3049 return lpi->
spx->basisStatus() == SPxBasis::OPTIMAL || lpi->
spx->basisStatus() == SPxBasis::PRIMAL;
3061 assert(lpi !=
NULL);
3064 return (lpi->
spx->status() == SPxSolver::INFEASIBLE);
3076 assert(lpi !=
NULL);
3079 return lpi->
spx->hasDualFarkas();
3089 assert(lpi !=
NULL);
3092 return lpi->
spx->status() == SPxSolver::INFEASIBLE && lpi->
spx->basisStatus() == SPxBasis::DUAL;
3102 assert(lpi !=
NULL);
3105 return (lpi->
spx->status() == SPxSolver::UNBOUNDED);
3115 assert(lpi !=
NULL);
3118 return (lpi->
spx->basisStatus() == SPxBasis::OPTIMAL) || lpi->
spx->basisStatus() == SPxBasis::DUAL;
3128 assert(lpi !=
NULL);
3130 assert((lpi->
spx->basisStatus() == SPxBasis::OPTIMAL)
3133 return (lpi->
spx->status() == SPxSolver::OPTIMAL);
3149 assert(lpi !=
NULL);
3154 #if SOPLEX_APIVERSION >= 3 3155 if( lpi->
spx->status() == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS )
3186 assert(lpi !=
NULL);
3189 return (lpi->
spx->status() == SPxSolver::ABORT_VALUE);
3199 assert(lpi !=
NULL);
3202 return (lpi->
spx->status() == SPxSolver::ABORT_ITER);
3212 assert(lpi !=
NULL);
3215 return (lpi->
spx->status() == SPxSolver::ABORT_TIME);
3225 assert(lpi !=
NULL);
3228 return static_cast<int>(lpi->
spx->status());
3239 assert(lpi !=
NULL);
3241 assert(success !=
NULL);
3243 #if SOPLEX_APIVERSION >= 4 3244 *success = lpi->
spx->ignoreUnscaledViolations();
3260 assert(lpi !=
NULL);
3262 assert(objval !=
NULL);
3264 *objval = lpi->
spx->objValueReal();
3285 assert(lpi !=
NULL);
3288 if( objval !=
NULL )
3289 *objval = lpi->
spx->objValueReal();
3293 if( primsol !=
NULL )
3295 #if SOPLEX_APIVERSION > 10 3296 (void)lpi->
spx->getPrimalReal(primsol, lpi->
spx->numColsReal());
3298 Vector tmp(lpi->
spx->numColsReal(), primsol);
3299 (void)lpi->
spx->getPrimalReal(tmp);
3302 if( dualsol !=
NULL )
3304 #if SOPLEX_APIVERSION > 10 3305 (void)lpi->
spx->getDualReal(dualsol, lpi->
spx->numRowsReal());
3307 Vector tmp(lpi->
spx->numRowsReal(), dualsol);
3308 (void)lpi->
spx->getDualReal(tmp);
3311 if( activity !=
NULL )
3313 #if SOPLEX_APIVERSION > 10 3314 (void)lpi->
spx->getSlacksReal(activity, lpi->
spx->numRowsReal());
3316 Vector tmp(lpi->
spx->numRowsReal(), activity);
3317 (void)lpi->
spx->getSlacksReal(tmp);
3320 if( redcost !=
NULL )
3322 #if SOPLEX_APIVERSION > 10 3323 (void)lpi->
spx->getRedCostReal(redcost, lpi->
spx->numColsReal());
3325 Vector tmp(lpi->
spx->numColsReal(), redcost);
3326 (void)lpi->
spx->getRedCostReal(tmp);
3331 catch(
const SPxException&
x )
3333 std::string s =
x.what();
3336 catch(
const SPxException& )
3353 assert(lpi !=
NULL);
3355 assert(lpi->
spx->hasPrimalRay());
3356 assert(ray !=
NULL);
3360 #if SOPLEX_APIVERSION > 10 3361 (void)lpi->
spx->getPrimalRayReal(ray, lpi->
spx->numColsReal());
3363 Vector tmp(lpi->
spx->numColsReal(), ray);
3364 (void)lpi->
spx->getPrimalRayReal(tmp);
3368 catch(
const SPxException&
x )
3370 std::string s =
x.what();
3373 catch(
const SPxException& )
3390 assert(lpi !=
NULL);
3392 assert(lpi->
spx->hasDualFarkas());
3393 assert(dualfarkas !=
NULL);
3397 #if SOPLEX_APIVERSION > 10 3398 (void)lpi->
spx->getDualFarkasReal(dualfarkas, lpi->
spx->numRowsReal());
3400 Vector tmp(lpi->
spx->numRowsReal(), dualfarkas);
3401 (void)lpi->
spx->getDualFarkasReal(tmp);
3405 catch(
const SPxException&
x )
3407 std::string s =
x.what();
3410 catch(
const SPxException& )
3427 assert(lpi !=
NULL);
3429 assert(iterations !=
NULL);
3431 *iterations = lpi->
spx->numIterations();
3449 assert(lpi !=
NULL);
3450 assert(quality !=
NULL);
3454 SCIPdebugMessage(
"requesting solution quality from SoPlex: quality %d\n", qualityindicator);
3456 switch( qualityindicator )
3459 success = lpi->
spx->getEstimatedCondition(*quality);
3463 success = lpi->
spx->getExactCondition(*quality);
3504 assert(lpi !=
NULL);
3507 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3511 for( i = 0; i < lpi->
spx->numRowsReal(); ++i )
3513 switch( lpi->
spx->basisRowStatus(i) )
3515 case SPxSolver::BASIC:
3518 case SPxSolver::FIXED:
3519 case SPxSolver::ON_LOWER:
3522 case SPxSolver::ON_UPPER:
3525 case SPxSolver::ZERO:
3526 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
3528 case SPxSolver::UNDEFINED:
3539 for( i = 0; i < lpi->
spx->numColsReal(); ++i )
3542 switch( lpi->
spx->basisColStatus(i) )
3544 case SPxSolver::BASIC:
3547 case SPxSolver::FIXED:
3561 case SPxSolver::ON_LOWER:
3564 case SPxSolver::ON_UPPER:
3567 case SPxSolver::ZERO:
3570 case SPxSolver::UNDEFINED:
3595 assert(lpi !=
NULL);
3601 assert(cstat !=
NULL || ncols == 0);
3602 assert(rstat !=
NULL || nrows == 0);
3604 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3607 DataArray<SPxSolver::VarStatus>& _colstat = lpi->
spx->colStat();
3608 DataArray<SPxSolver::VarStatus>& _rowstat = lpi->
spx->rowStat();
3610 _colstat.reSize(ncols);
3611 _rowstat.reSize(nrows);
3613 for( i = 0; i < nrows; ++i )
3618 _rowstat[i] = SPxSolver::ON_LOWER;
3621 _rowstat[i] = SPxSolver::BASIC;
3624 _rowstat[i] = SPxSolver::ON_UPPER;
3627 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
3636 for( i = 0; i < ncols; ++i )
3641 _colstat[i] = SPxSolver::ON_LOWER;
3644 _colstat[i] = SPxSolver::BASIC;
3647 _colstat[i] = SPxSolver::ON_UPPER;
3650 _colstat[i] = SPxSolver::ZERO;
3660 lpi->
spx->freePreStrongbranchingBasis();
3673 assert(lpi !=
NULL);
3675 assert(bind !=
NULL);
3677 assert(lpi->
spx->preStrongbranchingBasisFreed());
3679 lpi->
spx->getBasisInd(bind);
3702 assert(lpi !=
NULL);
3704 assert(lpi->
spx->preStrongbranchingBasisFreed());
3705 assert(coef !=
NULL);
3708 assert(r < lpi->spx->numRowsReal());
3710 if( ! lpi->
spx->getBasisInverseRowReal(
r, coef, inds, ninds) )
3737 assert( lpi !=
NULL );
3739 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3740 assert(coef !=
NULL);
3742 if( ! lpi->
spx->getBasisInverseColReal(c, coef, inds, ninds) )
3772 assert(lpi !=
NULL);
3774 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3775 assert(coef !=
NULL);
3777 nrows = lpi->
spx->numRowsReal();
3778 ncols = lpi->
spx->numColsReal();
3782 if( binvrow ==
NULL )
3791 assert(binv !=
NULL);
3799 Vector binvvec(nrows, binv);
3801 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3806 for( c = 0; c < ncols; ++c )
3808 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3809 lpi->
spx->getColVectorReal(c, acol);
3810 coef[c] = binvvec * acol;
3812 coef[c] = binvvec * lpi->
spx->colVectorReal(c);
3838 DVector col(lpi->
spx->numRowsReal());
3840 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3847 assert( lpi !=
NULL );
3849 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3850 assert(coef !=
NULL);
3854 assert(c < lpi->spx->numColsReal());
3864 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3865 lpi->
spx->getColVectorReal(c, colsparse);
3869 col = lpi->
spx->colVectorReal(c);
3873 if( ! lpi->
spx->getBasisInverseTimesVecReal(col.get_ptr(), coef) )
3903 assert(blkmem !=
NULL);
3904 assert(lpi !=
NULL);
3906 assert(lpistate !=
NULL);
3908 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3910 ncols = lpi->
spx->numColsReal();
3911 nrows = lpi->
spx->numRowsReal();
3926 (*lpistate)->ncols = ncols;
3927 (*lpistate)->nrows = nrows;
3948 assert(lpi !=
NULL);
3950 assert(lpistate !=
NULL);
3953 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3955 lpncols = lpi->
spx->numColsReal();
3956 lpnrows = lpi->
spx->numRowsReal();
3957 assert(lpistate->
ncols <= lpncols);
3958 assert(lpistate->
nrows <= lpnrows);
3968 for( i = lpistate->
ncols; i < lpncols; ++i )
3974 bnd = lpi->
spx->lowerReal(i);
3986 for( i = lpistate->
nrows; i < lpnrows; ++i )
4002 assert(lpi !=
NULL);
4007 lpi->
spx->clearBasis();
4010 catch(
const SPxException&
x )
4012 std::string s = x.what();
4015 catch(
const SPxException& )
4018 assert( lpi->
spx->status() != SPxSolver::OPTIMAL );
4034 assert(lpi !=
NULL);
4035 assert(lpistate !=
NULL);
4036 assert(blkmem !=
NULL);
4038 if ( *lpistate !=
NULL )
4050 assert(lpi !=
NULL);
4061 assert(lpi !=
NULL);
4063 assert(fname !=
NULL);
4065 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4079 assert(lpi !=
NULL);
4081 assert(fname !=
NULL);
4084 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4116 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4120 assert(blkmem !=
NULL);
4121 assert(lpi !=
NULL);
4123 assert(lpinorms !=
NULL);
4125 lpi->
spx->getNdualNorms(nrows, ncols);
4127 if( nrows == 0 && ncols == 0)
4136 (*lpinorms)->nrows = 0;
4137 (*lpinorms)->ncols = 0;
4139 SCIPdebugMessage(
"storing SoPlex LPi pricing norms in %p (%d rows, %d cols)\n", (
void *) *lpinorms, nrows, ncols);
4141 if( !lpi->
spx->getDualNorms((*lpinorms)->nrows, (*lpinorms)->ncols, (*lpinorms)->norms) )
4146 assert(*lpinorms ==
NULL);
4151 assert(nrows == (*lpinorms)->nrows);
4152 assert(ncols == (*lpinorms)->ncols);
4171 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4172 assert(blkmem !=
NULL);
4173 assert(lpi !=
NULL);
4177 if( lpinorms ==
NULL )
4180 assert(lpinorms->
nrows <= lpi->
spx->numRowsReal());
4181 assert(lpinorms->
ncols <= lpi->
spx->numColsReal());
4183 if( lpinorms->
nrows == 0 )
4186 SCIPdebugMessage(
"loading LPi simplex norms %p (%d rows, %d cols) into SoPlex LP with %d rows and %d cols\n",
4187 (
const void *) lpinorms, lpinorms->
nrows, lpinorms->
ncols, lpi->
spx->numRowsReal(), lpi->
spx->numColsReal());
4202 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4203 assert(lpi !=
NULL);
4204 assert(lpinorms !=
NULL);
4210 assert(*lpinorms ==
NULL);
4239 assert(lpi !=
NULL);
4241 assert(ival !=
NULL);
4246 *ival = lpi->
spx->getFromScratch();
4249 *ival = lpi->
spx->getLpInfo();
4252 *ival = lpi->
spx->intParam(SoPlex::ITERLIMIT);
4257 *ival = lpi->
spx->intParam(SoPlex::SIMPLIFIER);
4263 scaleparam = lpi->
spx->intParam(SoPlex::SCALER);
4265 if( scaleparam == SoPlex::SCALER_OFF )
4267 else if( scaleparam == SoPlex::SCALER_BIEQUI )
4269 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 2) 4272 assert(scaleparam == SoPlex::SCALER_LEASTSQ);
4278 assert(scaleparam == SoPlex::SCALER_GEO8);
4283 #if SOPLEX_VERSION >= 201 4285 *ival = (int) (lpi->
spx->intParam(SoPlex::TIMER));
4288 #if SOPLEX_VERSION >= 230 || (SOPLEX_VERSION == 220 && SOPLEX_SUBVERSION >= 3) 4290 *ival = (int) lpi->
spx->randomSeed();
4293 #if SOPLEX_APIVERSION >= 1 4295 *ival = (int) lpi->
spx->intParam(SoPlex::FACTOR_UPDATE_MAX);
4314 assert(lpi !=
NULL);
4321 lpi->
spx->setFromScratch(
bool(ival));
4325 lpi->
spx->setLpInfo(
bool(ival));
4328 assert( ival >= 0 );
4330 if( ival >= INT_MAX )
4332 (void) lpi->
spx->setIntParam(SoPlex::ITERLIMIT, ival);
4336 #if SOPLEX_APIVERSION < 13 4339 assert(ival == 1 || ival == 0 || ival == 2);
4341 (void) lpi->
spx->setIntParam(SoPlex::SIMPLIFIER, ival);
4349 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_AUTO);
4352 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_STEEP);
4355 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_PARMULT);
4358 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_STEEP);
4361 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_QUICKSTEEP);
4364 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_DEVEX);
4371 assert(ival >= 0 && ival <= 2);
4373 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_OFF);
4374 else if( ival == 1 )
4375 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_BIEQUI);
4377 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 2) 4378 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_LEASTSQ);
4380 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_GEO8);
4384 #if SOPLEX_VERSION >= 201 4386 assert(ival >= 0 && ival < 3);
4387 (void) lpi->
spx->setIntParam(SoPlex::TIMER, ival);
4390 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3) 4392 lpi->
spx->setRandomSeed((
unsigned long)(
long)ival);
4395 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION >= 221 && SOPLEX_SUBVERSION >= 3) 4397 assert(ival >= 0 && ival < 3);
4398 (void) lpi->
spx->setIntParam(SoPlex::SOLUTION_POLISHING, ival);
4401 #if SOPLEX_APIVERSION >= 1 4404 (void) lpi->
spx->setIntParam(SoPlex::FACTOR_UPDATE_MAX, ival);
4424 assert(lpi !=
NULL);
4426 assert(dval !=
NULL);
4431 *dval = lpi->
spx->feastol();
4434 *dval = lpi->
spx->opttol();
4437 if ( lpi->
spx->intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE )
4438 *dval = lpi->
spx->realParam(SoPlex::OBJLIMIT_UPPER);
4440 *dval = lpi->
spx->realParam(SoPlex::OBJLIMIT_LOWER);
4443 *dval = lpi->
spx->realParam(SoPlex::TIMELIMIT);
4446 *dval = lpi->
spx->realParam(SoPlex::REPRESENTATION_SWITCH);
4454 #if (SOPLEX_APIVERSION >= 9) 4455 *dval = lpi->
spx->realParam(SoPlex::MIN_MARKOWITZ);
4474 assert(lpi !=
NULL);
4481 assert( dval > 0.0 );
4482 lpi->
spx->setFeastol(dval);
4486 assert( dval > 0.0 );
4487 lpi->
spx->setOpttol(dval);
4491 if ( lpi->
spx->intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE )
4492 (
void) lpi->
spx->setRealParam(SoPlex::OBJLIMIT_UPPER, dval);
4494 (
void) lpi->
spx->setRealParam(SoPlex::OBJLIMIT_LOWER, dval);
4497 assert( dval > 0.0 );
4499 (void) lpi->
spx->setRealParam(SoPlex::TIMELIMIT, dval);
4503 assert( dval >= 0.0 || dval == -1.0 );
4507 (
void) lpi->
spx->setRealParam(SoPlex::REPRESENTATION_SWITCH, dval);
4514 #if (SOPLEX_APIVERSION >= 9) 4518 else if( dval > 0.9999 )
4521 (void) lpi->
spx->setRealParam(SoPlex::MIN_MARKOWITZ, dval);
4537 assert(lpi !=
NULL);
4540 lpi->
spx->setInterrupt(interrupt);
4562 assert(lpi !=
NULL);
4565 return lpi->
spx->realParam(SoPlex::INFTY);
4574 assert(lpi !=
NULL);
4577 return (val >= lpi->
spx->realParam(SoPlex::INFTY));
4595 const char* filename
4600 f = fopen(filename,
"r");
4617 assert(lpi !=
NULL);
4619 assert(fname !=
NULL);
4621 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4628 assert(lpi->
spx->intParam(SoPlex::READMODE) == SoPlex::READMODE_REAL);
4629 if( !lpi->
spx->readFile(fname) )
4633 catch(
const SPxException&
x )
4635 std::string s =
x.what();
4638 catch(
const SPxException& )
4655 assert(lpi !=
NULL);
4657 assert(fname !=
NULL);
4661 (void) lpi->
spx->writeFileReal(fname);
4664 catch(
const SPxException&
x )
4666 std::string s =
x.what();
4669 catch(
const SPxException& )
SCIP_RETCODE SCIPlpiGetBInvCol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiGetNRows(SCIP_LPI *lpi, int *nrows)
enum SCIP_LPSolQuality SCIP_LPSOLQUALITY
SCIP_RETCODE SCIPlpiFree(SCIP_LPI **lpi)
SCIP_RETCODE SCIPlpiSetState(SCIP_LPI *lpi, BMS_BLKMEM *, const SCIP_LPISTATE *lpistate)
SCIP_Bool SCIPlpiIsInfinity(SCIP_LPI *lpi, SCIP_Real val)
#define BMSfreeMemoryArrayNull(ptr)
SCIP_Bool SCIPlpiIsDualUnbounded(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, const SCIP_LPINORMS *lpinorms)
SCIP_RETCODE SCIPlpiGetDualfarkas(SCIP_LPI *lpi, SCIP_Real *dualfarkas)
SCIP_RETCODE SCIPlpiStartStrongbranch(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetSol(SCIP_LPI *lpi, SCIP_Real *objval, SCIP_Real *primsol, SCIP_Real *dualsol, SCIP_Real *activity, SCIP_Real *redcost)
SCIP_RETCODE SCIPlpiSetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int ival)
enum SCIP_ObjSen SCIP_OBJSEN
SCIP_RETCODE SCIPlpiSolvePrimal(SCIP_LPI *lpi)
void * SCIPlpiGetSolverPointer(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetBase(SCIP_LPI *lpi, int *cstat, int *rstat)
void SCIPdecodeDualBit(const SCIP_DUALPACKET *inp, int *out, int count)
SCIP_RETCODE SCIPlpiChgSides(SCIP_LPI *lpi, int nrows, const int *ind, const SCIP_Real *lhs, const SCIP_Real *rhs)
SCIP_RETCODE SCIPlpiGetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int *ival)
interface methods for specific LP solvers
SCIP_RETCODE SCIPlpiGetIterations(SCIP_LPI *lpi, int *iterations)
static SCIP_RETCODE lpistateCreate(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem, int ncols, int nrows)
SCIP_RETCODE SCIPlpiGetNNonz(SCIP_LPI *lpi, int *nnonz)
static int rowpacketNum(int nrows)
static SCIP_RETCODE optimize(SCIP *scip, SCIP_SOL *worksol, SCIP_VAR **vars, int *blockstart, int *blockend, int nblocks, OPTTYPE opttype, SCIP_Real *activities, int nrows, SCIP_Bool *improvement, SCIP_Bool *varboundserr, SCIP_HEURDATA *heurdata)
static void invalidateSolution(SCIP_LPI *lpi)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPlpiSetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real dval)
SCIP_Bool SCIPlpiHasPrimalRay(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
enum SCIP_LPParam SCIP_LPPARAM
SCIP_RETCODE SCIPlpiGetNCols(SCIP_LPI *lpi, int *ncols)
#define BMSallocMemoryArray(ptr, num)
SCIP_RETCODE SCIPlpiReadState(SCIP_LPI *lpi, const char *fname)
SCIP_Bool SCIPlpiHasDualSolve(void)
SCIP_RETCODE SCIPlpiGetBounds(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lbs, SCIP_Real *ubs)
SCIP_RETCODE SCIPlpiClear(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetRealSolQuality(SCIP_LPI *lpi, SCIP_LPSOLQUALITY qualityindicator, SCIP_Real *quality)
SCIP_RETCODE SCIPlpiScaleCol(SCIP_LPI *lpi, int col, SCIP_Real scaleval)
SCIP_RETCODE SCIPlpiGetObjsen(SCIP_LPI *lpi, SCIP_OBJSEN *objsen)
#define BMSfreeMemory(ptr)
SCIP_RETCODE SCIPlpiSetIntegralityInformation(SCIP_LPI *lpi, int ncols, int *intInfo)
enum SCIP_Pricing SCIP_PRICING
static void lpistateFree(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem)
SCIP_RETCODE SCIPlpiClearState(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetCols(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lb, SCIP_Real *ub, int *nnonz, int *beg, int *ind, SCIP_Real *val)
SCIP_RETCODE SCIPlpiCreate(SCIP_LPI **lpi, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_OBJSEN objsen)
static SCIP_RETCODE ensureRstatMem(SCIP_LPI *lpi, int num)
SCIP_RETCODE SCIPlpiGetBInvARow(SCIP_LPI *lpi, int r, const SCIP_Real *binvrow, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiAddCols(SCIP_LPI *lpi, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
SCIP_Bool SCIPlpiIsPrimalUnbounded(SCIP_LPI *lpi)
int SCIPlpiGetInternalStatus(SCIP_LPI *lpi)
#define SOPLEX_TRY(messagehdlr, x)
SCIP_RETCODE SCIPlpiSolveDual(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsStable(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiAddRows(SCIP_LPI *lpi, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
SCIP_RETCODE SCIPlpiWriteLP(SCIP_LPI *lpi, const char *fname)
static SCIP_RETCODE ensureCstatMem(SCIP_LPI *lpi, int num)
packing single and dual bit values
static int colpacketNum(int ncols)
SCIP_RETCODE SCIPlpiGetBasisInd(SCIP_LPI *lpi, int *bind)
SCIP_RETCODE SCIPlpiStrongbranchesFrac(SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
SCIP_RETCODE SCIPlpiFreeState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
SCIP_Bool SCIPlpiIsPrimalInfeasible(SCIP_LPI *lpi)
static const char spxname[20]
SCIP_RETCODE SCIPlpiGetColNames(SCIP_LPI *lpi, int firstcol, int lastcol, char **colnames, char *namestorage, int namestoragesize, int *storageleft)
SCIP_RETCODE SCIPlpiStrongbranchFrac(SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
SCIP_RETCODE SCIPlpiStrongbranchesInt(SCIP_LPI *lpi, int *cols, int ncols, SCIP_Real *psols, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
const char * SCIPlpiGetSolverDesc(void)
SCIP_Bool SCIPlpiHasBarrierSolve(void)
static void setIntParam(SCIP_LPI *lpi, int const param, int const parval)
static SCIP_RETCODE lpiStrongbranch(SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
SCIP_RETCODE SCIPlpiGetSolFeasibility(SCIP_LPI *lpi, SCIP_Bool *primalfeasible, SCIP_Bool *dualfeasible)
SCIP_RETCODE SCIPlpiFreeNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
SCIP_RETCODE SCIPlpiDelRows(SCIP_LPI *lpi, int firstrow, int lastrow)
static SCIP_Bool fileExists(const char *filename)
void SCIPencodeDualBit(const int *inp, SCIP_DUALPACKET *out, int count)
SCIP_RETCODE SCIPlpiReadLP(SCIP_LPI *lpi, const char *fname)
#define CHECK_SOPLEX_PARAM(x)
SCIP_Bool SCIPlpiWasSolved(SCIP_LPI *lpi)
#define SOPLEX_SUBVERSION
#define BMSfreeBlockMemory(mem, ptr)
SCIP_Bool SCIPlpiExistsPrimalRay(SCIP_LPI *lpi)
unsigned int SCIP_DUALPACKET
SCIP_RETCODE SCIPlpiGetObjval(SCIP_LPI *lpi, SCIP_Real *objval)
SCIP_RETCODE SCIPlpiDelRowset(SCIP_LPI *lpi, int *dstat)
SCIP_Bool SCIPlpiHasStateBasis(SCIP_LPI *lpi, SCIP_LPISTATE *lpistate)
SCIP_RETCODE SCIPlpiDelCols(SCIP_LPI *lpi, int firstcol, int lastcol)
#define BMSallocBlockMemoryArray(mem, ptr, num)
SCIP_RETCODE SCIPlpiWriteState(SCIP_LPI *lpi, const char *fname)
SCIP_Real SCIPlpiInfinity(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiChgCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real newval)
SCIP_Bool SCIPlpiIsDualFeasible(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
SCIP_Bool SCIPlpiIsDualInfeasible(SCIP_LPI *lpi)
#define BMSallocMemoryCPP(size)
#define BMSfreeBlockMemoryArray(mem, ptr, num)
SCIP_RETCODE SCIPlpiGetRowNames(SCIP_LPI *lpi, int firstrow, int lastrow, char **rownames, char *namestorage, int namestoragesize, int *storageleft)
static void lpistatePack(SCIP_LPISTATE *lpistate, const int *cstat, const int *rstat)
static SCIP_RETCODE spxSolve(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSetBase(SCIP_LPI *lpi, const int *cstat, const int *rstat)
SCIP_Bool SCIPlpiIsOptimal(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiHasPrimalSolve(void)
SCIP_RETCODE SCIPlpiChgBounds(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *lb, const SCIP_Real *ub)
SCIP_Bool SCIPlpiIsTimelimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetRows(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhs, SCIP_Real *rhs, int *nnonz, int *beg, int *ind, SCIP_Real *val)
SCIP_RETCODE SCIPlpiStrongbranchInt(SCIP_LPI *lpi, int col, SCIP_Real psol, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, int *iter)
SCIP_RETCODE SCIPlpiSolveBarrier(SCIP_LPI *lpi, SCIP_Bool crossover)
SCIP_RETCODE SCIPlpiGetPrimalRay(SCIP_LPI *lpi, SCIP_Real *ray)
SCIP_RETCODE SCIPlpiEndStrongbranch(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiLoadColLP(SCIP_LPI *lpi, SCIP_OBJSEN objsen, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **colnames, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
SCIP_RETCODE SCIPlpiScaleRow(SCIP_LPI *lpi, int row, SCIP_Real scaleval)
SCIP_RETCODE SCIPlpiGetSides(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhss, SCIP_Real *rhss)
static void lpistateUnpack(const SCIP_LPISTATE *lpistate, int *cstat, int *rstat)
SCIP_Bool SCIPlpiHasDualRay(SCIP_LPI *lpi)
public methods for message output
SCIP_RETCODE SCIPlpiGetBInvACol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiGetObj(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *vals)
SCIP_Bool SCIPlpiIsObjlimExc(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsPrimalFeasible(SCIP_LPI *lpi)
SCIP_DUALPACKET COLPACKET
#define BMSallocMemory(ptr)
#define BMSreallocMemoryArray(ptr, num)
SCIP_DUALPACKET ROWPACKET
#define SOPLEX_TRY_ABORT(x)
SCIP_RETCODE SCIPlpiChgObj(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *obj)
SCIP_Bool SCIPlpiExistsDualRay(SCIP_LPI *lpi)
SCIP_MESSAGEHDLR * messagehdlr
#define BMSallocBlockMemory(mem, ptr)
SCIP_RETCODE SCIPlpiInterrupt(SCIP_LPI *lpi, SCIP_Bool interrupt)
SCIP_Bool SCIPlpiIsIterlimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
struct BMS_BlkMem BMS_BLKMEM
SCIP_RETCODE SCIPlpiChgObjsen(SCIP_LPI *lpi, SCIP_OBJSEN objsen)
SCIP_RETCODE SCIPlpiGetBInvRow(SCIP_LPI *lpi, int r, SCIP_Real *coef, int *inds, int *ninds)
const char * SCIPlpiGetSolverName(void)
SCIP_RETCODE SCIPlpiIgnoreInstability(SCIP_LPI *lpi, SCIP_Bool *success)
SCIP_RETCODE SCIPlpiGetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real *dval)
SCIP_RETCODE SCIPlpiDelColset(SCIP_LPI *lpi, int *dstat)