46#define CPX_SUBVERSION 0
54#define CHECK_ZERO(messagehdlr, x) { int _restat_; \
55 if( (_restat_ = (x)) != 0 ) \
57 SCIPmessagePrintWarning((messagehdlr), "LP Error: CPLEX returned %d\n", _restat_); \
58 return SCIP_LPERROR; \
63#define ABORT_ZERO(x) { int _restat_; \
64 if( (_restat_ = (x)) != 0 ) \
66 SCIPerrorMessage("LP Error: CPLEX returned %d\n", _restat_); \
72#define CPX_INT_MAX 2100000000
77#define CPX_REFACTORMAXITERS 50
81#define CPX_MAGICZEROCONSTANT 1e-10
84#define COLS_PER_PACKET SCIP_DUALPACKETSIZE
86#define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
89#if (CPX_VERSION < 12060100)
98#if (CPX_VERSION < 12060100)
105 CPX_PARAM_SIMDISPLAY,
175#if (CPX_VERSION <= 1100)
179#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
233 assert(num <= lpi->boundchgsize);
258 assert(num <= lpi->sidechgsize);
281 assert(num <= lpi->valsize);
303 assert(num <= lpi->cstatsize);
325 assert(num <= lpi->rstatsize);
522#if (CPX_VERSION == 12070100 || CPX_VERSION == 12070000)
558#if (CPX_VERSION == 12070000)
637 if( val >= CPX_INFBOUND )
639 else if( val <= -CPX_INFBOUND )
640 return -CPX_INFBOUND;
688 if( parval >= CPX_INFBOUND )
690 else if( parval <= -CPX_INFBOUND )
741 const SCIP_Real* lhs,
742 const SCIP_Real* rhs,
757 for(
i = 0;
i < nrows; ++
i )
760 if( lhs[
i] == rhs[
i] )
762 assert(-CPX_INFBOUND < rhs[
i] && rhs[
i] < CPX_INFBOUND);
766 else if( lhs[
i] <= -CPX_INFBOUND )
771 else if( rhs[
i] >= CPX_INFBOUND )
816 for(
i = 0;
i < nrows; ++
i )
826 lhs[
i] = -CPX_INFBOUND;
832 rhs[
i] = CPX_INFBOUND;
871 for(
i = 0;
i < nrows; ++
i )
882 lhs[
i] = -CPX_INFBOUND;
919 for(
i = 0;
i < nrows; ++
i )
935 rhs[
i] = CPX_INFBOUND;
964 else if( lhs !=
NULL )
966 else if( rhs !=
NULL )
1011static const char cpxname[]= {
'C',
'P',
'L',
'E',
'X',
' ',
1012#if (defined CPX_VERSION_VERSION) && (CPX_VERSION_VERSION >= 10) && (CPX_VERSION_RELEASE >= 10)
1013 (CPX_VERSION_VERSION/10) +
'0', (CPX_VERSION_VERSION%10) +
'0',
'.', (CPX_VERSION_RELEASE/10) +
'0', (CPX_VERSION_RELEASE%10) +
'0',
'.', CPX_VERSION_MODIFICATION +
'0',
'.', CPX_VERSION_FIX +
'0'
1014#elif (defined CPX_VERSION_VERSION) && (CPX_VERSION_VERSION <= 9) && (CPX_VERSION_RELEASE <= 9)
1015 CPX_VERSION_VERSION +
'0',
'.',CPX_VERSION_RELEASE +
'0',
'.', CPX_VERSION_MODIFICATION +
'0',
'.', CPX_VERSION_FIX +
'0'
1016#elif (defined CPX_VERSION_VERSION) && (CPX_VERSION_VERSION >= 10) && (CPX_VERSION_RELEASE <= 9)
1017 (CPX_VERSION_VERSION/10) +
'0', (CPX_VERSION_VERSION%10) +
'0',
'.', CPX_VERSION_RELEASE +
'0',
'.', CPX_VERSION_MODIFICATION +
'0',
'.', CPX_VERSION_FIX +
'0'
1018#elif (defined CPX_VERSION_VERSION) && (CPX_VERSION_VERSION <= 9) && (CPX_VERSION_RELEASE >= 10)
1019 CPX_VERSION_VERSION +
'0',
'.', (CPX_VERSION_RELEASE/10) +
'0', (CPX_VERSION_RELEASE%10) +
'0',
'.', CPX_VERSION_MODIFICATION +
'0',
'.', CPX_VERSION_FIX +
'0'
1021 (CPX_VERSION / 100) +
'0',
'.', ((CPX_VERSION % 100) / 10) +
'0',
'.', (CPX_VERSION % 10) +
'0',
'.',
CPX_SUBVERSION +
'0'
1042 return "Linear Programming Solver developed by IBM (www.cplex.com)";
1053 return (
void*) lpi->
cpxlp;
1067 SCIPerrorMessage(
"SCIPlpiSetIntegralityInformation() has not been implemented yet.\n");
1117 assert(
sizeof(SCIP_Real) ==
sizeof(
double));
1126 (*lpi)->cpxenv = CPXopenCPLEX(&restat);
1129#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
1131 CHECK_ZERO( messagehdlr, CPXsetintparam((*lpi)->cpxenv, CPX_PARAM_THREADS, 1) );
1134#ifdef SCIP_DISABLED_CODE
1136 CHECK_ZERO( messagehdlr, CPXsetintparam((*lpi)->cpxenv, CPX_PARAM_PREIND, CPX_OFF) );
1139#if (CPX_VERSION == 12070000)
1141 CHECK_ZERO( messagehdlr, CPXsetintparam((*lpi)->cpxenv, CPX_PARAM_SCAIND, -1) );
1149 (*lpi)->larray =
NULL;
1150 (*lpi)->uarray =
NULL;
1151 (*lpi)->senarray =
NULL;
1152 (*lpi)->rhsarray =
NULL;
1153 (*lpi)->rngarray =
NULL;
1154 (*lpi)->valarray =
NULL;
1155 (*lpi)->rngindarray =
NULL;
1156 (*lpi)->cstat =
NULL;
1157 (*lpi)->rstat =
NULL;
1158 (*lpi)->indarray =
NULL;
1159 (*lpi)->boundchgsize = 0;
1160 (*lpi)->sidechgsize = 0;
1161 (*lpi)->valsize = 0;
1162 (*lpi)->cstatsize = 0;
1163 (*lpi)->rstatsize = 0;
1164 (*lpi)->iterations = 0;
1166 (*lpi)->solisbasic =
FALSE;
1167 (*lpi)->cpxlp = CPXcreateprob((*lpi)->cpxenv, &restat, name);
1168 (*lpi)->instabilityignored =
FALSE;
1169 (*lpi)->fromscratch =
FALSE;
1170 (*lpi)->clearstate =
FALSE;
1171 (*lpi)->feastol = 1e-06;
1172 (*lpi)->conditionlimit = -1.0;
1173 (*lpi)->checkcondition =
FALSE;
1174#if (CPX_VERSION <= 1100)
1175 (*lpi)->rngfound =
FALSE;
1177 (*lpi)->messagehdlr = messagehdlr;
1204 CHECK_ZERO( (*lpi)->messagehdlr, CPXfreeprob((*lpi)->cpxenv, &((*lpi)->cpxlp)) );
1219 CHECK_ZERO( (*lpi)->messagehdlr, CPXcloseCPLEX(&((*lpi)->cpxenv)) );
1243 const SCIP_Real*
obj,
1244 const SCIP_Real* lb,
1245 const SCIP_Real* ub,
1248 const SCIP_Real* lhs,
1249 const SCIP_Real* rhs,
1254 const SCIP_Real* val
1264 for( j = 0; j < nnonz; j++ )
1279 SCIPdebugMessage(
"loading LP in column format into CPLEX: %d cols, %d rows\n", ncols, nrows);
1290 for(
c = 0;
c < ncols-1; ++
c )
1292 cnt[
c] = beg[
c+1] - beg[
c];
1295 cnt[ncols-1] = nnonz - beg[ncols-1];
1296 assert(cnt[ncols-1] >= 0);
1300 lpi->
rhsarray, lpi->
senarray, beg, cnt, ind, val, lb, ub, lpi->
rngarray, colnames, rownames) );
1316 const SCIP_Real*
obj,
1317 const SCIP_Real* lb,
1318 const SCIP_Real* ub,
1323 const SCIP_Real* val
1338 SCIPdebugMessage(
"adding %d columns with %d nonzeros to CPLEX\n", ncols, nnonz);
1350 for (j = 0; j < nnonz; ++j)
1352 assert( 0 <= ind[j] && ind[j] < nrows );
1357 CHECK_ZERO( lpi->
messagehdlr, CPXaddcols(lpi->
cpxenv, lpi->
cpxlp, ncols, nnonz,
obj, beg, ind, val, lb, ub, colnames) );
1377 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->
cpxenv, lpi->
cpxlp));
1379 SCIPdebugMessage(
"deleting %d columns from CPLEX\n", lastcol - firstcol + 1);
1414 const SCIP_Real* lhs,
1415 const SCIP_Real* rhs,
1420 const SCIP_Real* val
1434 SCIPdebugMessage(
"adding %d rows with %d nonzeros to CPLEX\n", nrows, nnonz);
1452 for (j = 0; j < nnonz; ++j) {
1454 assert( 0 <= ind[j] && ind[j] < ncols );
1457 CHECK_ZERO( lpi->
messagehdlr, CPXaddrows(lpi->
cpxenv, lpi->
cpxlp, 0, nrows, nnonz, lpi->
rhsarray, lpi->
senarray, beg, ind, val,
NULL,
1466#if (CPX_VERSION <= 1100)
1489 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp));
1556 const SCIP_Real* lb,
1571 for(
i = 0;
i < ncols; ++
i )
1577 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[
i]);
1582 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[
i]);
1596 for(
i = 0;
i < ncols; ++
i )
1619 const SCIP_Real* lhs,
1620 const SCIP_Real* rhs
1648 for(
i = 0;
i < rngcount; ++
i )
1674 SCIPdebugMessage(
"changing coefficient row %d, column %d in CPLEX to %g\n", row, col, newval);
1697#if (CPX_VERSION >= 12050000)
1711 const SCIP_Real*
obj
1747 SCIPdebugMessage(
"scaling row %d with factor %g in CPLEX\n", row, scaleval);
1757 for(
i = 0;
i < nnonz; ++
i )
1763 if( lhs > -CPX_INFBOUND )
1765 else if( scaleval < 0.0 )
1767 if( rhs < CPX_INFBOUND )
1769 else if( scaleval < 0.0 )
1770 rhs = -CPX_INFBOUND;
1771 if( scaleval > 0.0 )
1804 SCIPdebugMessage(
"scaling column %d with factor %g in CPLEX\n", col, scaleval);
1817 for(
i = 0;
i < nnonz; ++
i )
1827 if( lb > -CPX_INFBOUND )
1829 else if( scaleval < 0.0 )
1831 if( ub < CPX_INFBOUND )
1833 else if( scaleval < 0.0 )
1835 if( scaleval > 0.0 )
1929 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->
cpxenv, lpi->
cpxlp));
1947 CPXgetnumnz(lpi->
cpxenv, lpi->
cpxlp), &surplus, firstcol, lastcol) );
1970#if CPX_VERSION < 12070000
1977 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp));
1989#if CPX_VERSION < 12070000
1991 if( retcode != CPXERR_NO_RNGVAL )
2011 CPXgetnumnz(lpi->
cpxenv, lpi->
cpxlp), &surplus, firstrow, lastrow) );
2025 int namestoragesize,
2034 assert(colnames !=
NULL || namestoragesize == 0);
2035 assert(namestorage !=
NULL || namestoragesize == 0);
2036 assert(namestoragesize >= 0);
2038 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->
cpxenv, lpi->
cpxlp));
2042 retcode = CPXgetcolname(lpi->
cpxenv, lpi->
cpxlp, colnames, namestorage, namestoragesize, storageleft, firstcol, lastcol);
2043 assert( namestoragesize != 0 || retcode == CPXERR_NEGATIVE_SURPLUS );
2044 if( namestoragesize != 0 )
2059 int namestoragesize,
2068 assert(rownames !=
NULL || namestoragesize == 0);
2069 assert(namestorage !=
NULL || namestoragesize == 0);
2070 assert(namestoragesize >= 0);
2072 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp));
2076 retcode = CPXgetrowname(lpi->
cpxenv, lpi->
cpxlp, rownames, namestorage, namestoragesize, storageleft, firstrow, lastrow);
2077 assert( namestoragesize != 0 || retcode == CPXERR_NEGATIVE_SURPLUS );
2078 if( namestoragesize != 0 )
2116 assert(firstcol <= lastcol);
2119 SCIPdebugMessage(
"getting objective values %d to %d\n", firstcol, lastcol);
2138 assert(firstcol <= lastcol);
2164#if CPX_VERSION < 12070000
2171 assert(firstrow <= lastrow);
2179#if CPX_VERSION < 12070000
2181 if( retval != CPXERR_NO_RNGVAL )
2238#if CPX_VERSION == 12070100
2251#if (CPX_VERSION == 12070000)
2265#if CPX_VERSION == 12070100
2277#if CPX_VERSION == 12070100
2289 case CPXERR_NO_MEMORY:
2299 if( lpi->
solstat != CPX_STAT_INForUNBD )
2306 SCIPdebugMessage(
" -> CPLEX returned solstat=%d, pfeas=%d, dfeas=%d (%d iterations)\n",
2309#if CPX_VERSION == 12070100
2315 if( lpi->
solstat == CPX_STAT_INForUNBD && CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp) == 0 )
2317 lpi->
solstat = CPX_STAT_UNBOUNDED;
2323 if( lpi->
solstat == CPX_STAT_INForUNBD
2324 || (lpi->
solstat == CPX_STAT_INFEASIBLE && !dualfeasible)
2325 || (lpi->
solstat == CPX_STAT_UNBOUNDED && !primalfeasible) )
2327 if(
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON )
2330 SCIPdebugMessage(
"presolver may have solved the problem -> calling CPLEX primal simplex again without presolve\n");
2341 case CPXERR_NO_MEMORY:
2359 if( lpi->
solstat == CPX_STAT_INForUNBD )
2362 SCIPerrorMessage(
"CPLEX primal simplex returned CPX_STAT_INForUNBD after presolving was turned off.\n");
2369 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2399#if (CPX_VERSION == 12070000)
2414 case CPXERR_NO_MEMORY:
2424 if( lpi->
solstat != CPX_STAT_INForUNBD )
2431 SCIPdebugMessage(
" -> CPLEX returned solstat=%d, pfeas=%d, dfeas=%d (%d iterations)\n",
2434 if( lpi->
solstat == CPX_STAT_INForUNBD
2435 || (lpi->
solstat == CPX_STAT_INFEASIBLE && !dualfeasible)
2436 || (lpi->
solstat == CPX_STAT_UNBOUNDED && !primalfeasible) )
2438 if(
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON )
2441 SCIPdebugMessage(
"presolver may have solved the problem -> calling CPLEX dual simplex again without presolve\n");
2452 case CPXERR_NO_MEMORY:
2471 if( lpi->
solstat == CPX_STAT_INForUNBD )
2474 SCIPerrorMessage(
"CPLEX dual simplex returned CPX_STAT_INForUNBD after presolving was turned off\n");
2482 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2485#ifdef SCIP_DISABLED_CODE
2510 SCIPdebugMessage(
"dual solution %g does not exceed objective limit [%g,%g] (%d iterations) -> calling CPLEX dual simplex again for one iteration\n",
2516 setDblParam(lpi, CPX_PARAM_OBJLLIM, -CPX_INFBOUND);
2517 setDblParam(lpi, CPX_PARAM_OBJULIM, CPX_INFBOUND);
2526 case CPXERR_NO_MEMORY:
2548 case CPXERR_NO_MEMORY:
2589 retval = CPXhybbaropt(lpi->
cpxenv, lpi->
cpxlp, crossover ? 0 : CPX_ALG_NONE);
2594 case CPXERR_NO_MEMORY:
2602 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2606 if( lpi->
solstat != CPX_STAT_INForUNBD )
2613 if( lpi->
solstat == CPX_STAT_INForUNBD )
2616 SCIPdebugMessage(
"CPLEX returned INForUNBD -> calling CPLEX barrier again without presolve\n");
2622 retval = CPXhybbaropt(lpi->
cpxenv, lpi->
cpxlp, crossover ? 0 : CPX_ALG_NONE);
2627 case CPXERR_NO_MEMORY:
2635 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2658 SCIP_Bool* downvalid,
2665 const char lbound =
'L';
2666 const char ubound =
'U';
2698 if( newub >= oldlb - 0.5 )
2725 if( newlb <= oldub + 0.5 )
2790 SCIP_Bool* downvalid,
2807 SCIPdebugMessage(
"calling CPLEX strongbranching on fractional variable %d (%d iterations)\n", col, itlim);
2820 retval = CPXstrongbranch(lpi->
cpxenv, lpi->
cpxlp, &col, 1, down, up, itlim);
2821 if( retval == CPXERR_NEED_OPT_SOLN )
2826 else if( retval == CPXERR_TILIM_STRONGBRANCH )
2831 else if( retval == CPXERR_SINGULAR )
2855 SCIP_Bool* downvalid,
2875 SCIPdebugMessage(
"calling CPLEX strongbranching on %d fractional variables (%d iterations)\n", ncols, itlim);
2883 for( j = 0; j < ncols; ++j )
2886 downvalid[j] =
TRUE;
2892 retval = CPXstrongbranch(lpi->
cpxenv, lpi->
cpxlp, cols, ncols, down, up, itlim);
2893 if( retval == CPXERR_NEED_OPT_SOLN )
2898 else if( retval == CPXERR_TILIM_STRONGBRANCH )
2920 SCIP_Bool* downvalid,
2934 SCIPdebugMessage(
"calling CPLEX strongbranching on variable %d with integral value (%d iterations)\n", col, itlim);
2955 SCIP_Bool* downvalid,
2973 SCIPdebugMessage(
"calling CPLEX strongbranching on %d variables with integer values (%d iterations)\n", ncols, itlim);
2979 for( j = 0; j < ncols; ++j )
3023 SCIP_Bool* primalfeasible,
3024 SCIP_Bool* dualfeasible
3056 return (lpi->
solstat == CPX_STAT_UNBOUNDED || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED);
3071 return (lpi->
solstat == CPX_STAT_UNBOUNDED );
3094 return ((primalfeasible && (lpi->
solstat == CPX_STAT_UNBOUNDED || lpi->
solstat == CPX_STAT_INForUNBD))
3095 || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED);
3114 return (lpi->
solstat == CPX_STAT_INFEASIBLE || (lpi->
solstat == CPX_STAT_INForUNBD && dualfeasible));
3133 return (SCIP_Bool)primalfeasible;
3146 return (lpi->
solstat == CPX_STAT_INFEASIBLE);
3161 return (lpi->
solstat == CPX_STAT_INFEASIBLE && CPXgetmethod(lpi->
cpxenv, lpi->
cpxlp) == CPX_ALG_DUAL);
3180 return (dualfeasible && (lpi->
solstat == CPX_STAT_INFEASIBLE || lpi->
solstat == CPX_STAT_INForUNBD));
3199 return (lpi->
solstat == CPX_STAT_UNBOUNDED
3200 || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED
3201 || (lpi->
solstat == CPX_STAT_INForUNBD && primalfeasible));
3220 return (SCIP_Bool)dualfeasible;
3231 return (lpi->
solstat == CPX_STAT_OPTIMAL);
3252#ifdef SCIP_DISABLED_CODE
3261 if( lpi->
solstat == CPX_STAT_UNBOUNDED )
3267 if( !primalfeasible )
3292 return (lpi->
solstat != CPX_STAT_NUM_BEST && lpi->
solstat != CPX_STAT_OPTIMAL_INFEAS);
3303 return (lpi->
solstat == CPX_STAT_ABORT_OBJ_LIM
3304 || lpi->
solstat == CPX_STAT_ABORT_DUAL_OBJ_LIM
3305 || lpi->
solstat == CPX_STAT_ABORT_PRIM_OBJ_LIM);
3316 return (lpi->
solstat == CPX_STAT_ABORT_IT_LIM);
3327 return (lpi->
solstat == CPX_STAT_ABORT_TIME_LIM);
3351 || lpi->
solstat == CPX_STAT_NUM_BEST
3352 || lpi->
solstat == CPX_STAT_OPTIMAL_INFEAS);
3355 if( lpi->
solstat == CPX_STAT_NUM_BEST || lpi->
solstat == CPX_STAT_OPTIMAL_INFEAS )
3356 lpi->
solstat = CPX_STAT_OPTIMAL;
3382 if( retcode == CPXERR_NO_SOLN )
3404 SCIP_Real* activity,
3420 if( activity !=
NULL )
3451 SCIP_Real* dualfarkas
3503 SCIPdebugMessage(
"requesting solution quality from CPLEX: quality %d\n", qualityindicator);
3505 switch( qualityindicator )
3512 what = CPX_EXACT_KAPPA;
3522 if( solntype == CPX_BASIC_SOLN )
3557 SCIPdebugMessage(
"saving CPLEX basis into %p/%p\n", (
void *) cstat, (
void *) rstat);
3563 for (
i = 0;
i < nrows; ++
i)
3565 if ( rstat[
i] == CPX_AT_LOWER )
3604 SCIPdebugMessage(
"loading basis %p/%p into CPLEX\n", (
void *) cstat, (
void *) rstat);
3617 for (
i = 0;
i < nrows; ++
i)
3623 lpi->
rstat[
i] = CPX_AT_LOWER;
3654 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3690 if ( ninds !=
NULL )
3698 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3719 assert(basicrow < nrows);
3724 if( rowsense ==
'G' || rowsense ==
'R' )
3728 for(
i = 0;
i < nrows;
i++ )
3767 if ( ninds !=
NULL )
3775 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3791 for(
r = 0;
r < nrows;
r++ )
3799 assert(basicrow < nrows);
3802 if( basicrow >= 0 && basicrow < nrows && (lpi->
senarray[basicrow] ==
'G' || lpi->
senarray[basicrow] ==
'R') )
3819 const SCIP_Real* binvrow,
3837 if ( ninds !=
NULL )
3844 retval = CPXbinvarow(lpi->
cpxenv, lpi->
cpxlp,
r, coef);
3845 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3848 retval = CPXbinvarow(lpi->
cpxenv, lpi->
cpxlp,
r, coef);
3866 assert(basicrow < nrows);
3871 if( rowsense ==
'G' || rowsense ==
'R' )
3877 for( j = 0; j < ncols; j++ )
3912 if ( ninds !=
NULL )
3919 retval = CPXbinvacol(lpi->
cpxenv, lpi->
cpxlp,
c, coef);
3920 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3923 retval = CPXbinvacol(lpi->
cpxenv, lpi->
cpxlp,
c, coef);
3936 for(
r = 0;
r < nrows;
r++ )
3944 assert(basicrow < nrows);
3947 if( basicrow >= 0 && basicrow < nrows && (lpi->
senarray[basicrow] ==
'G' || lpi->
senarray[basicrow] ==
'R') )
4000 SCIPdebugMessage(
"storing CPLEX LPI state in %p (%d cols, %d rows)\n", (
void *) *lpistate, ncols, nrows);
4006 (*lpistate)->ncols = ncols;
4007 (*lpistate)->nrows = nrows;
4032 if( lpistate ==
NULL )
4040 SCIPdebugMessage(
"loading LPI state %p (%d cols, %d rows) into CPLEX LP with %d cols and %d rows\n",
4041 (
void *) lpistate, lpistate->
ncols, lpistate->
nrows, lpncols, lpnrows);
4043 if( lpistate->
ncols == 0 || lpistate->
nrows == 0 )
4054 for(
i = lpistate->
ncols;
i < lpncols; ++
i )
4070 for(
i = lpistate->
nrows;
i < lpnrows; ++
i )
4103 if( *lpistate !=
NULL )
4118 return (lpistate !=
NULL);
4205 (*lpinorms)->normlen = 0;
4207 SCIPdebugMessage(
"storing CPLEX LPI pricing norms in %p (%d rows)\n", (
void *) *lpinorms, nrows);
4210 retval = CPXgetdnorms(lpi->
cpxenv, lpi->
cpxlp, (*lpinorms)->norm, (*lpinorms)->head, &((*lpinorms)->normlen));
4213 if( retval == 1264 )
4223 assert((*lpinorms)->normlen == nrows);
4247 if( lpinorms ==
NULL )
4253 SCIPdebugMessage(
"loading LPI simplex norms %p (%d rows) into CPLEX LP with %d rows\n",
4254 (
void *) lpinorms, lpinorms->
normlen, lpnrows);
4316#if (CPX_VERSION < 12060100)
4322#if (CPX_VERSION <= 1100)
4329 *ival = (
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON);
4335 *ival = (
getIntParam(lpi, CPX_PARAM_SCRIND) == CPX_ON);
4339#if (CPX_VERSION <= 1230)
4345#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
4348 *ival = lpi->pseudonthreads;
4379#if (CPX_VERSION < 12060100)
4381 assert(0 <= ival && ival <= 1);
4386 assert(0 <= ival && ival <= 2);
4387#if (CPX_VERSION <= 1100)
4402 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_AUTO);
4403 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_AUTO);
4406 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_FULL);
4407 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_FULL);
4410 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_PARTIAL);
4411 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_AUTO);
4415 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_STEEP);
4416 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_STEEP);
4419 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_STEEPQSTART);
4420 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_STEEPQSTART);
4422#if (CPX_VERSION >= 900)
4424 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_DEVEX);
4425 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_DEVEX);
4442#if (CPX_VERSION <= 1230)
4448#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
4451 lpi->pseudonthreads = ival;
4493 if ( CPXgetobjsen(lpi->
cpxenv, lpi->
cpxlp) == CPX_MIN )
4533 else if( dval > 1e-04 )
4544 else if( dval > 1e-04 )
4559 if ( CPXgetobjsen(lpi->
cpxenv, lpi->
cpxlp) == CPX_MIN )
4576 else if( dval > .99999 )
4621 return CPX_INFBOUND;
4631 return (val >= CPX_INFBOUND);
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
#define SCIP_CALL_QUIET(x)
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 *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 **rownames, 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)
static SCIP_RETCODE lpiStrongbranchIntegral(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 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 **colnames, 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 **rownames, 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
static SCIP_RETCODE setBase(SCIP_LPI *lpi)
static void reconvertSides(SCIP_LPI *lpi, int nrows, SCIP_Real *lhs, SCIP_Real *rhs)
static void lpistatePack(SCIP_LPISTATE *lpistate, const int *cstat, const int *rstat)
static void lpistateUnpack(const SCIP_LPISTATE *lpistate, int *cstat, int *rstat)
static int rowpacketNum(int nrows)
static void invalidateSolution(SCIP_LPI *const lpi)
SCIP_DUALPACKET ROWPACKET
static SCIP_RETCODE ensureCstatMem(SCIP_LPI *lpi, int num)
static SCIP_RETCODE setParameterValues(SCIP_LPI *const lpi, SCIP_CPXPARAM *const cpxparam)
static void convertSides(SCIP_LPI *lpi, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, int indoffset, int *rngcount)
static SCIP_RETCODE checkParameterValues(SCIP_LPI *const lpi)
static int getIntParam(SCIP_LPI *lpi, int const param)
static void setDblParam(SCIP_LPI *lpi, int const param, double parval)
static SCIP_RETCODE ensureBoundchgMem(SCIP_LPI *lpi, int num)
static const char cpxname[]
static void lpistateFree(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem)
static void setIntParam(SCIP_LPI *lpi, int const param, int const parval)
static const int intparam[NUMINTPARAM]
static SCIP_RETCODE getBase(SCIP_LPI *lpi)
SCIP_DUALPACKET COLPACKET
static SCIP_RETCODE getParameterValues(SCIP_LPI *lpi, SCIP_CPXPARAM *cpxparam)
static SCIP_RETCODE restoreLPData(SCIP_LPI *lpi)
static int cpxObjsen(SCIP_OBJSEN const objsen)
#define CHECK_ZERO(messagehdlr, x)
static const double dblparammin[NUMDBLPARAM]
static void reconvertBothSides(SCIP_LPI *lpi, int nrows, SCIP_Real *lhs, SCIP_Real *rhs)
static SCIP_RETCODE ensureRstatMem(SCIP_LPI *lpi, int num)
static int colpacketNum(int ncols)
static SCIP_RETCODE ensureSidechgMem(SCIP_LPI *lpi, int num)
static void copyParameterValues(SCIP_CPXPARAM *dest, SCIP_CPXPARAM *const source)
#define CPX_REFACTORMAXITERS
static const int dblparam[NUMDBLPARAM]
static void reconvertLhs(SCIP_LPI *lpi, int nrows, SCIP_Real *lhs)
static void reconvertRhs(SCIP_LPI *lpi, int nrows, SCIP_Real *rhs)
static double getDblParam(SCIP_LPI *lpi, int const param)
static SCIP_RETCODE lpistateCreate(SCIP_LPISTATE **lpistate, BMS_BLKMEM *blkmem, int ncols, int nrows)
#define CPX_MAGICZEROCONSTANT
static SCIP_RETCODE ensureValMem(SCIP_LPI *lpi, int num)
#define BMSfreeMemory(ptr)
#define BMSfreeBlockMemory(mem, ptr)
#define BMSallocBlockMemory(mem, ptr)
#define BMSreallocMemoryArray(ptr, num)
#define BMSallocMemoryArray(ptr, num)
#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
double dblparval[NUMDBLPARAM]
int intparval[NUMINTPARAM]
SCIP_Bool instabilityignored
SCIP_MESSAGEHDLR * messagehdlr
@ SCIP_PRICING_STEEPQSTART
@ SCIP_PRICING_LPIDEFAULT
enum SCIP_Pricing SCIP_PRICING
enum SCIP_LPParam SCIP_LPPARAM
@ SCIP_LPSOLQUALITY_EXACTCONDITION
@ SCIP_LPSOLQUALITY_ESTIMCONDITION
@ SCIP_LPPAR_BARRIERCONVTOL
@ SCIP_LPPAR_CONDITIONLIMIT
enum SCIP_LPSolQuality SCIP_LPSOLQUALITY
enum SCIP_ObjSen SCIP_OBJSEN
enum SCIP_Retcode SCIP_RETCODE