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) );
1382 assert(firstcol <= lastcol + 1);
1384 SCIPdebugMessage(
"deleting %d columns from CPLEX\n", lastcol - firstcol + 1);
1387 if( firstcol > lastcol )
1443 SCIPdebugMessage(
"adding %d rows with %d nonzeros to CPLEX\n", nrows, nnonz);
1461 for (j = 0; j < nnonz; ++j) {
1463 assert( 0 <= ind[j] && ind[j] < ncols );
1466 CHECK_ZERO( lpi->
messagehdlr, CPXaddrows(lpi->
cpxenv, lpi->
cpxlp, 0, nrows, nnonz, lpi->
rhsarray, lpi->
senarray, beg, ind, val,
NULL,
1475#if (CPX_VERSION <= 1100)
1500 assert(firstrow <= lastrow + 1);
1505 if( firstrow > lastrow )
1586 for(
i = 0;
i < ncols; ++
i )
1592 SCIPerrorMessage(
"LP Error: fixing lower bound for variable %d to infinity.\n", ind[
i]);
1597 SCIPerrorMessage(
"LP Error: fixing upper bound for variable %d to -infinity.\n", ind[
i]);
1611 for(
i = 0;
i < ncols; ++
i )
1663 for(
i = 0;
i < rngcount; ++
i )
1689 SCIPdebugMessage(
"changing coefficient row %d, column %d in CPLEX to %g\n", row, col, newval);
1712#if (CPX_VERSION >= 12050000)
1762 SCIPdebugMessage(
"scaling row %d with factor %g in CPLEX\n", row, scaleval);
1772 for(
i = 0;
i < nnonz; ++
i )
1778 if( lhs > -CPX_INFBOUND )
1780 else if( scaleval < 0.0 )
1782 if( rhs < CPX_INFBOUND )
1784 else if( scaleval < 0.0 )
1785 rhs = -CPX_INFBOUND;
1786 if( scaleval > 0.0 )
1819 SCIPdebugMessage(
"scaling column %d with factor %g in CPLEX\n", col, scaleval);
1832 for(
i = 0;
i < nnonz; ++
i )
1842 if( lb > -CPX_INFBOUND )
1844 else if( scaleval < 0.0 )
1846 if( ub < CPX_INFBOUND )
1848 else if( scaleval < 0.0 )
1850 if( scaleval > 0.0 )
1948 assert(firstcol <= lastcol + 1);
1964 CPXgetnumnz(lpi->
cpxenv, lpi->
cpxlp), &surplus, firstcol, lastcol) );
1987#if CPX_VERSION < 12070000
1998 assert(firstrow <= lastrow + 1);
2008#if CPX_VERSION < 12070000
2010 if( retcode != CPXERR_NO_RNGVAL )
2030 CPXgetnumnz(lpi->
cpxenv, lpi->
cpxlp), &surplus, firstrow, lastrow) );
2044 int namestoragesize,
2053 assert(colnames !=
NULL || namestoragesize == 0);
2054 assert(namestorage !=
NULL || namestoragesize == 0);
2055 assert(namestoragesize >= 0);
2059 assert(firstcol <= lastcol + 1);
2063 retcode = CPXgetcolname(lpi->
cpxenv, lpi->
cpxlp, colnames, namestorage, namestoragesize, storageleft, firstcol, lastcol);
2064 assert( namestoragesize != 0 || retcode == CPXERR_NEGATIVE_SURPLUS );
2065 if( namestoragesize != 0 )
2080 int namestoragesize,
2089 assert(rownames !=
NULL || namestoragesize == 0);
2090 assert(namestorage !=
NULL || namestoragesize == 0);
2091 assert(namestoragesize >= 0);
2095 assert(firstrow <= lastrow + 1);
2099 retcode = CPXgetrowname(lpi->
cpxenv, lpi->
cpxlp, rownames, namestorage, namestoragesize, storageleft, firstrow, lastrow);
2100 assert( namestoragesize != 0 || retcode == CPXERR_NEGATIVE_SURPLUS );
2101 if( namestoragesize != 0 )
2142 assert(firstcol <= lastcol + 1);
2144 SCIPdebugMessage(
"getting objective values %d to %d\n", firstcol, lastcol);
2165 assert(firstcol <= lastcol + 1);
2191#if CPX_VERSION < 12070000
2200 assert(firstrow <= lastrow + 1);
2208#if CPX_VERSION < 12070000
2210 if( retval != CPXERR_NO_RNGVAL )
2267#if CPX_VERSION == 12070100
2280#if (CPX_VERSION == 12070000)
2294#if CPX_VERSION == 12070100
2306#if CPX_VERSION == 12070100
2318 case CPXERR_NO_MEMORY:
2325 lpi->
method = CPX_ALG_PRIMAL;
2330 if( lpi->
solstat != CPX_STAT_INForUNBD && solntype != CPX_NO_SOLN )
2335 SCIPdebugMessage(
" -> CPLEX returned solstat=%d, pfeas=%d, dfeas=%d (%d iterations)\n",
2338#if CPX_VERSION == 12070100
2344 if( lpi->
solstat == CPX_STAT_INForUNBD && CPXgetnumrows(lpi->
cpxenv, lpi->
cpxlp) == 0 )
2346 lpi->
solstat = CPX_STAT_UNBOUNDED;
2352 if( lpi->
solstat == CPX_STAT_INForUNBD
2353 || (lpi->
solstat == CPX_STAT_INFEASIBLE && !dualfeasible)
2354 || (lpi->
solstat == CPX_STAT_UNBOUNDED && !primalfeasible) )
2356 if(
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON )
2359 SCIPdebugMessage(
"presolver may have solved the problem -> calling CPLEX primal simplex again without presolve\n");
2370 case CPXERR_NO_MEMORY:
2389 if( lpi->
solstat == CPX_STAT_INForUNBD )
2392 SCIPerrorMessage(
"CPLEX primal simplex returned CPX_STAT_INForUNBD after presolving was turned off.\n");
2398 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2428#if (CPX_VERSION == 12070000)
2443 case CPXERR_NO_MEMORY:
2450 lpi->
method = CPX_ALG_DUAL;
2455 if( lpi->
solstat != CPX_STAT_INForUNBD && solntype != CPX_NO_SOLN )
2460 SCIPdebugMessage(
" -> CPLEX returned solstat=%d, pfeas=%d, dfeas=%d (%d iterations)\n",
2463 if( lpi->
solstat == CPX_STAT_INForUNBD
2464 || (lpi->
solstat == CPX_STAT_INFEASIBLE && !dualfeasible)
2465 || (lpi->
solstat == CPX_STAT_UNBOUNDED && !primalfeasible) )
2467 if(
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON )
2470 SCIPdebugMessage(
"presolver may have solved the problem -> calling CPLEX dual simplex again without presolve\n");
2481 case CPXERR_NO_MEMORY:
2500 if( lpi->
solstat == CPX_STAT_INForUNBD )
2503 SCIPerrorMessage(
"CPLEX dual simplex returned CPX_STAT_INForUNBD after presolving was turned off\n");
2510 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2513#ifdef SCIP_DISABLED_CODE
2538 SCIPdebugMessage(
"dual solution %g does not exceed objective limit [%g,%g] (%d iterations) -> calling CPLEX dual simplex again for one iteration\n",
2544 setDblParam(lpi, CPX_PARAM_OBJLLIM, -CPX_INFBOUND);
2545 setDblParam(lpi, CPX_PARAM_OBJULIM, CPX_INFBOUND);
2554 case CPXERR_NO_MEMORY:
2576 case CPXERR_NO_MEMORY:
2617 retval = CPXhybbaropt(lpi->
cpxenv, lpi->
cpxlp, crossover ? 0 : CPX_ALG_NONE);
2622 case CPXERR_NO_MEMORY:
2630 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2632 lpi->
method = CPX_ALG_BARRIER;
2635 if( lpi->
solstat != CPX_STAT_INForUNBD && solntype != CPX_NO_SOLN )
2642 if( lpi->
solstat == CPX_STAT_INForUNBD )
2645 SCIPdebugMessage(
"CPLEX returned INForUNBD -> calling CPLEX barrier again without presolve\n");
2651 retval = CPXhybbaropt(lpi->
cpxenv, lpi->
cpxlp, crossover ? 0 : CPX_ALG_NONE);
2656 case CPXERR_NO_MEMORY:
2664 lpi->
solisbasic = (solntype == CPX_BASIC_SOLN);
2673 if( lpi->
solstat == CPX_STAT_INForUNBD )
2699 const char lbound =
'L';
2700 const char ubound =
'U';
2732 if( newub >= oldlb - 0.5 )
2759 if( newlb <= oldub + 0.5 )
2841 SCIPdebugMessage(
"calling CPLEX strongbranching on fractional variable %d (%d iterations)\n", col, itlim);
2854 retval = CPXstrongbranch(lpi->
cpxenv, lpi->
cpxlp, &col, 1, down, up, itlim);
2855 if( retval == CPXERR_NEED_OPT_SOLN )
2860 else if( retval == CPXERR_TILIM_STRONGBRANCH )
2865 else if( retval == CPXERR_SINGULAR )
2909 SCIPdebugMessage(
"calling CPLEX strongbranching on %d fractional variables (%d iterations)\n", ncols, itlim);
2917 for( j = 0; j < ncols; ++j )
2920 downvalid[j] =
TRUE;
2926 retval = CPXstrongbranch(lpi->
cpxenv, lpi->
cpxlp, cols, ncols, down, up, itlim);
2927 if( retval == CPXERR_NEED_OPT_SOLN )
2932 else if( retval == CPXERR_TILIM_STRONGBRANCH )
2968 SCIPdebugMessage(
"calling CPLEX strongbranching on variable %d with integral value (%d iterations)\n", col, itlim);
3007 SCIPdebugMessage(
"calling CPLEX strongbranching on %d variables with integer values (%d iterations)\n", ncols, itlim);
3013 for( j = 0; j < ncols; ++j )
3090 return (lpi->
solstat == CPX_STAT_UNBOUNDED || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED);
3105 return (lpi->
solstat == CPX_STAT_UNBOUNDED );
3128 return ((primalfeasible && (lpi->
solstat == CPX_STAT_UNBOUNDED || lpi->
solstat == CPX_STAT_INForUNBD))
3129 || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED || (primalfeasible && lpi->
solstat == CPX_STAT_ABORT_PRIM_OBJ_LIM && lpi->
method == CPX_ALG_BARRIER));
3148 return (lpi->
solstat == CPX_STAT_INFEASIBLE || (lpi->
solstat == CPX_STAT_INForUNBD && dualfeasible)
3149 || (lpi->
solstat == CPX_STAT_ABORT_DUAL_OBJ_LIM && lpi->
method == CPX_ALG_BARRIER));
3181 return (lpi->
solstat == CPX_STAT_INFEASIBLE);
3196 return (lpi->
solstat == CPX_STAT_INFEASIBLE && lpi->
method == CPX_ALG_DUAL);
3215 return (dualfeasible && ((lpi->
solstat == CPX_STAT_INFEASIBLE || lpi->
solstat == CPX_STAT_INForUNBD)
3216 || (lpi->
solstat == CPX_STAT_ABORT_DUAL_OBJ_LIM && lpi->
method == CPX_ALG_BARRIER)));
3235 return (lpi->
solstat == CPX_STAT_UNBOUNDED
3236 || lpi->
solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED
3237 || (lpi->
solstat == CPX_STAT_INForUNBD && primalfeasible)
3238 || (lpi->
solstat == CPX_STAT_ABORT_PRIM_OBJ_LIM && lpi->
method == CPX_ALG_BARRIER));
3268 return (lpi->
solstat == CPX_STAT_OPTIMAL);
3289#ifdef SCIP_DISABLED_CODE
3298 if( lpi->
solstat == CPX_STAT_UNBOUNDED )
3304 if( !primalfeasible )
3329 return (lpi->
solstat != CPX_STAT_NUM_BEST && lpi->
solstat != CPX_STAT_OPTIMAL_INFEAS);
3340 if( lpi->
solstat == CPX_STAT_ABORT_OBJ_LIM )
3342 else if( lpi->
solstat == CPX_STAT_ABORT_DUAL_OBJ_LIM || lpi->
solstat == CPX_STAT_ABORT_PRIM_OBJ_LIM )
3344 if( lpi->
method != CPX_ALG_BARRIER )
3358 return (lpi->
solstat == CPX_STAT_ABORT_IT_LIM);
3369 return (lpi->
solstat == CPX_STAT_ABORT_TIME_LIM);
3393 || lpi->
solstat == CPX_STAT_NUM_BEST
3394 || lpi->
solstat == CPX_STAT_OPTIMAL_INFEAS);
3397 if( lpi->
solstat == CPX_STAT_NUM_BEST || lpi->
solstat == CPX_STAT_OPTIMAL_INFEAS )
3398 lpi->
solstat = CPX_STAT_OPTIMAL;
3424 if( retcode == CPXERR_NO_SOLN )
3462 if( activity !=
NULL )
3544 SCIPdebugMessage(
"requesting solution quality from CPLEX: quality %d\n", qualityindicator);
3548 if( solntype == CPX_BASIC_SOLN )
3552 switch( qualityindicator )
3559 what = CPX_EXACT_KAPPA;
3567 (void) CPXgetdblquality(lpi->
cpxenv, lpi->
cpxlp, quality, what);
3600 SCIPdebugMessage(
"saving CPLEX basis into %p/%p\n", (
void *) cstat, (
void *) rstat);
3606 for (
i = 0;
i < nrows; ++
i)
3608 if ( rstat[
i] == CPX_AT_LOWER )
3647 SCIPdebugMessage(
"loading basis %p/%p into CPLEX\n", (
void *) cstat, (
void *) rstat);
3660 for (
i = 0;
i < nrows; ++
i)
3666 lpi->
rstat[
i] = CPX_AT_LOWER;
3697 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3733 if ( ninds !=
NULL )
3741 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3762 assert(basicrow < nrows);
3767 if( rowsense ==
'G' || rowsense ==
'R' )
3771 for(
i = 0;
i < nrows;
i++ )
3810 if ( ninds !=
NULL )
3818 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3834 for(
r = 0;
r < nrows;
r++ )
3842 assert(basicrow < nrows);
3845 if( basicrow >= 0 && basicrow < nrows && (lpi->
senarray[basicrow] ==
'G' || lpi->
senarray[basicrow] ==
'R') )
3880 if ( ninds !=
NULL )
3887 retval = CPXbinvarow(lpi->
cpxenv, lpi->
cpxlp,
r, coef);
3888 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3891 retval = CPXbinvarow(lpi->
cpxenv, lpi->
cpxlp,
r, coef);
3909 assert(basicrow < nrows);
3914 if( rowsense ==
'G' || rowsense ==
'R' )
3920 for( j = 0; j < ncols; j++ )
3955 if ( ninds !=
NULL )
3962 retval = CPXbinvacol(lpi->
cpxenv, lpi->
cpxlp,
c, coef);
3963 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3966 retval = CPXbinvacol(lpi->
cpxenv, lpi->
cpxlp,
c, coef);
3979 for(
r = 0;
r < nrows;
r++ )
3987 assert(basicrow < nrows);
3990 if( basicrow >= 0 && basicrow < nrows && (lpi->
senarray[basicrow] ==
'G' || lpi->
senarray[basicrow] ==
'R') )
4043 SCIPdebugMessage(
"storing CPLEX LPI state in %p (%d cols, %d rows)\n", (
void *) *lpistate, ncols, nrows);
4049 (*lpistate)->ncols = ncols;
4050 (*lpistate)->nrows = nrows;
4075 if( lpistate ==
NULL )
4083 SCIPdebugMessage(
"loading LPI state %p (%d cols, %d rows) into CPLEX LP with %d cols and %d rows\n",
4084 (
void *) lpistate, lpistate->
ncols, lpistate->
nrows, lpncols, lpnrows);
4086 if( lpistate->
ncols == 0 || lpistate->
nrows == 0 )
4097 for(
i = lpistate->
ncols;
i < lpncols; ++
i )
4113 for(
i = lpistate->
nrows;
i < lpnrows; ++
i )
4146 if( *lpistate !=
NULL )
4161 return (lpistate !=
NULL);
4248 (*lpinorms)->normlen = 0;
4250 SCIPdebugMessage(
"storing CPLEX LPI pricing norms in %p (%d rows)\n", (
void *) *lpinorms, nrows);
4253 retval = CPXgetdnorms(lpi->
cpxenv, lpi->
cpxlp, (*lpinorms)->norm, (*lpinorms)->head, &((*lpinorms)->normlen));
4256 if( retval == 1264 )
4266 assert((*lpinorms)->normlen == nrows);
4290 if( lpinorms ==
NULL )
4296 SCIPdebugMessage(
"loading LPI simplex norms %p (%d rows) into CPLEX LP with %d rows\n",
4297 (
void *) lpinorms, lpinorms->
normlen, lpnrows);
4359#if (CPX_VERSION < 12060100)
4365#if (CPX_VERSION <= 1100)
4372 *ival = (
getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON);
4378 *ival = (
getIntParam(lpi, CPX_PARAM_SCRIND) == CPX_ON);
4382#if (CPX_VERSION <= 1230)
4388#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
4391 *ival = lpi->pseudonthreads;
4422#if (CPX_VERSION < 12060100)
4424 assert(0 <= ival && ival <= 1);
4429 assert(0 <= ival && ival <= 2);
4430#if (CPX_VERSION <= 1100)
4445 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_AUTO);
4446 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_AUTO);
4449 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_FULL);
4450 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_FULL);
4453 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_PARTIAL);
4454 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_AUTO);
4458 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_STEEP);
4459 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_STEEP);
4462 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_STEEPQSTART);
4463 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_STEEPQSTART);
4465#if (CPX_VERSION >= 900)
4467 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_DEVEX);
4468 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_DEVEX);
4485#if (CPX_VERSION <= 1230)
4491#if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
4494 lpi->pseudonthreads = ival;
4536 if ( CPXgetobjsen(lpi->
cpxenv, lpi->
cpxlp) == CPX_MIN )
4576 else if( dval > 1e-01 )
4587 else if( dval > 1e-01 )
4602 if ( CPXgetobjsen(lpi->
cpxenv, lpi->
cpxlp) == CPX_MIN )
4619 else if( dval > .99999 )
4664 return CPX_INFBOUND;
4674 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