43#define AUTOPRICING_ITERSWITCH 10000
44#define STRONGBRANCH_RESTOREBASIS
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(m_messagehdlr, "CPLEX error <%d>; SoPlex result unchecked\n", _cpxstat_); \
65 if( EXIT_AT_CPXERROR ) \
89#pragma GCC diagnostic ignored "-Wclass-memaccess"
97#ifndef SOPLEX_SUBVERSION
98#define SOPLEX_SUBVERSION 0
101#ifndef SOPLEX_APIVERSION
102#define SOPLEX_APIVERSION 0
106#if (SOPLEX_VERSION < 133)
107#error "This interface is not compatible with SoPlex versions prior to 1.4"
111#if (SOPLEX_VERSION >= 160)
112#if (SOPLEX_APIVERSION <= 5)
113#include "spxgithash.h"
117#define WITH_BOUNDFLIPPING
118#if (SOPLEX_APIVERSION <= 5)
120#include "spxsolver.h"
121#include "slufactor.h"
122#include "spxsteeppr.h"
123#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 6) || SOPLEX_VERSION > 160)
124#include "spxsteepexpr.h"
126#include "spxparmultpr.h"
127#include "spxdevexpr.h"
128#include "spxfastrt.h"
129#include "spxmainsm.h"
130#include "spxequilisc.h"
132#ifdef WITH_BOUNDFLIPPING
133#include "spxboundflippingrt.h"
145#if defined(_MSC_VER) && _MSC_VER < 1900
147#define snprintf _snprintf
151#define SOPLEX_VERBLEVEL 5
164using namespace soplex;
172#define SOPLEX_TRY(messagehdlr, x) do \
178 catch( const SPxMemoryException& E ) \
180 std::string s = E.what(); \
181 SCIPerrorMessage("SoPlex threw a memory exception: %s\n", s.c_str()); \
184 catch( const SPxException& E ) \
186 std::string s = E.what(); \
187 SCIPmessagePrintWarning((messagehdlr), "SoPlex threw an exception: %s\n", s.c_str()); \
188 return SCIP_LPERROR; \
194#define SOPLEX_TRY(messagehdlr, x) do \
200 catch( const SPxMemoryException& E ) \
202 std::string s = E.what(); \
203 SCIPerrorMessage("SoPlex threw a memory exception: %s\n", s.c_str()); \
206 catch( const SPxException& ) \
208 return SCIP_LPERROR; \
217#define SOPLEX_TRY_ABORT(x) do \
223 catch( const SPxException& E ) \
225 std::string s = E.what(); \
226 SCIPerrorMessage("SoPlex threw an exception: %s\n", s.c_str()); \
237 SPxLP::SPxSense m_sense;
239 SPxSteepPR m_price_steep;
240#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 6) || SOPLEX_VERSION > 160)
241 SPxSteepExPR m_price_steep_ex;
243 SPxSteepPR m_price_steep_ex;
245 SPxParMultPR m_price_parmult;
246 SPxDevexPR m_price_devex;
247#ifdef WITH_BOUNDFLIPPING
248 SPxBoundFlippingRT m_ratio;
265 DataArray<SPxSolver::VarStatus> m_rowstat;
266 DataArray<SPxSolver::VarStatus> m_colstat;
270#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 201)
274#ifdef SCIP_WITH_LPSCHECK
285 const char* probname =
NULL
289 m_fromscratch(
false),
291 m_objLoLimit(-soplex::infinity),
292 m_objUpLimit(soplex::infinity),
303 m_messagehdlr(messagehdlr)
305#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 201)
306 setOutstream(m_spxout);
309 setSense(SPxLP::MINIMIZE);
310#if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION == 4)
311 setBasisSolver(&m_slu);
316 setPricer(&m_price_steep);
319 if ( probname !=
NULL )
322#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 160)
323 m_lpifeastol = SPxSolver::feastol();
324 m_lpiopttol = SPxSolver::opttol();
326 m_lpifeastol = SPxSolver::delta();
327 m_lpiopttol = SPxSolver::delta();
330#ifdef SCIP_WITH_LPSCHECK
332 m_cpxenv = CPXopenCPLEX(&cpxstat);
334 m_cpxlp = CPXcreateprob(m_cpxenv, &cpxstat, probname !=
NULL ? probname :
"spxcheck");
335 (void) CPXsetintparam(m_cpxenv, CPX_PARAM_SCRIND, 0);
337 m_doublecheck =
false;
343 if( m_probname !=
NULL )
344 spx_free(m_probname);
346 freePreStrongbranchingBasis();
348 if( m_rownames !=
NULL )
350 m_rownames->~NameSet();
351 spx_free(m_rownames);
353 if( m_colnames !=
NULL )
355 m_colnames->~NameSet();
356 spx_free(m_colnames);
359#ifdef SCIP_WITH_LPSCHECK
360 (void) CPXfreeprob(m_cpxenv, &m_cpxlp);
361 (void) CPXcloseCPLEX(&m_cpxenv);
378#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 160)
379 SPxSolver::setFeastol(d);
381 SPxSolver::setDelta(d);
398#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 160)
399 SPxSolver::setOpttol(d);
401 SPxSolver::setDelta(d);
405 bool isPerturbed()
const
408 return (shift() >= 10.0 * epsilon());
412 void setIterationLimit(
421 setPricer(&m_price_devex);
422 m_autopricing =
true;
427 setPricer(&m_price_steep);
428 m_autopricing =
false;
431 void setSteepPricer()
433 setPricer(&m_price_steep_ex);
434 m_autopricing =
false;
437 void setSteepQStartPricer()
439 setPricer(&m_price_steep);
440 m_autopricing =
false;
443 void setParmultPricer()
445 setPricer(&m_price_parmult);
446 m_autopricing =
false;
449 void setDevexPricer()
451 setPricer(&m_price_devex);
452 m_autopricing =
false;
456 int getIterationLimit()
const
461 bool getFromScratch()
const
463 return m_fromscratch;
466 void setFromScratch(
bool fs)
471 int getScaling()
const
476 void setScaling(
int s)
481 bool getPresolving()
const
486 void setPresolving(
bool p)
491 bool getLpInfo()
const
496 void setLpInfo(
bool li)
501 SPxLP::SPxSense getSense()
const
503 assert(m_sense == sense());
508 void setSense(
const SPxLP::SPxSense sen)
510 assert(m_sense == sense());
518 if( m_sense == SPxLP::MINIMIZE && getObjUpLimit() < soplex::infinity )
521 SPxSolver::setTerminationValue(getObjUpLimit());
523 else if( m_sense == SPxLP::MAXIMIZE && getObjLoLimit() > -soplex::infinity )
526 SPxSolver::setTerminationValue(getObjLoLimit());
531 void setProbname(
const char* probname)
536 if( m_probname !=
NULL )
537 spx_free(m_probname);
539 len = strlen(probname);
540 spx_alloc(m_probname, len + 1);
541 memcpy(m_probname, probname, len + 1);
544 Real getObjLoLimit()
const
549 void setObjLoLimit(Real limit)
551 if( getSense() == SPxLP::MAXIMIZE )
553 SCIPdebugMessage(
"setting termination value from <%g> to <%g>\n", m_objLoLimit, limit);
554 SPxSolver::setTerminationValue(limit);
556 m_objLoLimit = limit;
559 Real getObjUpLimit()
const
564 void setObjUpLimit(Real limit)
566 if( getSense() == SPxLP::MINIMIZE )
568 SCIPdebugMessage(
"setting termination value from <%g> to <%g>\n", m_objUpLimit, limit);
569 SPxSolver::setTerminationValue(limit);
571 m_objUpLimit = limit;
574 void setRep(SPxSolver::Representation p_rep)
578 SCIPdebugMessage(
"switching to %s representation of the basis\n", p_rep == SPxSolver::ROW ?
"row" :
"column");
579 SPxSolver::setRep(p_rep);
583#ifdef SCIP_WITH_LPSCHECK
584 bool getDoubleCheck()
587 return m_doublecheck && m_checknum + 1 >= CHECK_START;
590 void setDoubleCheck(
bool dc)
595 const char* spxStatusString(
const SPxSolver::Status stat)
599 case SPxSolver::ABORT_TIME:
601 case SPxSolver::ABORT_ITER:
603 case SPxSolver::ABORT_VALUE:
604 return "ABORT_VALUE";
605 case SPxSolver::SINGULAR:
607 case SPxSolver::REGULAR:
609 case SPxSolver::UNKNOWN:
611 case SPxSolver::OPTIMAL:
613 case SPxSolver::UNBOUNDED:
615 case SPxSolver::INFEASIBLE:
624 const char* cpxStatusString(
const int stat)
628 case CPX_STAT_ABORT_TIME_LIM:
630 case CPX_STAT_ABORT_IT_LIM:
632 case CPX_STAT_ABORT_OBJ_LIM:
633 return "ABORT_VALUE";
634 case CPX_STAT_OPTIMAL:
636 case CPX_STAT_OPTIMAL_INFEAS:
637 return "CPX_STAT_OPTIMAL_INFEAS: OPT SOL INFEASIBLE AFTER UNSCALING";
638 case CPX_STAT_UNBOUNDED:
640 case CPX_STAT_INFEASIBLE:
642 case CPX_STAT_INForUNBD:
643 return "INFEASIBLE or UNBOUNDED";
644 case CPX_STAT_NUM_BEST:
645 return "CPX_STAT_NUM_BEST: SOL AVAILABLE BUT NOT PROVEN OPTIMAL DUE TO NUM TROUBLE";
655 bool checkConsistentBounds()
const
657 for(
int i = 0;
i < nCols(); ++
i )
659 if( lower(
i) > upper(
i) + Param::epsilon() )
661 SCIPerrorMessage(
"inconsistent bounds on column %d: lower=%.17g, upper=%.17g\n",
662 i, lower(
i), upper(
i));
670 bool checkConsistentSides()
const
672 for(
int i = 0;
i < nRows(); ++
i )
674 if( lhs(
i) > rhs(
i) + Param::epsilon() )
686 void trySolve(
bool printwarning =
true)
692 m_stat = SPxSolver::solve();
694 catch(
const SPxException&
x )
696 std::string s =
x.what();
701 m_stat = SPxSolver::status();
707 assert( m_stat != SPxSolver::OPTIMAL );
711 m_itused += SPxSolver::iterations();
712 assert(m_itlim < 0 || m_itused <= m_itlim);
715 timespent = SPxSolver::time();
719 timelimit = SPxSolver::terminationTime();
720 if( timelimit > timespent )
721 timelimit -= timespent;
726 SPxSolver::setTerminationTime(timelimit);
730 void doSolve(
bool printwarning =
true)
733#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 201)
734 SPxOut::Verbosity verbosity;
735 verbosity = m_spxout.getVerbosity();
736 m_spxout.setVerbosity(getLpInfo() ? (SPxOut::Verbosity)
SOPLEX_VERBLEVEL : (SPxOut::Verbosity) 0);
739 verbosity = Param::verbose();
743 assert(checkConsistentBounds());
744 assert(checkConsistentSides());
746#ifdef SCIP_WITH_LPSCHECK
748 if( getDoubleCheck() )
755 trySolve(printwarning);
757 if( m_autopricing && m_stat == SPxSolver::ABORT_ITER && (m_itlim < 0 || m_itlim - m_itused > 0) )
759 setTerminationIter(m_itlim - m_itused);
760 setPricer(&m_price_steep_ex);
762 trySolve(printwarning);
764 setPricer(&m_price_devex);
768 setTerminationIter(m_itlim);
770 if( m_stat == OPTIMAL )
774 if( (
objval > m_objUpLimit) || (
objval < m_objLoLimit) )
775 m_stat = ABORT_VALUE;
778#ifdef SCIP_WITH_LPSCHECK
780 if( getDoubleCheck() && (m_stat == SPxSolver::OPTIMAL || m_stat == SPxSolver::UNBOUNDED || m_stat == SPxSolver::INFEASIBLE || m_stat == SPxSolver::ABORT_VALUE) )
786 CPX_CALL( CPXreadcopyprob(m_cpxenv, m_cpxlp,
"spxcheck.mps",
NULL) );
787 CPX_CALL( CPXreadcopybase(m_cpxenv, m_cpxlp,
"spxcheck.bas") );
790 CPX_CALL( CPXsetdblparam(m_cpxenv, CPX_PARAM_EPOPT,
MAX(opttol(), 1e-9)) );
791 CPX_CALL( CPXsetdblparam(m_cpxenv, CPX_PARAM_EPRHS,
MAX(feastol(), 1e-9)) );
794 CPX_CALL( CPXlpopt(m_cpxenv, m_cpxlp) );
797 CPX_CALL( CPXsolution(m_cpxenv, m_cpxlp, &cpxstat, &cpxobj,
NULL,
NULL,
NULL,
NULL) );
798 if( getSense() == SPxLP::MAXIMIZE )
802 if( cpxstat == CPX_STAT_OPTIMAL_INFEAS )
804 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s)\n",
805 m_probname, m_stat, spxStatusString(m_stat), cpxstat, cpxStatusString(cpxstat));
806 if( EXIT_AT_CPXERROR )
809 else if( (m_stat == SPxSolver::OPTIMAL && cpxstat != CPX_STAT_OPTIMAL)
810 || (m_stat == SPxSolver::UNBOUNDED && cpxstat != CPX_STAT_UNBOUNDED)
811 || (m_stat == SPxSolver::INFEASIBLE && cpxstat != CPX_STAT_INFEASIBLE) )
813 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
814 m_probname, m_stat, spxStatusString(m_stat), cpxstat, cpxStatusString(cpxstat), m_checknum);
815 if( EXIT_AT_WRONG_RESULT )
818 else if( m_stat == SPxSolver::ABORT_VALUE )
822 case CPX_STAT_OPTIMAL:
823 if( (getSense() == SPxSolver::MINIMIZE && LTrel(cpxobj, getObjUpLimit(), 2*opttol()))
824 || (getSense() == SPxSolver::MAXIMIZE && GTrel(cpxobj, getObjLoLimit(), 2*opttol())) )
826 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
827 m_probname, m_stat, spxStatusString(m_stat), cpxobj, getSense() == SPxSolver::MINIMIZE ?
"<" :
">",
828 getSense() == SPxSolver::MINIMIZE ? getObjUpLimit() : getObjLoLimit(), cpxStatusString(cpxstat), m_checknum);
829 if( EXIT_AT_WRONG_RESULT )
832 else if( (getSense() == SPxSolver::MINIMIZE && cpxobj < getObjUpLimit())
833 || (getSense() == SPxSolver::MAXIMIZE && cpxobj > getObjLoLimit()) )
835 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
836 m_probname, m_stat, spxStatusString(m_stat), cpxobj, getSense() == SPxSolver::MINIMIZE ?
"<" :
">",
837 getSense() == SPxSolver::MINIMIZE ? getObjUpLimit() : getObjLoLimit(), cpxStatusString(cpxstat), m_checknum);
840 case CPX_STAT_OPTIMAL_INFEAS:
841 case CPX_STAT_NUM_BEST:
842 if( (getSense() == SPxSolver::MINIMIZE && cpxobj < getObjUpLimit())
843 || (getSense() == SPxSolver::MAXIMIZE && cpxobj > getObjLoLimit()) )
845 SCIPerrorMessage(
"In %s: SoPlex returned status=%d (%s) while CPLEX claims obj=%.10f %s %.10f=obj.limit (%s) (checknum=%d)\n",
846 m_probname, m_stat, spxStatusString(m_stat), cpxobj, getSense() == SPxSolver::MINIMIZE ?
"<" :
">",
847 getSense() == SPxSolver::MINIMIZE ? getObjUpLimit() : getObjLoLimit(), cpxStatusString(cpxstat), m_checknum);
850 case CPX_STAT_INFEASIBLE:
852 case CPX_STAT_UNBOUNDED:
853 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
854 m_probname, m_stat, spxStatusString(m_stat), cpxstat, cpxStatusString(cpxstat), m_checknum);
855 if( EXIT_AT_WRONG_RESULT )
858 case CPX_STAT_INForUNBD:
860 SCIPerrorMessage(
"In %s: SoPlex status=%d (%s) while CPLEX status=%d (%s) (checknum=%d)\n",
861 m_probname, m_stat, spxStatusString(m_stat), cpxstat, cpxStatusString(cpxstat), m_checknum);
866 else if( m_stat == SPxSolver::OPTIMAL )
868 if( (getSense() == SPxSolver::MINIMIZE && LTrel(value(), cpxobj, 2*opttol()))
869 || (getSense() == SPxSolver::MAXIMIZE && GTrel(value(), cpxobj, 2*opttol())) )
874 else if( (getSense() == SPxSolver::MINIMIZE && GTrel(value(), cpxobj, 2*opttol()))
875 || (getSense() == SPxSolver::MAXIMIZE && LTrel(value(), cpxobj, 2*opttol())) )
877 SCIPerrorMessage(
"In %s: LP optimal; SoPlex value=%.10f %s CPLEX value=%.10f suboptimal (checknum=%d)\n", value(),
878 m_probname, getSense() == SPxSolver::MINIMIZE ?
">" :
"<", cpxobj, m_checknum);
879 if( EXIT_AT_WRONG_RESULT )
889#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 201)
890 m_spxout.setVerbosity(verbosity);
892 Param::setVerbose(verbosity);
897 virtual Status solve()
899 assert(m_sense == sense());
900 SPxEquiliSC* scaler =
NULL;
901 SPxMainSM* simplifier =
NULL;
903 SPxSimplifier::Result
result = SPxSimplifier::OKAY;
906 if ( getFromScratch() )
912 catch(
const SPxException&
x )
914 std::string s =
x.what();
916 m_stat = SPxSolver::status();
917 assert( m_stat != SPxSolver::OPTIMAL );
921 assert(!getFromScratch() || getBasisStatus() == SPxBasis::NO_PROBLEM);
924 if( SPxSolver::getBasisStatus() == SPxBasis::NO_PROBLEM && (getScaling() > 0) && nCols() > 0 && nRows() > 0 )
926 spx_alloc(scaler, 1);
927 scaler =
new (scaler) SPxEquiliSC();
929#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 201)
930 scaler->setOutstream(m_spxout);
934 if( SPxSolver::getBasisStatus() == SPxBasis::NO_PROBLEM && getPresolving() && nCols() > 0 && nRows() > 0 )
936 spx_alloc(simplifier, 1);
937 simplifier =
new (simplifier) SPxMainSM();
942 if( scaler !=
NULL || simplifier !=
NULL )
943 origlp = SPxLP(*
this);
952 scaler->scale(*
this);
955 if( simplifier !=
NULL )
958#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 201)
959 SPxOut::Verbosity verbosity;
960 verbosity = m_spxout.getVerbosity();
961 m_spxout.setVerbosity(getLpInfo() ? (SPxOut::Verbosity)
SOPLEX_VERBLEVEL : (SPxOut::Verbosity) 0);
964 verbosity = Param::verbose();
968#ifdef WITH_BOUNDFLIPPING
969 result = simplifier->simplify(*
this, epsilon(), feastol(), opttol(),
true);
971#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 160)
972 result = simplifier->simplify(*
this, epsilon(), feastol(), opttol());
974 result = simplifier->simplify(*
this, epsilon(), delta());
977 SCIPdebugMessage(
"simplifier ended with status %u (0: OKAY, 1: INFEASIBLE, 2: DUAL_INFEASIBLE, 3: UNBOUNDED, 4: VANISHED)\n",
result);
980 if(
result == SPxSimplifier::INFEASIBLE ||
result == SPxSimplifier::DUAL_INFEASIBLE )
982 SCIPdebugMessage(
"simplifier detected primal or dual infeasibility - reloading and solving unsimplified LP\n");
984 simplifier->~SPxMainSM();
985 spx_free(simplifier);
987 SPxSolver::loadLP(origlp);
993#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 201)
994 m_spxout.setVerbosity(verbosity);
996 Param::setVerbose(verbosity);
1001 if(
result != SPxSimplifier::VANISHED )
1004 Real objlolimit = getObjLoLimit();
1005 Real objuplimit = getObjUpLimit();
1007 if( simplifier !=
NULL || scaler !=
NULL )
1009 setObjLoLimit(-soplex::infinity);
1010 setObjUpLimit(soplex::infinity);
1019 if( simplifier !=
NULL || scaler !=
NULL )
1021 setObjLoLimit(objlolimit);
1022 setObjUpLimit(objuplimit);
1027 if( m_stat != SPxSolver::OPTIMAL && simplifier !=
NULL )
1029 SCIPdebugMessage(
"presolved LP not optimal - reloading and solving original LP\n");
1031 simplifier->~SPxMainSM();
1032 spx_free(simplifier);
1034 SPxSolver::loadLP(origlp);
1041 if( scaler !=
NULL || simplifier !=
NULL )
1043 SPxSolver::VarStatus* cstat =
NULL;
1044 SPxSolver::VarStatus* rstat =
NULL;
1047 if( (simplifier ==
NULL ||
result != SPxSimplifier::VANISHED) && SPxSolver::getBasisStatus() >= SPxBasis::REGULAR )
1050 spx_alloc(rstat, nRows());
1051 spx_alloc(cstat, nCols());
1052 (void) SPxSolver::getBasis(rstat, cstat);
1056 if( simplifier !=
NULL && SPxSolver::getBasisStatus() >= SPxBasis::REGULAR )
1062 int ncols =
result == SPxSimplifier::VANISHED ? 0 : nCols();
1063 int nrows =
result == SPxSimplifier::VANISHED ? 0 : nRows();
1066 DVector primals(ncols);
1067 DVector duals(nrows);
1068 DVector slacks(nrows);
1069 DVector redcosts(ncols);
1070 if(
result != SPxSimplifier::VANISHED )
1072 (void) SPxSolver::getPrimal(primals);
1073 (void) SPxSolver::getDual(duals);
1074 (void) SPxSolver::getSlacks(slacks);
1075 (void) SPxSolver::getRedCost(redcosts);
1082 simplifier->unsimplify(primals, duals, slacks, redcosts, rstat, cstat);
1084 catch(
const SPxException&
x )
1086 std::string s =
x.what();
1087 SCIPmessagePrintWarning(m_messagehdlr,
"SoPlex unsimplification unsuccessful; solving again without LP presolving (SoPlex says %s)\n",
1096 if( simplifier->isUnsimplified() )
1101 spx_alloc(rstat, origlp.nRows());
1102 spx_alloc(cstat, origlp.nCols());
1103 simplifier->getBasis(rstat, cstat);
1109 SPxSolver::loadLP(origlp);
1113 if( rstat !=
NULL && cstat !=
NULL )
1116 SPxSolver::setBasis(rstat, cstat);
1131 if( scaler !=
NULL )
1133 scaler->~SPxEquiliSC();
1136 if( simplifier !=
NULL )
1138 simplifier->~SPxMainSM();
1139 spx_free(simplifier);
1143 if( m_stat == OPTIMAL )
1147 if( (
objval > m_objUpLimit) || (
objval < m_objLoLimit) )
1148 m_stat = ABORT_VALUE;
1155 void savePreStrongbranchingBasis()
1157 m_rowstat.reSize(nRows());
1158 m_colstat.reSize(nCols());
1162 m_stat = getBasis(m_rowstat.get_ptr(), m_colstat.get_ptr());
1165 catch(
const SPxException&
x )
1167 std::string s =
x.what();
1174 assert(m_stat != SPxSolver::OPTIMAL);
1177 catch(
const SPxException& )
1184 void restorePreStrongbranchingBasis()
1186 assert(m_rowstat.size() == nRows());
1187 assert(m_colstat.size() == nCols());
1191 setBasis(m_rowstat.get_const_ptr(), m_colstat.get_const_ptr());
1194 catch(
const SPxException&
x )
1196 std::string s =
x.what();
1199 catch(
const SPxException& )
1202 m_stat = SPxSolver::status();
1208 assert(m_stat != SPxSolver::OPTIMAL);
1213 void freePreStrongbranchingBasis()
1220 bool preStrongbranchingBasisFreed()
const
1222 return ((m_rowstat.size() == 0 ) && (m_colstat.size() == 0));
1226 DataArray<SPxSolver::VarStatus>& rowStat()
1232 DataArray<SPxSolver::VarStatus>& colStat()
1237 Status getStatus()
const
1242 Status updateStatus()
1244 m_stat = SPxSolver::status();
1248 bool isInitialized()
const
1250 return SPxSolver::isInitialized();
1253 int iterations()
const
1258 virtual void clear()
1261 freePreStrongbranchingBasis();
1262 m_stat = NO_PROBLEM;
1266 bool readLP(
const char* fname)
1270 if ( m_rownames != 0 )
1271 m_rownames->~NameSet();
1273 spx_alloc(m_colnames, 1);
1275 if ( m_colnames != 0 )
1276 m_colnames->~NameSet();
1278 spx_alloc(m_rownames, 1);
1280 m_rownames =
new (m_rownames) NameSet();
1281 m_colnames =
new (m_colnames) NameSet();
1283 if( SPxSolver::readFile(fname, m_rownames, m_colnames) )
1285 m_stat = NO_PROBLEM;
1299 int namestoragesize,
1306 if ( namestoragesize == 0 )
1309 *storageleft = -m_colnames->memSize();
1313 NameSet* names = m_colnames;
1315 int sizeleft = namestoragesize;
1316 char* s = namestorage;
1317 for (
int j = firstcol; j <= lastcol; ++j)
1319 const char* t = (*names)[j];
1320 colnames[j-firstcol] = s;
1321 while( *t !=
'\0' && sizeleft >= 0 )
1328 if ( sizeleft == 0 )
1330 *storageleft = namestoragesize - m_colnames->memSize();
1331 assert( *storageleft <= 0 );
1334 *storageleft = sizeleft;
1344 int namestoragesize,
1351 if ( namestoragesize == 0 )
1354 *storageleft = -m_rownames->memSize();
1358 NameSet* names = m_rownames;
1360 int sizeleft = namestoragesize;
1361 char* s = namestorage;
1362 for (
int i = firstrow;
i <= lastrow; ++
i)
1364 const char* t = (*names)[
i];
1365 rownames[
i-firstrow] = s;
1366 while( *t !=
'\0' && sizeleft >= 0 )
1373 if ( sizeleft == 0 )
1375 *storageleft = m_rownames->memSize() - namestoragesize;
1376 assert( *storageleft <= 0 );
1379 *storageleft = sizeleft;
1395#define COLS_PER_PACKET SCIP_DUALPACKETSIZE
1397#define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
1457 assert(num <= lpi->cstatsize);
1479 assert(num <= lpi->rstatsize);
1600 return SPxLP::MAXIMIZE;
1602 return SPxLP::MINIMIZE;
1606 return SPxLP::MINIMIZE;
1636#if (SOPLEX_SUBVERSION > 0)
1637 const static char spxname[20]= {
'S',
'o',
'p',
'l',
'e',
'x',
'1',
' ', SOPLEX_VERSION/100 +
'0',
'.', (SOPLEX_VERSION % 100)/10 +
'0',
'.', SOPLEX_VERSION % 10 +
'0',
'.',
SOPLEX_SUBVERSION +
'0',
'\0'};
1639 const static char spxname[20] = {
'S',
'o',
'p',
'l',
'e',
'x',
'1',
' ', SOPLEX_VERSION/100 +
'0',
'.', (SOPLEX_VERSION % 100)/10 +
'0',
'.', SOPLEX_VERSION % 10 +
'0',
'\0'};
1647 (void)snprintf(
spxdesc, 200,
"%s [GitHash: %s]",
"Linear Programming Solver developed at Zuse Institute Berlin (soplex.zib.de)"
1648#ifdef SCIP_WITH_LPSCHECK
1649 " - including CPLEX double check"
1680 return (
void*) lpi->
spx;
1690#if (SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3))
1691 assert(ncols == lpi->
spx->nCols() || (ncols == 0 && intInfo ==
NULL));
1692 lpi->
spx->setIntegralityInformation(ncols, intInfo);
1695 SCIPerrorMessage(
"SCIPlpiSetIntegralityInformation() has not been implemented yet.\n");
1752 SOPLEX_TRY( messagehdlr, (*lpi)->spx = new ((*lpi)->spx) SPxSCIP(messagehdlr, name) );
1753 (*lpi)->cstat =
NULL;
1754 (*lpi)->rstat =
NULL;
1755 (*lpi)->cstatsize = 0;
1756 (*lpi)->rstatsize = 0;
1758 (*lpi)->factorization = 0;
1760 (*lpi)->conditionlimit = -1.0;
1761 (*lpi)->checkcondition =
FALSE;
1762 (*lpi)->messagehdlr = messagehdlr;
1785 (*lpi)->spx->~SPxSCIP();
1830 for( j = 0; j < nnonz; j++ )
1849 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1853 SPxSCIP* spx = lpi->
spx;
1854 LPRowSet rows(nrows);
1855 DSVector emptyVector(0);
1864 for(
i = 0;
i < nrows; ++
i )
1865 rows.add(lhs[
i], emptyVector, rhs[
i]);
1872 catch(
const SPxException&
x )
1874 std::string s =
x.what();
1877 catch(
const SPxException& )
1915 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1921 int nrows = lpi->
spx->nRows();
1922 for (
int j = 0; j < nnonz; ++j)
1924 assert( 0 <= ind[j] && ind[j] < nrows );
1930 SPxSCIP* spx = lpi->
spx;
1933 LPColSet cols(ncols);
1934 DSVector colVector(ncols);
1940 for(
i = 0;
i < ncols; ++
i )
1946 last = (
i == ncols-1 ? nnonz : beg[
i+1]);
1947 colVector.add( last-start, &ind[start], &val[start] );
1949 cols.add(
obj[
i], lb[
i], colVector, ub[
i]);
1954 catch(
const SPxException&
x )
1956 std::string s =
x.what();
1959 catch(
const SPxException& )
1979 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->nCols());
1983 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2009 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2011 ncols = lpi->
spx->nCols();
2014 for(
i = 0;
i < ncols; ++
i )
2047 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2053 int ncols = lpi->
spx->nCols();
2054 for (
int j = 0; j < nnonz; ++j)
2056 assert( 0 <= ind[j] && ind[j] < ncols );
2064 SPxSCIP* spx = lpi->
spx;
2065 LPRowSet rows(nrows);
2072 for(
i = 0;
i < nrows; ++
i )
2078 last = (
i == nrows-1 ? nnonz : beg[
i+1]);
2079 rowVector.add( last-start, &ind[start], &val[start] );
2081 rows.add(lhs[
i], rowVector, rhs[
i]);
2086 catch(
const SPxException&
x )
2088 std::string s =
x.what();
2091 catch(
const SPxException& )
2111 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->nRows());
2115 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2140 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2142 nrows = lpi->
spx->nRows();
2145 for(
i = 0;
i < nrows; ++
i )
2165 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2192 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2196 for(
i = 0;
i < ncols; ++
i )
2198 assert(0 <= ind[
i] && ind[
i] < lpi->
spx->nCols());
2202 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[
i]);
2207 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[
i]);
2211 lpi->
spx->changeBounds(ind[
i], lb[
i], ub[
i]);
2212 assert(lpi->
spx->lower(ind[
i]) <= lpi->
spx->upper(ind[
i]) + Param::epsilon());
2216 catch(
const SPxException&
x )
2218 std::string s =
x.what();
2221 catch(
const SPxException& )
2253 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2257 for(
i = 0;
i < nrows; ++
i )
2259 assert(0 <= ind[
i] && ind[
i] < lpi->
spx->nRows());
2260 lpi->
spx->changeRange(ind[
i], lhs[
i], rhs[
i]);
2261 assert(lpi->
spx->lhs(ind[
i]) <= lpi->
spx->rhs(ind[
i]) + Param::epsilon());
2265 catch(
const SPxException&
x )
2267 std::string s =
x.what();
2270 catch(
const SPxException& )
2291 assert(0 <= row && row < lpi->spx->nRows());
2292 assert(0 <= col && col < lpi->spx->nCols());
2296 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2316 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2342 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2346 for(
i = 0;
i < ncols; ++
i )
2348 assert(0 <= ind[
i] && ind[
i] < lpi->
spx->nCols());
2349 lpi->
spx->changeObj(ind[
i],
obj[
i]);
2353 catch(
const SPxException&
x )
2355 std::string s =
x.what();
2358 catch(
const SPxException& )
2387 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2390 SVector rowvec = lpi->
spx->rowVector(row);
2391 lhs = lpi->
spx->lhs(row);
2392 rhs = lpi->
spx->rhs(row);
2398 if( lhs > -soplex::infinity )
2400 else if( scaleval < 0.0 )
2401 lhs = soplex::infinity;
2402 if( rhs < soplex::infinity )
2404 else if( scaleval < 0.0 )
2405 rhs = -soplex::infinity;
2406 if( scaleval < 0.0 )
2414 LPRow lprow(lhs, rowvec, rhs);
2417 lpi->
spx->changeRow(row, lprow);
2421 catch(
const SPxException&
x )
2423 std::string s =
x.what();
2426 catch(
const SPxException& )
2458 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2461 SVector colvec = lpi->
spx->colVector(col);
2462 obj = lpi->
spx->obj(col);
2463 lb = lpi->
spx->lower(col);
2464 ub = lpi->
spx->upper(col);
2473 if( lb > -soplex::infinity )
2475 else if( scaleval < 0.0 )
2476 lb = soplex::infinity;
2477 if( ub < soplex::infinity )
2479 else if( scaleval < 0.0 )
2480 ub = -soplex::infinity;
2481 if( scaleval < 0.0 )
2489 LPCol lpcol(
obj, colvec, ub, lb);
2492 lpi->
spx->changeCol(col, lpcol);
2496 catch(
const SPxException&
x )
2498 std::string s =
x.what();
2501 catch(
const SPxException& )
2534 *nrows = lpi->
spx->nRows();
2551 *ncols = lpi->
spx->nCols();
2572 if( lpi->
spx->nRows() < lpi->
spx->nCols() )
2574 for(
i = 0;
i < lpi->
spx->nRows(); ++
i )
2575 (*nnonz) += lpi->
spx->rowVector(
i).size();
2579 for(
i = 0;
i < lpi->
spx->nCols(); ++
i )
2580 (*nnonz) += lpi->
spx->colVector(
i).size();
2609 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->nCols());
2615 const Vector& lbvec = lpi->
spx->lower();
2616 const Vector& ubvec = lpi->
spx->upper();
2617 for(
i = firstcol;
i <= lastcol; ++
i )
2619 lb[
i-firstcol] = lbvec[
i];
2620 ub[
i-firstcol] = ubvec[
i];
2627 for(
i = firstcol;
i <= lastcol; ++
i )
2629 beg[
i-firstcol] = *nnonz;
2630 const SVector& cvec = lpi->
spx->colVector(
i);
2631 for( j = 0; j < cvec.size(); ++j )
2633 ind[*nnonz] = cvec.index(j);
2634 val[*nnonz] = cvec.value(j);
2666 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->nRows());
2672 const Vector& lhsvec = lpi->
spx->lhs();
2673 const Vector& rhsvec = lpi->
spx->rhs();
2674 for(
i = firstrow;
i <= lastrow; ++
i )
2676 lhs[
i-firstrow] = lhsvec[
i];
2677 rhs[
i-firstrow] = rhsvec[
i];
2684 for(
i = firstrow;
i <= lastrow; ++
i )
2686 beg[
i-firstrow] = *nnonz;
2687 const SVector& rvec = lpi->
spx->rowVector(
i);
2688 for( j = 0; j < rvec.size(); ++j )
2690 ind[*nnonz] = rvec.index(j);
2691 val[*nnonz] = rvec.value(j);
2707 int namestoragesize,
2713 assert( colnames !=
NULL || namestoragesize == 0 );
2714 assert( namestorage !=
NULL || namestoragesize == 0 );
2715 assert( namestoragesize >= 0 );
2717 assert( 0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->nCols() );
2721 lpi->
spx->getColNames(firstcol, lastcol, colnames, namestorage, namestoragesize, storageleft);
2733 int namestoragesize,
2739 assert( rownames !=
NULL || namestoragesize == 0 );
2740 assert( namestorage !=
NULL || namestoragesize == 0 );
2741 assert( namestoragesize >= 0 );
2743 assert( 0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->nRows() );
2747 lpi->
spx->getRowNames(firstrow, lastrow, rownames, namestorage, namestoragesize, storageleft);
2783 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->nCols());
2786 for(
i = firstcol;
i <= lastcol; ++
i )
2787 vals[
i-firstcol] = lpi->
spx->obj(
i);
2807 assert(0 <= firstcol && firstcol <= lastcol && lastcol < lpi->spx->nCols());
2809 for(
i = firstcol;
i <= lastcol; ++
i )
2812 lbs[
i-firstcol] = lpi->
spx->lower(
i);
2814 ubs[
i-firstcol] = lpi->
spx->upper(
i);
2835 assert(0 <= firstrow && firstrow <= lastrow && lastrow < lpi->spx->nRows());
2837 for(
i = firstrow;
i <= lastrow; ++
i )
2840 lhss[
i-firstrow] = lpi->
spx->lhs(
i);
2842 rhss[
i-firstrow] = lpi->
spx->rhs(
i);
2860 assert(0 <= col && col < lpi->spx->nCols());
2861 assert(0 <= row && row < lpi->spx->nRows());
2864 *val = lpi->
spx->colVector(col)[row];
2885 SPxSolver::Representation rep,
2886 SPxSolver::Type type
2891 assert( rep == SPxSolver::ROW || rep == SPxSolver::COLUMN );
2892 assert( type == SPxSolver::ENTER || type == SPxSolver::LEAVE );
2894 SCIPdebugMessage(
"calling SoPlex solve(): %d cols, %d rows, rep=%s\n", lpi->
spx->nCols(), lpi->
spx->nRows(),
2895 rep == SPxSolver::COLUMN ?
"column" :
"row");
2899 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2902 lpi->
spx->setRep(rep);
2903 lpi->
spx->setType(type);
2905#ifdef SCIP_WITH_LPSCHECK
2906 lpi->
spx->setDoubleCheck(CHECK_SPXSOLVE);
2909 SPxSolver::Status status = lpi->
spx->solve();
2910 SCIPdebugMessage(
" -> SoPlex status: %d, basis status: %d\n", lpi->
spx->getStatus(), lpi->
spx->basis().status());
2915 case SPxSolver::ABORT_TIME:
2916 case SPxSolver::ABORT_ITER:
2917 case SPxSolver::ABORT_VALUE:
2918 case SPxSolver::SINGULAR:
2919 case SPxSolver::REGULAR:
2920 case SPxSolver::UNKNOWN:
2921 case SPxSolver::OPTIMAL:
2922 case SPxSolver::UNBOUNDED:
2923 case SPxSolver::INFEASIBLE:
2947 rowrep = lpi->
spx->rep() == SPxSolver::ROW;
2967 retcode = rowrep ?
spxSolve(lpi, SPxSolver::ROW, SPxSolver::LEAVE) :
spxSolve(lpi, SPxSolver::COLUMN, SPxSolver::ENTER);
2968 assert(!rowrep || lpi->
spx->rep() == SPxSolver::ROW);
2969 assert(rowrep || lpi->
spx->rep() == SPxSolver::COLUMN);
2991 rowrep = lpi->
spx->rep() == SPxSolver::ROW;
3011 retcode = rowrep ?
spxSolve(lpi, SPxSolver::ROW, SPxSolver::ENTER) :
spxSolve(lpi, SPxSolver::COLUMN, SPxSolver::LEAVE);
3012 assert(!rowrep || lpi->
spx->rep() == SPxSolver::ROW);
3013 assert(rowrep || lpi->
spx->rep() == SPxSolver::COLUMN);
3042 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3043 lpi->
spx->savePreStrongbranchingBasis();
3056 assert( ! lpi->
spx->preStrongbranchingBasisFreed() );
3057 lpi->
spx->restorePreStrongbranchingBasis();
3058 lpi->
spx->freePreStrongbranchingBasis();
3080 SPxSolver::Status status;
3085 bool fromparentbasis;
3089 SCIPdebugMessage(
"calling SCIPlpiStrongbranch() on variable %d (%d iterations)\n", col, itlim);
3099 status = SPxSolver::UNKNOWN;
3100 fromparentbasis =
false;
3102 oldItlim = spx->getIterationLimit();
3105 oldlb = spx->lower(col);
3106 oldub = spx->upper(col);
3115 lpi->
spx->setType( lpi->
spx->rep() == SPxSolver::ROW ? SPxSolver::ENTER : SPxSolver::LEAVE);
3118 newub =
EPSCEIL(psol-1.0, lpi->
spx->feastol());
3119 if( newub >= oldlb - 0.5 && down !=
NULL )
3121 SCIPdebugMessage(
"strong branching down on x%d (%g) with %d iterations\n", col, psol, itlim);
3123 spx->changeUpper(col, newub);
3124 assert(spx->lower(col) <= spx->upper(col));
3126 spx->setIterationLimit(itlim);
3129#ifdef SCIP_WITH_LPSCHECK
3130 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
3132 status = spx->solve();
3136 case SPxSolver::OPTIMAL:
3137 *down = spx->value();
3141 case SPxSolver::ABORT_TIME:
3142 case SPxSolver::ABORT_ITER:
3143 case SPxSolver::ABORT_CYCLING:
3144 *down = spx->value();
3146 case SPxSolver::ABORT_VALUE:
3147 case SPxSolver::INFEASIBLE:
3148 *down = spx->terminationValue();
3156 (*iter) += spx->iterations();
3158#ifdef STRONGBRANCH_RESTOREBASIS
3160 assert( ! spx->preStrongbranchingBasisFreed() );
3161 spx->restorePreStrongbranchingBasis();
3162 fromparentbasis =
false;
3166 if( (status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->iterations() < itlim )
3168 SCIPdebugMessage(
" --> Repeat strong branching down with %d iterations after restoring basis\n", itlim - spx->iterations());
3169 spx->setIterationLimit(itlim - spx->iterations());
3170 spx->restorePreStrongbranchingBasis();
3171 fromparentbasis =
true;
3176 fromparentbasis =
false;
3179 while( fromparentbasis );
3181 spx->changeUpper(col, oldub);
3182 assert(spx->lower(col) <= spx->upper(col));
3184 else if( down !=
NULL )
3186 *down = spx->terminationValue();
3196 if( newlb <= oldub + 0.5 && up !=
NULL )
3198 SCIPdebugMessage(
"strong branching up on x%d (%g) with %d iterations\n", col, psol, itlim);
3200 spx->changeLower(col, newlb);
3201 assert(spx->lower(col) <= spx->upper(col));
3203 spx->setIterationLimit(itlim);
3206#ifdef SCIP_WITH_LPSCHECK
3207 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
3209 status = spx->solve();
3213 case SPxSolver::OPTIMAL:
3218 case SPxSolver::ABORT_TIME:
3219 case SPxSolver::ABORT_ITER:
3220 case SPxSolver::ABORT_CYCLING:
3223 case SPxSolver::ABORT_VALUE:
3224 case SPxSolver::INFEASIBLE:
3225 *up = spx->terminationValue();
3233 (*iter) += spx->iterations();
3235#ifdef STRONGBRANCH_RESTOREBASIS
3237 assert( ! spx->preStrongbranchingBasisFreed() );
3238 spx->restorePreStrongbranchingBasis();
3239 fromparentbasis =
false;
3243 if( (status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->iterations() < itlim )
3245 SCIPdebugMessage(
" --> Repeat strong branching up with %d iterations after restoring basis\n", itlim - spx->iterations());
3246 spx->restorePreStrongbranchingBasis();
3247 spx->setIterationLimit(itlim - spx->iterations());
3249 fromparentbasis =
true;
3253 fromparentbasis =
false;
3256 while( fromparentbasis );
3258 spx->changeLower(col, oldlb);
3259 assert(spx->lower(col) <= spx->upper(col));
3261 else if( up !=
NULL )
3263 *up = spx->terminationValue();
3271 spx->setIterationLimit(oldItlim);
3275 SCIPdebugMessage(
"SCIPlpiStrongbranch() returned SoPlex status %d\n",
int(status));
3300 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
3341 for (
int j = 0; j < ncols; ++j)
3344 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
3374 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
3415 for (
int j = 0; j < ncols; ++j)
3418 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
3492 return (lpi->
spx->getStatus() == SPxSolver::UNBOUNDED);
3507#if ((SOPLEX_VERSION == 150 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 150)
3508 return (lpi->
spx->getStatus() == SPxSolver::UNBOUNDED);
3524 assert(lpi->
spx->getStatus() != SPxSolver::UNBOUNDED || lpi->
spx->basis().status() == SPxBasis::UNBOUNDED);
3529 return (lpi->
spx->getStatus() == SPxSolver::UNBOUNDED && !lpi->
spx->isPerturbed());
3542 return (lpi->
spx->getStatus() == SPxSolver::INFEASIBLE);
3550 SPxBasis::SPxStatus basestatus;
3557 basestatus = lpi->
spx->basis().status();
3562 assert(basestatus == SPxBasis::OPTIMAL || lpi->
spx->getStatus() != SPxSolver::OPTIMAL);
3564 return basestatus == SPxBasis::OPTIMAL ||
3565 ((basestatus == SPxBasis::PRIMAL || basestatus == SPxBasis::UNBOUNDED) && !lpi->
spx->isPerturbed());
3580 return (lpi->
spx->getStatus() == SPxSolver::INFEASIBLE);
3595 return (lpi->
spx->getStatus() == SPxSolver::INFEASIBLE);
3608 return (lpi->
spx->getStatus() == SPxSolver::INFEASIBLE && lpi->
spx->basis().status() == SPxBasis::DUAL
3609 && !lpi->
spx->isPerturbed());
3622 return (lpi->
spx->getStatus() == SPxSolver::UNBOUNDED);
3638 assert(lpi->
spx->basis().status() == SPxBasis::OPTIMAL || lpi->
spx->getStatus() != SPxSolver::OPTIMAL);
3640 return (lpi->
spx->basis().status() == SPxBasis::OPTIMAL) ||
3641 (lpi->
spx->basis().status() == SPxBasis::DUAL && !lpi->
spx->isPerturbed());
3653 assert((lpi->
spx->basis().status() == SPxBasis::OPTIMAL)
3659 return (lpi->
spx->basis().status() == SPxBasis::OPTIMAL);
3678#if ((SOPLEX_VERSION == 172 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 172)
3701 return (lpi->
spx->getStatus() != SPxSolver::ERROR && lpi->
spx->getStatus() != SPxSolver::SINGULAR);
3714 return (lpi->
spx->getStatus() == SPxSolver::ABORT_VALUE);
3727 return (lpi->
spx->getStatus() == SPxSolver::ABORT_ITER);
3740 return (lpi->
spx->getStatus() == SPxSolver::ABORT_TIME);
3753 return static_cast<int>(lpi->
spx->getStatus());
3818 (void)lpi->
spx->getPrimal(tmp);
3820 if( dualsol !=
NULL )
3822 Vector tmp(lpi->
spx->nRows(), dualsol);
3823 (void)lpi->
spx->getDual(tmp);
3825 if( activity !=
NULL )
3827 Vector tmp(lpi->
spx->nRows(), activity);
3828 (void)lpi->
spx->getSlacks(tmp);
3830 if( redcost !=
NULL )
3832 Vector tmp(lpi->
spx->nCols(), redcost);
3833 (void)lpi->
spx->getRedCost(tmp);
3837 catch(
const SPxException&
x )
3839 std::string s =
x.what();
3842 catch(
const SPxException& )
3863#if ((SOPLEX_VERSION == 150 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 150)
3866 Vector tmp(lpi->
spx->nCols(), ray);
3867 (void)lpi->
spx->getPrimalray(tmp);
3870 catch(
const SPxException&
x )
3872 std::string s =
x.what();
3875 catch(
const SPxException& )
3883 SCIPerrorMessage(
"SCIPlpiGetPrimalRay() not supported by SoPlex versions <= 1.5.0\n");
3902 Vector tmp(lpi->
spx->nRows(), dualfarkas);
3903 (void)lpi->
spx->getDualfarkas(tmp);
3906 catch(
const SPxException&
x )
3908 std::string s =
x.what();
3911 catch(
const SPxException& )
3932 *iterations = lpi->
spx->iterations();
3953#if ((SOPLEX_VERSION == 172 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 172)
3957 SCIPdebugMessage(
"requesting solution quality from SoPlex: quality %d\n", qualityindicator);
3959 switch( qualityindicator )
3976 *quality = lpi->
spx->basis().condition(maxiter, tolerance);
4006 if (! spx->isInitialized() )
4009 assert( 0 <= col && col < spx->nCols() );
4011 if( spx->rep() == SPxSolver::COLUMN )
4014 if (spx->getSense() == SPxLP::MINIMIZE)
4015 *val = spx->pVec()[col] - spx->maxObj()[col];
4017 *val = spx->maxObj()[col] - spx->pVec()[col];
4021 assert( spx->rep() == SPxSolver::ROW );
4024#ifdef SCIP_DISABLED_CODE
4027 if ( spx->getSense() == SPxLP::MINIMIZE )
4030 if ( spx->isColBasic(col) )
4033 for (
int i = spx->dim() - 1;
i >= 0; --
i)
4035 SPxId
id = spx->basis().baseId(
i);
4036 if (
id.isSPxColId() && col == spx->number(SPxColId(
id)) )
4038 *val = sign * spx->fVec()[
i];
4065 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4069 for(
i = 0;
i < lpi->
spx->nRows(); ++
i )
4071 switch( lpi->
spx->getBasisRowStatus(
i) )
4073 case SPxSolver::BASIC:
4076 case SPxSolver::FIXED:
4077 case SPxSolver::ON_LOWER:
4080 case SPxSolver::ON_UPPER:
4083 case SPxSolver::ZERO:
4084 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
4086 case SPxSolver::UNDEFINED:
4097 for(
i = 0;
i < lpi->
spx->nCols(); ++
i )
4100 switch( lpi->
spx->getBasisColStatus(
i) )
4102 case SPxSolver::BASIC:
4105 case SPxSolver::FIXED:
4117 case SPxSolver::ON_LOWER:
4120 case SPxSolver::ON_UPPER:
4123 case SPxSolver::ZERO:
4126 case SPxSolver::UNDEFINED:
4160 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4163 DataArray<SPxSolver::VarStatus>& m_colstat = lpi->
spx->colStat();
4164 DataArray<SPxSolver::VarStatus>& m_rowstat = lpi->
spx->rowStat();
4166 m_colstat.reSize(ncols);
4167 m_rowstat.reSize(nrows);
4169 for(
i = 0;
i < nrows; ++
i )
4175 m_rowstat[
i] = SPxSolver::ON_LOWER;
4178 m_rowstat[
i] = SPxSolver::BASIC;
4181 m_rowstat[
i] = SPxSolver::ON_UPPER;
4184 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
4193 for(
i = 0;
i < ncols; ++
i )
4199 m_colstat[
i] = SPxSolver::ON_LOWER;
4202 m_colstat[
i] = SPxSolver::BASIC;
4205 m_colstat[
i] = SPxSolver::ON_UPPER;
4208 m_colstat[
i] = SPxSolver::ZERO;
4218 (void) lpi->
spx->updateStatus();
4220 lpi->
spx->freePreStrongbranchingBasis();
4239 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4247 if( spx->rep() == SPxSolver::COLUMN )
4249 for(
int i = 0;
i < spx->nRows(); ++
i )
4251 SPxId
id = spx->basis().baseId(
i);
4253 bind[
i] = (
id.isSPxColId() ? spx->number(
id) : - 1 - spx->number(
id));
4260 int nrows = spx->nRows();
4261 int ncols = spx->nCols();
4263 assert( spx->rep() == SPxSolver::ROW );
4265 for(
int i = 0;
i < nrows; ++
i )
4267 if( !spx->isRowBasic(
i) )
4275 for(
int j = 0; j < ncols && k < nrows; ++j )
4277 if( !spx->isColBasic(j) )
4294 SCIPdebugMessage(
"Preparing factorization for computation of basis inverse.\n");
4301 SPxSolver* spx = lpi->
spx;
4304 DataArray <const SVector*> matrix(spx->nRows());
4307 for (
int i = 0;
i < spx->nRows(); ++
i)
4309 if ( ! spx->isRowBasic(
i) )
4310 matrix[k++] =
new UnitVector(
i);
4312 for (
int j = 0; j < spx->nCols(); ++j)
4314 if ( ! spx->isColBasic(j) )
4315 matrix[k++] = &spx->colVector(j);
4317 assert( k == spx->nRows() );
4318 assert( k == matrix.size() );
4323 SLinSolver::Status status = lpi->
factorization->load(matrix.get_ptr(), k);
4327 assert( status == SLinSolver::OK );
4332 for (
int i = 0;
i < spx->nRows(); ++
i)
4334 if ( ! spx->isRowBasic(
i) )
4340 catch(
const SPxException&
x )
4342 std::string s =
x.what();
4345 catch(
const SPxException& )
4374 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4377 int nCols = lpi->
spx->nCols();
4378 int nRows = lpi->
spx->nRows();
4388 if ( spx->rep() == SPxSolver::COLUMN )
4391 spx->basis().coSolve(
x, spx->unitVector(
r));
4394 if( ninds !=
NULL && inds !=
NULL )
4400 for(
int i = 0;
i < *ninds; ++
i )
4411 Vector
y(nRows, coef);
4419 assert(spx->rep() == SPxSolver::ROW);
4436 Vector
x(nRows, coef);
4438 DSVector rhs(nCols);
4461 assert(!spx->isRowBasic(idx));
4464 rhs = spx->rowVector(idx);
4472 assert(!spx->isColBasic(idx));
4475 rhs = spx->unitVector(idx);
4479 spx->basis().solve(
y, rhs);
4485 for(
int i = 0;
i < nCols; ++
i )
4487 SPxId
id = spx->basis().baseId(
i);
4489 if(
id.isSPxRowId() )
4491 assert(spx->number(
id) >= 0);
4492 assert(spx->number(
id) < nRows);
4493 assert(bind[
r] >= 0 || spx->number(
id) != idx);
4495 x[spx->number(
id)] =
y[
i];
4516 catch(
const SPxException&
x )
4518 std::string s =
x.what();
4521 catch(
const SPxException& )
4542 assert(lpi->
spx->preStrongbranchingBasisFreed());
4546 int nCols = lpi->
spx->nCols();
4547 int nRows = lpi->
spx->nRows();
4552 Vector v(nRows, rhs);
4553 Vector
x(nRows, coef);
4556 if( spx->rep() == SPxSolver::COLUMN )
4559 spx->basis().solve(
x, v);
4563 assert(spx->rep() == SPxSolver::ROW);
4574 DSVector rowrhs(nCols);
4586 for(
int i = 0;
i < nCols; ++
i )
4588 SPxId
id = spx->basis().baseId(
i);
4590 if(
id.isSPxRowId() )
4592 assert(spx->number(
id) >= 0);
4593 assert(spx->number(
id) < nRows);
4595 rowrhs.add(
i, v[spx->number(
id)]);
4604 spx->basis().coSolve(
y, rowrhs);
4607 for(
int i = 0;
i < nRows; ++
i )
4620 assert(!spx->isRowBasic(idx));
4622 x[
i] = v[idx] - (spx->rowVector(idx) * Vector(nCols,
y.get_ptr()));
4629 assert(!spx->isColBasic(idx));
4641 catch(
const SPxException&
x )
4643 std::string s =
x.what();
4646 catch(
const SPxException& )
4678 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4686 DVector e(lpi->
spx->nRows());
4726 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4729 nrows = lpi->
spx->nRows();
4730 ncols = lpi->
spx->nCols();
4734 if( binvrow ==
NULL )
4750 soplex::Vector binvvec(nrows, binv);
4751 for(
c = 0;
c < ncols; ++
c )
4752 coef[
c] = binvvec * lpi->
spx->colVector(
c);
4775 DVector col(lpi->
spx->nRows());
4781 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4793 col = lpi->
spx->colVector(
c);
4794 col.reDim(lpi->
spx->nRows());
4831 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4833 ncols = lpi->
spx->nCols();
4834 nrows = lpi->
spx->nRows();
4849 (*lpistate)->ncols = ncols;
4850 (*lpistate)->nrows = nrows;
4876 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4878 lpncols = lpi->
spx->nCols();
4879 lpnrows = lpi->
spx->nRows();
4891 for(
i = lpistate->
ncols;
i < lpncols; ++
i )
4897 bnd = lpi->
spx->lower(
i);
4906 for(
i = lpistate->
nrows;
i < lpnrows; ++
i )
4930 catch(
const SPxException&
x )
4932 std::string s =
x.what();
4935 catch(
const SPxException& )
4938 assert( lpi->
spx->getStatus() != SPxSolver::OPTIMAL );
4958 if ( *lpistate !=
NULL )
4985 assert( lpi->
spx->preStrongbranchingBasisFreed() );
5004 assert( lpi->
spx->preStrongbranchingBasisFreed() );
5036#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201)
5045 lpi->
spx->getNdualNorms(nrows, ncols);
5047 if( nrows == 0 && ncols == 0)
5056 (*lpinorms)->nrows = 0;
5057 (*lpinorms)->ncols = 0;
5059 SCIPdebugMessage(
"storing SoPlex LPi pricing norms in %p (%d rows, %d cols)\n", (
void *) *lpinorms, nrows, ncols);
5061 if( !lpi->
spx->getDualNorms((*lpinorms)->nrows, (*lpinorms)->ncols, (*lpinorms)->norms) )
5071 assert(nrows == (*lpinorms)->nrows);
5072 assert(ncols == (*lpinorms)->ncols);
5091#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201)
5097 if( lpinorms ==
NULL )
5103 if( lpinorms->
nrows == 0 )
5106 SCIPdebugMessage(
"loading LPi simplex norms %p (%d rows, %d cols) into SoPlex LP with %d rows and %d cols\n",
5107 (
const void *) lpinorms, lpinorms->
nrows, lpinorms->
ncols, lpi->
spx->nRows(), lpi->
spx->nCols());
5123#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201)
5165 *ival = lpi->
spx->getFromScratch();
5168 *ival = lpi->
spx->getLpInfo();
5171 *ival = lpi->
spx->getIterationLimit();
5176 *ival = lpi->
spx->getPresolving();
5182 *ival = lpi->
spx->getScaling();
5184#if SOPLEX_VERSION >= 201
5186 *ival = (int) lpi->
spx->getTiming();
5189#if SOPLEX_VERSION >= 230 || (SOPLEX_VERSION == 220 && SOPLEX_SUBVERSION >= 3)
5191 *ival = (int) lpi->
spx->random.getSeed();
5217 lpi->
spx->setFromScratch(
bool(ival));
5221 lpi->
spx->setLpInfo(
bool(ival));
5226 if( ival >= INT_MAX )
5228 lpi->
spx->setIterationLimit(ival);
5232 lpi->
spx->setPresolving(
bool(ival));
5240 lpi->
spx->setAutoPricer();
5243 lpi->
spx->setFullPricer();
5246 lpi->
spx->setParmultPricer();
5249 lpi->
spx->setSteepPricer();
5252 lpi->
spx->setSteepQStartPricer();
5255 lpi->
spx->setDevexPricer();
5263 lpi->
spx->setScaling(ival);
5265#if SOPLEX_VERSION >= 201
5267 assert(ival >= 0 && ival < 3);
5268 lpi->
spx->setTiming((Timer::TYPE) ival);
5271#if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 220 && SOPLEX_SUBVERSION >= 2)
5273 lpi->
spx->random.setSeed((
unsigned int) ival);
5276#if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3)
5278 assert(ival >= 0 && ival < 3);
5279 lpi->
spx->setSolutionPolishing((SPxSolver::SolutionPolish) ival);
5306 *dval = lpi->
spx->feastol();
5308#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 160)
5310 *dval = lpi->
spx->opttol();
5314 if ( lpi->
spx->getSense() == SPxLP::MINIMIZE )
5315 *dval = lpi->
spx->getObjUpLimit();
5317 *dval = lpi->
spx->getObjLoLimit();
5320 *dval = lpi->
spx->terminationTime();
5352 lpi->
spx->setFeastol(dval);
5354#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 160)
5358 lpi->
spx->setOpttol(dval);
5362 if ( lpi->
spx->getSense() == SPxLP::MINIMIZE )
5363 lpi->
spx->setObjUpLimit(dval);
5365 lpi->
spx->setObjLoLimit(dval);
5373 lpi->
spx->setTerminationTime(dval);
5376 assert( dval >= 0.0 || dval == -1.0 );
5421 return soplex::infinity;
5432 return (val >= soplex::infinity);
5450 const char* filename
5455 f = fopen(filename,
"r");
5476 assert( lpi->
spx->preStrongbranchingBasisFreed() );
5483 if( !lpi->
spx->readLP(fname) )
5487 catch(
const SPxException&
x )
5489 std::string s =
x.what();
5492 catch(
const SPxException& )
5515 lpi->
spx->writeFile(fname);
5518 catch(
const SPxException&
x )
5520 std::string s =
x.what();
5523 catch(
const SPxException& )
void SCIPdecodeDualBit(const SCIP_DUALPACKET *inp, int *out, int count)
void SCIPencodeDualBit(const int *inp, SCIP_DUALPACKET *out, int count)
packing single and dual bit values
unsigned int SCIP_DUALPACKET
SCIP_RETCODE SCIPlpiChgSides(SCIP_LPI *lpi, int nrows, const int *ind, const SCIP_Real *lhs, const SCIP_Real *rhs)
SCIP_RETCODE SCIPlpiSetState(SCIP_LPI *lpi, BMS_BLKMEM *, const SCIP_LPISTATE *lpistate)
SCIP_RETCODE SCIPlpiGetBInvACol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiGetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real *dval)
SCIP_Real SCIPlpiInfinity(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiIsObjlimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiChgObjsen(SCIP_LPI *lpi, SCIP_OBJSEN objsen)
SCIP_Bool SCIPlpiIsInfinity(SCIP_LPI *lpi, SCIP_Real val)
SCIP_RETCODE SCIPlpiClear(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiClearState(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiExistsDualRay(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiExistsPrimalRay(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetBase(SCIP_LPI *lpi, int *cstat, int *rstat)
SCIP_RETCODE SCIPlpiReadState(SCIP_LPI *lpi, const char *fname)
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 SCIPlpiGetPrimalRay(SCIP_LPI *lpi, SCIP_Real *ray)
SCIP_RETCODE SCIPlpiGetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int *ival)
SCIP_RETCODE SCIPlpiWriteLP(SCIP_LPI *lpi, const char *fname)
SCIP_RETCODE SCIPlpiSetIntegralityInformation(SCIP_LPI *lpi, int ncols, int *intInfo)
SCIP_Bool SCIPlpiIsDualInfeasible(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real dval)
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)
SCIP_RETCODE SCIPlpiSetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, const SCIP_LPINORMS *lpinorms)
SCIP_RETCODE SCIPlpiGetNNonz(SCIP_LPI *lpi, int *nnonz)
SCIP_Bool SCIPlpiHasPrimalSolve(void)
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 SCIPlpiGetBounds(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *lbs, SCIP_Real *ubs)
SCIP_Bool SCIPlpiHasBarrierSolve(void)
SCIP_RETCODE SCIPlpiGetDualfarkas(SCIP_LPI *lpi, SCIP_Real *dualfarkas)
SCIP_RETCODE SCIPlpiGetObjval(SCIP_LPI *lpi, SCIP_Real *objval)
SCIP_RETCODE SCIPlpiScaleCol(SCIP_LPI *lpi, int col, SCIP_Real scaleval)
int SCIPlpiGetInternalStatus(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiStartStrongbranch(SCIP_LPI *lpi)
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_Bool SCIPlpiIsIterlimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiChgBounds(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *lb, const SCIP_Real *ub)
SCIP_Bool SCIPlpiIsPrimalUnbounded(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiIgnoreInstability(SCIP_LPI *lpi, SCIP_Bool *success)
SCIP_RETCODE SCIPlpiWriteState(SCIP_LPI *lpi, const char *fname)
SCIP_RETCODE SCIPlpiFree(SCIP_LPI **lpi)
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 SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
SCIP_Bool SCIPlpiIsPrimalFeasible(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiReadLP(SCIP_LPI *lpi, const char *fname)
SCIP_RETCODE SCIPlpiGetRealSolQuality(SCIP_LPI *lpi, SCIP_LPSOLQUALITY qualityindicator, SCIP_Real *quality)
SCIP_Bool SCIPlpiIsDualFeasible(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetNorms(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPINORMS **lpinorms)
SCIP_Bool SCIPlpiIsTimelimExc(SCIP_LPI *lpi)
SCIP_Bool SCIPlpiHasStateBasis(SCIP_LPI *lpi, SCIP_LPISTATE *lpistate)
SCIP_RETCODE SCIPlpiSetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int ival)
const char * SCIPlpiGetSolverName(void)
SCIP_RETCODE SCIPlpiSetBase(SCIP_LPI *lpi, const int *cstat, const int *rstat)
SCIP_Bool SCIPlpiHasPrimalRay(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetBInvRow(SCIP_LPI *lpi, int r, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiDelRows(SCIP_LPI *lpi, int firstrow, int lastrow)
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 SCIPlpiGetBInvCol(SCIP_LPI *lpi, int c, SCIP_Real *coef, int *inds, int *ninds)
SCIP_RETCODE SCIPlpiGetColNames(SCIP_LPI *lpi, int firstcol, int lastcol, char **colnames, char *namestorage, int namestoragesize, int *storageleft)
SCIP_RETCODE SCIPlpiGetBInvARow(SCIP_LPI *lpi, int r, const SCIP_Real *binvrow, SCIP_Real *coef, int *inds, int *ninds)
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_Bool SCIPlpiWasSolved(SCIP_LPI *lpi)
const char * SCIPlpiGetSolverDesc(void)
SCIP_RETCODE SCIPlpiSolveBarrier(SCIP_LPI *lpi, SCIP_Bool crossover)
SCIP_Bool SCIPlpiIsOptimal(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetRowNames(SCIP_LPI *lpi, int firstrow, int lastrow, char **rownames, char *namestorage, int namestoragesize, int *storageleft)
SCIP_Bool SCIPlpiHasDualSolve(void)
SCIP_RETCODE SCIPlpiEndStrongbranch(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetSides(SCIP_LPI *lpi, int firstrow, int lastrow, SCIP_Real *lhss, SCIP_Real *rhss)
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 SCIPlpiGetSol(SCIP_LPI *lpi, SCIP_Real *objval, SCIP_Real *primsol, SCIP_Real *dualsol, SCIP_Real *activity, SCIP_Real *redcost)
SCIP_Bool SCIPlpiHasDualRay(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiDelColset(SCIP_LPI *lpi, int *dstat)
SCIP_RETCODE SCIPlpiGetObj(SCIP_LPI *lpi, int firstcol, int lastcol, SCIP_Real *vals)
SCIP_RETCODE SCIPlpiFreeState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
SCIP_Bool SCIPlpiIsPrimalInfeasible(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiSolveDual(SCIP_LPI *lpi)
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 SCIPlpiSolvePrimal(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_Bool SCIPlpiIsDualUnbounded(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetIterations(SCIP_LPI *lpi, int *iterations)
SCIP_RETCODE SCIPlpiGetBasisInd(SCIP_LPI *lpi, int *bind)
SCIP_RETCODE SCIPlpiCreate(SCIP_LPI **lpi, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_OBJSEN objsen)
void * SCIPlpiGetSolverPointer(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiChgObj(SCIP_LPI *lpi, int ncols, const int *ind, const SCIP_Real *obj)
SCIP_RETCODE SCIPlpiGetObjsen(SCIP_LPI *lpi, SCIP_OBJSEN *objsen)
SCIP_Bool SCIPlpiIsStable(SCIP_LPI *lpi)
SCIP_RETCODE SCIPlpiGetNCols(SCIP_LPI *lpi, int *ncols)
SCIP_RETCODE SCIPlpiInterrupt(SCIP_LPI *lpi, SCIP_Bool interrupt)
SCIP_RETCODE SCIPlpiDelCols(SCIP_LPI *lpi, int firstcol, int lastcol)
SCIP_RETCODE SCIPlpiDelRowset(SCIP_LPI *lpi, int *dstat)
SCIP_RETCODE SCIPlpiScaleRow(SCIP_LPI *lpi, int row, SCIP_Real scaleval)
SCIP_RETCODE SCIPlpiGetNRows(SCIP_LPI *lpi, int *nrows)
SCIP_RETCODE SCIPlpiGetState(SCIP_LPI *lpi, BMS_BLKMEM *blkmem, SCIP_LPISTATE **lpistate)
SCIP_RETCODE SCIPlpiChgCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real newval)
assert(minobj< SCIPgetCutoffbound(scip))
interface methods for specific LP solvers
SCIP_DUALPACKET ROWPACKET
SCIP_DUALPACKET COLPACKET
#define AUTOPRICING_ITERSWITCH
static SCIP_RETCODE getRedCostEst(SPxSCIP *spx, int col, SCIP_Real *val)
static SPxLP::SPxSense spxObjsen(SCIP_OBJSEN objsen)
static const char spxname[20]
static SCIP_RETCODE lpiGetBInvVec(SCIP_LPI *lpi, SCIP_Real *rhs, SCIP_Real *coef)
static void lpistatePack(SCIP_LPISTATE *lpistate, const int *cstat, const int *rstat)
static void lpistateUnpack(const SCIP_LPISTATE *lpistate, int *cstat, int *rstat)
static SCIP_Bool fileExists(const char *filename)
#define SOPLEX_TRY(messagehdlr, x)
static int rowpacketNum(int nrows)
static SCIP_RETCODE spxSolve(SCIP_LPI *lpi)
static SCIP_RETCODE ensureCstatMem(SCIP_LPI *lpi, int num)
static void lpistateFree(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem)
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)
static SCIP_RETCODE ensureRstatMem(SCIP_LPI *lpi, int num)
static int colpacketNum(int ncols)
#define SOPLEX_SUBVERSION
static SCIP_RETCODE lpistateCreate(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem, int ncols, int nrows)
#define SOPLEX_TRY_ABORT(x)
static const char spxname[20]
static void invalidateSolution(SCIP_LPI *lpi)
#define BMSfreeMemory(ptr)
#define BMSfreeBlockMemory(mem, ptr)
#define BMSallocBlockMemory(mem, ptr)
#define BMSreallocMemoryArray(ptr, num)
#define BMSallocMemoryArray(ptr, num)
#define BMSallocMemoryCPP(size)
#define BMSfreeMemoryArray(ptr)
#define BMSallocBlockMemoryArray(mem, ptr, num)
#define BMSfreeBlockMemoryArray(mem, ptr, num)
#define BMSclearMemoryArray(ptr, num)
struct BMS_BlkMem BMS_BLKMEM
#define BMSfreeMemoryArrayNull(ptr)
#define BMSallocMemory(ptr)
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
public methods for message output
SCIP_MESSAGEHDLR * messagehdlr
SLUFactor * factorization
@ SCIP_PRICING_STEEPQSTART
@ SCIP_PRICING_LPIDEFAULT
enum SCIP_Pricing SCIP_PRICING
enum SCIP_LPParam SCIP_LPPARAM
@ SCIP_LPSOLQUALITY_EXACTCONDITION
@ SCIP_LPSOLQUALITY_ESTIMCONDITION
struct SCIP_LPiState SCIP_LPISTATE
struct SCIP_LPiNorms SCIP_LPINORMS
@ SCIP_LPPAR_CONDITIONLIMIT
@ SCIP_LPPAR_ROWREPSWITCH
enum SCIP_LPSolQuality SCIP_LPSOLQUALITY
enum SCIP_ObjSen SCIP_OBJSEN
struct SCIP_Messagehdlr SCIP_MESSAGEHDLR
enum SCIP_Retcode SCIP_RETCODE