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,
176#if (CPX_VERSION <= 1100)
180#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
234 assert(num <= lpi->boundchgsize);
259 assert(num <= lpi->sidechgsize);
282 assert(num <= lpi->valsize);
304 assert(num <= lpi->cstatsize);
326 assert(num <= lpi->rstatsize);
523#if (CPX_VERSION == 12070100 || CPX_VERSION == 12070000)
559#if (CPX_VERSION == 12070000)
638 if( val >= CPX_INFBOUND )
640 else if( val <= -CPX_INFBOUND )
641 return -CPX_INFBOUND;
689 if( parval >= CPX_INFBOUND )
691 else if( parval <= -CPX_INFBOUND )
715 lpi->
method = CPX_ALG_NONE;
759 for(
i = 0;
i < nrows; ++
i )
762 if( lhs[
i] == rhs[
i] )
764 assert(-CPX_INFBOUND < rhs[
i] && rhs[
i] < CPX_INFBOUND);
768 else if( lhs[
i] <= -CPX_INFBOUND )
773 else if( rhs[
i] >= CPX_INFBOUND )
818 for(
i = 0;
i < nrows; ++
i )
828 lhs[
i] = -CPX_INFBOUND;
834 rhs[
i] = CPX_INFBOUND;
873 for(
i = 0;
i < nrows; ++
i )
884 lhs[
i] = -CPX_INFBOUND;
921 for(
i = 0;
i < nrows; ++
i )
937 rhs[
i] = CPX_INFBOUND;
966 else if( lhs !=
NULL )
968 else if( rhs !=
NULL )
1013static const char cpxname[]= {
'C',
'P',
'L',
'E',
'X',
' ',
1014#if (defined CPX_VERSION_VERSION) && (CPX_VERSION_VERSION >= 10) && (CPX_VERSION_RELEASE >= 10)
1015 (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'
1016#elif (defined CPX_VERSION_VERSION) && (CPX_VERSION_VERSION <= 9) && (CPX_VERSION_RELEASE <= 9)
1017 CPX_VERSION_VERSION +
'0',
'.',CPX_VERSION_RELEASE +
'0',
'.', CPX_VERSION_MODIFICATION +
'0',
'.', CPX_VERSION_FIX +
'0'
1018#elif (defined CPX_VERSION_VERSION) && (CPX_VERSION_VERSION >= 10) && (CPX_VERSION_RELEASE <= 9)
1019 (CPX_VERSION_VERSION/10) +
'0', (CPX_VERSION_VERSION%10) +
'0',
'.', CPX_VERSION_RELEASE +
'0',
'.', CPX_VERSION_MODIFICATION +
'0',
'.', CPX_VERSION_FIX +
'0'
1020#elif (defined CPX_VERSION_VERSION) && (CPX_VERSION_VERSION <= 9) && (CPX_VERSION_RELEASE >= 10)
1021 CPX_VERSION_VERSION +
'0',
'.', (CPX_VERSION_RELEASE/10) +
'0', (CPX_VERSION_RELEASE%10) +
'0',
'.', CPX_VERSION_MODIFICATION +
'0',
'.', CPX_VERSION_FIX +
'0'
1023 (CPX_VERSION / 100) +
'0',
'.', ((CPX_VERSION % 100) / 10) +
'0',
'.', (CPX_VERSION % 10) +
'0',
'.',
CPX_SUBVERSION +
'0'
1045 return "Linear Programming Solver developed by IBM (www.cplex.com)";
1056 return (
void*) lpi->
cpxlp;
1070 SCIPerrorMessage(
"SCIPlpiSetIntegralityInformation() has not been implemented yet.\n");
1129 (*lpi)->cpxenv = CPXopenCPLEX(&restat);
1132#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
1134 CHECK_ZERO( messagehdlr, CPXsetintparam((*lpi)->cpxenv, CPX_PARAM_THREADS, 1) );
1137#ifdef SCIP_DISABLED_CODE
1139 CHECK_ZERO( messagehdlr, CPXsetintparam((*lpi)->cpxenv, CPX_PARAM_PREIND, CPX_OFF) );
1142#if (CPX_VERSION == 12070000)
1144 CHECK_ZERO( messagehdlr, CPXsetintparam((*lpi)->cpxenv, CPX_PARAM_SCAIND, -1) );
1152 (*lpi)->larray =
NULL;
1153 (*lpi)->uarray =
NULL;
1154 (*lpi)->senarray =
NULL;
1155 (*lpi)->rhsarray =
NULL;
1156 (*lpi)->rngarray =
NULL;
1157 (*lpi)->valarray =
NULL;
1158 (*lpi)->rngindarray =
NULL;
1159 (*lpi)->cstat =
NULL;
1160 (*lpi)->rstat =
NULL;
1161 (*lpi)->indarray =
NULL;
1162 (*lpi)->boundchgsize = 0;
1163 (*lpi)->sidechgsize = 0;
1164 (*lpi)->valsize = 0;
1165 (*lpi)->cstatsize = 0;
1166 (*lpi)->rstatsize = 0;
1167 (*lpi)->iterations = 0;
1169 (*lpi)->solisbasic =
FALSE;
1170 (*lpi)->cpxlp = CPXcreateprob((*lpi)->cpxenv, &restat, name);
1171 (*lpi)->instabilityignored =
FALSE;
1172 (*lpi)->fromscratch =
FALSE;
1173 (*lpi)->clearstate =
FALSE;
1174 (*lpi)->feastol = 1e-06;
1175 (*lpi)->conditionlimit = -1.0;
1176 (*lpi)->checkcondition =
FALSE;
1177#if (CPX_VERSION <= 1100)
1178 (*lpi)->rngfound =
FALSE;
1180 (*lpi)->messagehdlr = messagehdlr;
1207 CHECK_ZERO( (*lpi)->messagehdlr, CPXfreeprob((*lpi)->cpxenv, &((*lpi)->cpxlp)) );
1222 CHECK_ZERO( (*lpi)->messagehdlr, CPXcloseCPLEX(&((*lpi)->cpxenv)) );
1267 for( j = 0; j < nnonz; j++ )
1282 SCIPdebugMessage(
"loading LP in column format into CPLEX: %d cols, %d rows\n", ncols, nrows);
1293 for(
c = 0;
c < ncols-1; ++
c )
1295 cnt[
c] = beg[
c+1] - beg[
c];
1298 cnt[ncols-1] = nnonz - beg[ncols-1];
1299 assert(cnt[ncols-1] >= 0);
1303 lpi->
rhsarray, lpi->
senarray, beg, cnt, ind, val, lb, ub, lpi->
rngarray, colnames, rownames) );
1341 SCIPdebugMessage(
"adding %d columns with %d nonzeros to CPLEX\n", ncols, nnonz);
1353 for (j = 0; j < nnonz; ++j)
1355 assert( 0 <= ind[j] && ind[j] < nrows );
1360 CHECK_ZERO( lpi->
messagehdlr, CPXaddcols(lpi->
cpxenv, lpi->
cpxlp, ncols, nnonz,
obj, beg, ind, val, lb, ub, colnames) );
1380 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->
cpxenv, lpi->
cpxlp));
1382 SCIPdebugMessage(
"deleting %d columns from CPLEX\n", lastcol - firstcol + 1);
1437 SCIPdebugMessage(
"adding %d rows with %d nonzeros to CPLEX\n", nrows, nnonz);
1455 for (j = 0; j < nnonz; ++j) {
1457 assert( 0 <= ind[j] && ind[j] < ncols );
1460 CHECK_ZERO( lpi->
messagehdlr, CPXaddrows(lpi->
cpxenv, lpi->
cpxlp, 0, nrows, nnonz, lpi->
rhsarray, lpi->
senarray, beg, ind, val,
NULL,
1469#if (CPX_VERSION <= 1100)
1492 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp));
1574 for(
i = 0;
i < ncols; ++
i )
1580 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[
i]);
1585 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[
i]);
1599 for(
i = 0;
i < ncols; ++
i )
1651 for(
i = 0;
i < rngcount; ++
i )
1677 SCIPdebugMessage(
"changing coefficient row %d, column %d in CPLEX to %g\n", row, col, newval);
1700#if (CPX_VERSION >= 12050000)
1750 SCIPdebugMessage(
"scaling row %d with factor %g in CPLEX\n", row, scaleval);
1760 for(
i = 0;
i < nnonz; ++
i )
1766 if( lhs > -CPX_INFBOUND )
1768 else if( scaleval < 0.0 )
1770 if( rhs < CPX_INFBOUND )
1772 else if( scaleval < 0.0 )
1773 rhs = -CPX_INFBOUND;
1774 if( scaleval > 0.0 )
1807 SCIPdebugMessage(
"scaling column %d with factor %g in CPLEX\n", col, scaleval);
1820 for(
i = 0;
i < nnonz; ++
i )
1830 if( lb > -CPX_INFBOUND )
1832 else if( scaleval < 0.0 )
1834 if( ub < CPX_INFBOUND )
1836 else if( scaleval < 0.0 )
1838 if( scaleval > 0.0 )
1932 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->
cpxenv, lpi->
cpxlp));
1950 CPXgetnumnz(lpi->
cpxenv, lpi->
cpxlp), &surplus, firstcol, lastcol) );
1973#if CPX_VERSION < 12070000
1980 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp));
1992#if CPX_VERSION < 12070000
1994 if( retcode != CPXERR_NO_RNGVAL )
2014 CPXgetnumnz(lpi->
cpxenv, lpi->
cpxlp), &surplus, firstrow, lastrow) );
2028 int namestoragesize,
2037 assert(colnames !=
NULL || namestoragesize == 0);
2038 assert(namestorage !=
NULL || namestoragesize == 0);
2039 assert(namestoragesize >= 0);
2041 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->
cpxenv, lpi->
cpxlp));
2045 retcode = CPXgetcolname(lpi->
cpxenv, lpi->
cpxlp, colnames, namestorage, namestoragesize, storageleft, firstcol, lastcol);
2046 assert( namestoragesize != 0 || retcode == CPXERR_NEGATIVE_SURPLUS );
2047 if( namestoragesize != 0 )
2062 int namestoragesize,
2071 assert(rownames !=
NULL || namestoragesize == 0);
2072 assert(namestorage !=
NULL || namestoragesize == 0);
2073 assert(namestoragesize >= 0);
2075 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp));
2079 retcode = CPXgetrowname(lpi->
cpxenv, lpi->
cpxlp, rownames, namestorage, namestoragesize, storageleft, firstrow, lastrow);
2080 assert( namestoragesize != 0 || retcode == CPXERR_NEGATIVE_SURPLUS );
2081 if( namestoragesize != 0 )
2119 assert(firstcol <= lastcol);
2122 SCIPdebugMessage(
"getting objective values %d to %d\n", firstcol, lastcol);
2141 assert(firstcol <= lastcol);
2167#if CPX_VERSION < 12070000
2174 assert(firstrow <= lastrow);
2182#if CPX_VERSION < 12070000
2184 if( retval != CPXERR_NO_RNGVAL )
2241#if CPX_VERSION == 12070100
2254#if (CPX_VERSION == 12070000)
2268#if CPX_VERSION == 12070100
2280#if CPX_VERSION == 12070100
2292 case CPXERR_NO_MEMORY:
2299 lpi->
method = CPX_ALG_PRIMAL;
2304 if( lpi->
solstat != CPX_STAT_INForUNBD && solntype != CPX_NO_SOLN )
2309 SCIPdebugMessage(
" -> CPLEX returned solstat=%d, pfeas=%d, dfeas=%d (%d iterations)\n",
2312#if CPX_VERSION == 12070100
2318 if( lpi->
solstat == CPX_STAT_INForUNBD && CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp) == 0 )
2320 lpi->
solstat = CPX_STAT_UNBOUNDED;
2326 if( lpi->
solstat == CPX_STAT_INForUNBD
2327 || (lpi->
solstat == CPX_STAT_INFEASIBLE && !dualfeasible)
2328 || (lpi->
solstat == CPX_STAT_UNBOUNDED && !primalfeasible) )
2330 if(
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON )
2333 SCIPdebugMessage(
"presolver may have solved the problem -> calling CPLEX primal simplex again without presolve\n");
2344 case CPXERR_NO_MEMORY:
2363 if( lpi->
solstat == CPX_STAT_INForUNBD )
2366 SCIPerrorMessage(
"CPLEX primal simplex returned CPX_STAT_INForUNBD after presolving was turned off.\n");
2372 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2402#if (CPX_VERSION == 12070000)
2417 case CPXERR_NO_MEMORY:
2424 lpi->
method = CPX_ALG_DUAL;
2429 if( lpi->
solstat != CPX_STAT_INForUNBD && solntype != CPX_NO_SOLN )
2434 SCIPdebugMessage(
" -> CPLEX returned solstat=%d, pfeas=%d, dfeas=%d (%d iterations)\n",
2437 if( lpi->
solstat == CPX_STAT_INForUNBD
2438 || (lpi->
solstat == CPX_STAT_INFEASIBLE && !dualfeasible)
2439 || (lpi->
solstat == CPX_STAT_UNBOUNDED && !primalfeasible) )
2441 if(
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON )
2444 SCIPdebugMessage(
"presolver may have solved the problem -> calling CPLEX dual simplex again without presolve\n");
2455 case CPXERR_NO_MEMORY:
2474 if( lpi->
solstat == CPX_STAT_INForUNBD )
2477 SCIPerrorMessage(
"CPLEX dual simplex returned CPX_STAT_INForUNBD after presolving was turned off\n");
2484 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2487#ifdef SCIP_DISABLED_CODE
2512 SCIPdebugMessage(
"dual solution %g does not exceed objective limit [%g,%g] (%d iterations) -> calling CPLEX dual simplex again for one iteration\n",
2518 setDblParam(lpi, CPX_PARAM_OBJLLIM, -CPX_INFBOUND);
2519 setDblParam(lpi, CPX_PARAM_OBJULIM, CPX_INFBOUND);
2528 case CPXERR_NO_MEMORY:
2550 case CPXERR_NO_MEMORY:
2591 retval = CPXhybbaropt(lpi->
cpxenv, lpi->
cpxlp, crossover ? 0 : CPX_ALG_NONE);
2596 case CPXERR_NO_MEMORY:
2604 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2606 lpi->
method = CPX_ALG_BARRIER;
2609 if( lpi->
solstat != CPX_STAT_INForUNBD && solntype != CPX_NO_SOLN )
2616 if( lpi->
solstat == CPX_STAT_INForUNBD )
2619 SCIPdebugMessage(
"CPLEX returned INForUNBD -> calling CPLEX barrier again without presolve\n");
2625 retval = CPXhybbaropt(lpi->
cpxenv, lpi->
cpxlp, crossover ? 0 : CPX_ALG_NONE);
2630 case CPXERR_NO_MEMORY:
2638 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2647 if( lpi->
solstat == CPX_STAT_INForUNBD )
2673 const char lbound =
'L';
2674 const char ubound =
'U';
2706 if( newub >= oldlb - 0.5 )
2733 if( newlb <= oldub + 0.5 )
2815 SCIPdebugMessage(
"calling CPLEX strongbranching on fractional variable %d (%d iterations)\n", col, itlim);
2828 retval = CPXstrongbranch(lpi->
cpxenv, lpi->
cpxlp, &col, 1, down, up, itlim);
2829 if( retval == CPXERR_NEED_OPT_SOLN )
2834 else if( retval == CPXERR_TILIM_STRONGBRANCH )
2839 else if( retval == CPXERR_SINGULAR )
2883 SCIPdebugMessage(
"calling CPLEX strongbranching on %d fractional variables (%d iterations)\n", ncols, itlim);
2891 for( j = 0; j < ncols; ++j )
2894 downvalid[j] =
TRUE;
2900 retval = CPXstrongbranch(lpi->
cpxenv, lpi->
cpxlp, cols, ncols, down, up, itlim);
2901 if( retval == CPXERR_NEED_OPT_SOLN )
2906 else if( retval == CPXERR_TILIM_STRONGBRANCH )
2942 SCIPdebugMessage(
"calling CPLEX strongbranching on variable %d with integral value (%d iterations)\n", col, itlim);
2981 SCIPdebugMessage(
"calling CPLEX strongbranching on %d variables with integer values (%d iterations)\n", ncols, itlim);
2987 for( j = 0; j < ncols; ++j )
3064 return (lpi->
solstat == CPX_STAT_UNBOUNDED || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED);
3079 return (lpi->
solstat == CPX_STAT_UNBOUNDED );
3102 return ((primalfeasible && (lpi->
solstat == CPX_STAT_UNBOUNDED || lpi->
solstat == CPX_STAT_INForUNBD))
3103 || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED || (primalfeasible && lpi->
solstat == CPX_STAT_ABORT_PRIM_OBJ_LIM && lpi->
method == CPX_ALG_BARRIER));
3122 return (lpi->
solstat == CPX_STAT_INFEASIBLE || (lpi->
solstat == CPX_STAT_INForUNBD && dualfeasible)
3123 || (lpi->
solstat == CPX_STAT_ABORT_DUAL_OBJ_LIM && lpi->
method == CPX_ALG_BARRIER));
3155 return (lpi->
solstat == CPX_STAT_INFEASIBLE);
3170 return (lpi->
solstat == CPX_STAT_INFEASIBLE && lpi->
method == CPX_ALG_DUAL);
3189 return (dualfeasible && ((lpi->
solstat == CPX_STAT_INFEASIBLE || lpi->
solstat == CPX_STAT_INForUNBD)
3190 || (lpi->
solstat == CPX_STAT_ABORT_DUAL_OBJ_LIM && lpi->
method == CPX_ALG_BARRIER)));
3209 return (lpi->
solstat == CPX_STAT_UNBOUNDED
3210 || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED
3211 || (lpi->
solstat == CPX_STAT_INForUNBD && primalfeasible)
3212 || (lpi->
solstat == CPX_STAT_ABORT_PRIM_OBJ_LIM && lpi->
method == CPX_ALG_BARRIER));
3242 return (lpi->
solstat == CPX_STAT_OPTIMAL);
3263#ifdef SCIP_DISABLED_CODE
3272 if( lpi->
solstat == CPX_STAT_UNBOUNDED )
3278 if( !primalfeasible )
3303 return (lpi->
solstat != CPX_STAT_NUM_BEST && lpi->
solstat != CPX_STAT_OPTIMAL_INFEAS);
3314 if( lpi->
solstat == CPX_STAT_ABORT_OBJ_LIM )
3316 else if( lpi->
solstat == CPX_STAT_ABORT_DUAL_OBJ_LIM || lpi->
solstat == CPX_STAT_ABORT_PRIM_OBJ_LIM )
3318 if( lpi->
method != CPX_ALG_BARRIER )
3332 return (lpi->
solstat == CPX_STAT_ABORT_IT_LIM);
3343 return (lpi->
solstat == CPX_STAT_ABORT_TIME_LIM);
3367 || lpi->
solstat == CPX_STAT_NUM_BEST
3368 || lpi->
solstat == CPX_STAT_OPTIMAL_INFEAS);
3371 if( lpi->
solstat == CPX_STAT_NUM_BEST || lpi->
solstat == CPX_STAT_OPTIMAL_INFEAS )
3372 lpi->
solstat = CPX_STAT_OPTIMAL;
3398 if( retcode == CPXERR_NO_SOLN )
3436 if( activity !=
NULL )
3518 SCIPdebugMessage(
"requesting solution quality from CPLEX: quality %d\n", qualityindicator);
3522 if( solntype == CPX_BASIC_SOLN )
3526 switch( qualityindicator )
3533 what = CPX_EXACT_KAPPA;
3541 (void) CPXgetdblquality(lpi->
cpxenv, lpi->
cpxlp, quality, what);
3574 SCIPdebugMessage(
"saving CPLEX basis into %p/%p\n", (
void *) cstat, (
void *) rstat);
3580 for (
i = 0;
i < nrows; ++
i)
3582 if ( rstat[
i] == CPX_AT_LOWER )
3621 SCIPdebugMessage(
"loading basis %p/%p into CPLEX\n", (
void *) cstat, (
void *) rstat);
3634 for (
i = 0;
i < nrows; ++
i)
3640 lpi->
rstat[
i] = CPX_AT_LOWER;
3671 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3707 if ( ninds !=
NULL )
3715 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3736 assert(basicrow < nrows);
3741 if( rowsense ==
'G' || rowsense ==
'R' )
3745 for(
i = 0;
i < nrows;
i++ )
3784 if ( ninds !=
NULL )
3792 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3808 for(
r = 0;
r < nrows;
r++ )
3816 assert(basicrow < nrows);
3819 if( basicrow >= 0 && basicrow < nrows && (lpi->
senarray[basicrow] ==
'G' || lpi->
senarray[basicrow] ==
'R') )
3854 if ( ninds !=
NULL )
3861 retval = CPXbinvarow(lpi->
cpxenv, lpi->
cpxlp,
r, coef);
3862 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3865 retval = CPXbinvarow(lpi->
cpxenv, lpi->
cpxlp,
r, coef);
3883 assert(basicrow < nrows);
3888 if( rowsense ==
'G' || rowsense ==
'R' )
3894 for( j = 0; j < ncols; j++ )
3929 if ( ninds !=
NULL )
3936 retval = CPXbinvacol(lpi->
cpxenv, lpi->
cpxlp,
c, coef);
3937 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3940 retval = CPXbinvacol(lpi->
cpxenv, lpi->
cpxlp,
c, coef);
3953 for(
r = 0;
r < nrows;
r++ )
3961 assert(basicrow < nrows);
3964 if( basicrow >= 0 && basicrow < nrows && (lpi->
senarray[basicrow] ==
'G' || lpi->
senarray[basicrow] ==
'R') )
4017 SCIPdebugMessage(
"storing CPLEX LPI state in %p (%d cols, %d rows)\n", (
void *) *lpistate, ncols, nrows);
4023 (*lpistate)->ncols = ncols;
4024 (*lpistate)->nrows = nrows;
4049 if( lpistate ==
NULL )
4057 SCIPdebugMessage(
"loading LPI state %p (%d cols, %d rows) into CPLEX LP with %d cols and %d rows\n",
4058 (
void *) lpistate, lpistate->
ncols, lpistate->
nrows, lpncols, lpnrows);
4060 if( lpistate->
ncols == 0 || lpistate->
nrows == 0 )
4071 for(
i = lpistate->
ncols;
i < lpncols; ++
i )
4087 for(
i = lpistate->
nrows;
i < lpnrows; ++
i )
4120 if( *lpistate !=
NULL )
4135 return (lpistate !=
NULL);
4222 (*lpinorms)->normlen = 0;
4224 SCIPdebugMessage(
"storing CPLEX LPI pricing norms in %p (%d rows)\n", (
void *) *lpinorms, nrows);
4227 retval = CPXgetdnorms(lpi->
cpxenv, lpi->
cpxlp, (*lpinorms)->norm, (*lpinorms)->head, &((*lpinorms)->normlen));
4230 if( retval == 1264 )
4240 assert((*lpinorms)->normlen == nrows);
4264 if( lpinorms ==
NULL )
4270 SCIPdebugMessage(
"loading LPI simplex norms %p (%d rows) into CPLEX LP with %d rows\n",
4271 (
void *) lpinorms, lpinorms->
normlen, lpnrows);
4333#if (CPX_VERSION < 12060100)
4339#if (CPX_VERSION <= 1100)
4346 *ival = (
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON);
4352 *ival = (
getIntParam(lpi, CPX_PARAM_SCRIND) == CPX_ON);
4356#if (CPX_VERSION <= 1230)
4362#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
4365 *ival = lpi->pseudonthreads;
4396#if (CPX_VERSION < 12060100)
4398 assert(0 <= ival && ival <= 1);
4403 assert(0 <= ival && ival <= 2);
4404#if (CPX_VERSION <= 1100)
4419 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_AUTO);
4420 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_AUTO);
4423 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_FULL);
4424 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_FULL);
4427 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_PARTIAL);
4428 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_AUTO);
4432 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_STEEP);
4433 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_STEEP);
4436 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_STEEPQSTART);
4437 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_STEEPQSTART);
4439#if (CPX_VERSION >= 900)
4441 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_DEVEX);
4442 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_DEVEX);
4459#if (CPX_VERSION <= 1230)
4465#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
4468 lpi->pseudonthreads = ival;
4510 if ( CPXgetobjsen(lpi->
cpxenv, lpi->
cpxlp) == CPX_MIN )
4550 else if( dval > 1e-04 )
4561 else if( dval > 1e-04 )
4576 if ( CPXgetobjsen(lpi->
cpxenv, lpi->
cpxlp) == CPX_MIN )
4593 else if( dval > .99999 )
4638 return CPX_INFBOUND;
4648 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
static int rowpacketNum(int nrows)
SCIP_DUALPACKET ROWPACKET
SCIP_DUALPACKET COLPACKET
static int colpacketNum(int ncols)
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)
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)
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
struct SCIP_CPXParam SCIP_CPXPARAM
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
struct SCIP_LPiState SCIP_LPISTATE
struct SCIP_LPiNorms SCIP_LPINORMS
@ SCIP_LPPAR_BARRIERCONVTOL
@ SCIP_LPPAR_CONDITIONLIMIT
enum SCIP_LPSolQuality SCIP_LPSOLQUALITY
enum SCIP_ObjSen SCIP_OBJSEN
struct SCIP_Messagehdlr SCIP_MESSAGEHDLR
enum SCIP_Retcode SCIP_RETCODE