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,
1305 assert(firstcol <= lastcol + 1);
1308 if( namestoragesize == 0 )
1311 *storageleft = -m_colnames->memSize();
1315 NameSet* names = m_colnames;
1317 int sizeleft = namestoragesize;
1318 char* s = namestorage;
1319 for(
int j = firstcol; j <= lastcol; ++j )
1321 const char* t = (*names)[j];
1322 colnames[j-firstcol] = s;
1323 while( *t !=
'\0' && sizeleft >= 0 )
1332 *storageleft = namestoragesize - m_colnames->memSize();
1333 assert(*storageleft <= 0);
1336 *storageleft = sizeleft;
1346 int namestoragesize,
1352 assert(firstrow <= lastrow + 1);
1355 if( namestoragesize == 0 )
1358 *storageleft = -m_rownames->memSize();
1362 NameSet* names = m_rownames;
1364 int sizeleft = namestoragesize;
1365 char* s = namestorage;
1366 for(
int i = firstrow;
i <= lastrow; ++
i )
1368 const char* t = (*names)[
i];
1369 rownames[
i-firstrow] = s;
1370 while( *t !=
'\0' && sizeleft >= 0 )
1379 *storageleft = m_rownames->memSize() - namestoragesize;
1380 assert(*storageleft <= 0);
1383 *storageleft = sizeleft;
1399#define COLS_PER_PACKET SCIP_DUALPACKETSIZE
1401#define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
1461 assert(num <= lpi->cstatsize);
1483 assert(num <= lpi->rstatsize);
1604 return SPxLP::MAXIMIZE;
1606 return SPxLP::MINIMIZE;
1610 return SPxLP::MINIMIZE;
1640#if (SOPLEX_SUBVERSION > 0)
1641 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'};
1643 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'};
1651 (void)snprintf(
spxdesc, 200,
"%s [GitHash: %s]",
"Linear Programming Solver developed at Zuse Institute Berlin (soplex.zib.de)"
1652#ifdef SCIP_WITH_LPSCHECK
1653 " - including CPLEX double check"
1684 return (
void*) lpi->
spx;
1694#if (SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3))
1695 assert(ncols == lpi->
spx->nCols() || (ncols == 0 && intInfo ==
NULL));
1696 lpi->
spx->setIntegralityInformation(ncols, intInfo);
1699 SCIPerrorMessage(
"SCIPlpiSetIntegralityInformation() has not been implemented yet.\n");
1756 SOPLEX_TRY( messagehdlr, (*lpi)->spx = new ((*lpi)->spx) SPxSCIP(messagehdlr, name) );
1757 (*lpi)->cstat =
NULL;
1758 (*lpi)->rstat =
NULL;
1759 (*lpi)->cstatsize = 0;
1760 (*lpi)->rstatsize = 0;
1762 (*lpi)->factorization = 0;
1764 (*lpi)->conditionlimit = -1.0;
1765 (*lpi)->checkcondition =
FALSE;
1766 (*lpi)->messagehdlr = messagehdlr;
1789 (*lpi)->spx->~SPxSCIP();
1834 for( j = 0; j < nnonz; j++ )
1853 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1857 SPxSCIP* spx = lpi->
spx;
1858 LPRowSet rows(nrows);
1859 DSVector emptyVector(0);
1868 for(
i = 0;
i < nrows; ++
i )
1869 rows.add(lhs[
i], emptyVector, rhs[
i]);
1876 catch(
const SPxException&
x )
1878 std::string s =
x.what();
1881 catch(
const SPxException& )
1919 assert( lpi->
spx->preStrongbranchingBasisFreed() );
1925 int nrows = lpi->
spx->nRows();
1926 for (
int j = 0; j < nnonz; ++j)
1928 assert( 0 <= ind[j] && ind[j] < nrows );
1934 SPxSCIP* spx = lpi->
spx;
1937 LPColSet cols(ncols);
1938 DSVector colVector(ncols);
1944 for(
i = 0;
i < ncols; ++
i )
1950 last = (
i == ncols-1 ? nnonz : beg[
i+1]);
1951 colVector.add( last-start, &ind[start], &val[start] );
1953 cols.add(
obj[
i], lb[
i], colVector, ub[
i]);
1958 catch(
const SPxException&
x )
1960 std::string s =
x.what();
1963 catch(
const SPxException& )
1982 assert(lastcol < lpi->spx->nCols());
1983 assert(firstcol <= lastcol + 1);
1988 if( firstcol > lastcol )
1993 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2019 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2021 ncols = lpi->
spx->nCols();
2024 for(
i = 0;
i < ncols; ++
i )
2057 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2063 int ncols = lpi->
spx->nCols();
2064 for (
int j = 0; j < nnonz; ++j)
2066 assert( 0 <= ind[j] && ind[j] < ncols );
2074 SPxSCIP* spx = lpi->
spx;
2075 LPRowSet rows(nrows);
2082 for(
i = 0;
i < nrows; ++
i )
2088 last = (
i == nrows-1 ? nnonz : beg[
i+1]);
2089 rowVector.add( last-start, &ind[start], &val[start] );
2091 rows.add(lhs[
i], rowVector, rhs[
i]);
2096 catch(
const SPxException&
x )
2098 std::string s =
x.what();
2101 catch(
const SPxException& )
2120 assert(lastrow < lpi->spx->nRows());
2121 assert(firstrow <= lastrow + 1);
2126 if( firstrow > lastrow )
2131 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2156 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2158 nrows = lpi->
spx->nRows();
2161 for(
i = 0;
i < nrows; ++
i )
2181 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2208 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2212 for(
i = 0;
i < ncols; ++
i )
2214 assert(0 <= ind[
i] && ind[
i] < lpi->
spx->nCols());
2218 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[
i]);
2223 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[
i]);
2227 lpi->
spx->changeBounds(ind[
i], lb[
i], ub[
i]);
2228 assert(lpi->
spx->lower(ind[
i]) <= lpi->
spx->upper(ind[
i]) + Param::epsilon());
2232 catch(
const SPxException&
x )
2234 std::string s =
x.what();
2237 catch(
const SPxException& )
2269 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2273 for(
i = 0;
i < nrows; ++
i )
2275 assert(0 <= ind[
i] && ind[
i] < lpi->
spx->nRows());
2276 lpi->
spx->changeRange(ind[
i], lhs[
i], rhs[
i]);
2277 assert(lpi->
spx->lhs(ind[
i]) <= lpi->
spx->rhs(ind[
i]) + Param::epsilon());
2281 catch(
const SPxException&
x )
2283 std::string s =
x.what();
2286 catch(
const SPxException& )
2307 assert(0 <= row && row < lpi->spx->nRows());
2308 assert(0 <= col && col < lpi->spx->nCols());
2312 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2332 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2358 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2362 for(
i = 0;
i < ncols; ++
i )
2364 assert(0 <= ind[
i] && ind[
i] < lpi->
spx->nCols());
2365 lpi->
spx->changeObj(ind[
i],
obj[
i]);
2369 catch(
const SPxException&
x )
2371 std::string s =
x.what();
2374 catch(
const SPxException& )
2403 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2406 SVector rowvec = lpi->
spx->rowVector(row);
2407 lhs = lpi->
spx->lhs(row);
2408 rhs = lpi->
spx->rhs(row);
2414 if( lhs > -soplex::infinity )
2416 else if( scaleval < 0.0 )
2417 lhs = soplex::infinity;
2418 if( rhs < soplex::infinity )
2420 else if( scaleval < 0.0 )
2421 rhs = -soplex::infinity;
2422 if( scaleval < 0.0 )
2430 LPRow lprow(lhs, rowvec, rhs);
2433 lpi->
spx->changeRow(row, lprow);
2437 catch(
const SPxException&
x )
2439 std::string s =
x.what();
2442 catch(
const SPxException& )
2474 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2477 SVector colvec = lpi->
spx->colVector(col);
2478 obj = lpi->
spx->obj(col);
2479 lb = lpi->
spx->lower(col);
2480 ub = lpi->
spx->upper(col);
2489 if( lb > -soplex::infinity )
2491 else if( scaleval < 0.0 )
2492 lb = soplex::infinity;
2493 if( ub < soplex::infinity )
2495 else if( scaleval < 0.0 )
2496 ub = -soplex::infinity;
2497 if( scaleval < 0.0 )
2505 LPCol lpcol(
obj, colvec, ub, lb);
2508 lpi->
spx->changeCol(col, lpcol);
2512 catch(
const SPxException&
x )
2514 std::string s =
x.what();
2517 catch(
const SPxException& )
2550 *nrows = lpi->
spx->nRows();
2567 *ncols = lpi->
spx->nCols();
2588 if( lpi->
spx->nRows() < lpi->
spx->nCols() )
2590 for(
i = 0;
i < lpi->
spx->nRows(); ++
i )
2591 (*nnonz) += lpi->
spx->rowVector(
i).size();
2595 for(
i = 0;
i < lpi->
spx->nCols(); ++
i )
2596 (*nnonz) += lpi->
spx->colVector(
i).size();
2626 assert(lastcol < lpi->spx->nCols());
2627 assert(firstcol <= lastcol + 1);
2633 const Vector& lbvec = lpi->
spx->lower();
2634 const Vector& ubvec = lpi->
spx->upper();
2635 for(
i = firstcol;
i <= lastcol; ++
i )
2637 lb[
i-firstcol] = lbvec[
i];
2638 ub[
i-firstcol] = ubvec[
i];
2645 for(
i = firstcol;
i <= lastcol; ++
i )
2647 beg[
i-firstcol] = *nnonz;
2648 const SVector& cvec = lpi->
spx->colVector(
i);
2649 for( j = 0; j < cvec.size(); ++j )
2651 ind[*nnonz] = cvec.index(j);
2652 val[*nnonz] = cvec.value(j);
2685 assert(lastrow < lpi->spx->nRows());
2686 assert(firstrow <= lastrow + 1);
2692 const Vector& lhsvec = lpi->
spx->lhs();
2693 const Vector& rhsvec = lpi->
spx->rhs();
2694 for(
i = firstrow;
i <= lastrow; ++
i )
2696 lhs[
i-firstrow] = lhsvec[
i];
2697 rhs[
i-firstrow] = rhsvec[
i];
2704 for(
i = firstrow;
i <= lastrow; ++
i )
2706 beg[
i-firstrow] = *nnonz;
2707 const SVector& rvec = lpi->
spx->rowVector(
i);
2708 for( j = 0; j < rvec.size(); ++j )
2710 ind[*nnonz] = rvec.index(j);
2711 val[*nnonz] = rvec.value(j);
2727 int namestoragesize,
2733 assert(colnames !=
NULL || namestoragesize == 0);
2734 assert(namestorage !=
NULL || namestoragesize == 0);
2735 assert(namestoragesize >= 0);
2738 assert(lastcol < lpi->spx->nCols());
2739 assert(firstcol <= lastcol + 1);
2743 lpi->
spx->getColNames(firstcol, lastcol, colnames, namestorage, namestoragesize, storageleft);
2755 int namestoragesize,
2761 assert(rownames !=
NULL || namestoragesize == 0);
2762 assert(namestorage !=
NULL || namestoragesize == 0);
2763 assert(namestoragesize >= 0);
2766 assert(lastrow < lpi->spx->nRows());
2767 assert(firstrow <= lastrow + 1);
2771 lpi->
spx->getRowNames(firstrow, lastrow, rownames, namestorage, namestoragesize, storageleft);
2807 assert(lastcol < lpi->spx->nCols());
2808 assert(firstcol <= lastcol + 1);
2812 for(
i = firstcol;
i <= lastcol; ++
i )
2813 vals[
i-firstcol] = lpi->
spx->obj(
i);
2832 assert(lastcol < lpi->spx->nCols());
2833 assert(firstcol <= lastcol + 1);
2837 for(
i = firstcol;
i <= lastcol; ++
i )
2840 lbs[
i-firstcol] = lpi->
spx->lower(
i);
2842 ubs[
i-firstcol] = lpi->
spx->upper(
i);
2862 assert(lastrow < lpi->spx->nRows());
2863 assert(firstrow <= lastrow + 1);
2867 for(
i = firstrow;
i <= lastrow; ++
i )
2870 lhss[
i-firstrow] = lpi->
spx->lhs(
i);
2872 rhss[
i-firstrow] = lpi->
spx->rhs(
i);
2890 assert(0 <= col && col < lpi->spx->nCols());
2891 assert(0 <= row && row < lpi->spx->nRows());
2894 *val = lpi->
spx->colVector(col)[row];
2915 SPxSolver::Representation rep,
2916 SPxSolver::Type type
2921 assert( rep == SPxSolver::ROW || rep == SPxSolver::COLUMN );
2922 assert( type == SPxSolver::ENTER || type == SPxSolver::LEAVE );
2924 SCIPdebugMessage(
"calling SoPlex solve(): %d cols, %d rows, rep=%s\n", lpi->
spx->nCols(), lpi->
spx->nRows(),
2925 rep == SPxSolver::COLUMN ?
"column" :
"row");
2929 assert( lpi->
spx->preStrongbranchingBasisFreed() );
2932 lpi->
spx->setRep(rep);
2933 lpi->
spx->setType(type);
2935#ifdef SCIP_WITH_LPSCHECK
2936 lpi->
spx->setDoubleCheck(CHECK_SPXSOLVE);
2939 SPxSolver::Status status = lpi->
spx->solve();
2940 SCIPdebugMessage(
" -> SoPlex status: %d, basis status: %d\n", lpi->
spx->getStatus(), lpi->
spx->basis().status());
2945 case SPxSolver::ABORT_TIME:
2946 case SPxSolver::ABORT_ITER:
2947 case SPxSolver::ABORT_VALUE:
2948 case SPxSolver::SINGULAR:
2949 case SPxSolver::REGULAR:
2950 case SPxSolver::UNKNOWN:
2951 case SPxSolver::OPTIMAL:
2952 case SPxSolver::UNBOUNDED:
2953 case SPxSolver::INFEASIBLE:
2977 rowrep = lpi->
spx->rep() == SPxSolver::ROW;
2997 retcode = rowrep ?
spxSolve(lpi, SPxSolver::ROW, SPxSolver::LEAVE) :
spxSolve(lpi, SPxSolver::COLUMN, SPxSolver::ENTER);
2998 assert(!rowrep || lpi->
spx->rep() == SPxSolver::ROW);
2999 assert(rowrep || lpi->
spx->rep() == SPxSolver::COLUMN);
3021 rowrep = lpi->
spx->rep() == SPxSolver::ROW;
3041 retcode = rowrep ?
spxSolve(lpi, SPxSolver::ROW, SPxSolver::ENTER) :
spxSolve(lpi, SPxSolver::COLUMN, SPxSolver::LEAVE);
3042 assert(!rowrep || lpi->
spx->rep() == SPxSolver::ROW);
3043 assert(rowrep || lpi->
spx->rep() == SPxSolver::COLUMN);
3072 assert( lpi->
spx->preStrongbranchingBasisFreed() );
3073 lpi->
spx->savePreStrongbranchingBasis();
3086 assert( ! lpi->
spx->preStrongbranchingBasisFreed() );
3087 lpi->
spx->restorePreStrongbranchingBasis();
3088 lpi->
spx->freePreStrongbranchingBasis();
3110 SPxSolver::Status status;
3115 bool fromparentbasis;
3119 SCIPdebugMessage(
"calling SCIPlpiStrongbranch() on variable %d (%d iterations)\n", col, itlim);
3129 status = SPxSolver::UNKNOWN;
3130 fromparentbasis =
false;
3132 oldItlim = spx->getIterationLimit();
3135 oldlb = spx->lower(col);
3136 oldub = spx->upper(col);
3145 lpi->
spx->setType( lpi->
spx->rep() == SPxSolver::ROW ? SPxSolver::ENTER : SPxSolver::LEAVE);
3148 newub =
EPSCEIL(psol-1.0, lpi->
spx->feastol());
3149 if( newub >= oldlb - 0.5 && down !=
NULL )
3151 SCIPdebugMessage(
"strong branching down on x%d (%g) with %d iterations\n", col, psol, itlim);
3153 spx->changeUpper(col, newub);
3154 assert(spx->lower(col) <= spx->upper(col));
3156 spx->setIterationLimit(itlim);
3159#ifdef SCIP_WITH_LPSCHECK
3160 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
3162 status = spx->solve();
3166 case SPxSolver::OPTIMAL:
3167 *down = spx->value();
3171 case SPxSolver::ABORT_TIME:
3172 case SPxSolver::ABORT_ITER:
3173 case SPxSolver::ABORT_CYCLING:
3174 *down = spx->value();
3176 case SPxSolver::ABORT_VALUE:
3177 case SPxSolver::INFEASIBLE:
3178 *down = spx->terminationValue();
3186 (*iter) += spx->iterations();
3188#ifdef STRONGBRANCH_RESTOREBASIS
3190 assert( ! spx->preStrongbranchingBasisFreed() );
3191 spx->restorePreStrongbranchingBasis();
3192 fromparentbasis =
false;
3196 if( (status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->iterations() < itlim )
3198 SCIPdebugMessage(
" --> Repeat strong branching down with %d iterations after restoring basis\n", itlim - spx->iterations());
3199 spx->setIterationLimit(itlim - spx->iterations());
3200 spx->restorePreStrongbranchingBasis();
3201 fromparentbasis =
true;
3206 fromparentbasis =
false;
3209 while( fromparentbasis );
3211 spx->changeUpper(col, oldub);
3212 assert(spx->lower(col) <= spx->upper(col));
3214 else if( down !=
NULL )
3216 *down = spx->terminationValue();
3226 if( newlb <= oldub + 0.5 && up !=
NULL )
3228 SCIPdebugMessage(
"strong branching up on x%d (%g) with %d iterations\n", col, psol, itlim);
3230 spx->changeLower(col, newlb);
3231 assert(spx->lower(col) <= spx->upper(col));
3233 spx->setIterationLimit(itlim);
3236#ifdef SCIP_WITH_LPSCHECK
3237 spx->setDoubleCheck(CHECK_SPXSTRONGBRANCH);
3239 status = spx->solve();
3243 case SPxSolver::OPTIMAL:
3248 case SPxSolver::ABORT_TIME:
3249 case SPxSolver::ABORT_ITER:
3250 case SPxSolver::ABORT_CYCLING:
3253 case SPxSolver::ABORT_VALUE:
3254 case SPxSolver::INFEASIBLE:
3255 *up = spx->terminationValue();
3263 (*iter) += spx->iterations();
3265#ifdef STRONGBRANCH_RESTOREBASIS
3267 assert( ! spx->preStrongbranchingBasisFreed() );
3268 spx->restorePreStrongbranchingBasis();
3269 fromparentbasis =
false;
3273 if( (status == SPxSolver::ABORT_CYCLING || status == SPxSolver::SINGULAR) && !fromparentbasis && spx->iterations() < itlim )
3275 SCIPdebugMessage(
" --> Repeat strong branching up with %d iterations after restoring basis\n", itlim - spx->iterations());
3276 spx->restorePreStrongbranchingBasis();
3277 spx->setIterationLimit(itlim - spx->iterations());
3279 fromparentbasis =
true;
3283 fromparentbasis =
false;
3286 while( fromparentbasis );
3288 spx->changeLower(col, oldlb);
3289 assert(spx->lower(col) <= spx->upper(col));
3291 else if( up !=
NULL )
3293 *up = spx->terminationValue();
3301 spx->setIterationLimit(oldItlim);
3305 SCIPdebugMessage(
"SCIPlpiStrongbranch() returned SoPlex status %d\n",
int(status));
3330 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
3371 for (
int j = 0; j < ncols; ++j)
3374 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
3404 retcode =
lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter);
3445 for (
int j = 0; j < ncols; ++j)
3448 retcode =
lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter);
3522 return (lpi->
spx->getStatus() == SPxSolver::UNBOUNDED);
3537#if ((SOPLEX_VERSION == 150 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 150)
3538 return (lpi->
spx->getStatus() == SPxSolver::UNBOUNDED);
3554 assert(lpi->
spx->getStatus() != SPxSolver::UNBOUNDED || lpi->
spx->basis().status() == SPxBasis::UNBOUNDED);
3559 return (lpi->
spx->getStatus() == SPxSolver::UNBOUNDED && !lpi->
spx->isPerturbed());
3572 return (lpi->
spx->getStatus() == SPxSolver::INFEASIBLE);
3580 SPxBasis::SPxStatus basestatus;
3587 basestatus = lpi->
spx->basis().status();
3592 assert(basestatus == SPxBasis::OPTIMAL || lpi->
spx->getStatus() != SPxSolver::OPTIMAL);
3594 return basestatus == SPxBasis::OPTIMAL ||
3595 ((basestatus == SPxBasis::PRIMAL || basestatus == SPxBasis::UNBOUNDED) && !lpi->
spx->isPerturbed());
3610 return (lpi->
spx->getStatus() == SPxSolver::INFEASIBLE);
3625 return (lpi->
spx->getStatus() == SPxSolver::INFEASIBLE);
3638 return (lpi->
spx->getStatus() == SPxSolver::INFEASIBLE && lpi->
spx->basis().status() == SPxBasis::DUAL
3639 && !lpi->
spx->isPerturbed());
3652 return (lpi->
spx->getStatus() == SPxSolver::UNBOUNDED);
3668 assert(lpi->
spx->basis().status() == SPxBasis::OPTIMAL || lpi->
spx->getStatus() != SPxSolver::OPTIMAL);
3670 return (lpi->
spx->basis().status() == SPxBasis::OPTIMAL) ||
3671 (lpi->
spx->basis().status() == SPxBasis::DUAL && !lpi->
spx->isPerturbed());
3683 assert((lpi->
spx->basis().status() == SPxBasis::OPTIMAL)
3689 return (lpi->
spx->basis().status() == SPxBasis::OPTIMAL);
3708#if ((SOPLEX_VERSION == 172 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 172)
3731 return (lpi->
spx->getStatus() != SPxSolver::ERROR && lpi->
spx->getStatus() != SPxSolver::SINGULAR);
3744 return (lpi->
spx->getStatus() == SPxSolver::ABORT_VALUE);
3757 return (lpi->
spx->getStatus() == SPxSolver::ABORT_ITER);
3770 return (lpi->
spx->getStatus() == SPxSolver::ABORT_TIME);
3783 return static_cast<int>(lpi->
spx->getStatus());
3848 (void)lpi->
spx->getPrimal(tmp);
3850 if( dualsol !=
NULL )
3852 Vector tmp(lpi->
spx->nRows(), dualsol);
3853 (void)lpi->
spx->getDual(tmp);
3855 if( activity !=
NULL )
3857 Vector tmp(lpi->
spx->nRows(), activity);
3858 (void)lpi->
spx->getSlacks(tmp);
3860 if( redcost !=
NULL )
3862 Vector tmp(lpi->
spx->nCols(), redcost);
3863 (void)lpi->
spx->getRedCost(tmp);
3867 catch(
const SPxException&
x )
3869 std::string s =
x.what();
3872 catch(
const SPxException& )
3893#if ((SOPLEX_VERSION == 150 && SOPLEX_SUBVERSION >= 2) || SOPLEX_VERSION > 150)
3896 Vector tmp(lpi->
spx->nCols(), ray);
3897 (void)lpi->
spx->getPrimalray(tmp);
3900 catch(
const SPxException&
x )
3902 std::string s =
x.what();
3905 catch(
const SPxException& )
3913 SCIPerrorMessage(
"SCIPlpiGetPrimalRay() not supported by SoPlex versions <= 1.5.0\n");
3932 Vector tmp(lpi->
spx->nRows(), dualfarkas);
3933 (void)lpi->
spx->getDualfarkas(tmp);
3936 catch(
const SPxException&
x )
3938 std::string s =
x.what();
3941 catch(
const SPxException& )
3962 *iterations = lpi->
spx->iterations();
3983#if ((SOPLEX_VERSION == 172 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 172)
3987 SCIPdebugMessage(
"requesting solution quality from SoPlex: quality %d\n", qualityindicator);
3989 switch( qualityindicator )
4006 *quality = lpi->
spx->basis().condition(maxiter, tolerance);
4036 if (! spx->isInitialized() )
4039 assert( 0 <= col && col < spx->nCols() );
4041 if( spx->rep() == SPxSolver::COLUMN )
4044 if (spx->getSense() == SPxLP::MINIMIZE)
4045 *val = spx->pVec()[col] - spx->maxObj()[col];
4047 *val = spx->maxObj()[col] - spx->pVec()[col];
4051 assert( spx->rep() == SPxSolver::ROW );
4054#ifdef SCIP_DISABLED_CODE
4057 if ( spx->getSense() == SPxLP::MINIMIZE )
4060 if ( spx->isColBasic(col) )
4063 for (
int i = spx->dim() - 1;
i >= 0; --
i)
4065 SPxId
id = spx->basis().baseId(
i);
4066 if (
id.isSPxColId() && col == spx->number(SPxColId(
id)) )
4068 *val = sign * spx->fVec()[
i];
4095 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4099 for(
i = 0;
i < lpi->
spx->nRows(); ++
i )
4101 switch( lpi->
spx->getBasisRowStatus(
i) )
4103 case SPxSolver::BASIC:
4106 case SPxSolver::FIXED:
4107 case SPxSolver::ON_LOWER:
4110 case SPxSolver::ON_UPPER:
4113 case SPxSolver::ZERO:
4114 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
4116 case SPxSolver::UNDEFINED:
4127 for(
i = 0;
i < lpi->
spx->nCols(); ++
i )
4130 switch( lpi->
spx->getBasisColStatus(
i) )
4132 case SPxSolver::BASIC:
4135 case SPxSolver::FIXED:
4147 case SPxSolver::ON_LOWER:
4150 case SPxSolver::ON_UPPER:
4153 case SPxSolver::ZERO:
4156 case SPxSolver::UNDEFINED:
4190 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4193 DataArray<SPxSolver::VarStatus>& m_colstat = lpi->
spx->colStat();
4194 DataArray<SPxSolver::VarStatus>& m_rowstat = lpi->
spx->rowStat();
4196 m_colstat.reSize(ncols);
4197 m_rowstat.reSize(nrows);
4199 for(
i = 0;
i < nrows; ++
i )
4205 m_rowstat[
i] = SPxSolver::ON_LOWER;
4208 m_rowstat[
i] = SPxSolver::BASIC;
4211 m_rowstat[
i] = SPxSolver::ON_UPPER;
4214 SCIPerrorMessage(
"slack variable has basis status ZERO (should not occur)\n");
4223 for(
i = 0;
i < ncols; ++
i )
4229 m_colstat[
i] = SPxSolver::ON_LOWER;
4232 m_colstat[
i] = SPxSolver::BASIC;
4235 m_colstat[
i] = SPxSolver::ON_UPPER;
4238 m_colstat[
i] = SPxSolver::ZERO;
4248 (void) lpi->
spx->updateStatus();
4250 lpi->
spx->freePreStrongbranchingBasis();
4269 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4277 if( spx->rep() == SPxSolver::COLUMN )
4279 for(
int i = 0;
i < spx->nRows(); ++
i )
4281 SPxId
id = spx->basis().baseId(
i);
4283 bind[
i] = (
id.isSPxColId() ? spx->number(
id) : - 1 - spx->number(
id));
4290 int nrows = spx->nRows();
4291 int ncols = spx->nCols();
4293 assert( spx->rep() == SPxSolver::ROW );
4295 for(
int i = 0;
i < nrows; ++
i )
4297 if( !spx->isRowBasic(
i) )
4305 for(
int j = 0; j < ncols && k < nrows; ++j )
4307 if( !spx->isColBasic(j) )
4324 SCIPdebugMessage(
"Preparing factorization for computation of basis inverse.\n");
4331 SPxSolver* spx = lpi->
spx;
4334 DataArray <const SVector*> matrix(spx->nRows());
4337 for (
int i = 0;
i < spx->nRows(); ++
i)
4339 if ( ! spx->isRowBasic(
i) )
4340 matrix[k++] =
new UnitVector(
i);
4342 for (
int j = 0; j < spx->nCols(); ++j)
4344 if ( ! spx->isColBasic(j) )
4345 matrix[k++] = &spx->colVector(j);
4347 assert( k == spx->nRows() );
4348 assert( k == matrix.size() );
4353 SLinSolver::Status status = lpi->
factorization->load(matrix.get_ptr(), k);
4357 assert( status == SLinSolver::OK );
4362 for (
int i = 0;
i < spx->nRows(); ++
i)
4364 if ( ! spx->isRowBasic(
i) )
4370 catch(
const SPxException&
x )
4372 std::string s =
x.what();
4375 catch(
const SPxException& )
4404 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4407 int nCols = lpi->
spx->nCols();
4408 int nRows = lpi->
spx->nRows();
4418 if ( spx->rep() == SPxSolver::COLUMN )
4421 spx->basis().coSolve(
x, spx->unitVector(
r));
4424 if( ninds !=
NULL && inds !=
NULL )
4430 for(
int i = 0;
i < *ninds; ++
i )
4441 Vector
y(nRows, coef);
4449 assert(spx->rep() == SPxSolver::ROW);
4466 Vector
x(nRows, coef);
4468 DSVector rhs(nCols);
4491 assert(!spx->isRowBasic(idx));
4494 rhs = spx->rowVector(idx);
4502 assert(!spx->isColBasic(idx));
4505 rhs = spx->unitVector(idx);
4509 spx->basis().solve(
y, rhs);
4515 for(
int i = 0;
i < nCols; ++
i )
4517 SPxId
id = spx->basis().baseId(
i);
4519 if(
id.isSPxRowId() )
4521 assert(spx->number(
id) >= 0);
4522 assert(spx->number(
id) < nRows);
4523 assert(bind[
r] >= 0 || spx->number(
id) != idx);
4525 x[spx->number(
id)] =
y[
i];
4546 catch(
const SPxException&
x )
4548 std::string s =
x.what();
4551 catch(
const SPxException& )
4572 assert(lpi->
spx->preStrongbranchingBasisFreed());
4576 int nCols = lpi->
spx->nCols();
4577 int nRows = lpi->
spx->nRows();
4582 Vector v(nRows, rhs);
4583 Vector
x(nRows, coef);
4586 if( spx->rep() == SPxSolver::COLUMN )
4589 spx->basis().solve(
x, v);
4593 assert(spx->rep() == SPxSolver::ROW);
4604 DSVector rowrhs(nCols);
4616 for(
int i = 0;
i < nCols; ++
i )
4618 SPxId
id = spx->basis().baseId(
i);
4620 if(
id.isSPxRowId() )
4622 assert(spx->number(
id) >= 0);
4623 assert(spx->number(
id) < nRows);
4625 rowrhs.add(
i, v[spx->number(
id)]);
4634 spx->basis().coSolve(
y, rowrhs);
4637 for(
int i = 0;
i < nRows; ++
i )
4650 assert(!spx->isRowBasic(idx));
4652 x[
i] = v[idx] - (spx->rowVector(idx) * Vector(nCols,
y.get_ptr()));
4659 assert(!spx->isColBasic(idx));
4671 catch(
const SPxException&
x )
4673 std::string s =
x.what();
4676 catch(
const SPxException& )
4708 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4716 DVector e(lpi->
spx->nRows());
4756 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4759 nrows = lpi->
spx->nRows();
4760 ncols = lpi->
spx->nCols();
4764 if( binvrow ==
NULL )
4780 soplex::Vector binvvec(nrows, binv);
4781 for(
c = 0;
c < ncols; ++
c )
4782 coef[
c] = binvvec * lpi->
spx->colVector(
c);
4805 DVector col(lpi->
spx->nRows());
4811 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4823 col = lpi->
spx->colVector(
c);
4824 col.reDim(lpi->
spx->nRows());
4861 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4863 ncols = lpi->
spx->nCols();
4864 nrows = lpi->
spx->nRows();
4879 (*lpistate)->ncols = ncols;
4880 (*lpistate)->nrows = nrows;
4906 assert( lpi->
spx->preStrongbranchingBasisFreed() );
4908 lpncols = lpi->
spx->nCols();
4909 lpnrows = lpi->
spx->nRows();
4921 for(
i = lpistate->
ncols;
i < lpncols; ++
i )
4927 bnd = lpi->
spx->lower(
i);
4936 for(
i = lpistate->
nrows;
i < lpnrows; ++
i )
4960 catch(
const SPxException&
x )
4962 std::string s =
x.what();
4965 catch(
const SPxException& )
4968 assert( lpi->
spx->getStatus() != SPxSolver::OPTIMAL );
4988 if ( *lpistate !=
NULL )
5015 assert( lpi->
spx->preStrongbranchingBasisFreed() );
5034 assert( lpi->
spx->preStrongbranchingBasisFreed() );
5066#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201)
5075 lpi->
spx->getNdualNorms(nrows, ncols);
5077 if( nrows == 0 && ncols == 0)
5086 (*lpinorms)->nrows = 0;
5087 (*lpinorms)->ncols = 0;
5089 SCIPdebugMessage(
"storing SoPlex LPi pricing norms in %p (%d rows, %d cols)\n", (
void *) *lpinorms, nrows, ncols);
5091 if( !lpi->
spx->getDualNorms((*lpinorms)->nrows, (*lpinorms)->ncols, (*lpinorms)->norms) )
5101 assert(nrows == (*lpinorms)->nrows);
5102 assert(ncols == (*lpinorms)->ncols);
5121#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201)
5127 if( lpinorms ==
NULL )
5133 if( lpinorms->
nrows == 0 )
5136 SCIPdebugMessage(
"loading LPi simplex norms %p (%d rows, %d cols) into SoPlex LP with %d rows and %d cols\n",
5137 (
const void *) lpinorms, lpinorms->
nrows, lpinorms->
ncols, lpi->
spx->nRows(), lpi->
spx->nCols());
5153#if ((SOPLEX_VERSION == 201 && SOPLEX_SUBVERSION >= 3) || SOPLEX_VERSION > 201)
5195 *ival = lpi->
spx->getFromScratch();
5198 *ival = lpi->
spx->getLpInfo();
5201 *ival = lpi->
spx->getIterationLimit();
5206 *ival = lpi->
spx->getPresolving();
5212 *ival = lpi->
spx->getScaling();
5214#if SOPLEX_VERSION >= 201
5216 *ival = (int) lpi->
spx->getTiming();
5219#if SOPLEX_VERSION >= 230 || (SOPLEX_VERSION == 220 && SOPLEX_SUBVERSION >= 3)
5221 *ival = (int) lpi->
spx->random.getSeed();
5247 lpi->
spx->setFromScratch(
bool(ival));
5251 lpi->
spx->setLpInfo(
bool(ival));
5256 if( ival >= INT_MAX )
5258 lpi->
spx->setIterationLimit(ival);
5262 lpi->
spx->setPresolving(
bool(ival));
5270 lpi->
spx->setAutoPricer();
5273 lpi->
spx->setFullPricer();
5276 lpi->
spx->setParmultPricer();
5279 lpi->
spx->setSteepPricer();
5282 lpi->
spx->setSteepQStartPricer();
5285 lpi->
spx->setDevexPricer();
5293 lpi->
spx->setScaling(ival);
5295#if SOPLEX_VERSION >= 201
5297 assert(ival >= 0 && ival < 3);
5298 lpi->
spx->setTiming((Timer::TYPE) ival);
5301#if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 220 && SOPLEX_SUBVERSION >= 2)
5303 lpi->
spx->random.setSeed((
unsigned int) ival);
5306#if SOPLEX_VERSION > 221 || (SOPLEX_VERSION == 221 && SOPLEX_SUBVERSION >= 3)
5308 assert(ival >= 0 && ival < 3);
5309 lpi->
spx->setSolutionPolishing((SPxSolver::SolutionPolish) ival);
5336 *dval = lpi->
spx->feastol();
5338#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 160)
5340 *dval = lpi->
spx->opttol();
5344 if ( lpi->
spx->getSense() == SPxLP::MINIMIZE )
5345 *dval = lpi->
spx->getObjUpLimit();
5347 *dval = lpi->
spx->getObjLoLimit();
5350 *dval = lpi->
spx->terminationTime();
5382 lpi->
spx->setFeastol(dval);
5384#if ((SOPLEX_VERSION == 160 && SOPLEX_SUBVERSION >= 5) || SOPLEX_VERSION > 160)
5388 lpi->
spx->setOpttol(dval);
5392 if ( lpi->
spx->getSense() == SPxLP::MINIMIZE )
5393 lpi->
spx->setObjUpLimit(dval);
5395 lpi->
spx->setObjLoLimit(dval);
5403 lpi->
spx->setTerminationTime(dval);
5406 assert( dval >= 0.0 || dval == -1.0 );
5451 return soplex::infinity;
5462 return (val >= soplex::infinity);
5480 const char* filename
5485 f = fopen(filename,
"r");
5506 assert( lpi->
spx->preStrongbranchingBasisFreed() );
5513 if( !lpi->
spx->readLP(fname) )
5517 catch(
const SPxException&
x )
5519 std::string s =
x.what();
5522 catch(
const SPxException& )
5545 lpi->
spx->writeFile(fname);
5548 catch(
const SPxException&
x )
5550 std::string s =
x.what();
5553 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