30 #define STRONGBRANCH_RESTOREBASIS 38 #ifndef NO_CONFIG_HEADER 39 #include "scip/config.h" 43 #ifdef SCIP_WITH_LPSCHECK 46 #define CHECK_SPXSOLVE true 47 #define CHECK_SPXSTRONGBRANCH true 49 #define EXIT_AT_WRONG_RESULT false 50 #define EXIT_AT_CPXERROR false 52 #define CPX_CALL(x) do \ 55 if( (_cpxstat_ = (x)) != 0 ) \ 57 SCIPmessagePrintWarning(_messagehdlr, "CPLEX error <%d>; SoPlex result unchecked\n", _cpxstat_); \ 58 if( EXIT_AT_CPXERROR ) \ 72 #define CHECK_SOPLEX_PARAM(x) \ 75 SCIPmessagePrintWarning(_messagehdlr, "SoPlex: unsupported parameter value\n"); \ 89 #pragma GCC diagnostic ignored "-Wclass-memaccess" 96 #pragma GCC diagnostic ignored "-Wdeprecated-copy" 104 #ifndef SOPLEX_SUBVERSION 105 #define SOPLEX_SUBVERSION 0 108 #ifndef SOPLEX_APIVERSION 109 #define SOPLEX_APIVERSION 0 113 #if (SOPLEX_VERSION < 200 || (SOPLEX_VERSION == 200 && SOPLEX_SUBVERSION < 2) || (SOPLEX_VERSION > 200 && SOPLEX_VERSION < 201)) 114 #error "This interface is not compatible with SoPlex versions prior to 2.0.0.2" 117 #if (SOPLEX_APIVERSION <= 5) 118 #include "spxgithash.h" 129 #if defined(_MSC_VER) && _MSC_VER < 1900 131 #define snprintf _snprintf 135 #define SOPLEX_VERBLEVEL 5 156 #define SOPLEX_TRY(messagehdlr, x) do \ 162 catch( const SPxMemoryException& E ) \ 164 std::string s = E.what(); \ 165 SCIPerrorMessage("SoPlex threw a memory exception: %s\n", s.c_str()); \ 168 catch( const SPxException& E ) \ 170 std::string s = E.what(); \ 171 SCIPmessagePrintWarning((messagehdlr), "SoPlex threw an exception: %s\n", s.c_str()); \ 172 return SCIP_LPERROR; \ 178 #define SOPLEX_TRY(messagehdlr, x) do \ 184 catch( const SPxMemoryException& E ) \ 186 std::string s = E.what(); \ 187 SCIPerrorMessage("SoPlex threw a memory exception: %s\n", s.c_str()); \ 190 catch( const SPxException& ) \ 192 return SCIP_LPERROR; \ 201 #define SOPLEX_TRY_ABORT(x) do \ 207 catch( const SPxException& E ) \ 209 std::string s = E.what(); \ 210 SCIPerrorMessage("SoPlex threw an exception: %s\n", s.c_str()); \ 219 class SPxSCIP :
public SoPlex 224 DataArray<SPxSolver::VarStatus> _colStat;
225 DataArray<SPxSolver::VarStatus> _rowStat;
226 #ifdef SCIP_WITH_LPSCHECK 237 const char* probname =
NULL 244 _messagehdlr(messagehdlr)
246 if ( probname !=
NULL )
249 #if SOPLEX_APIVERSION >= 2 250 (void)setBoolParam(SoPlex::ENSURERAY,
true);
253 #ifdef SCIP_WITH_LPSCHECK 256 _doublecheck =
false;
257 _cpxenv = CPXopenCPLEX(&cpxstat);
258 assert(_cpxenv !=
NULL);
259 _cpxlp = CPXcreateprob(_cpxenv, &cpxstat, probname !=
NULL ? probname :
"spxcheck");
260 (void) CPXsetintparam(_cpxenv, CPX_PARAM_SCRIND, 0);
266 if( _probname !=
NULL )
269 freePreStrongbranchingBasis();
271 #ifdef SCIP_WITH_LPSCHECK 272 (void) CPXfreeprob(_cpxenv, &_cpxlp);
273 (void) CPXcloseCPLEX(&_cpxenv);
295 return realParam(OPTTOL);
307 Real getObjLimit()
const 309 return (intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE)
310 ? realParam(SoPlex::OBJLIMIT_UPPER)
311 : realParam(SoPlex::OBJLIMIT_LOWER);
315 bool getFromScratch()
const 320 void setFromScratch(
bool fs)
326 bool getLpInfo()
const 331 void setLpInfo(
bool lpinfo)
337 void setProbname(
const char* probname)
341 assert(probname !=
NULL);
342 if( _probname !=
NULL )
345 len = strlen(probname);
346 spx_alloc(_probname, len + 1);
347 memcpy(_probname, probname, len + 1);
350 void setRep(SPxSolver::Representation p_rep)
352 if( p_rep == SPxSolver::COLUMN && intParam(REPRESENTATION) == REPRESENTATION_ROW )
357 else if( (p_rep == SPxSolver::ROW && intParam(REPRESENTATION) == REPRESENTATION_COLUMN) )
364 #ifdef SCIP_WITH_LPSCHECK 365 bool getDoubleCheck()
368 return _doublecheck && _checknum + 1 >= CHECK_START;
371 void setDoubleCheck(
bool dc)
380 case SPxSolver::ABORT_TIME:
382 case SPxSolver::ABORT_ITER:
384 case SPxSolver::ABORT_VALUE:
385 return "ABORT_VALUE";
386 case SPxSolver::SINGULAR:
388 case SPxSolver::REGULAR:
392 case SPxSolver::OPTIMAL:
394 #if SOPLEX_APIVERSION >= 3 395 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
396 return "OPTIMAL_UNSCALED_VIOLATIONS";
398 case SPxSolver::UNBOUNDED:
400 case SPxSolver::INFEASIBLE:
407 const char* cpxStatusString(
const int stat)
const 411 case CPX_STAT_ABORT_TIME_LIM:
413 case CPX_STAT_ABORT_IT_LIM:
415 case CPX_STAT_ABORT_OBJ_LIM:
416 return "ABORT_VALUE";
417 case CPX_STAT_OPTIMAL:
419 case CPX_STAT_OPTIMAL_INFEAS:
420 return "CPX_STAT_OPTIMAL_INFEAS: OPT SOL INFEASIBLE AFTER UNSCALING";
421 case CPX_STAT_UNBOUNDED:
423 case CPX_STAT_INFEASIBLE:
425 case CPX_STAT_INForUNBD:
426 return "INFEASIBLE or UNBOUNDED";
427 case CPX_STAT_NUM_BEST:
428 return "CPX_STAT_NUM_BEST: SOL AVAILABLE BUT NOT PROVEN OPTIMAL DUE TO NUM TROUBLE";
436 bool checkConsistentBounds()
const 438 for(
int i = 0; i < numColsReal(); ++i )
440 if( lowerReal(i) > upperReal(i) + realParam(SoPlex::EPSILON_ZERO) )
442 SCIPerrorMessage(
"inconsistent bounds on column %d: lower=%.17g, upper=%.17g\n",
443 i, lowerReal(i), upperReal(i));
451 bool checkConsistentSides()
const 453 for(
int i = 0; i < numRowsReal(); ++i )
455 if( lhsReal(i) > rhsReal(i) + realParam(SoPlex::EPSILON_ZERO) )
458 i, lhsReal(i), rhsReal(i));
467 void trySolve(
bool printwarning =
true)
474 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 480 catch(
const SPxException&
x)
482 std::string s = x.what();
492 assert(status() != SPxSolver::OPTIMAL);
495 assert(intParam(ITERLIMIT) < 0 || numIterations() <= intParam(ITERLIMIT));
498 timespent = solveTime();
502 timelimit = realParam(TIMELIMIT);
503 if( timelimit > timespent )
504 timelimit -= timespent;
508 assert(timelimit >= 0);
515 SPxOut::Verbosity verbosity;
520 verbosity = spxout.getVerbosity();
521 spxout.setVerbosity((SPxOut::Verbosity)(getLpInfo() ?
SOPLEX_VERBLEVEL : 0));
523 assert(checkConsistentBounds());
524 assert(checkConsistentSides());
526 #ifdef SCIP_WITH_LPSCHECK 528 if( getDoubleCheck() )
529 writeStateReal(
"spxcheck",
NULL,
NULL);
532 trySolve(printwarning);
533 spxStatus = status();
538 #ifdef SCIP_WITH_LPSCHECK 539 bool minimize = intParam(OBJSENSE) == OBJSENSE_MINIMIZE;
540 Real objLimitUpper = realParam(OBJLIMIT_UPPER);
541 Real objLimitLower = realParam(OBJLIMIT_LOWER);
544 if( getDoubleCheck() && (spxStatus == SPxSolver::OPTIMAL || spxStatus == SPxSolver::UNBOUNDED || spxStatus == SPxSolver::INFEASIBLE || spxStatus == SPxSolver::ABORT_VALUE) )
550 CPX_CALL( CPXreadcopyprob(_cpxenv, _cpxlp,
"spxcheck.mps",
NULL) );
551 CPX_CALL( CPXreadcopybase(_cpxenv, _cpxlp,
"spxcheck.bas") );
554 CPX_CALL( CPXsetdblparam(_cpxenv, CPX_PARAM_EPOPT,
MAX(opttol(), 1e-9)) );
555 CPX_CALL( CPXsetdblparam(_cpxenv, CPX_PARAM_EPRHS,
MAX(feastol(), 1e-9)) );
558 CPX_CALL( CPXlpopt(_cpxenv, _cpxlp) );
561 CPX_CALL( CPXsolution(_cpxenv, _cpxlp, &cpxstat, &cpxobj,
NULL,
NULL,
NULL,
NULL) );
566 if( cpxstat == CPX_STAT_OPTIMAL_INFEAS )
568 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s)\n",
569 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat));
570 if( EXIT_AT_CPXERROR )
573 else if( (spxStatus == SPxSolver::OPTIMAL && cpxstat != CPX_STAT_OPTIMAL)
574 || (spxStatus == SPxSolver::UNBOUNDED && cpxstat != CPX_STAT_UNBOUNDED)
575 || (spxStatus == SPxSolver::INFEASIBLE && cpxstat != CPX_STAT_INFEASIBLE) )
577 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
578 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
579 if( EXIT_AT_WRONG_RESULT )
582 else if( spxStatus == SPxSolver::ABORT_VALUE )
586 case CPX_STAT_OPTIMAL:
587 if( (minimize && LTrel(cpxobj, objLimitUpper, 2*opttol()))
588 || (!minimize && GTrel(cpxobj, objLimitLower, 2*opttol())) )
590 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
591 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize ?
"<" :
">",
592 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
593 if( EXIT_AT_WRONG_RESULT )
596 else if( (minimize && cpxobj < objLimitUpper) || (!minimize && cpxobj > objLimitLower) )
598 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
599 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize?
"<" :
">",
600 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
603 case CPX_STAT_OPTIMAL_INFEAS:
604 case CPX_STAT_NUM_BEST:
605 if( (minimize && cpxobj < objLimitUpper) || (!minimize && cpxobj > objLimitLower) )
607 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
608 _probname, spxStatus, spxStatusString(spxStatus), cpxobj, minimize ?
"<" :
">",
609 minimize ? objLimitUpper : objLimitLower, cpxStatusString(cpxstat), _checknum);
612 case CPX_STAT_INFEASIBLE:
614 case CPX_STAT_UNBOUNDED:
615 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
616 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
617 if( EXIT_AT_WRONG_RESULT )
620 case CPX_STAT_INForUNBD:
622 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
623 _probname, spxStatus, spxStatusString(spxStatus), cpxstat, cpxStatusString(cpxstat), _checknum);
628 else if( spxStatus == SPxSolver::OPTIMAL )
630 if( (minimize && LTrel(objValueReal(), cpxobj, 2*opttol()))
631 || (!minimize && GTrel(objValueReal(), cpxobj, 2*opttol())) )
636 else if( (minimize && GTrel(objValueReal(), cpxobj, 2*opttol()))
637 || (!minimize && LTrel(objValueReal(), cpxobj, 2*opttol())) )
639 SCIPerrorMessage(
"In %s: LP optimal; SoPlex value=%.10f %s CPLEX value=%.10f suboptimal (checknum=%d)\n", objValueReal(),
640 _probname, minimize ?
">" :
"<", cpxobj, _checknum);
641 if( EXIT_AT_WRONG_RESULT )
651 spxout.setVerbosity(verbosity);
657 void savePreStrongbranchingBasis()
659 _rowStat.reSize(numRowsReal());
660 _colStat.reSize(numColsReal());
664 getBasis(_rowStat.get_ptr(), _colStat.get_ptr());
667 catch(
const SPxException&
x)
669 std::string s = x.what();
676 assert(status() != SPxSolver::OPTIMAL);
679 catch(
const SPxException&)
685 void restorePreStrongbranchingBasis()
687 assert(_rowStat.size() == numRowsReal());
688 assert(_colStat.size() == numColsReal());
692 setBasis(_rowStat.get_ptr(), _colStat.get_ptr());
695 catch(
const SPxException&
x)
697 std::string s = x.what();
700 catch(
const SPxException&)
707 assert(status() != SPxSolver::OPTIMAL);
712 void freePreStrongbranchingBasis()
719 bool preStrongbranchingBasisFreed()
const 721 return ((_rowStat.size() == 0 ) && (_colStat.size() == 0));
725 DataArray<SPxSolver::VarStatus>& rowStat()
731 DataArray<SPxSolver::VarStatus>& colStat()
749 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE 751 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE 775 COLPACKET* packcstat;
776 ROWPACKET* packrstat;
810 assert(num <= lpi->cstatsize);
832 assert(num <= lpi->rstatsize);
870 assert(lpistate !=
NULL);
886 assert(lpistate !=
NULL);
903 assert(lpistate !=
NULL);
904 assert(blkmem !=
NULL);
925 assert(blkmem !=
NULL);
926 assert(lpistate !=
NULL);
927 assert(*lpistate !=
NULL);
977 #if (SOPLEX_SUBVERSION > 0) 978 (void)snprintf(
spxname, 100,
"SoPlex %d.%d.%d.%d", SOPLEX_VERSION/100, (SOPLEX_VERSION % 100)/10, SOPLEX_VERSION % 10,
SOPLEX_SUBVERSION);
980 (void)snprintf(
spxname, 100,
"SoPlex %d.%d.%d", SOPLEX_VERSION/100, (SOPLEX_VERSION % 100)/10, SOPLEX_VERSION % 10);
990 (void)snprintf(
spxdesc, 200,
"%s [GitHash: %s]",
"Linear Programming Solver developed at Zuse Institute Berlin (soplex.zib.de)" 991 #ifdef SCIP_WITH_LPSCHECK
992 " - including CPLEX double check" 1004 return (
void*) lpi->
spx;
1014 assert( lpi !=
NULL );
1015 assert( ncols >= 0 );
1016 assert( ncols == 0 || intInfo !=
NULL );
1018 #if (SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3)) 1019 assert(ncols == lpi->
spx->numColsReal() || (ncols == 0 && intInfo ==
NULL));
1020 lpi->
spx->setIntegralityInformation(ncols, intInfo);
1023 SCIPerrorMessage(
"SCIPlpiSetIntegralityInformation() has not been implemented yet.\n");
1072 assert(lpi !=
NULL);
1073 assert(name !=
NULL);
1080 SOPLEX_TRY( messagehdlr, (*lpi)->spx = new ((*lpi)->spx) SPxSCIP(messagehdlr, name) );
1081 (void) (*lpi)->spx->setIntParam(SoPlex::SYNCMODE, SoPlex::SYNCMODE_ONLYREAL);
1082 (void) (*lpi)->spx->setIntParam(SoPlex::SOLVEMODE, SoPlex::SOLVEMODE_REAL);
1083 (void) (*lpi)->spx->setIntParam(SoPlex::REPRESENTATION, SoPlex::REPRESENTATION_AUTO);
1086 #if SOPLEX_APIVERSION >= 10 1087 (void) (*lpi)->spx->setIntParam(SoPlex::STATTIMER, 0);
1090 (*lpi)->cstat =
NULL;
1091 (*lpi)->rstat =
NULL;
1092 (*lpi)->cstatsize = 0;
1093 (*lpi)->rstatsize = 0;
1095 (*lpi)->conditionlimit = -1.0;
1096 (*lpi)->checkcondition =
FALSE;
1097 (*lpi)->messagehdlr = messagehdlr;
1108 SPxOut::Verbosity verbosity = (*lpi)->spx->spxout.getVerbosity();
1109 (*lpi)->spx->spxout.setVerbosity((SPxOut::Verbosity)((*lpi)->spx->getLpInfo() ?
SOPLEX_VERBLEVEL : 0));
1110 (*lpi)->spx->printVersion();
1111 (*lpi)->spx->spxout.setVerbosity(verbosity);
1122 assert(lpi !=
NULL);
1123 assert(*lpi !=
NULL);
1124 assert((*lpi)->spx !=
NULL);
1127 (*lpi)->spx->~SPxSCIP();
1172 for( j = 0; j < nnonz; j++ )
1173 assert( val[j] != 0 );
1179 assert(lpi !=
NULL);
1181 assert(lhs !=
NULL);
1182 assert(rhs !=
NULL);
1183 assert(obj !=
NULL);
1186 assert(beg !=
NULL);
1187 assert(ind !=
NULL);
1188 assert(val !=
NULL);
1191 assert(lpi->
spx->preStrongbranchingBasisFreed());
1195 SPxSCIP* spx = lpi->
spx;
1196 LPRowSet rows(nrows);
1197 DSVector emptyVector(0);
1203 (void) spx->setIntParam(SoPlex::OBJSENSE, (objsen ==
SCIP_OBJSEN_MINIMIZE ? SoPlex::OBJSENSE_MINIMIZE : SoPlex::OBJSENSE_MAXIMIZE));
1206 for( i = 0; i < nrows; ++i )
1207 rows.add(lhs[i], emptyVector, rhs[i]);
1208 spx->addRowsReal(rows);
1214 catch(
const SPxException&
x )
1216 std::string s =
x.what();
1219 catch(
const SPxException& )
1244 assert(lpi !=
NULL);
1246 assert(obj !=
NULL);
1249 assert(nnonz == 0 || beg !=
NULL);
1250 assert(nnonz == 0 || ind !=
NULL);
1251 assert(nnonz == 0 || val !=
NULL);
1257 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1263 int nrows = lpi->
spx->numRowsReal();
1264 for (
int j = 0; j < nnonz; ++j)
1266 assert( 0 <= ind[j] && ind[j] < nrows );
1267 assert( val[j] != 0.0 );
1272 SPxSCIP* spx = lpi->
spx;
1275 LPColSet cols(ncols);
1276 DSVector colVector(ncols);
1282 for( i = 0; i < ncols; ++i )
1288 last = (i == ncols-1 ? nnonz : beg[i+1]);
1289 colVector.add( last-start, &ind[start], &val[start] );
1291 cols.add(obj[i], lb[i], colVector, ub[i]);
1293 spx->addColsReal(cols);
1296 catch(
const SPxException&
x )
1298 std::string s =
x.what();
1301 catch(
const SPxException& )
1319 assert(lpi !=
NULL);
1321 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
1325 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1345 assert(lpi !=
NULL);
1347 assert(dstat !=
NULL);
1351 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1353 ncols = lpi->
spx->numColsReal();
1356 for( i = 0; i < ncols; ++i )
1379 assert(lpi !=
NULL);
1381 assert(lhs !=
NULL);
1382 assert(rhs !=
NULL);
1383 assert(nnonz == 0 || beg !=
NULL);
1384 assert(nnonz == 0 || ind !=
NULL);
1385 assert(nnonz == 0 || val !=
NULL);
1389 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1395 int ncols = lpi->
spx->numColsReal();
1396 for (
int j = 0; j < nnonz; ++j)
1398 assert( val[j] != 0.0 );
1399 assert( 0 <= ind[j] && ind[j] < ncols );
1406 SPxSCIP* spx = lpi->
spx;
1407 LPRowSet rows(nrows);
1414 for( i = 0; i < nrows; ++i )
1420 last = (i == nrows-1 ? nnonz : beg[i+1]);
1421 rowVector.add( last-start, &ind[start], &val[start] );
1423 rows.add(lhs[i], rowVector, rhs[i]);
1425 spx->addRowsReal(rows);
1428 catch(
const SPxException&
x )
1430 std::string s =
x.what();
1433 catch(
const SPxException& )
1451 assert(lpi !=
NULL);
1453 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
1457 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1477 assert(lpi !=
NULL);
1482 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1484 nrows = lpi->
spx->numRowsReal();
1487 for( i = 0; i < nrows; ++i )
1502 assert(lpi !=
NULL);
1507 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1526 assert(lpi !=
NULL);
1528 assert(ncols == 0 || (ind !=
NULL && lb !=
NULL && ub !=
NULL));
1534 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1538 for( i = 0; i < ncols; ++i )
1540 assert(0 <= ind[i] && ind[i] < lpi->
spx->numColsReal());
1544 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[i]);
1549 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[i]);
1553 lpi->
spx->changeBoundsReal(ind[i], lb[i], ub[i]);
1554 assert(lpi->
spx->lowerReal(ind[i]) <= lpi->
spx->upperReal(ind[i]) + lpi->
spx->realParam(SoPlex::EPSILON_ZERO));
1558 catch(
const SPxException&
x )
1560 std::string s =
x.what();
1563 catch(
const SPxException& )
1585 assert(lpi !=
NULL);
1587 assert(ind !=
NULL);
1588 assert(lhs !=
NULL);
1589 assert(rhs !=
NULL);
1595 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1599 for( i = 0; i < nrows; ++i )
1601 assert(0 <= ind[i] && ind[i] < lpi->
spx->numRowsReal());
1602 lpi->
spx->changeRangeReal(ind[i], lhs[i], rhs[i]);
1603 assert(lpi->
spx->lhsReal(ind[i]) <= lpi->
spx->rhsReal(ind[i]) + lpi->
spx->realParam(SoPlex::EPSILON_ZERO));
1607 catch(
const SPxException&
x )
1609 std::string s =
x.what();
1612 catch(
const SPxException& )
1631 assert(lpi !=
NULL);
1633 assert(0 <= row && row < lpi->spx->numRowsReal());
1634 assert(0 <= col && col < lpi->spx->numColsReal());
1638 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1653 assert(lpi !=
NULL);
1658 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1677 assert(lpi !=
NULL);
1679 assert(ind !=
NULL);
1680 assert(obj !=
NULL);
1684 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1688 for( i = 0; i < ncols; ++i )
1690 assert(0 <= ind[i] && ind[i] < lpi->
spx->numColsReal());
1691 lpi->
spx->changeObjReal(ind[i], obj[i]);
1695 catch(
const SPxException&
x )
1697 std::string s =
x.what();
1700 catch(
const SPxException& )
1721 assert(lpi !=
NULL);
1723 assert(scaleval != 0.0);
1729 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1732 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1733 SVector rowvec = lpi->
spx->rowVectorRealInternal(row);
1735 SVector rowvec = lpi->
spx->rowVectorReal(row);
1737 lhs = lpi->
spx->lhsReal(row);
1738 rhs = lpi->
spx->rhsReal(row);
1744 if( lhs > -lpi->
spx->realParam(SoPlex::INFTY) )
1746 else if( scaleval < 0.0 )
1747 lhs = lpi->
spx->realParam(SoPlex::INFTY);
1748 if( rhs < lpi->spx->realParam(SoPlex::INFTY) )
1750 else if( scaleval < 0.0 )
1751 rhs = -lpi->
spx->realParam(SoPlex::INFTY);
1752 if( scaleval < 0.0 )
1760 LPRow lprow(lhs, rowvec, rhs);
1763 lpi->
spx->changeRowReal(row, lprow);
1764 assert(lpi->
spx->lhsReal(row) <= lpi->
spx->rhsReal(row));
1767 catch(
const SPxException&
x )
1769 std::string s =
x.what();
1772 catch(
const SPxException& )
1796 assert(lpi !=
NULL);
1798 assert(scaleval != 0.0);
1804 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1807 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1808 SVector colvec = lpi->
spx->colVectorRealInternal(col);
1810 SVector colvec = lpi->
spx->colVectorReal(col);
1812 obj = lpi->
spx->objReal(col);
1813 lb = lpi->
spx->lowerReal(col);
1814 ub = lpi->
spx->upperReal(col);
1823 if( lb > -lpi->
spx->realParam(SoPlex::INFTY) )
1825 else if( scaleval < 0.0 )
1826 lb = lpi->
spx->realParam(SoPlex::INFTY);
1827 if( ub < lpi->spx->realParam(SoPlex::INFTY) )
1829 else if( scaleval < 0.0 )
1830 ub = -lpi->
spx->realParam(SoPlex::INFTY);
1831 if( scaleval < 0.0 )
1839 LPCol lpcol(obj, colvec, ub, lb);
1842 lpi->
spx->changeColReal(col, lpcol);
1843 assert(lpi->
spx->lowerReal(col) <= lpi->
spx->upperReal(col));
1846 catch(
const SPxException&
x )
1848 std::string s =
x.what();
1851 catch(
const SPxException& )
1880 assert(lpi !=
NULL);
1882 assert(nrows !=
NULL);
1884 *nrows = lpi->
spx->numRowsReal();
1897 assert(lpi !=
NULL);
1899 assert(ncols !=
NULL);
1901 *ncols = lpi->
spx->numColsReal();
1916 assert(lpi !=
NULL);
1918 assert(nnonz !=
NULL);
1922 if( lpi->
spx->numRowsReal() < lpi->
spx->numColsReal() )
1924 for( i = 0; i < lpi->
spx->numRowsReal(); ++i )
1926 (*nnonz) += lpi->
spx->rowVectorRealInternal(i).size();
1928 (*nnonz) += lpi->
spx->rowVectorReal(i).size();
1933 for( i = 0; i < lpi->
spx->numColsReal(); ++i )
1935 (*nnonz) += lpi->
spx->colVectorRealInternal(i).size();
1937 (*nnonz) += lpi->
spx->colVectorReal(i).size();
1965 assert(lpi !=
NULL);
1967 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
1973 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 1974 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
1976 DVector lbvec(lpi->
spx->numColsReal());
1977 DVector ubvec(lpi->
spx->numColsReal());
1978 lpi->
spx->getLowerReal(lbvec);
1979 lpi->
spx->getUpperReal(ubvec);
1980 for( i = firstcol; i <= lastcol; ++i )
1982 lb[i-firstcol] = lbvec[i];
1983 ub[i-firstcol] = ubvec[i];
1988 const Vector& lbvec = lpi->
spx->lowerRealInternal();
1989 const Vector& ubvec = lpi->
spx->upperRealInternal();
1990 for( i = firstcol; i <= lastcol; ++i )
1992 lb[i-firstcol] = lbvec[i];
1993 ub[i-firstcol] = ubvec[i];
1997 const Vector& lbvec = lpi->
spx->lowerReal();
1998 const Vector& ubvec = lpi->
spx->upperReal();
2000 for( i = firstcol; i <= lastcol; ++i )
2002 lb[i-firstcol] = lbvec[i];
2003 ub[i-firstcol] = ubvec[i];
2011 for( i = firstcol; i <= lastcol; ++i )
2013 beg[i-firstcol] = *nnonz;
2015 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2016 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2019 lpi->
spx->getColVectorReal(i, cvec);
2020 for( j = 0; j < cvec.size(); ++j )
2022 ind[*nnonz] = cvec.index(j);
2023 val[*nnonz] = cvec.value(j);
2029 const SVector& cvec = lpi->
spx->colVectorRealInternal(i);
2030 for( j = 0; j < cvec.size(); ++j )
2032 ind[*nnonz] = cvec.index(j);
2033 val[*nnonz] = cvec.value(j);
2038 const SVector& cvec = lpi->
spx->colVectorReal(i);
2039 for( j = 0; j < cvec.size(); ++j )
2041 ind[*nnonz] = cvec.index(j);
2042 val[*nnonz] = cvec.value(j);
2073 assert(lpi !=
NULL);
2075 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
2081 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2082 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2084 DVector lhsvec(lpi->
spx->numRowsReal());
2085 DVector rhsvec(lpi->
spx->numRowsReal());
2086 lpi->
spx->getLhsReal(lhsvec);
2087 lpi->
spx->getRhsReal(rhsvec);
2088 for( i = firstrow; i <= lastrow; ++i )
2090 lhs[i-firstrow] = lhsvec[i];
2091 rhs[i-firstrow] = rhsvec[i];
2096 const Vector& lhsvec = lpi->
spx->lhsRealInternal();
2097 const Vector& rhsvec = lpi->
spx->rhsRealInternal();
2098 for( i = firstrow; i <= lastrow; ++i )
2100 lhs[i-firstrow] = lhsvec[i];
2101 rhs[i-firstrow] = rhsvec[i];
2105 const Vector& lhsvec = lpi->
spx->lhsReal();
2106 const Vector& rhsvec = lpi->
spx->rhsReal();
2107 for( i = firstrow; i <= lastrow; ++i )
2109 lhs[i-firstrow] = lhsvec[i];
2110 rhs[i-firstrow] = rhsvec[i];
2118 for( i = firstrow; i <= lastrow; ++i )
2120 beg[i-firstrow] = *nnonz;
2122 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2123 if( lpi->
spx->boolParam(SoPlex::PERSISTENTSCALING) )
2126 lpi->
spx->getRowVectorReal(i, rvec);
2127 for( j = 0; j < rvec.size(); ++j )
2129 ind[*nnonz] = rvec.index(j);
2130 val[*nnonz] = rvec.value(j);
2136 const SVector& rvec = lpi->
spx->rowVectorRealInternal(i);
2137 for( j = 0; j < rvec.size(); ++j )
2139 ind[*nnonz] = rvec.index(j);
2140 val[*nnonz] = rvec.value(j);
2145 const SVector& rvec = lpi->
spx->rowVectorReal(i);
2146 for( j = 0; j < rvec.size(); ++j )
2148 ind[*nnonz] = rvec.index(j);
2149 val[*nnonz] = rvec.value(j);
2166 int namestoragesize,
2170 assert( lpi !=
NULL );
2172 assert( colnames !=
NULL || namestoragesize == 0 );
2173 assert( namestorage !=
NULL || namestoragesize == 0 );
2174 assert( namestoragesize >= 0 );
2175 assert( storageleft !=
NULL );
2176 assert( 0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal() );
2192 int namestoragesize,
2196 assert( lpi !=
NULL );
2198 assert( rownames !=
NULL || namestoragesize == 0 );
2199 assert( namestorage !=
NULL || namestoragesize == 0 );
2200 assert( namestoragesize >= 0 );
2201 assert( storageleft !=
NULL );
2202 assert( 0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal() );
2219 assert(lpi !=
NULL);
2221 assert(objsen !=
NULL);
2240 assert(lpi !=
NULL);
2242 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
2243 assert(vals !=
NULL);
2245 for( i = firstcol; i <= lastcol; ++i )
2246 vals[i-firstcol] = lpi->
spx->objReal(i);
2264 assert(lpi !=
NULL);
2266 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->numColsReal());
2268 for( i = firstcol; i <= lastcol; ++i )
2271 lbs[i-firstcol] = lpi->
spx->lowerReal(i);
2273 ubs[i-firstcol] = lpi->
spx->upperReal(i);
2292 assert(lpi !=
NULL);
2294 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->numRowsReal());
2296 for( i = firstrow; i <= lastrow; ++i )
2299 lhss[i-firstrow] = lpi->
spx->lhsReal(i);
2301 rhss[i-firstrow] = lpi->
spx->rhsReal(i);
2317 assert(lpi !=
NULL);
2319 assert(0 <= col && col < lpi->spx->numColsReal());
2320 assert(0 <= row && row < lpi->spx->numRowsReal());
2321 assert(val !=
NULL);
2323 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2324 *val = lpi->
spx->coefReal(row, col);
2326 *val = lpi->
spx->colVectorReal(col)[row];
2350 assert( lpi !=
NULL );
2353 SPxOut::Verbosity verbosity;
2355 verbosity = lpi->
spx->spxout.getVerbosity();
2358 SCIPdebugMessage(
"calling SoPlex solve(): %d cols, %d rows\n", lpi->
spx->numColsReal(), lpi->
spx->numRowsReal());
2362 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2364 #ifdef SCIP_WITH_LPSCHECK 2365 lpi->
spx->setDoubleCheck(CHECK_SPXSOLVE);
2369 if( lpi->
spx->getFromScratch() )
2373 lpi->
spx->clearBasis();
2376 catch(
const SPxException&
x)
2378 std::string s = x.what();
2381 catch(
const SPxException&)
2384 assert( lpi->
spx->status() != SPxSolver::OPTIMAL );
2388 assert(!lpi->
spx->getFromScratch() || lpi->
spx->status() == SPxSolver::NO_PROBLEM);
2391 SCIPdebugMessage(
" -> SoPlex status: %d, basis status: %d\n", lpi->
spx->status(), lpi->
spx->basisStatus());
2395 lpi->
spx->spxout.setVerbosity(verbosity);
2399 case SPxSolver::ABORT_TIME:
2400 case SPxSolver::ABORT_ITER:
2401 case SPxSolver::ABORT_VALUE:
2402 case SPxSolver::SINGULAR:
2403 case SPxSolver::REGULAR:
2405 case SPxSolver::OPTIMAL:
2406 #if SOPLEX_APIVERSION >= 3 2407 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2409 case SPxSolver::UNBOUNDED:
2410 case SPxSolver::INFEASIBLE:
2424 assert(lpi !=
NULL);
2427 (void) lpi->
spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_PRIMAL);
2438 assert(lpi !=
NULL);
2441 (void) lpi->
spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_DUAL);
2451 assert(lpi !=
NULL);
2465 assert(lpi !=
NULL);
2468 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2469 lpi->
spx->savePreStrongbranchingBasis();
2479 assert(lpi !=
NULL);
2482 assert( ! lpi->
spx->preStrongbranchingBasisFreed() );
2483 lpi->
spx->restorePreStrongbranchingBasis();
2484 lpi->
spx->freePreStrongbranchingBasis();
2505 assert(lpi !=
NULL);
2514 bool fromparentbasis;
2517 SPxOut::Verbosity verbosity;
2520 verbosity = lpi->
spx->spxout.getVerbosity();
2523 SCIPdebugMessage(
"calling SCIPlpiStrongbranch() on variable %d (%d iterations)\n", col, itlim);
2525 assert(lpi !=
NULL);
2529 assert(downvalid !=
NULL);
2530 assert(upvalid !=
NULL);
2533 #ifndef STRONGBRANCH_RESTOREBASIS 2534 fromparentbasis =
false;
2537 oldItlim = spx->intParam(SoPlex::ITERLIMIT);
2540 oldlb = spx->lowerReal(col);
2541 oldub = spx->upperReal(col);
2550 (void) spx->setIntParam(SoPlex::ALGORITHM, SoPlex::ALGORITHM_DUAL);
2553 newub =
EPSCEIL(psol-1.0, lpi->
spx->feastol());
2554 if( newub >= oldlb - 0.5 && down !=
NULL )
2556 SCIPdebugMessage(
"strong branching down on x%d (%g) with %d iterations\n", col, psol, itlim);
2558 spx->changeUpperReal(col, newub);
2559 assert(spx->lowerReal(col) <= spx->upperReal(col));
2561 (void) spx->setIntParam(SoPlex::ITERLIMIT, itlim);
2564 #ifndef STRONGBRANCH_RESTOREBASIS 2567 #ifdef SCIP_WITH_LPSCHECK 2568 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
2570 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2571 status = spx->optimize();
2573 status = spx->solve();
2578 case SPxSolver::OPTIMAL:
2579 *down = spx->objValueReal();
2583 case SPxSolver::ABORT_TIME:
2584 case SPxSolver::ABORT_ITER:
2585 case SPxSolver::ABORT_CYCLING:
2586 #if SOPLEX_APIVERSION >= 3 2587 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2589 *down = spx->objValueReal();
2591 case SPxSolver::ABORT_VALUE:
2592 case SPxSolver::INFEASIBLE:
2593 *down = spx->getObjLimit();
2601 (*iter) += spx->numIterations();
2603 #ifdef STRONGBRANCH_RESTOREBASIS 2605 assert( ! spx->preStrongbranchingBasisFreed() );
2606 spx->restorePreStrongbranchingBasis();
2607 fromparentbasis =
false;
2611 #if SOPLEX_APIVERSION >= 3 2612 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS
2613 || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->numIterations() < itlim);
2615 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR)
2616 && !fromparentbasis && spx->numIterations() < itlim);
2618 if( repeatstrongbranching )
2620 SCIPdebugMessage(
" --> Repeat strong branching down with %d iterations after restoring basis\n",
2621 itlim - spx->numIterations());
2622 spx->setIntParam(SoPlex::ITERLIMIT, itlim - spx->numIterations());
2623 spx->restorePreStrongbranchingBasis();
2624 fromparentbasis =
true;
2629 fromparentbasis =
false;
2632 while( fromparentbasis );
2634 spx->changeUpperReal(col, oldub);
2635 assert(spx->lowerReal(col) <= spx->upperReal(col));
2637 else if( down !=
NULL )
2639 *down = spx->getObjLimit();
2649 if( newlb <= oldub + 0.5 && up !=
NULL )
2651 SCIPdebugMessage(
"strong branching up on x%d (%g) with %d iterations\n", col, psol, itlim);
2653 spx->changeLowerReal(col, newlb);
2654 assert(spx->lowerReal(col) <= spx->upperReal(col));
2656 (void) spx->setIntParam(SoPlex::ITERLIMIT, itlim);
2659 #ifndef STRONGBRANCH_RESTOREBASIS 2662 #ifdef SCIP_WITH_LPSCHECK 2663 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
2665 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 2666 status = spx->optimize();
2668 status = spx->solve();
2673 case SPxSolver::OPTIMAL:
2674 *up = spx->objValueReal();
2678 case SPxSolver::ABORT_TIME:
2679 case SPxSolver::ABORT_ITER:
2680 case SPxSolver::ABORT_CYCLING:
2681 #if SOPLEX_APIVERSION >= 3 2682 case SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS:
2684 *up = spx->objValueReal();
2686 case SPxSolver::ABORT_VALUE:
2687 case SPxSolver::INFEASIBLE:
2688 *up = spx->getObjLimit();
2696 (*iter) += spx->numIterations();
2698 #ifdef STRONGBRANCH_RESTOREBASIS 2700 assert( ! spx->preStrongbranchingBasisFreed() );
2701 spx->restorePreStrongbranchingBasis();
2702 fromparentbasis =
false;
2706 #if SOPLEX_APIVERSION >= 3 2707 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS
2708 || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->numIterations() < itlim);
2710 repeatstrongbranching = ((status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR)
2711 && !fromparentbasis && spx->numIterations() < itlim);
2713 if( repeatstrongbranching )
2715 SCIPdebugMessage(
" --> Repeat strong branching up with %d iterations after restoring basis\n", itlim - spx->numIterations());
2716 spx->restorePreStrongbranchingBasis();
2717 spx->setIntParam(SoPlex::ITERLIMIT, itlim - spx->numIterations());
2719 fromparentbasis =
true;
2723 fromparentbasis =
false;
2726 while( fromparentbasis );
2728 spx->changeLowerReal(col, oldlb);
2729 assert(spx->lowerReal(col) <= spx->upperReal(col));
2731 else if( up !=
NULL )
2733 *up = spx->getObjLimit();
2741 (void) spx->setIntParam(SoPlex::ITERLIMIT, oldItlim);
2744 lpi->
spx->spxout.setVerbosity(verbosity);
2748 SCIPdebugMessage(
"SCIPlpiStrongbranch() returned SoPlex status %d\n",
int(status));
2773 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
2803 assert( cols !=
NULL );
2804 assert( psols !=
NULL );
2805 assert( down !=
NULL );
2806 assert( up !=
NULL );
2807 assert( downvalid !=
NULL );
2808 assert( upvalid !=
NULL );
2809 assert( down !=
NULL );
2814 for (
int j = 0; j < ncols; ++j)
2817 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
2847 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
2877 assert( cols !=
NULL );
2878 assert( psols !=
NULL );
2879 assert( down !=
NULL );
2880 assert( up !=
NULL );
2881 assert( downvalid !=
NULL );
2882 assert( upvalid !=
NULL );
2883 assert( down !=
NULL );
2888 for (
int j = 0; j < ncols; ++j)
2891 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
2920 assert(lpi !=
NULL);
2943 assert(lpi !=
NULL);
2944 assert(primalfeasible !=
NULL);
2945 assert(dualfeasible !=
NULL);
2962 assert(lpi !=
NULL);
2965 return (lpi->
spx->status() == SPxSolver::UNBOUNDED);
2977 assert(lpi !=
NULL);
2980 return lpi->
spx->hasPrimalRay();
2990 assert(lpi !=
NULL);
2993 assert(lpi->
spx->status() != SPxSolver::UNBOUNDED || lpi->
spx->basisStatus() == SPxBasis::UNBOUNDED);
2998 return lpi->
spx->status() == SPxSolver::UNBOUNDED;
3008 assert(lpi !=
NULL);
3011 return (lpi->
spx->status() == SPxSolver::INFEASIBLE);
3021 assert(lpi !=
NULL);
3024 return lpi->
spx->basisStatus() == SPxBasis::OPTIMAL || lpi->
spx->basisStatus() == SPxBasis::PRIMAL;
3036 assert(lpi !=
NULL);
3039 return (lpi->
spx->status() == SPxSolver::INFEASIBLE);
3051 assert(lpi !=
NULL);
3054 return lpi->
spx->hasDualFarkas();
3064 assert(lpi !=
NULL);
3067 return lpi->
spx->status() == SPxSolver::INFEASIBLE && lpi->
spx->basisStatus() == SPxBasis::DUAL;
3077 assert(lpi !=
NULL);
3080 return (lpi->
spx->status() == SPxSolver::UNBOUNDED);
3090 assert(lpi !=
NULL);
3093 return (lpi->
spx->basisStatus() == SPxBasis::OPTIMAL) || lpi->
spx->basisStatus() == SPxBasis::DUAL;
3103 assert(lpi !=
NULL);
3105 assert((lpi->
spx->basisStatus() == SPxBasis::OPTIMAL)
3108 return (lpi->
spx->status() == SPxSolver::OPTIMAL);
3124 assert(lpi !=
NULL);
3129 #if SOPLEX_APIVERSION >= 3 3130 if( lpi->
spx->status() == SPxSolver::OPTIMAL_UNSCALED_VIOLATIONS )
3161 assert(lpi !=
NULL);
3164 return (lpi->
spx->status() == SPxSolver::ABORT_VALUE);
3174 assert(lpi !=
NULL);
3177 return (lpi->
spx->status() == SPxSolver::ABORT_ITER);
3187 assert(lpi !=
NULL);
3190 return (lpi->
spx->status() == SPxSolver::ABORT_TIME);
3200 assert(lpi !=
NULL);
3203 return static_cast<int>(lpi->
spx->status());
3214 assert(lpi !=
NULL);
3216 assert(success !=
NULL);
3218 #if SOPLEX_APIVERSION >= 4 3219 *success = lpi->
spx->ignoreUnscaledViolations();
3235 assert(lpi !=
NULL);
3237 assert(objval !=
NULL);
3239 *objval = lpi->
spx->objValueReal();
3260 assert(lpi !=
NULL);
3263 if( objval !=
NULL )
3264 *objval = lpi->
spx->objValueReal();
3268 if( primsol !=
NULL )
3270 #if SOPLEX_APIVERSION > 10 3271 (void)lpi->
spx->getPrimalReal(primsol, lpi->
spx->numColsReal());
3273 Vector tmp(lpi->
spx->numColsReal(), primsol);
3274 (void)lpi->
spx->getPrimalReal(tmp);
3277 if( dualsol !=
NULL )
3279 #if SOPLEX_APIVERSION > 10 3280 (void)lpi->
spx->getDualReal(dualsol, lpi->
spx->numRowsReal());
3282 Vector tmp(lpi->
spx->numRowsReal(), dualsol);
3283 (void)lpi->
spx->getDualReal(tmp);
3286 if( activity !=
NULL )
3288 #if SOPLEX_APIVERSION > 10 3289 (void)lpi->
spx->getSlacksReal(activity, lpi->
spx->numRowsReal());
3291 Vector tmp(lpi->
spx->numRowsReal(), activity);
3292 (void)lpi->
spx->getSlacksReal(tmp);
3295 if( redcost !=
NULL )
3297 #if SOPLEX_APIVERSION > 10 3298 (void)lpi->
spx->getRedCostReal(redcost, lpi->
spx->numColsReal());
3300 Vector tmp(lpi->
spx->numColsReal(), redcost);
3301 (void)lpi->
spx->getRedCostReal(tmp);
3306 catch(
const SPxException&
x )
3308 std::string s =
x.what();
3311 catch(
const SPxException& )
3328 assert(lpi !=
NULL);
3330 assert(lpi->
spx->hasPrimalRay());
3331 assert(ray !=
NULL);
3335 #if SOPLEX_APIVERSION > 10 3336 (void)lpi->
spx->getPrimalRayReal(ray, lpi->
spx->numColsReal());
3338 Vector tmp(lpi->
spx->numColsReal(), ray);
3339 (void)lpi->
spx->getPrimalRayReal(tmp);
3343 catch(
const SPxException&
x )
3345 std::string s =
x.what();
3348 catch(
const SPxException& )
3365 assert(lpi !=
NULL);
3367 assert(lpi->
spx->hasDualFarkas());
3368 assert(dualfarkas !=
NULL);
3372 #if SOPLEX_APIVERSION > 10 3373 (void)lpi->
spx->getDualFarkasReal(dualfarkas, lpi->
spx->numRowsReal());
3375 Vector tmp(lpi->
spx->numRowsReal(), dualfarkas);
3376 (void)lpi->
spx->getDualFarkasReal(tmp);
3380 catch(
const SPxException&
x )
3382 std::string s =
x.what();
3385 catch(
const SPxException& )
3402 assert(lpi !=
NULL);
3404 assert(iterations !=
NULL);
3406 *iterations = lpi->
spx->numIterations();
3424 assert(lpi !=
NULL);
3425 assert(quality !=
NULL);
3429 SCIPdebugMessage(
"requesting solution quality from SoPlex: quality %d\n", qualityindicator);
3431 switch( qualityindicator )
3434 success = lpi->
spx->getEstimatedCondition(*quality);
3438 success = lpi->
spx->getExactCondition(*quality);
3479 assert(lpi !=
NULL);
3482 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3486 for( i = 0; i < lpi->
spx->numRowsReal(); ++i )
3488 switch( lpi->
spx->basisRowStatus(i) )
3490 case SPxSolver::BASIC:
3493 case SPxSolver::FIXED:
3494 case SPxSolver::ON_LOWER:
3497 case SPxSolver::ON_UPPER:
3500 case SPxSolver::ZERO:
3501 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
3503 case SPxSolver::UNDEFINED:
3514 for( i = 0; i < lpi->
spx->numColsReal(); ++i )
3517 switch( lpi->
spx->basisColStatus(i) )
3519 case SPxSolver::BASIC:
3522 case SPxSolver::FIXED:
3536 case SPxSolver::ON_LOWER:
3539 case SPxSolver::ON_UPPER:
3542 case SPxSolver::ZERO:
3545 case SPxSolver::UNDEFINED:
3570 assert(lpi !=
NULL);
3576 assert(cstat !=
NULL || ncols == 0);
3577 assert(rstat !=
NULL || nrows == 0);
3579 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3582 DataArray<SPxSolver::VarStatus>& _colstat = lpi->
spx->colStat();
3583 DataArray<SPxSolver::VarStatus>& _rowstat = lpi->
spx->rowStat();
3585 _colstat.reSize(ncols);
3586 _rowstat.reSize(nrows);
3588 for( i = 0; i < nrows; ++i )
3593 _rowstat[i] = SPxSolver::ON_LOWER;
3596 _rowstat[i] = SPxSolver::BASIC;
3599 _rowstat[i] = SPxSolver::ON_UPPER;
3602 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
3611 for( i = 0; i < ncols; ++i )
3616 _colstat[i] = SPxSolver::ON_LOWER;
3619 _colstat[i] = SPxSolver::BASIC;
3622 _colstat[i] = SPxSolver::ON_UPPER;
3625 _colstat[i] = SPxSolver::ZERO;
3635 lpi->
spx->freePreStrongbranchingBasis();
3648 assert(lpi !=
NULL);
3650 assert(bind !=
NULL);
3652 assert(lpi->
spx->preStrongbranchingBasisFreed());
3654 lpi->
spx->getBasisInd(bind);
3677 assert(lpi !=
NULL);
3679 assert(lpi->
spx->preStrongbranchingBasisFreed());
3680 assert(coef !=
NULL);
3683 assert(r < lpi->spx->numRowsReal());
3685 if( ! lpi->
spx->getBasisInverseRowReal(
r, coef, inds, ninds) )
3712 assert( lpi !=
NULL );
3714 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3715 assert(coef !=
NULL);
3717 if( ! lpi->
spx->getBasisInverseColReal(c, coef, inds, ninds) )
3747 assert(lpi !=
NULL);
3749 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3750 assert(coef !=
NULL);
3752 nrows = lpi->
spx->numRowsReal();
3753 ncols = lpi->
spx->numColsReal();
3757 if( binvrow ==
NULL )
3766 assert(binv !=
NULL);
3774 Vector binvvec(nrows, binv);
3776 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3781 for( c = 0; c < ncols; ++c )
3783 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3784 lpi->
spx->getColVectorReal(c, acol);
3785 coef[c] = binvvec * acol;
3787 coef[c] = binvvec * lpi->
spx->colVectorReal(c);
3813 DVector col(lpi->
spx->numRowsReal());
3815 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3822 assert( lpi !=
NULL );
3824 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3825 assert(coef !=
NULL);
3829 assert(c < lpi->spx->numColsReal());
3839 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 4) 3840 lpi->
spx->getColVectorReal(c, colsparse);
3844 col = lpi->
spx->colVectorReal(c);
3848 if( ! lpi->
spx->getBasisInverseTimesVecReal(col.get_ptr(), coef) )
3878 assert(blkmem !=
NULL);
3879 assert(lpi !=
NULL);
3881 assert(lpistate !=
NULL);
3883 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3885 ncols = lpi->
spx->numColsReal();
3886 nrows = lpi->
spx->numRowsReal();
3901 (*lpistate)->ncols = ncols;
3902 (*lpistate)->nrows = nrows;
3923 assert(lpi !=
NULL);
3925 assert(lpistate !=
NULL);
3928 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3930 lpncols = lpi->
spx->numColsReal();
3931 lpnrows = lpi->
spx->numRowsReal();
3932 assert(lpistate->
ncols <= lpncols);
3933 assert(lpistate->
nrows <= lpnrows);
3943 for( i = lpistate->
ncols; i < lpncols; ++i )
3949 bnd = lpi->
spx->lowerReal(i);
3961 for( i = lpistate->
nrows; i < lpnrows; ++i )
3977 assert(lpi !=
NULL);
3982 lpi->
spx->clearBasis();
3985 catch(
const SPxException&
x )
3987 std::string s = x.what();
3990 catch(
const SPxException& )
3993 assert( lpi->
spx->status() != SPxSolver::OPTIMAL );
4009 assert(lpi !=
NULL);
4010 assert(lpistate !=
NULL);
4011 assert(blkmem !=
NULL);
4013 if ( *lpistate !=
NULL )
4025 assert(lpi !=
NULL);
4036 assert(lpi !=
NULL);
4038 assert(fname !=
NULL);
4040 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4054 assert(lpi !=
NULL);
4056 assert(fname !=
NULL);
4059 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4091 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4095 assert(blkmem !=
NULL);
4096 assert(lpi !=
NULL);
4098 assert(lpinorms !=
NULL);
4100 lpi->
spx->getNdualNorms(nrows, ncols);
4102 if( nrows == 0 && ncols == 0)
4111 (*lpinorms)->nrows = 0;
4112 (*lpinorms)->ncols = 0;
4114 SCIPdebugMessage(
"storing SoPlex LPi pricing norms in %p (%d rows, %d cols)\n", (
void *) *lpinorms, nrows, ncols);
4116 if( !lpi->
spx->getDualNorms((*lpinorms)->nrows, (*lpinorms)->ncols, (*lpinorms)->norms) )
4121 assert(*lpinorms ==
NULL);
4126 assert(nrows == (*lpinorms)->nrows);
4127 assert(ncols == (*lpinorms)->ncols);
4146 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4147 assert(blkmem !=
NULL);
4148 assert(lpi !=
NULL);
4152 if( lpinorms ==
NULL )
4155 assert(lpinorms->
nrows <= lpi->
spx->numRowsReal());
4156 assert(lpinorms->
ncols <= lpi->
spx->numColsReal());
4158 if( lpinorms->
nrows == 0 )
4161 SCIPdebugMessage(
"loading LPi simplex norms %p (%d rows, %d cols) into SoPlex LP with %d rows and %d cols\n",
4162 (
const void *) lpinorms, lpinorms->
nrows, lpinorms->
ncols, lpi->
spx->numRowsReal(), lpi->
spx->numColsReal());
4177 #if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201) 4178 assert(lpi !=
NULL);
4179 assert(lpinorms !=
NULL);
4185 assert(*lpinorms ==
NULL);
4214 assert(lpi !=
NULL);
4216 assert(ival !=
NULL);
4221 *ival = lpi->
spx->getFromScratch();
4224 *ival = lpi->
spx->getLpInfo();
4227 *ival = lpi->
spx->intParam(SoPlex::ITERLIMIT);
4232 *ival = lpi->
spx->intParam(SoPlex::SIMPLIFIER) == SoPlex::SIMPLIFIER_AUTO;
4238 scaleparam = lpi->
spx->intParam(SoPlex::SCALER);
4240 if( scaleparam == SoPlex::SCALER_OFF )
4242 else if( scaleparam == SoPlex::SCALER_BIEQUI )
4244 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 2) 4247 assert(scaleparam == SoPlex::SCALER_LEASTSQ);
4253 assert(scaleparam == SoPlex::SCALER_GEO8);
4258 #if SOPLEX_VERSION >= 201 4260 *ival = (int) (lpi->
spx->intParam(SoPlex::TIMER));
4263 #if SOPLEX_VERSION >= 230 || (SOPLEX_VERSION == 220 && SOPLEX_SUBVERSION >= 3) 4265 *ival = (int) lpi->
spx->randomSeed();
4268 #if SOPLEX_APIVERSION >= 1 4270 *ival = (int) lpi->
spx->intParam(SoPlex::FACTOR_UPDATE_MAX);
4289 assert(lpi !=
NULL);
4296 lpi->
spx->setFromScratch(
bool(ival));
4300 lpi->
spx->setLpInfo(
bool(ival));
4303 assert( ival >= 0 );
4305 if( ival >= INT_MAX )
4307 (void) lpi->
spx->setIntParam(SoPlex::ITERLIMIT, ival);
4311 (void) lpi->
spx->setIntParam(SoPlex::SIMPLIFIER, (ival ? SoPlex::SIMPLIFIER_AUTO : SoPlex::SIMPLIFIER_OFF));
4319 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_AUTO);
4322 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_STEEP);
4325 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_PARMULT);
4328 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_STEEP);
4331 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_QUICKSTEEP);
4334 (void) lpi->
spx->setIntParam(SoPlex::PRICER, SoPlex::PRICER_DEVEX);
4341 assert(ival >= 0 && ival <= 2);
4343 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_OFF);
4344 else if( ival == 1 )
4345 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_BIEQUI);
4347 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 2) 4348 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_LEASTSQ);
4350 (void) lpi->
spx->setIntParam(SoPlex::SCALER, SoPlex::SCALER_GEO8);
4354 #if SOPLEX_VERSION >= 201 4356 assert(ival >= 0 && ival < 3);
4357 (void) lpi->
spx->setIntParam(SoPlex::TIMER, ival);
4360 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3) 4362 lpi->
spx->setRandomSeed((
unsigned long)(
long)ival);
4365 #if SOPLEX_VERSION > 221 || (SOPLEX_VERSION >= 221 && SOPLEX_SUBVERSION >= 3) 4367 assert(ival >= 0 && ival < 3);
4368 (void) lpi->
spx->setIntParam(SoPlex::SOLUTION_POLISHING, ival);
4371 #if SOPLEX_APIVERSION >= 1 4374 (void) lpi->
spx->setIntParam(SoPlex::FACTOR_UPDATE_MAX, ival);
4394 assert(lpi !=
NULL);
4396 assert(dval !=
NULL);
4401 *dval = lpi->
spx->feastol();
4404 *dval = lpi->
spx->opttol();
4407 if ( lpi->
spx->intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE )
4408 *dval = lpi->
spx->realParam(SoPlex::OBJLIMIT_UPPER);
4410 *dval = lpi->
spx->realParam(SoPlex::OBJLIMIT_LOWER);
4413 *dval = lpi->
spx->realParam(SoPlex::TIMELIMIT);
4416 *dval = lpi->
spx->realParam(SoPlex::REPRESENTATION_SWITCH);
4424 #if (SOPLEX_APIVERSION >= 9) 4425 *dval = lpi->
spx->realParam(SoPlex::MIN_MARKOWITZ);
4444 assert(lpi !=
NULL);
4451 assert( dval > 0.0 );
4452 lpi->
spx->setFeastol(dval);
4456 assert( dval > 0.0 );
4457 lpi->
spx->setOpttol(dval);
4461 if ( lpi->
spx->intParam(SoPlex::OBJSENSE) == SoPlex::OBJSENSE_MINIMIZE )
4462 (
void) lpi->
spx->setRealParam(SoPlex::OBJLIMIT_UPPER, dval);
4464 (
void) lpi->
spx->setRealParam(SoPlex::OBJLIMIT_LOWER, dval);
4467 assert( dval > 0.0 );
4469 (void) lpi->
spx->setRealParam(SoPlex::TIMELIMIT, dval);
4473 assert( dval >= 0.0 || dval == -1.0 );
4477 (
void) lpi->
spx->setRealParam(SoPlex::REPRESENTATION_SWITCH, dval);
4484 #if (SOPLEX_APIVERSION >= 9) 4488 else if( dval > 0.9999 )
4491 (void) lpi->
spx->setRealParam(SoPlex::MIN_MARKOWITZ, dval);
4518 assert(lpi !=
NULL);
4521 return lpi->
spx->realParam(SoPlex::INFTY);
4530 assert(lpi !=
NULL);
4533 return (val >= lpi->
spx->realParam(SoPlex::INFTY));
4551 const char* filename
4556 f = fopen(filename,
"r");
4573 assert(lpi !=
NULL);
4575 assert(fname !=
NULL);
4577 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4584 assert(lpi->
spx->intParam(SoPlex::READMODE) == SoPlex::READMODE_REAL);
4585 if( !lpi->
spx->readFile(fname) )
4589 catch(
const SPxException&
x )
4591 std::string s =
x.what();
4594 catch(
const SPxException& )
4611 assert(lpi !=
NULL);
4613 assert(fname !=
NULL);
4617 (void) lpi->
spx->writeFileReal(fname);
4620 catch(
const SPxException&
x )
4622 std::string s =
x.what();
4625 catch(
const SPxException& )
SCIP_RETCODE SCIPlpiCreate(SCIP_LPI **lpi, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_OBJSEN objsen)
SCIP_RETCODE SCIPlpiSetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int ival)
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)
enum SCIP_LPSolQuality SCIP_LPSOLQUALITY
SCIP_Real SCIPlpiInfinity(SCIP_LPI *lpi)
const char * SCIPlpiGetSolverName(void)
#define BMSfreeMemoryArrayNull(ptr)
SCIP_RETCODE SCIPlpiGetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int *ival)
SCIP_RETCODE SCIPlpiSetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, const SCIP_LPINORMS *lpinorms)
SCIP_RETCODE SCIPlpiGetDualfarkas(SCIP_LPI *lpi, SCIP_Real *dualfarkas)
SCIP_RETCODE SCIPlpiChgCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real newval)
SCIP_RETCODE SCIPlpiGetBase(SCIP_LPI *lpi, int *cstat, int *rstat)
SCIP_RETCODE SCIPlpiGetObj(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *vals)
enum SCIP_ObjSen SCIP_OBJSEN
void * SCIPlpiGetSolverPointer(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiHasStateBasis(SCIP_LPI *lpi, SCIP_LPISTATE *lpistate)
void SCIPdecodeDualBit(const SCIP_DUALPACKET *inp, int *out, int count)
SCIP_Bool SCIPlpiHasPrimalRay(SCIP_LPI *lpi)
interface methods for specific LP solvers
SCIP_RETCODE SCIPlpiSolveBarrier(SCIP_LPI *lpi, SCIP_Bool crossover)
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)
static SCIP_RETCODE lpistateCreate(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem, int ncols, int nrows)
SCIP_Bool SCIPlpiIsInfinity(SCIP_LPI *lpi, SCIP_Real val)
SCIP_Bool SCIPlpiHasPrimalSolve(void)
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)
SCIP_Bool SCIPlpiIsPrimalInfeasible(SCIP_LPI *lpi)
static void invalidateSolution(SCIP_LPI *lpi)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPlpiGetBInvACol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiStartStrongbranch(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
enum SCIP_LPParam SCIP_LPPARAM
#define BMSallocMemoryArray(ptr, num)
SCIP_Bool SCIPlpiIsObjlimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiDelRows(SCIP_LPI *lpi, int firstrow, int lastrow)
SCIP_RETCODE SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
#define BMSfreeMemory(ptr)
enum SCIP_Pricing SCIP_PRICING
static void lpistateFree(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem)
static void setOpttol(SCIP_NLPIPROBLEM *nlpiproblem, SCIP_Real opttol)
static SCIP_RETCODE ensureRstatMem(SCIP_LPI *lpi, int num)
SCIP_RETCODE SCIPlpiGetBInvCol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
SCIP_Bool SCIPlpiIsIterlimExc(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)
#define SOPLEX_TRY(messagehdlr, x)
SCIP_Bool SCIPlpiIsDualUnbounded(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiScaleCol(SCIP_LPI *lpi, int col, SCIP_Real scaleval)
polyscip::Polyscip::PolyscipStatus Status
abbreviation
SCIP_RETCODE SCIPlpiReadState(SCIP_LPI *lpi, const char *fname)
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)
static SCIP_RETCODE ensureCstatMem(SCIP_LPI *lpi, int num)
SCIP_RETCODE SCIPlpiGetNRows(SCIP_LPI *lpi, int *nrows)
packing single and dual bit values
SCIP_RETCODE SCIPlpiGetSolFeasibility(SCIP_LPI *lpi, SCIP_Bool *primalfeasible, SCIP_Bool *dualfeasible)
static int colpacketNum(int ncols)
SCIP_RETCODE SCIPlpiEndStrongbranch(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsTimelimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSetBase(SCIP_LPI *lpi, const int *cstat, const int *rstat)
SCIP_RETCODE SCIPlpiWriteLP(SCIP_LPI *lpi, const char *fname)
SCIP_RETCODE SCIPlpiDelColset(SCIP_LPI *lpi, int *dstat)
SCIP_RETCODE SCIPlpiGetRowNames(SCIP_LPI *lpi, int firstrow, int lastrow, char **rownames, char *namestorage, int namestoragesize, int *storageleft)
SCIP_RETCODE SCIPlpiSetIntegralityInformation(SCIP_LPI *lpi, int ncols, int *intInfo)
SCIP_Bool SCIPlpiExistsDualRay(SCIP_LPI *lpi)
static SCIP_RETCODE pricing(SCIP *scip, SCIP_PRICER *pricer, SCIP_Real *lowerbound, SCIP_Bool farkas)
SCIP_RETCODE SCIPlpiChgObjsen(SCIP_LPI *lpi, SCIP_OBJSEN objsen)
SCIP_RETCODE SCIPlpiGetObjval(SCIP_LPI *lpi, SCIP_Real *objval)
SCIP_Bool SCIPlpiHasDualSolve(void)
SCIP_RETCODE SCIPlpiIgnoreInstability(SCIP_LPI *lpi, SCIP_Bool *success)
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
SCIP_RETCODE SCIPlpiDelCols(SCIP_LPI *lpi, int firstcol, int lastcol)
SCIP_RETCODE SCIPlpiClearState(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetSides(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhss, SCIP_Real *rhss)
static void setIntParam(SCIP_LPI *lpi, int const param, int const parval)
SCIP_RETCODE SCIPlpiChgSides(SCIP_LPI *lpi, int nrows, const int *ind, const SCIP_Real *lhs, const SCIP_Real *rhs)
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 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)
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_RETCODE SCIPlpiFreeNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
static SCIP_Bool fileExists(const char *filename)
SCIP_Bool SCIPlpiIsDualFeasible(SCIP_LPI *lpi)
void SCIPencodeDualBit(const int *inp, SCIP_DUALPACKET *out, int count)
SCIP_RETCODE SCIPlpiChgBounds(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *lb, const SCIP_Real *ub)
#define CHECK_SOPLEX_PARAM(x)
#define SOPLEX_SUBVERSION
#define BMSfreeBlockMemory(mem, ptr)
unsigned int SCIP_DUALPACKET
SCIP_RETCODE SCIPlpiGetBInvARow(SCIP_LPI *lpi, int r, const SCIP_Real *binvrow, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiScaleRow(SCIP_LPI *lpi, int row, SCIP_Real scaleval)
SCIP_RETCODE SCIPlpiSolvePrimal(SCIP_LPI *lpi)
#define BMSallocBlockMemoryArray(mem, ptr, num)
static void setFeastol(SCIP_NLPIPROBLEM *nlpiproblem, SCIP_Real feastol)
const char * SCIPlpiGetSolverDesc(void)
#define BMSallocMemoryCPP(size)
#define BMSfreeBlockMemoryArray(mem, ptr, num)
SCIP_RETCODE SCIPlpiSetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real dval)
static void lpistatePack(SCIP_LPISTATE *lpistate, const int *cstat, const int *rstat)
SCIP_RETCODE SCIPlpiGetNCols(SCIP_LPI *lpi, int *ncols)
SCIP_RETCODE SCIPlpiGetBounds(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lbs, SCIP_Real *ubs)
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 SCIPlpiGetRows(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhs, SCIP_Real *rhs, int *nnonz, int *beg, int *ind, SCIP_Real *val)
static SCIP_RETCODE spxSolve(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiChgObj(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *obj)
SCIP_Bool SCIPlpiIsStable(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetBasisInd(SCIP_LPI *lpi, int *bind)
SCIP_RETCODE SCIPlpiGetColNames(SCIP_LPI *lpi, int firstcol, int lastcol, char **colnames, char *namestorage, int namestoragesize, int *storageleft)
int SCIPlpiGetInternalStatus(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiHasDualRay(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsPrimalUnbounded(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 SCIPlpiGetState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
SCIP_Bool SCIPlpiIsPrimalFeasible(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsOptimal(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiFree(SCIP_LPI **lpi)
SCIP_RETCODE SCIPlpiSetState(SCIP_LPI *lpi, BMS_BLKMEM *, const SCIP_LPISTATE *lpistate)
static void lpistateUnpack(const SCIP_LPISTATE *lpistate, int *cstat, int *rstat)
public methods for message output
SCIP_RETCODE SCIPlpiGetNNonz(SCIP_LPI *lpi, int *nnonz)
SCIP_DUALPACKET COLPACKET
SCIP_Bool SCIPlpiWasSolved(SCIP_LPI *lpi)
#define BMSallocMemory(ptr)
#define BMSreallocMemoryArray(ptr, num)
SCIP_RETCODE SCIPlpiClear(SCIP_LPI *lpi)
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_Bool SCIPlpiExistsPrimalRay(SCIP_LPI *lpi)
SCIP_DUALPACKET ROWPACKET
#define SOPLEX_TRY_ABORT(x)
SCIP_MESSAGEHDLR * messagehdlr
SCIP_RETCODE SCIPlpiGetBInvRow(SCIP_LPI *lpi, int r, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiSolveDual(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiFreeState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
SCIP_RETCODE SCIPlpiGetIterations(SCIP_LPI *lpi, int *iterations)
SCIP_Bool SCIPlpiIsDualInfeasible(SCIP_LPI *lpi)
#define BMSallocBlockMemory(mem, ptr)
SCIP_RETCODE SCIPlpiGetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real *dval)
struct BMS_BlkMem BMS_BLKMEM
SCIP_RETCODE SCIPlpiDelRowset(SCIP_LPI *lpi, int *dstat)
SCIP_RETCODE SCIPlpiGetPrimalRay(SCIP_LPI *lpi, SCIP_Real *ray)
SCIP_RETCODE SCIPlpiReadLP(SCIP_LPI *lpi, const char *fname)
SCIP_RETCODE SCIPlpiGetRealSolQuality(SCIP_LPI *lpi, SCIP_LPSOLQUALITY qualityindicator, SCIP_Real *quality)
SCIP_RETCODE SCIPlpiWriteState(SCIP_LPI *lpi, const char *fname)
SCIP_Bool SCIPlpiHasBarrierSolve(void)
SCIP_RETCODE SCIPlpiGetObjsen(SCIP_LPI *lpi, SCIP_OBJSEN *objsen)