39 #define STRONGBRANCH_RESTOREBASIS 47 #include "scip/config.h" 50 #ifdef SCIP_WITH_LPSCHECK 53 #define CHECK_SPXSOLVE true 54 #define CHECK_SPXSTRONGBRANCH true 56 #define EXIT_AT_WRONG_RESULT false 57 #define EXIT_AT_CPXERROR false 59 #define CPX_CALL(x) do \ 62 if( (_cpxstat_ = (x)) != 0 ) \ 64 SCIPmessagePrintWarning(_messagehdlr, "CPLEX error <%d>; SoPlex result unchecked\n", _cpxstat_); \ 65 if( EXIT_AT_CPXERROR ) \ 79 #define CHECK_SOPLEX_PARAM(x) \ 82 SCIPmessagePrintWarning(_messagehdlr, "SoPlex: unsupported parameter value\n"); \ 93 #pragma GCC visibility push(default) 94 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy" 101 #ifndef SOPLEX_SUBVERSION 102 #define SOPLEX_SUBVERSION 0 105 #ifndef SOPLEX_APIVERSION 106 #define SOPLEX_APIVERSION 0 110 #if (SOPLEX_VERSION < 200 || (SOPLEX_VERSION == 200 && SOPLEX_SUBVERSION < 2) || (SOPLEX_VERSION > 200 && SOPLEX_VERSION < 201)) 111 #error "This interface is not compatible with SoPlex versions prior to 2.0.0.2" 114 #if (SOPLEX_APIVERSION <= 5) 115 #include "spxgithash.h" 126 #if defined(_MSC_VER) && _MSC_VER < 1900 128 #define snprintf _snprintf 132 #define SOPLEX_VERBLEVEL 5 153 #define SOPLEX_TRY(messagehdlr, x) do \ 159 catch( const SPxMemoryException& E ) \ 161 std::string s = E.what(); \ 162 SCIPerrorMessage("SoPlex threw a memory exception: %s\n", s.c_str()); \ 165 catch( const SPxException& E ) \ 167 std::string s = E.what(); \ 168 SCIPmessagePrintWarning((messagehdlr), "SoPlex threw an exception: %s\n", s.c_str()); \ 169 return SCIP_LPERROR; \ 175 #define SOPLEX_TRY(messagehdlr, x) do \ 181 catch( const SPxMemoryException& E ) \ 183 std::string s = E.what(); \ 184 SCIPerrorMessage("SoPlex threw a memory exception: %s\n", s.c_str()); \ 187 catch( const SPxException& ) \ 189 return SCIP_LPERROR; \ 198 #define SOPLEX_TRY_ABORT(x) do \ 204 catch( const SPxException& E ) \ 206 std::string s = E.what(); \ 207 SCIPerrorMessage("SoPlex threw an exception: %s\n", s.c_str()); \ 216 class SPxSCIP :
public SoPlex 222 DataArray<SPxSolver::VarStatus> _colStat;
223 DataArray<SPxSolver::VarStatus> _rowStat;
224 #ifdef SCIP_WITH_LPSCHECK 235 const char* probname =
NULL 242 _messagehdlr(messagehdlr)
244 if ( probname !=
NULL )
247 #if SOPLEX_APIVERSION >= 2 248 (void)setBoolParam(SoPlex::ENSURERAY,
true);
251 #ifdef SCIP_WITH_LPSCHECK 254 _doublecheck =
false;
255 _cpxenv = CPXopenCPLEX(&cpxstat);
256 assert(_cpxenv !=
NULL);
257 _cpxlp = CPXcreateprob(_cpxenv, &cpxstat, probname !=
NULL ? probname :
"spxcheck");
258 (void) CPXsetintparam(_cpxenv, CPX_PARAM_SCRIND, 0);
264 if( _probname !=
NULL )
267 freePreStrongbranchingBasis();
269 #ifdef SCIP_WITH_LPSCHECK 270 (void) CPXfreeprob(_cpxenv, &_cpxlp);
271 (void) CPXcloseCPLEX(&_cpxenv);
293 return realParam(OPTTOL);
305 Real getObjLimit()
const 307 return (intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE)
308 ? realParam(SoPlex::OBJLIMIT_UPPER)
309 : realParam(SoPlex::OBJLIMIT_LOWER);
313 bool getFromScratch()
const 318 void setFromScratch(
bool fs)
323 void setInterrupt(
bool interrupt)
325 _interrupt = interrupt;
334 bool getLpInfo()
const 339 void setLpInfo(
bool lpinfo)
345 void setProbname(
const char* probname)
349 assert(probname !=
NULL);
350 if( _probname !=
NULL )
353 len = strlen(probname);
354 spx_alloc(_probname, len + 1);
355 memcpy(_probname, probname, len + 1);
358 void setRep(SPxSolver::Representation p_rep)
360 if( p_rep == SPxSolver::COLUMN && intParam(REPRESENTATION) == REPRESENTATION_ROW )
365 else if( (p_rep == SPxSolver::ROW && intParam(REPRESENTATION) == REPRESENTATION_COLUMN) )
372 #ifdef SCIP_WITH_LPSCHECK 373 bool getDoubleCheck()
376 return _doublecheck && _checknum + 1 >= CHECK_START;
379 void setDoubleCheck(
bool dc)
384 const char* spxStatusString(
const SPxSolver::Status stat)
const 388 case SPxSolver::ABORT_TIME:
390 case SPxSolver::ABORT_ITER:
392 case SPxSolver::ABORT_VALUE:
393 return "ABORT_VALUE";
394 case SPxSolver::SINGULAR:
396 case SPxSolver::REGULAR:
400 case SPxSolver::OPTIMAL:
402 #if SOPLEX_APIVERSION >= 3 403 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
404 return "OPTIMAL_UNSCALED_VIOLATIONS";
406 case SPxSolver::UNBOUNDED:
408 case SPxSolver::INFEASIBLE:
415 const char* cpxStatusString(
const int stat)
const 419 case CPX_STAT_ABORT_TIME_LIM:
421 case CPX_STAT_ABORT_IT_LIM:
423 case CPX_STAT_ABORT_OBJ_LIM:
424 return "ABORT_VALUE";
425 case CPX_STAT_OPTIMAL:
427 case CPX_STAT_OPTIMAL_INFEAS:
428 return "CPX_STAT_OPTIMAL_INFEAS: OPT SOL INFEASIBLE AFTER UNSCALING";
429 case CPX_STAT_UNBOUNDED:
431 case CPX_STAT_INFEASIBLE:
433 case CPX_STAT_INForUNBD:
434 return "INFEASIBLE or UNBOUNDED";
435 case CPX_STAT_NUM_BEST:
436 return "CPX_STAT_NUM_BEST: SOL AVAILABLE BUT NOT PROVEN OPTIMAL DUE TO NUM TROUBLE";
444 bool checkConsistentBounds()
const 446 for(
int i = 0; i < numColsReal(); ++i )
448 if( lowerReal(i) > upperReal(i) + realParam(SoPlex::EPSILON_ZERO) )
450 SCIPerrorMessage(
"inconsistent bounds on column %d: lower=%.17g, upper=%.17g\n",
451 i, lowerReal(i), upperReal(i));
459 bool checkConsistentSides()
const 461 for(
int i = 0; i < numRowsReal(); ++i )
463 if( lhsReal(i) > rhsReal(i) + realParam(SoPlex::EPSILON_ZERO) )
466 i, lhsReal(i), rhsReal(i));
475 void trySolve(
bool printwarning =
true)
482 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 483 #if SOPLEX_APIVERSION > 11 492 catch(
const SPxException&
x)
494 std::string s = x.what();
504 assert(status() != SPxSolver::OPTIMAL);
507 assert(intParam(ITERLIMIT) < 0 || numIterations() <= intParam(ITERLIMIT));
510 timespent = solveTime();
514 timelimit = realParam(TIMELIMIT);
515 if( timelimit > timespent )
516 timelimit -= timespent;
520 assert(timelimit >= 0);
525 SPxSolver::Status doSolve(
bool printwarning =
true)
527 SPxOut::Verbosity verbosity;
529 SPxSolver::Status spxStatus;
532 verbosity = spxout.getVerbosity();
533 spxout.setVerbosity((SPxOut::Verbosity)(getLpInfo() ?
SOPLEX_VERBLEVEL : 0));
535 assert(checkConsistentBounds());
536 assert(checkConsistentSides());
538 #ifdef SCIP_WITH_LPSCHECK 540 if( getDoubleCheck() )
541 writeStateReal(
"spxcheck",
NULL,
NULL);
544 trySolve(printwarning);
545 spxStatus = status();
550 #ifdef SCIP_WITH_LPSCHECK 551 bool minimize = intParam(OBJSENSE) == OBJSENSE_MINIMIZE;
552 Real objLimitUpper = realParam(OBJLIMIT_UPPER);
553 Real objLimitLower = realParam(OBJLIMIT_LOWER);
556 if( getDoubleCheck() && (spxStatus == SPxSolver::OPTIMAL || spxStatus == SPxSolver::UNBOUNDED || spxStatus == SPxSolver::INFEASIBLE || spxStatus == SPxSolver::ABORT_VALUE) )
562 CPX_CALL( CPXreadcopyprob(_cpxenv, _cpxlp,
"spxcheck.mps",
NULL) );
563 CPX_CALL( CPXreadcopybase(_cpxenv, _cpxlp,
"spxcheck.bas") );
566 CPX_CALL( CPXsetdblparam(_cpxenv, CPX_PARAM_EPOPT,
MAX(opttol(), 1e-9)) );
567 CPX_CALL( CPXsetdblparam(_cpxenv, CPX_PARAM_EPRHS,
MAX(feastol(), 1e-9)) );
570 CPX_CALL( CPXlpopt(_cpxenv, _cpxlp) );
573 CPX_CALL( CPXsolution(_cpxenv, _cpxlp, &cpxstat, &cpxobj,
NULL,
NULL,
NULL,
NULL) );
578 if( cpxstat == CPX_STAT_OPTIMAL_INFEAS )
580 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s)\n",
581 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat));
582 if( EXIT_AT_CPXERROR )
585 else if( (spxStatus == SPxSolver::OPTIMAL && cpxstat != CPX_STAT_OPTIMAL)
586 || (spxStatus == SPxSolver::UNBOUNDED && cpxstat != CPX_STAT_UNBOUNDED)
587 || (spxStatus == SPxSolver::INFEASIBLE && cpxstat != CPX_STAT_INFEASIBLE) )
589 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
590 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
591 if( EXIT_AT_WRONG_RESULT )
594 else if( spxStatus == SPxSolver::ABORT_VALUE )
598 case CPX_STAT_OPTIMAL:
599 if( (minimize && LTrel(cpxobj, objLimitUpper, 2*opttol()))
600 || (!minimize && GTrel(cpxobj, objLimitLower, 2*opttol())) )
602 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
603 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize ?
"<" :
">",
604 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
605 if( EXIT_AT_WRONG_RESULT )
608 else if( (minimize && cpxobj < objLimitUpper) || (!minimize && cpxobj > objLimitLower) )
610 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
611 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize?
"<" :
">",
612 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
615 case CPX_STAT_OPTIMAL_INFEAS:
616 case CPX_STAT_NUM_BEST:
617 if( (minimize && cpxobj < objLimitUpper) || (!minimize && cpxobj > objLimitLower) )
619 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
620 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize ?
"<" :
">",
621 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
624 case CPX_STAT_INFEASIBLE:
626 case CPX_STAT_UNBOUNDED:
627 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
628 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
629 if( EXIT_AT_WRONG_RESULT )
632 case CPX_STAT_INForUNBD:
634 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
635 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
640 else if( spxStatus == SPxSolver::OPTIMAL )
642 if( (minimize && LTrel(objValueReal(), cpxobj, 2*opttol()))
643 || (!minimize && GTrel(objValueReal(), cpxobj, 2*opttol())) )
648 else if( (minimize && GTrel(objValueReal(), cpxobj, 2*opttol()))
649 || (!minimize && LTrel(objValueReal(), cpxobj, 2*opttol())) )
651 SCIPerrorMessage(
"In %s: LP optimal; SoPlex value=%.10f %s CPLEX value=%.10f suboptimal (checknum=%d)\n", _probname, objValueReal(),
652 minimize ?
">" :
"<", cpxobj, _checknum);
653 if( EXIT_AT_WRONG_RESULT )
663 spxout.setVerbosity(verbosity);
669 void savePreStrongbranchingBasis()
671 _rowStat.reSize(numRowsReal());
672 _colStat.reSize(numColsReal());
676 getBasis(_rowStat.get_ptr(), _colStat.get_ptr());
679 catch(
const SPxException&
x)
681 std::string s = x.what();
688 assert(status() != SPxSolver::OPTIMAL);
691 catch(
const SPxException&)
697 void restorePreStrongbranchingBasis()
699 assert(_rowStat.size() == numRowsReal());
700 assert(_colStat.size() == numColsReal());
704 setBasis(_rowStat.get_ptr(), _colStat.get_ptr());
707 catch(
const SPxException&
x)
709 std::string s = x.what();
712 catch(
const SPxException&)
719 assert(status() != SPxSolver::OPTIMAL);
724 void freePreStrongbranchingBasis()
731 bool preStrongbranchingBasisFreed()
const 733 return ((_rowStat.size() == 0 ) && (_colStat.size() == 0));
737 DataArray<SPxSolver::VarStatus>& rowStat()
743 DataArray<SPxSolver::VarStatus>& colStat()
761 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE 763 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE 787 COLPACKET* packcstat;
788 ROWPACKET* packrstat;
822 assert(num <= lpi->cstatsize);
844 assert(num <= lpi->rstatsize);
882 assert(lpistate !=
NULL);
898 assert(lpistate !=
NULL);
915 assert(lpistate !=
NULL);
916 assert(blkmem !=
NULL);
937 assert(blkmem !=
NULL);
938 assert(lpistate !=
NULL);
939 assert(*lpistate !=
NULL);
976 #if (SOPLEX_SUBVERSION > 0) 977 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'};
979 const static char spxname[20] = {
'S',
'o',
'p',
'l',
'e',
'x',
' ', SOPLEX_VERSION/100 +
'0',
'.', (SOPLEX_VERSION % 100)/10 +
'0',
'.', SOPLEX_VERSION % 10 +
'0'};
981 const static char spxdesc[200] = {
'L',
'i',
'n',
'e',
'a',
'r',
' ',
'P',
'r',
'o',
'g',
'r',
'a',
'm',
'm',
'i',
'n',
'g',
982 ' ',
'S',
'o',
'l',
'v',
'e',
'r',
' ' ,
'd',
'e',
'v',
'e',
'l',
'o',
'p',
'e',
'd',
983 ' ',
'a',
't',
' ',
'Z',
'u',
's',
'e',
' ',
'I',
'n',
's',
't',
'i',
't',
'u',
't',
'e',
984 ' ',
'B',
'e',
'r',
'l',
'i',
'n',
' ',
'(',
's',
'o',
'p',
'l',
'e',
'x',
'.',
'z',
'i',
'b',
'.',
'd',
'e',
')',
985 #ifdef SCIP_WITH_LPSCHECK 986 ' ',
'-',
' ',
'i',
'n',
'c',
'l',
'u',
'd',
'i',
'n',
'g',
' ',
'C',
'P',
'L',
'E',
'X',
987 ' ',
'd',
'o',
'u',
'b',
'l',
'e',
' ',
'c',
'h',
'e',
'c',
'k',
989 ' ',
'[',
'G',
'i',
't',
'H',
'a',
's',
'h',
':',
' ',
990 getGitHash()[0], getGitHash()[1], getGitHash()[2], getGitHash()[3],
991 getGitHash()[4], getGitHash()[5], getGitHash()[6], getGitHash()[7],
1019 return (
void*) lpi->
spx;
1029 assert( lpi !=
NULL );
1030 assert( ncols >= 0 );
1031 assert( ncols == 0 || intInfo !=
NULL );
1033 #if (SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3)) 1034 assert(ncols == lpi->
spx->numColsReal() || (ncols == 0 && intInfo ==
NULL));
1035 lpi->
spx->setIntegralityInformation(ncols, intInfo);
1038 SCIPerrorMessage(
"SCIPlpiSetIntegralityInformation() has not been implemented yet.\n");
1087 assert(lpi !=
NULL);
1088 assert(name !=
NULL);
1095 SOPLEX_TRY( messagehdlr, (*lpi)->spx = new ((*lpi)->spx) SPxSCIP(messagehdlr, name) );
1096 (void) (*lpi)->spx->setIntParam(SoPlex::SYNCMODE, SoPlex::SYNCMODE_ONLYREAL);
1097 (void) (*lpi)->spx->setIntParam(SoPlex::SOLVEMODE, SoPlex::SOLVEMODE_REAL);
1098 (void) (*lpi)->spx->setIntParam(SoPlex::REPRESENTATION, SoPlex::REPRESENTATION_AUTO);
1101 #if SOPLEX_APIVERSION >= 10 1102 (void) (*lpi)->spx->setIntParam(SoPlex::STATTIMER, 0);
1105 (*lpi)->cstat =
NULL;
1106 (*lpi)->rstat =
NULL;
1107 (*lpi)->cstatsize = 0;
1108 (*lpi)->rstatsize = 0;
1110 (*lpi)->conditionlimit = -1.0;
1111 (*lpi)->checkcondition =
FALSE;
1112 (*lpi)->messagehdlr = messagehdlr;
1123 (*lpi)->spx->setInterrupt(
FALSE);
1124 SPxOut::Verbosity verbosity = (*lpi)->spx->spxout.getVerbosity();
1125 (*lpi)->spx->spxout.setVerbosity((SPxOut::Verbosity)((*lpi)->spx->getLpInfo() ?
SOPLEX_VERBLEVEL : 0));
1126 (*lpi)->spx->printVersion();
1127 (*lpi)->spx->spxout.setVerbosity(verbosity);
1138 assert(lpi !=
NULL);
1139 assert(*lpi !=
NULL);
1140 assert((*lpi)->spx !=
NULL);
1143 (*lpi)->spx->~SPxSCIP();
1188 for( j = 0; j < nnonz; j++ )
1189 assert( val[j] != 0 );
1195 assert(lpi !=
NULL);
1197 assert(lhs !=
NULL);
1198 assert(rhs !=
NULL);
1199 assert(obj !=
NULL);
1202 assert(beg !=
NULL);
1203 assert(ind !=
NULL);
1204 assert(val !=
NULL);
1207 assert(lpi->
spx->preStrongbranchingBasisFreed());
1211 SPxSCIP* spx = lpi->
spx;
1212 LPRowSet rows(nrows);
1213 DSVector emptyVector(0);
1219 (void) spx->setIntParam(SoPlex::OBJSENSE, (objsen ==
SCIP_OBJSEN_MINIMIZE ? SoPlex::OBJSENSE_MINIMIZE : SoPlex::OBJSENSE_MAXIMIZE));
1222 for( i = 0; i < nrows; ++i )
1223 rows.add(lhs[i], emptyVector, rhs[i]);
1224 spx->addRowsReal(rows);
1230 catch(
const SPxException&
x )
1232 std::string s =
x.what();
1235 catch(
const SPxException& )
1260 assert(lpi !=
NULL);
1262 assert(obj !=
NULL);
1265 assert(nnonz == 0 || beg !=
NULL);
1266 assert(nnonz == 0 || ind !=
NULL);
1267 assert(nnonz == 0 || val !=
NULL);
1273 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1279 int nrows = lpi->
spx->numRowsReal();
1280 for (
int j = 0; j < nnonz; ++j)
1282 assert( 0 <= ind[j] && ind[j] < nrows );
1283 assert( val[j] != 0.0 );
1288 SPxSCIP* spx = lpi->
spx;
1291 LPColSet cols(ncols);
1292 DSVector colVector(ncols);
1298 for( i = 0; i < ncols; ++i )
1304 last = (i == ncols-1 ? nnonz : beg[i+1]);
1305 colVector.add( last-start, &ind[start], &val[start] );
1307 cols.add(obj[i], lb[i], colVector, ub[i]);
1309 spx->addColsReal(cols);
1312 catch(
const SPxException&
x )
1314 std::string s =
x.what();
1317 catch(
const SPxException& )
1335 assert(lpi !=
NULL);
1337 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
1341 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1361 assert(lpi !=
NULL);
1363 assert(dstat !=
NULL);
1367 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1369 ncols = lpi->
spx->numColsReal();
1372 for( i = 0; i < ncols; ++i )
1395 assert(lpi !=
NULL);
1397 assert(lhs !=
NULL);
1398 assert(rhs !=
NULL);
1399 assert(nnonz == 0 || beg !=
NULL);
1400 assert(nnonz == 0 || ind !=
NULL);
1401 assert(nnonz == 0 || val !=
NULL);
1405 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1411 int ncols = lpi->
spx->numColsReal();
1412 for (
int j = 0; j < nnonz; ++j)
1414 assert( val[j] != 0.0 );
1415 assert( 0 <= ind[j] && ind[j] < ncols );
1422 SPxSCIP* spx = lpi->
spx;
1423 LPRowSet rows(nrows);
1430 for( i = 0; i < nrows; ++i )
1436 last = (i == nrows-1 ? nnonz : beg[i+1]);
1437 rowVector.add( last-start, &ind[start], &val[start] );
1439 rows.add(lhs[i], rowVector, rhs[i]);
1441 spx->addRowsReal(rows);
1444 catch(
const SPxException&
x )
1446 std::string s =
x.what();
1449 catch(
const SPxException& )
1467 assert(lpi !=
NULL);
1469 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
1473 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1493 assert(lpi !=
NULL);
1498 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1500 nrows = lpi->
spx->numRowsReal();
1503 for( i = 0; i < nrows; ++i )
1518 assert(lpi !=
NULL);
1523 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1542 assert(lpi !=
NULL);
1544 assert(ncols == 0 || (ind !=
NULL && lb !=
NULL && ub !=
NULL));
1550 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1554 for( i = 0; i < ncols; ++i )
1556 assert(0 <= ind[i] && ind[i] < lpi->
spx->numColsReal());
1560 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[i]);
1565 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[i]);
1569 lpi->
spx->changeBoundsReal(ind[i], lb[i], ub[i]);
1570 assert(lpi->
spx->lowerReal(ind[i]) <= lpi->
spx->upperReal(ind[i]) + lpi->
spx->realParam(SoPlex::EPSILON_ZERO));
1574 catch(
const SPxException&
x )
1576 std::string s =
x.what();
1579 catch(
const SPxException& )
1601 assert(lpi !=
NULL);
1603 assert(ind !=
NULL);
1604 assert(lhs !=
NULL);
1605 assert(rhs !=
NULL);
1611 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1615 for( i = 0; i < nrows; ++i )
1617 assert(0 <= ind[i] && ind[i] < lpi->
spx->numRowsReal());
1618 lpi->
spx->changeRangeReal(ind[i], lhs[i], rhs[i]);
1619 assert(lpi->
spx->lhsReal(ind[i]) <= lpi->
spx->rhsReal(ind[i]) + lpi->
spx->realParam(SoPlex::EPSILON_ZERO));
1623 catch(
const SPxException&
x )
1625 std::string s =
x.what();
1628 catch(
const SPxException& )
1647 assert(lpi !=
NULL);
1649 assert(0 <= row && row < lpi->spx->numRowsReal());
1650 assert(0 <= col && col < lpi->spx->numColsReal());
1654 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1669 assert(lpi !=
NULL);
1674 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1693 assert(lpi !=
NULL);
1695 assert(ind !=
NULL);
1696 assert(obj !=
NULL);
1700 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1704 for( i = 0; i < ncols; ++i )
1706 assert(0 <= ind[i] && ind[i] < lpi->
spx->numColsReal());
1707 lpi->
spx->changeObjReal(ind[i], obj[i]);
1711 catch(
const SPxException&
x )
1713 std::string s =
x.what();
1716 catch(
const SPxException& )
1737 assert(lpi !=
NULL);
1739 assert(scaleval != 0.0);
1745 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1748 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1749 SVector rowvec = lpi->
spx->rowVectorRealInternal(row);
1751 SVector rowvec = lpi->
spx->rowVectorReal(row);
1753 lhs = lpi->
spx->lhsReal(row);
1754 rhs = lpi->
spx->rhsReal(row);
1760 if( lhs > -lpi->
spx->realParam(SoPlex::INFTY) )
1762 else if( scaleval < 0.0 )
1763 lhs = lpi->
spx->realParam(SoPlex::INFTY);
1764 if( rhs < lpi->spx->realParam(SoPlex::INFTY) )
1766 else if( scaleval < 0.0 )
1767 rhs = -lpi->
spx->realParam(SoPlex::INFTY);
1768 if( scaleval < 0.0 )
1776 LPRow lprow(lhs, rowvec, rhs);
1779 lpi->
spx->changeRowReal(row, lprow);
1780 assert(lpi->
spx->lhsReal(row) <= lpi->
spx->rhsReal(row));
1783 catch(
const SPxException&
x )
1785 std::string s =
x.what();
1788 catch(
const SPxException& )
1812 assert(lpi !=
NULL);
1814 assert(scaleval != 0.0);
1820 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1823 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1824 SVector colvec = lpi->
spx->colVectorRealInternal(col);
1826 SVector colvec = lpi->
spx->colVectorReal(col);
1828 obj = lpi->
spx->objReal(col);
1829 lb = lpi->
spx->lowerReal(col);
1830 ub = lpi->
spx->upperReal(col);
1839 if( lb > -lpi->
spx->realParam(SoPlex::INFTY) )
1841 else if( scaleval < 0.0 )
1842 lb = lpi->
spx->realParam(SoPlex::INFTY);
1843 if( ub < lpi->spx->realParam(SoPlex::INFTY) )
1845 else if( scaleval < 0.0 )
1846 ub = -lpi->
spx->realParam(SoPlex::INFTY);
1847 if( scaleval < 0.0 )
1855 LPCol lpcol(obj, colvec, ub, lb);
1858 lpi->
spx->changeColReal(col, lpcol);
1859 assert(lpi->
spx->lowerReal(col) <= lpi->
spx->upperReal(col));
1862 catch(
const SPxException&
x )
1864 std::string s =
x.what();
1867 catch(
const SPxException& )
1896 assert(lpi !=
NULL);
1898 assert(nrows !=
NULL);
1900 *nrows = lpi->
spx->numRowsReal();
1913 assert(lpi !=
NULL);
1915 assert(ncols !=
NULL);
1917 *ncols = lpi->
spx->numColsReal();
1932 assert(lpi !=
NULL);
1934 assert(nnonz !=
NULL);
1938 if( lpi->
spx->numRowsReal() < lpi->
spx->numColsReal() )
1940 for( i = 0; i < lpi->
spx->numRowsReal(); ++i )
1942 (*nnonz) += lpi->
spx->rowVectorRealInternal(i).size();
1944 (*nnonz) += lpi->
spx->rowVectorReal(i).size();
1949 for( i = 0; i < lpi->
spx->numColsReal(); ++i )
1951 (*nnonz) += lpi->
spx->colVectorRealInternal(i).size();
1953 (*nnonz) += lpi->
spx->colVectorReal(i).size();
1981 assert(lpi !=
NULL);
1983 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
1989 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1990 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
1992 DVector lbvec(lpi->
spx->numColsReal());
1993 DVector ubvec(lpi->
spx->numColsReal());
1994 lpi->
spx->getLowerReal(lbvec);
1995 lpi->
spx->getUpperReal(ubvec);
1996 for( i = firstcol; i <= lastcol; ++i )
1998 lb[i-firstcol] = lbvec[i];
1999 ub[i-firstcol] = ubvec[i];
2004 const Vector& lbvec = lpi->
spx->lowerRealInternal();
2005 const Vector& ubvec = lpi->
spx->upperRealInternal();
2006 for( i = firstcol; i <= lastcol; ++i )
2008 lb[i-firstcol] = lbvec[i];
2009 ub[i-firstcol] = ubvec[i];
2013 const Vector& lbvec = lpi->
spx->lowerReal();
2014 const Vector& ubvec = lpi->
spx->upperReal();
2016 for( i = firstcol; i <= lastcol; ++i )
2018 lb[i-firstcol] = lbvec[i];
2019 ub[i-firstcol] = ubvec[i];
2027 for( i = firstcol; i <= lastcol; ++i )
2029 beg[i-firstcol] = *nnonz;
2031 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2032 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2035 lpi->
spx->getColVectorReal(i, cvec);
2036 for( j = 0; j < cvec.size(); ++j )
2038 ind[*nnonz] = cvec.index(j);
2039 val[*nnonz] = cvec.value(j);
2045 const SVector& cvec = lpi->
spx->colVectorRealInternal(i);
2046 for( j = 0; j < cvec.size(); ++j )
2048 ind[*nnonz] = cvec.index(j);
2049 val[*nnonz] = cvec.value(j);
2054 const SVector& cvec = lpi->
spx->colVectorReal(i);
2055 for( j = 0; j < cvec.size(); ++j )
2057 ind[*nnonz] = cvec.index(j);
2058 val[*nnonz] = cvec.value(j);
2089 assert(lpi !=
NULL);
2091 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
2097 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2098 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2100 DVector lhsvec(lpi->
spx->numRowsReal());
2101 DVector rhsvec(lpi->
spx->numRowsReal());
2102 lpi->
spx->getLhsReal(lhsvec);
2103 lpi->
spx->getRhsReal(rhsvec);
2104 for( i = firstrow; i <= lastrow; ++i )
2106 lhs[i-firstrow] = lhsvec[i];
2107 rhs[i-firstrow] = rhsvec[i];
2112 const Vector& lhsvec = lpi->
spx->lhsRealInternal();
2113 const Vector& rhsvec = lpi->
spx->rhsRealInternal();
2114 for( i = firstrow; i <= lastrow; ++i )
2116 lhs[i-firstrow] = lhsvec[i];
2117 rhs[i-firstrow] = rhsvec[i];
2121 const Vector& lhsvec = lpi->
spx->lhsReal();
2122 const Vector& rhsvec = lpi->
spx->rhsReal();
2123 for( i = firstrow; i <= lastrow; ++i )
2125 lhs[i-firstrow] = lhsvec[i];
2126 rhs[i-firstrow] = rhsvec[i];
2134 for( i = firstrow; i <= lastrow; ++i )
2136 beg[i-firstrow] = *nnonz;
2138 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2139 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2142 lpi->
spx->getRowVectorReal(i, rvec);
2143 for( j = 0; j < rvec.size(); ++j )
2145 ind[*nnonz] = rvec.index(j);
2146 val[*nnonz] = rvec.value(j);
2152 const SVector& rvec = lpi->
spx->rowVectorRealInternal(i);
2153 for( j = 0; j < rvec.size(); ++j )
2155 ind[*nnonz] = rvec.index(j);
2156 val[*nnonz] = rvec.value(j);
2161 const SVector& rvec = lpi->
spx->rowVectorReal(i);
2162 for( j = 0; j < rvec.size(); ++j )
2164 ind[*nnonz] = rvec.index(j);
2165 val[*nnonz] = rvec.value(j);
2182 int namestoragesize,
2186 assert( lpi !=
NULL );
2188 assert( colnames !=
NULL || namestoragesize == 0 );
2189 assert( namestorage !=
NULL || namestoragesize == 0 );
2190 assert( namestoragesize >= 0 );
2191 assert( storageleft !=
NULL );
2192 assert( 0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal() );
2208 int namestoragesize,
2212 assert( lpi !=
NULL );
2214 assert( rownames !=
NULL || namestoragesize == 0 );
2215 assert( namestorage !=
NULL || namestoragesize == 0 );
2216 assert( namestoragesize >= 0 );
2217 assert( storageleft !=
NULL );
2218 assert( 0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal() );
2235 assert(lpi !=
NULL);
2237 assert(objsen !=
NULL);
2256 assert(lpi !=
NULL);
2258 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
2259 assert(vals !=
NULL);
2261 for( i = firstcol; i <= lastcol; ++i )
2262 vals[i-firstcol] = lpi->
spx->objReal(i);
2280 assert(lpi !=
NULL);
2282 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
2284 for( i = firstcol; i <= lastcol; ++i )
2287 lbs[i-firstcol] = lpi->
spx->lowerReal(i);
2289 ubs[i-firstcol] = lpi->
spx->upperReal(i);
2308 assert(lpi !=
NULL);
2310 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
2312 for( i = firstrow; i <= lastrow; ++i )
2315 lhss[i-firstrow] = lpi->
spx->lhsReal(i);
2317 rhss[i-firstrow] = lpi->
spx->rhsReal(i);
2333 assert(lpi !=
NULL);
2335 assert(0 <= col && col < lpi->spx->numColsReal());
2336 assert(0 <= row && row < lpi->spx->numRowsReal());
2337 assert(val !=
NULL);
2339 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2340 *val = lpi->
spx->coefReal(row, col);
2342 *val = lpi->
spx->colVectorReal(col)[row];
2366 assert( lpi !=
NULL );
2369 SPxOut::Verbosity verbosity;
2371 verbosity = lpi->
spx->spxout.getVerbosity();
2374 SCIPdebugMessage(
"calling SoPlex solve(): %d cols, %d rows\n", lpi->
spx->numColsReal(), lpi->
spx->numRowsReal());
2378 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2380 #ifdef SCIP_WITH_LPSCHECK 2381 lpi->
spx->setDoubleCheck(CHECK_SPXSOLVE);
2385 if( lpi->
spx->getFromScratch() )
2389 lpi->
spx->clearBasis();
2392 catch(
const SPxException&
x)
2394 std::string s = x.what();
2397 catch(
const SPxException&)
2400 assert( lpi->
spx->status() != SPxSolver::OPTIMAL );
2404 assert(!lpi->
spx->getFromScratch() || lpi->
spx->status() == SPxSolver::NO_PROBLEM);
2406 SPxSolver::Status status = lpi->
spx->doSolve();
2407 SCIPdebugMessage(
" -> SoPlex status: %d, basis status: %d\n", lpi->
spx->status(), lpi->
spx->basisStatus());
2411 lpi->
spx->spxout.setVerbosity(verbosity);
2415 case SPxSolver::ABORT_TIME:
2416 case SPxSolver::ABORT_ITER:
2417 case SPxSolver::ABORT_VALUE:
2418 case SPxSolver::SINGULAR:
2419 case SPxSolver::REGULAR:
2421 case SPxSolver::OPTIMAL:
2422 #if SOPLEX_APIVERSION >= 3 2423 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2425 case SPxSolver::UNBOUNDED:
2426 case SPxSolver::INFEASIBLE:
2440 assert(lpi !=
NULL);
2443 (void) lpi->
spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_PRIMAL);
2454 assert(lpi !=
NULL);
2457 (void) lpi->
spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_DUAL);
2467 assert(lpi !=
NULL);
2481 assert(lpi !=
NULL);
2484 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2485 lpi->
spx->savePreStrongbranchingBasis();
2495 assert(lpi !=
NULL);
2498 assert( ! lpi->
spx->preStrongbranchingBasisFreed() );
2499 lpi->
spx->restorePreStrongbranchingBasis();
2500 lpi->
spx->freePreStrongbranchingBasis();
2521 assert(lpi !=
NULL);
2525 SPxSolver::Status status;
2530 bool fromparentbasis;
2533 SPxOut::Verbosity verbosity;
2536 verbosity = lpi->
spx->spxout.getVerbosity();
2539 SCIPdebugMessage(
"calling SCIPlpiStrongbranch() on variable %d (%d iterations)\n", col, itlim);
2541 assert(lpi !=
NULL);
2545 assert(downvalid !=
NULL);
2546 assert(upvalid !=
NULL);
2549 #ifndef STRONGBRANCH_RESTOREBASIS 2550 fromparentbasis =
false;
2553 oldItlim = spx->intParam(SoPlex::ITERLIMIT);
2556 oldlb = spx->lowerReal(col);
2557 oldub = spx->upperReal(col);
2566 (void) spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_DUAL);
2569 newub =
EPSCEIL(psol-1.0, lpi->
spx->feastol());
2570 if( newub >= oldlb - 0.5 && down !=
NULL )
2572 SCIPdebugMessage(
"strong branching down on x%d (%g) with %d iterations\n", col, psol, itlim);
2574 spx->changeUpperReal(col, newub);
2575 assert(spx->lowerReal(col) <= spx->upperReal(col));
2577 (void) spx->setIntParam(SoPlex::ITERLIMIT, itlim);
2580 #ifndef STRONGBRANCH_RESTOREBASIS 2583 #ifdef SCIP_WITH_LPSCHECK 2584 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
2586 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2587 #if SOPLEX_APIVERSION > 11 2588 status = spx->optimize(spx->getInterrupt());
2590 status = spx->optimize();
2593 status = spx->solve();
2598 case SPxSolver::OPTIMAL:
2599 *down = spx->objValueReal();
2603 case SPxSolver::ABORT_TIME:
2604 case SPxSolver::ABORT_ITER:
2605 case SPxSolver::ABORT_CYCLING:
2606 #if SOPLEX_APIVERSION >= 3 2607 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2609 *down = spx->objValueReal();
2611 case SPxSolver::ABORT_VALUE:
2612 case SPxSolver::INFEASIBLE:
2613 *down = spx->getObjLimit();
2621 (*iter) += spx->numIterations();
2623 #ifdef STRONGBRANCH_RESTOREBASIS 2625 assert( ! spx->preStrongbranchingBasisFreed() );
2626 spx->restorePreStrongbranchingBasis();
2627 fromparentbasis =
false;
2631 #if SOPLEX_APIVERSION >= 3 2632 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS
2633 || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->numIterations() < itlim);
2635 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR)
2636 && !fromparentbasis && spx->numIterations() < itlim);
2638 if( repeatstrongbranching )
2640 SCIPdebugMessage(
" --> Repeat strong branching down with %d iterations after restoring basis\n",
2641 itlim - spx->numIterations());
2642 spx->setIntParam(SoPlex::ITERLIMIT, itlim - spx->numIterations());
2643 spx->restorePreStrongbranchingBasis();
2644 fromparentbasis =
true;
2649 fromparentbasis =
false;
2652 while( fromparentbasis );
2654 spx->changeUpperReal(col, oldub);
2655 assert(spx->lowerReal(col) <= spx->upperReal(col));
2657 else if( down !=
NULL )
2659 *down = spx->getObjLimit();
2669 if( newlb <= oldub + 0.5 && up !=
NULL )
2671 SCIPdebugMessage(
"strong branching up on x%d (%g) with %d iterations\n", col, psol, itlim);
2673 spx->changeLowerReal(col, newlb);
2674 assert(spx->lowerReal(col) <= spx->upperReal(col));
2676 (void) spx->setIntParam(SoPlex::ITERLIMIT, itlim);
2679 #ifndef STRONGBRANCH_RESTOREBASIS 2682 #ifdef SCIP_WITH_LPSCHECK 2683 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
2685 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2686 #if SOPLEX_APIVERSION > 11 2687 status = spx->optimize(spx->getInterrupt());
2689 status = spx->optimize();
2692 status = spx->solve();
2697 case SPxSolver::OPTIMAL:
2698 *up = spx->objValueReal();
2702 case SPxSolver::ABORT_TIME:
2703 case SPxSolver::ABORT_ITER:
2704 case SPxSolver::ABORT_CYCLING:
2705 #if SOPLEX_APIVERSION >= 3 2706 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2708 *up = spx->objValueReal();
2710 case SPxSolver::ABORT_VALUE:
2711 case SPxSolver::INFEASIBLE:
2712 *up = spx->getObjLimit();
2720 (*iter) += spx->numIterations();
2722 #ifdef STRONGBRANCH_RESTOREBASIS 2724 assert( ! spx->preStrongbranchingBasisFreed() );
2725 spx->restorePreStrongbranchingBasis();
2726 fromparentbasis =
false;
2730 #if SOPLEX_APIVERSION >= 3 2731 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS
2732 || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->numIterations() < itlim);
2734 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR)
2735 && !fromparentbasis && spx->numIterations() < itlim);
2737 if( repeatstrongbranching )
2739 SCIPdebugMessage(
" --> Repeat strong branching up with %d iterations after restoring basis\n", itlim - spx->numIterations());
2740 spx->restorePreStrongbranchingBasis();
2741 spx->setIntParam(SoPlex::ITERLIMIT, itlim - spx->numIterations());
2743 fromparentbasis =
true;
2747 fromparentbasis =
false;
2750 while( fromparentbasis );
2752 spx->changeLowerReal(col, oldlb);
2753 assert(spx->lowerReal(col) <= spx->upperReal(col));
2755 else if( up !=
NULL )
2757 *up = spx->getObjLimit();
2765 (void) spx->setIntParam(SoPlex::ITERLIMIT, oldItlim);
2768 lpi->
spx->spxout.setVerbosity(verbosity);
2772 SCIPdebugMessage(
"SCIPlpiStrongbranch() returned SoPlex status %d\n",
int(status));
2797 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
2827 assert( cols !=
NULL );
2828 assert( psols !=
NULL );
2829 assert( down !=
NULL );
2830 assert( up !=
NULL );
2831 assert( downvalid !=
NULL );
2832 assert( upvalid !=
NULL );
2833 assert( down !=
NULL );
2838 for (
int j = 0; j < ncols; ++j)
2841 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
2871 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
2901 assert( cols !=
NULL );
2902 assert( psols !=
NULL );
2903 assert( down !=
NULL );
2904 assert( up !=
NULL );
2905 assert( downvalid !=
NULL );
2906 assert( upvalid !=
NULL );
2907 assert( down !=
NULL );
2912 for (
int j = 0; j < ncols; ++j)
2915 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
2944 assert(lpi !=
NULL);
2967 assert(lpi !=
NULL);
2968 assert(primalfeasible !=
NULL);
2969 assert(dualfeasible !=
NULL);
2986 assert(lpi !=
NULL);
2989 return (lpi->
spx->status() == SPxSolver::UNBOUNDED);
3001 assert(lpi !=
NULL);
3004 return lpi->
spx->hasPrimalRay();
3014 assert(lpi !=
NULL);
3017 assert(lpi->
spx->status() != SPxSolver::UNBOUNDED || lpi->
spx->basisStatus() == SPxBasis::UNBOUNDED);
3022 return lpi->
spx->status() == SPxSolver::UNBOUNDED;
3032 assert(lpi !=
NULL);
3035 return (lpi->
spx->status() == SPxSolver::INFEASIBLE);
3045 assert(lpi !=
NULL);
3048 return lpi->
spx->basisStatus() == SPxBasis::OPTIMAL || lpi->
spx->basisStatus() == SPxBasis::PRIMAL;
3060 assert(lpi !=
NULL);
3063 return (lpi->
spx->status() == SPxSolver::INFEASIBLE);
3075 assert(lpi !=
NULL);
3078 return lpi->
spx->hasDualFarkas();
3088 assert(lpi !=
NULL);
3091 return lpi->
spx->status() == SPxSolver::INFEASIBLE && lpi->
spx->basisStatus() == SPxBasis::DUAL;
3101 assert(lpi !=
NULL);
3104 return (lpi->
spx->status() == SPxSolver::UNBOUNDED);
3114 assert(lpi !=
NULL);
3117 return (lpi->
spx->basisStatus() == SPxBasis::OPTIMAL) || lpi->
spx->basisStatus() == SPxBasis::DUAL;
3127 assert(lpi !=
NULL);
3129 assert((lpi->
spx->basisStatus() == SPxBasis::OPTIMAL)
3132 return (lpi->
spx->status() == SPxSolver::OPTIMAL);
3148 assert(lpi !=
NULL);
3153 #if SOPLEX_APIVERSION >= 3 3154 if( lpi->
spx->status() == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS )
3182 if( lpi->
spx->intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MAXIMIZE )
3200 assert(lpi !=
NULL);
3203 return (lpi->
spx->status() == SPxSolver::ABORT_VALUE);
3213 assert(lpi !=
NULL);
3216 return (lpi->
spx->status() == SPxSolver::ABORT_ITER);
3226 assert(lpi !=
NULL);
3229 return (lpi->
spx->status() == SPxSolver::ABORT_TIME);
3239 assert(lpi !=
NULL);
3242 return static_cast<int>(lpi->
spx->status());
3253 assert(lpi !=
NULL);
3255 assert(success !=
NULL);
3257 #if SOPLEX_APIVERSION >= 4 3258 *success = lpi->
spx->ignoreUnscaledViolations();
3274 assert(lpi !=
NULL);
3276 assert(objval !=
NULL);
3278 *objval = lpi->
spx->objValueReal();
3299 assert(lpi !=
NULL);
3302 if( objval !=
NULL )
3303 *objval = lpi->
spx->objValueReal();
3307 if( primsol !=
NULL )
3309 #if SOPLEX_APIVERSION > 10 3310 (void)lpi->
spx->getPrimalReal(primsol, lpi->
spx->numColsReal());
3312 Vector tmp(lpi->
spx->numColsReal(), primsol);
3313 (void)lpi->
spx->getPrimalReal(tmp);
3316 if( dualsol !=
NULL )
3318 #if SOPLEX_APIVERSION > 10 3319 (void)lpi->
spx->getDualReal(dualsol, lpi->
spx->numRowsReal());
3321 Vector tmp(lpi->
spx->numRowsReal(), dualsol);
3322 (void)lpi->
spx->getDualReal(tmp);
3325 if( activity !=
NULL )
3327 #if SOPLEX_APIVERSION > 10 3328 (void)lpi->
spx->getSlacksReal(activity, lpi->
spx->numRowsReal());
3330 Vector tmp(lpi->
spx->numRowsReal(), activity);
3331 (void)lpi->
spx->getSlacksReal(tmp);
3334 if( redcost !=
NULL )
3336 #if SOPLEX_APIVERSION > 10 3337 (void)lpi->
spx->getRedCostReal(redcost, lpi->
spx->numColsReal());
3339 Vector tmp(lpi->
spx->numColsReal(), redcost);
3340 (void)lpi->
spx->getRedCostReal(tmp);
3345 catch(
const SPxException&
x )
3347 std::string s =
x.what();
3350 catch(
const SPxException& )
3367 assert(lpi !=
NULL);
3369 assert(lpi->
spx->hasPrimalRay());
3370 assert(ray !=
NULL);
3374 #if SOPLEX_APIVERSION > 10 3375 (void)lpi->
spx->getPrimalRayReal(ray, lpi->
spx->numColsReal());
3377 Vector tmp(lpi->
spx->numColsReal(), ray);
3378 (void)lpi->
spx->getPrimalRayReal(tmp);
3382 catch(
const SPxException&
x )
3384 std::string s =
x.what();
3387 catch(
const SPxException& )
3404 assert(lpi !=
NULL);
3406 assert(lpi->
spx->hasDualFarkas());
3407 assert(dualfarkas !=
NULL);
3411 #if SOPLEX_APIVERSION > 10 3412 (void)lpi->
spx->getDualFarkasReal(dualfarkas, lpi->
spx->numRowsReal());
3414 Vector tmp(lpi->
spx->numRowsReal(), dualfarkas);
3415 (void)lpi->
spx->getDualFarkasReal(tmp);
3419 catch(
const SPxException&
x )
3421 std::string s =
x.what();
3424 catch(
const SPxException& )
3441 assert(lpi !=
NULL);
3443 assert(iterations !=
NULL);
3445 *iterations = lpi->
spx->numIterations();
3463 assert(lpi !=
NULL);
3464 assert(quality !=
NULL);
3468 SCIPdebugMessage(
"requesting solution quality from SoPlex: quality %d\n", qualityindicator);
3470 switch( qualityindicator )
3473 success = lpi->
spx->getEstimatedCondition(*quality);
3477 success = lpi->
spx->getExactCondition(*quality);
3518 assert(lpi !=
NULL);
3521 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3525 for( i = 0; i < lpi->
spx->numRowsReal(); ++i )
3527 switch( lpi->
spx->basisRowStatus(i) )
3529 case SPxSolver::BASIC:
3532 case SPxSolver::FIXED:
3533 case SPxSolver::ON_LOWER:
3536 case SPxSolver::ON_UPPER:
3539 case SPxSolver::ZERO:
3540 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
3542 case SPxSolver::UNDEFINED:
3553 for( i = 0; i < lpi->
spx->numColsReal(); ++i )
3556 switch( lpi->
spx->basisColStatus(i) )
3558 case SPxSolver::BASIC:
3561 case SPxSolver::FIXED:
3575 case SPxSolver::ON_LOWER:
3578 case SPxSolver::ON_UPPER:
3581 case SPxSolver::ZERO:
3584 case SPxSolver::UNDEFINED:
3609 assert(lpi !=
NULL);
3615 assert(cstat !=
NULL || ncols == 0);
3616 assert(rstat !=
NULL || nrows == 0);
3618 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3621 DataArray<SPxSolver::VarStatus>& _colstat = lpi->
spx->colStat();
3622 DataArray<SPxSolver::VarStatus>& _rowstat = lpi->
spx->rowStat();
3624 _colstat.reSize(ncols);
3625 _rowstat.reSize(nrows);
3627 for( i = 0; i < nrows; ++i )
3632 _rowstat[i] = SPxSolver::ON_LOWER;
3635 _rowstat[i] = SPxSolver::BASIC;
3638 _rowstat[i] = SPxSolver::ON_UPPER;
3641 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
3650 for( i = 0; i < ncols; ++i )
3655 _colstat[i] = SPxSolver::ON_LOWER;
3658 _colstat[i] = SPxSolver::BASIC;
3661 _colstat[i] = SPxSolver::ON_UPPER;
3664 _colstat[i] = SPxSolver::ZERO;
3674 lpi->
spx->freePreStrongbranchingBasis();
3687 assert(lpi !=
NULL);
3689 assert(bind !=
NULL);
3691 assert(lpi->
spx->preStrongbranchingBasisFreed());
3693 lpi->
spx->getBasisInd(bind);
3716 assert(lpi !=
NULL);
3718 assert(lpi->
spx->preStrongbranchingBasisFreed());
3719 assert(coef !=
NULL);
3722 assert(r < lpi->spx->numRowsReal());
3724 if( ! lpi->
spx->getBasisInverseRowReal(
r, coef, inds, ninds) )
3751 assert( lpi !=
NULL );
3753 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3754 assert(coef !=
NULL);
3756 if( ! lpi->
spx->getBasisInverseColReal(c, coef, inds, ninds) )
3786 assert(lpi !=
NULL);
3788 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3789 assert(coef !=
NULL);
3791 nrows = lpi->
spx->numRowsReal();
3792 ncols = lpi->
spx->numColsReal();
3796 if( binvrow ==
NULL )
3805 assert(binv !=
NULL);
3813 Vector binvvec(nrows, binv);
3815 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3820 for( c = 0; c < ncols; ++c )
3822 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3823 lpi->
spx->getColVectorReal(c, acol);
3824 coef[c] = binvvec * acol;
3826 coef[c] = binvvec * lpi->
spx->colVectorReal(c);
3852 DVector col(lpi->
spx->numRowsReal());
3854 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3861 assert( lpi !=
NULL );
3863 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3864 assert(coef !=
NULL);
3868 assert(c < lpi->spx->numColsReal());
3878 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3879 lpi->
spx->getColVectorReal(c, colsparse);
3883 col = lpi->
spx->colVectorReal(c);
3887 if( ! lpi->
spx->getBasisInverseTimesVecReal(col.get_ptr(), coef) )
3917 assert(blkmem !=
NULL);
3918 assert(lpi !=
NULL);
3920 assert(lpistate !=
NULL);
3922 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3924 ncols = lpi->
spx->numColsReal();
3925 nrows = lpi->
spx->numRowsReal();
3940 (*lpistate)->ncols = ncols;
3941 (*lpistate)->nrows = nrows;
3962 assert(lpi !=
NULL);
3964 assert(lpistate !=
NULL);
3967 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3969 lpncols = lpi->
spx->numColsReal();
3970 lpnrows = lpi->
spx->numRowsReal();
3971 assert(lpistate->
ncols <= lpncols);
3972 assert(lpistate->
nrows <= lpnrows);
3982 for( i = lpistate->
ncols; i < lpncols; ++i )
3988 bnd = lpi->
spx->lowerReal(i);
4000 for( i = lpistate->
nrows; i < lpnrows; ++i )
4016 assert(lpi !=
NULL);
4021 lpi->
spx->clearBasis();
4024 catch(
const SPxException&
x )
4026 std::string s = x.what();
4029 catch(
const SPxException& )
4032 assert( lpi->
spx->status() != SPxSolver::OPTIMAL );
4048 assert(lpi !=
NULL);
4049 assert(lpistate !=
NULL);
4050 assert(blkmem !=
NULL);
4052 if ( *lpistate !=
NULL )
4064 assert(lpi !=
NULL);
4075 assert(lpi !=
NULL);
4077 assert(fname !=
NULL);
4079 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4093 assert(lpi !=
NULL);
4095 assert(fname !=
NULL);
4098 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4130 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4134 assert(blkmem !=
NULL);
4135 assert(lpi !=
NULL);
4137 assert(lpinorms !=
NULL);
4139 lpi->
spx->getNdualNorms(nrows, ncols);
4141 if( nrows == 0 && ncols == 0)
4150 (*lpinorms)->nrows = 0;
4151 (*lpinorms)->ncols = 0;
4153 SCIPdebugMessage(
"storing SoPlex LPi pricing norms in %p (%d rows, %d cols)\n", (
void *) *lpinorms, nrows, ncols);
4155 if( !lpi->
spx->getDualNorms((*lpinorms)->nrows, (*lpinorms)->ncols, (*lpinorms)->norms) )
4160 assert(*lpinorms ==
NULL);
4165 assert(nrows == (*lpinorms)->nrows);
4166 assert(ncols == (*lpinorms)->ncols);
4185 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4186 assert(blkmem !=
NULL);
4187 assert(lpi !=
NULL);
4191 if( lpinorms ==
NULL )
4194 assert(lpinorms->
nrows <= lpi->
spx->numRowsReal());
4195 assert(lpinorms->
ncols <= lpi->
spx->numColsReal());
4197 if( lpinorms->
nrows == 0 )
4200 SCIPdebugMessage(
"loading LPi simplex norms %p (%d rows, %d cols) into SoPlex LP with %d rows and %d cols\n",
4201 (
const void *) lpinorms, lpinorms->
nrows, lpinorms->
ncols, lpi->
spx->numRowsReal(), lpi->
spx->numColsReal());
4216 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4217 assert(lpi !=
NULL);
4218 assert(lpinorms !=
NULL);
4224 assert(*lpinorms ==
NULL);
4253 assert(lpi !=
NULL);
4255 assert(ival !=
NULL);
4260 *ival = lpi->
spx->getFromScratch();
4263 *ival = lpi->
spx->getLpInfo();
4266 *ival = lpi->
spx->intParam(SoPlex::ITERLIMIT);
4271 *ival = lpi->
spx->intParam(SoPlex::SIMPLIFIER);
4277 scaleparam = lpi->
spx->intParam(SoPlex::SCALER);
4279 if( scaleparam == SoPlex::SCALER_OFF )
4281 else if( scaleparam == SoPlex::SCALER_BIEQUI )
4283 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 2) 4286 assert(scaleparam == SoPlex::SCALER_LEASTSQ);
4292 assert(scaleparam == SoPlex::SCALER_GEO8);
4297 #if SOPLEX_VERSION >= 201 4299 *ival = (int) (lpi->
spx->intParam(SoPlex::TIMER));
4302 #if SOPLEX_VERSION >= 230 || (SOPLEX_VERSION == 220 && SOPLEX_SUBVERSION >= 3) 4304 *ival = (int) lpi->
spx->randomSeed();
4307 #if SOPLEX_APIVERSION >= 1 4309 *ival = (int) lpi->
spx->intParam(SoPlex::FACTOR_UPDATE_MAX);
4328 assert(lpi !=
NULL);
4335 lpi->
spx->setFromScratch(
bool(ival));
4339 lpi->
spx->setLpInfo(
bool(ival));
4342 assert( ival >= 0 );
4344 if( ival >= INT_MAX )
4346 (void) lpi->
spx->setIntParam(SoPlex::ITERLIMIT, ival);
4350 #if SOPLEX_APIVERSION < 13 4353 assert(ival == 1 || ival == 0 || ival == 2);
4355 (void) lpi->
spx->setIntParam(SoPlex::SIMPLIFIER, ival);
4363 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_AUTO);
4366 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_STEEP);
4369 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_PARMULT);
4372 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_STEEP);
4375 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_QUICKSTEEP);
4378 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_DEVEX);
4385 assert(ival >= 0 && ival <= 2);
4387 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_OFF);
4388 else if( ival == 1 )
4389 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_BIEQUI);
4391 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 2) 4392 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_LEASTSQ);
4394 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_GEO8);
4398 #if SOPLEX_VERSION >= 201 4400 assert(ival >= 0 && ival < 3);
4401 (void) lpi->
spx->setIntParam(SoPlex::TIMER, ival);
4404 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3) 4406 lpi->
spx->setRandomSeed((
unsigned long)(
long)ival);
4409 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION >= 221 && SOPLEX_SUBVERSION >= 3) 4411 assert(ival >= 0 && ival < 3);
4412 (void) lpi->
spx->setIntParam(SoPlex::SOLUTION_POLISHING, ival);
4415 #if SOPLEX_APIVERSION >= 1 4418 (void) lpi->
spx->setIntParam(SoPlex::FACTOR_UPDATE_MAX, ival);
4438 assert(lpi !=
NULL);
4440 assert(dval !=
NULL);
4445 *dval = lpi->
spx->feastol();
4448 *dval = lpi->
spx->opttol();
4451 if ( lpi->
spx->intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE )
4452 *dval = lpi->
spx->realParam(SoPlex::OBJLIMIT_UPPER);
4454 *dval = lpi->
spx->realParam(SoPlex::OBJLIMIT_LOWER);
4457 *dval = lpi->
spx->realParam(SoPlex::TIMELIMIT);
4460 *dval = lpi->
spx->realParam(SoPlex::REPRESENTATION_SWITCH);
4468 #if (SOPLEX_APIVERSION >= 9) 4469 *dval = lpi->
spx->realParam(SoPlex::MIN_MARKOWITZ);
4488 assert(lpi !=
NULL);
4495 assert( dval > 0.0 );
4496 lpi->
spx->setFeastol(dval);
4500 assert( dval > 0.0 );
4501 lpi->
spx->setOpttol(dval);
4505 if ( lpi->
spx->intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE )
4506 (
void) lpi->
spx->setRealParam(SoPlex::OBJLIMIT_UPPER, dval);
4508 (
void) lpi->
spx->setRealParam(SoPlex::OBJLIMIT_LOWER, dval);
4511 assert( dval > 0.0 );
4513 (void) lpi->
spx->setRealParam(SoPlex::TIMELIMIT, dval);
4517 assert( dval >= 0.0 || dval == -1.0 );
4521 (
void) lpi->
spx->setRealParam(SoPlex::REPRESENTATION_SWITCH, dval);
4528 #if (SOPLEX_APIVERSION >= 9) 4532 else if( dval > 0.9999 )
4535 (void) lpi->
spx->setRealParam(SoPlex::MIN_MARKOWITZ, dval);
4551 assert(lpi !=
NULL);
4554 lpi->
spx->setInterrupt(interrupt);
4576 assert(lpi !=
NULL);
4579 return lpi->
spx->realParam(SoPlex::INFTY);
4588 assert(lpi !=
NULL);
4591 return (val >= lpi->
spx->realParam(SoPlex::INFTY));
4609 const char* filename
4614 f = fopen(filename,
"r");
4631 assert(lpi !=
NULL);
4633 assert(fname !=
NULL);
4635 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4642 assert(lpi->
spx->intParam(SoPlex::READMODE) == SoPlex::READMODE_REAL);
4643 if( !lpi->
spx->readFile(fname) )
4647 catch(
const SPxException&
x )
4649 std::string s =
x.what();
4652 catch(
const SPxException& )
4669 assert(lpi !=
NULL);
4671 assert(fname !=
NULL);
4675 (void) lpi->
spx->writeFileReal(fname);
4678 catch(
const SPxException&
x )
4680 std::string s =
x.what();
4683 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)
static const char spxdesc[200]
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)