|
Go to the documentation of this file.
39 #ifndef CPX_SUBVERSION
40 #define CPX_SUBVERSION 0
42 #include "scip/bitencode.h"
48 #define CHECK_ZERO(messagehdlr, x) { int _restat_; \
49 if( (_restat_ = (x)) != 0 ) \
51 SCIPmessagePrintWarning((messagehdlr), "LP Error: CPLEX returned %d\n", _restat_); \
52 return SCIP_LPERROR; \
57 #define ABORT_ZERO(x) { int _restat_; \
58 if( (_restat_ = (x)) != 0 ) \
60 SCIPerrorMessage("LP Error: CPLEX returned %d\n", _restat_); \
66 #define CPX_INT_MAX 2100000000
71 #define CPX_REFACTORMAXITERS 50
75 #define CPX_MAGICZEROCONSTANT 1e-10
78 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE
80 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
83 #define NUMINTPARAM 10
162 #if (CPX_VERSION <= 1100)
166 #if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
205 if( num > lpi->boundchgsize )
210 newsize = MAX(2*lpi->boundchgsize, num);
211 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->larray, newsize) );
212 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->uarray, newsize) );
213 for( i = lpi->boundchgsize; i < newsize; ++i )
215 lpi->larray[i] = 'L';
216 lpi->uarray[i] = 'U';
218 lpi->boundchgsize = newsize;
220 assert(num <= lpi->boundchgsize);
234 if( num > lpi->sidechgsize )
238 newsize = MAX(2*lpi->sidechgsize, num);
239 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->senarray, newsize) );
240 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rhsarray, newsize) );
241 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rngarray, newsize) );
242 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rngindarray, newsize) );
243 lpi->sidechgsize = newsize;
245 assert(num <= lpi->sidechgsize);
259 if( num > lpi->valsize )
263 newsize = MAX(2*lpi->valsize, num);
264 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->valarray, newsize) );
265 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->indarray, newsize) );
266 lpi->valsize = newsize;
268 assert(num <= lpi->valsize);
282 if( num > lpi->cstatsize )
286 newsize = MAX(2*lpi->cstatsize, num);
287 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->cstat, newsize) );
288 lpi->cstatsize = newsize;
290 assert(num <= lpi->cstatsize);
304 if( num > lpi->rstatsize )
308 newsize = MAX(2*lpi->rstatsize, num);
309 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rstat, newsize) );
310 lpi->rstatsize = newsize;
312 assert(num <= lpi->rstatsize);
327 assert(lpi->cpxenv != NULL);
331 ncols = CPXgetnumcols(lpi->cpxenv, lpi->cpxlp);
332 nrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
339 CHECK_ZERO( lpi->messagehdlr, CPXgetbase(lpi->cpxenv, lpi->cpxlp, lpi->cstat, lpi->rstat) );
351 assert(lpi->cpxenv != NULL);
356 CHECK_ZERO( lpi->messagehdlr, CPXcopybase(lpi->cpxenv, lpi->cpxlp, lpi->cstat, lpi->rstat) );
400 assert(lpistate != NULL);
401 assert(lpistate->packcstat != NULL);
402 assert(lpistate->packrstat != NULL);
404 SCIPencodeDualBit(cstat, lpistate->packcstat, lpistate->ncols);
405 SCIPencodeDualBit(rstat, lpistate->packrstat, lpistate->nrows);
416 assert(lpistate != NULL);
417 assert(lpistate->packcstat != NULL);
418 assert(lpistate->packrstat != NULL);
420 SCIPdecodeDualBit(lpistate->packcstat, cstat, lpistate->ncols);
421 SCIPdecodeDualBit(lpistate->packrstat, rstat, lpistate->nrows);
433 assert(lpistate != NULL);
434 assert(blkmem != NULL);
438 SCIP_ALLOC( BMSallocBlockMemory(blkmem, lpistate) );
439 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->packcstat, colpacketNum(ncols)) );
440 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->packrstat, rowpacketNum(nrows)) );
452 assert(blkmem != NULL);
453 assert(lpistate != NULL);
454 assert(*lpistate != NULL);
456 BMSfreeBlockMemoryArray(blkmem, &(*lpistate)->packcstat, colpacketNum((*lpistate)->ncols));
457 BMSfreeBlockMemoryArray(blkmem, &(*lpistate)->packrstat, rowpacketNum((*lpistate)->nrows));
458 BMSfreeBlockMemory(blkmem, lpistate);
477 assert(cpxparam != NULL);
483 CHECK_ZERO( lpi->messagehdlr, CPXgetintparam(lpi->cpxenv, intparam[i], &(cpxparam-> intparval[i])) );
487 CHECK_ZERO( lpi->messagehdlr, CPXgetdblparam(lpi->cpxenv, dblparam[i], &(cpxparam-> dblparval[i])) );
504 assert(lpi->cpxenv != NULL);
506 SCIP_CALL( getParameterValues(lpi, &par) );
508 assert(lpi->curparam.intparval[i] == par. intparval[i]
511 assert( MAX(lpi->curparam.dblparval[i], dblparammin[i]) == par. dblparval[i]);
527 assert(lpi->cpxenv != NULL);
528 assert(cpxparam != NULL);
534 if( lpi->curparam.intparval[i] != cpxparam-> intparval[i] )
537 intparam[i], lpi->curparam.intparval[i], cpxparam-> intparval[i]);
538 lpi->curparam.intparval[i] = cpxparam-> intparval[i];
539 CHECK_ZERO( lpi->messagehdlr, CPXsetintparam(lpi->cpxenv, intparam[i], lpi->curparam.intparval[i]) );
544 if( lpi->curparam.dblparval[i] != cpxparam-> dblparval[i] )
547 dblparam[i], lpi->curparam.dblparval[i], MAX(cpxparam-> dblparval[i], dblparammin[i]));
548 lpi->curparam.dblparval[i] = MAX(cpxparam-> dblparval[i], dblparammin[i]);
549 CHECK_ZERO( lpi->messagehdlr, CPXsetdblparam(lpi->cpxenv, dblparam[i], lpi->curparam.dblparval[i]) );
560 void copyParameterValues(
569 for( i = 0; i < NUMDBLPARAM; ++i )
586 if( intparam[i] == param )
587 return lpi->cpxparam.intparval[i];
609 if( dblparam[i] == param )
611 val = lpi->cpxparam.dblparval[i];
612 if( val >= CPX_INFBOUND )
614 else if( val <= -CPX_INFBOUND )
615 return -CPX_INFBOUND;
640 if( intparam[i] == param )
642 lpi->cpxparam.intparval[i] = parval;
663 if( parval >= CPX_INFBOUND )
665 else if( parval <= -CPX_INFBOUND )
670 if( dblparam[i] == param )
672 lpi->cpxparam.dblparval[i] = parval;
683 void invalidateSolution(
689 lpi->instabilityignored = FALSE;
728 assert(rngcount != NULL);
732 for( i = 0; i < nrows; ++i )
734 assert(lhs[i] <= rhs[i]);
735 if( lhs[i] == rhs[i] )
737 assert(-CPX_INFBOUND < rhs[i] && rhs[i] < CPX_INFBOUND);
738 lpi->senarray[i] = 'E';
739 lpi->rhsarray[i] = rhs[i];
741 else if( lhs[i] <= -CPX_INFBOUND )
743 assert(-CPX_INFBOUND < rhs[i] && rhs[i] < CPX_INFBOUND);
744 lpi->senarray[i] = 'L';
745 lpi->rhsarray[i] = rhs[i];
747 else if( rhs[i] >= CPX_INFBOUND )
749 assert(-CPX_INFBOUND < lhs[i] && lhs[i] < CPX_INFBOUND);
750 lpi->senarray[i] = 'G';
751 lpi->rhsarray[i] = lhs[i];
768 lpi->senarray[i] = 'R';
769 lpi->rhsarray[i] = lhs[i];
770 lpi->rngarray[*rngcount] = rhs[i] - lhs[i];
771 lpi->rngindarray[*rngcount] = i + indoffset;
779 void reconvertBothSides(
793 for( i = 0; i < nrows; ++i )
795 switch( lpi->senarray[i] )
798 lhs[i] = lpi->rhsarray[i];
799 rhs[i] = lpi->rhsarray[i];
803 lhs[i] = -CPX_INFBOUND;
804 rhs[i] = lpi->rhsarray[i];
808 lhs[i] = lpi->rhsarray[i];
809 rhs[i] = CPX_INFBOUND;
813 assert(lpi->rngarray[i] != 0.0);
814 if( lpi->rngarray[i] > 0.0 )
816 lhs[i] = lpi->rhsarray[i];
817 rhs[i] = lpi->rhsarray[i] + lpi->rngarray[i];
821 lhs[i] = lpi->rhsarray[i] + lpi->rngarray[i];
822 rhs[i] = lpi->rhsarray[i];
830 assert(lhs[i] <= rhs[i]);
848 for( i = 0; i < nrows; ++i )
850 switch( lpi->senarray[i] )
853 assert(lpi->rngarray[i] == 0.0);
854 lhs[i] = lpi->rhsarray[i];
858 assert(lpi->rngarray[i] == 0.0);
859 lhs[i] = -CPX_INFBOUND;
863 assert(lpi->rngarray[i] == 0.0);
864 lhs[i] = lpi->rhsarray[i];
868 assert(lpi->rngarray[i] != 0.0);
869 if( lpi->rngarray[i] > 0.0 )
870 lhs[i] = lpi->rhsarray[i];
872 lhs[i] = lpi->rhsarray[i] + lpi->rngarray[i];
896 for( i = 0; i < nrows; ++i )
898 switch( lpi->senarray[i] )
901 assert(lpi->rngarray[i] == 0.0);
902 rhs[i] = lpi->rhsarray[i];
906 assert(lpi->rngarray[i] == 0.0);
907 rhs[i] = lpi->rhsarray[i];
911 assert(lpi->rngarray[i] == 0.0);
912 rhs[i] = CPX_INFBOUND;
916 assert(lpi->rngarray[i] != 0.0);
917 if( lpi->rngarray[i] > 0.0 )
918 rhs[i] = lpi->rhsarray[i] + lpi->rngarray[i];
920 rhs[i] = lpi->rhsarray[i];
940 reconvertBothSides(lpi, nrows, lhs, rhs);
941 else if( lhs != NULL )
942 reconvertLhs(lpi, nrows, lhs);
943 else if( rhs != NULL )
944 reconvertRhs(lpi, nrows, rhs);
966 CHECK_ZERO( lpi->messagehdlr, CPXdualopt(lpi->cpxenv, lpi->cpxlp) );
969 SCIPmessagePrintWarning(lpi->messagehdlr, "CPLEX needed %d phase 1 iterations to restore optimal basis.\n", CPXgetphase1cnt(lpi->cpxenv, lpi->cpxlp));
971 SCIPmessagePrintWarning(lpi->messagehdlr, "CPLEX needed %d iterations to restore optimal basis.\n", CPXgetitcnt(lpi->cpxenv, lpi->cpxlp));
987 static char cpxname[100];
997 #ifdef CPX_VERSION_VERSION
998 sprintf(cpxname, "CPLEX %d.%d.%d.%d", CPX_VERSION_VERSION, CPX_VERSION_RELEASE, CPX_VERSION_MODIFICATION, CPX_VERSION_FIX);
1000 sprintf(cpxname, "CPLEX %d.%d.%d.%d", CPX_VERSION/100, (CPX_VERSION%100)/10, CPX_VERSION%10, CPX_SUBVERSION);
1010 return "Linear Programming Solver developed by IBM (www.cplex.com)";
1021 return ( void*) lpi->cpxlp;
1045 assert( sizeof( SCIP_Real) == sizeof( double));
1046 assert( sizeof( SCIP_Bool) == sizeof( int));
1047 assert(lpi != NULL);
1054 (*lpi)->cpxenv = CPXopenCPLEX(&restat);
1057 #if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
1059 CHECK_ZERO( messagehdlr, CPXsetintparam((*lpi)->cpxenv, CPX_PARAM_THREADS, 1) );
1064 CHECK_ZERO( messagehdlr, CPXsetintparam((*lpi)->cpxenv, CPX_PARAM_PREIND, CPX_OFF) );
1068 SCIP_CALL( getParameterValues((*lpi), &((*lpi)->defparam)) );
1069 copyParameterValues(&((*lpi)->curparam), &((*lpi)->defparam));
1072 (*lpi)->larray = NULL;
1073 (*lpi)->uarray = NULL;
1074 (*lpi)->senarray = NULL;
1075 (*lpi)->rhsarray = NULL;
1076 (*lpi)->rngarray = NULL;
1077 (*lpi)->valarray = NULL;
1078 (*lpi)->rngindarray = NULL;
1079 (*lpi)->cstat = NULL;
1080 (*lpi)->rstat = NULL;
1081 (*lpi)->indarray = NULL;
1082 (*lpi)->boundchgsize = 0;
1083 (*lpi)->sidechgsize = 0;
1084 (*lpi)->valsize = 0;
1085 (*lpi)->cstatsize = 0;
1086 (*lpi)->rstatsize = 0;
1087 (*lpi)->iterations = 0;
1089 (*lpi)->solisbasic = FALSE;
1090 (*lpi)->cpxlp = CPXcreateprob((*lpi)->cpxenv, &restat, name);
1091 (*lpi)->instabilityignored = FALSE;
1092 (*lpi)->fromscratch = FALSE;
1093 (*lpi)->clearstate = FALSE;
1094 (*lpi)->feastol = 1e-06;
1095 (*lpi)->conditionlimit = -1.0;
1096 (*lpi)->checkcondition = FALSE;
1097 #if (CPX_VERSION <= 1100)
1098 (*lpi)->rngfound = FALSE;
1100 (*lpi)->messagehdlr = messagehdlr;
1103 invalidateSolution(*lpi);
1104 copyParameterValues(&((*lpi)->cpxparam), &((*lpi)->defparam));
1120 assert(lpi != NULL);
1121 assert(*lpi != NULL);
1122 assert((*lpi)->cpxenv != NULL);
1127 CHECK_ZERO( (*lpi)->messagehdlr, CPXfreeprob((*lpi)->cpxenv, &((*lpi)->cpxlp)) );
1130 BMSfreeMemoryArrayNull(&(*lpi)->larray);
1131 BMSfreeMemoryArrayNull(&(*lpi)->uarray);
1132 BMSfreeMemoryArrayNull(&(*lpi)->senarray);
1133 BMSfreeMemoryArrayNull(&(*lpi)->rhsarray);
1134 BMSfreeMemoryArrayNull(&(*lpi)->rngarray);
1135 BMSfreeMemoryArrayNull(&(*lpi)->rngindarray);
1136 BMSfreeMemoryArrayNull(&(*lpi)->cstat);
1137 BMSfreeMemoryArrayNull(&(*lpi)->rstat);
1140 CHECK_ZERO( (*lpi)->messagehdlr, CPXcloseCPLEX(&((*lpi)->cpxenv)) );
1182 assert(lpi != NULL);
1183 assert(lpi->cpxlp != NULL);
1184 assert(lpi->cpxenv != NULL);
1186 SCIPdebugMessage( "loading LP in column format into CPLEX: %d cols, %d rows\n", ncols, nrows);
1188 invalidateSolution(lpi);
1190 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
1193 convertSides(lpi, nrows, lhs, rhs, 0, &rngcount);
1196 SCIP_ALLOC( BMSallocMemoryArray(&cnt, ncols) );
1197 for( c = 0; c < ncols-1; ++c )
1199 cnt[c] = beg[c+1] - beg[c];
1200 assert(cnt[c] >= 0);
1202 cnt[ncols-1] = nnonz - beg[ncols-1];
1203 assert(cnt[ncols-1] >= 0);
1206 CHECK_ZERO( lpi->messagehdlr, CPXcopylpwnames(lpi->cpxenv, lpi->cpxlp, ncols, nrows, cpxObjsen(objsen), obj,
1207 lpi->rhsarray, lpi->senarray, beg, cnt, ind, val, lb, ub, lpi->rngarray, colnames, rownames) );
1210 BMSfreeMemoryArray(&cnt);
1212 assert(CPXgetnumcols(lpi->cpxenv, lpi->cpxlp) == ncols);
1213 assert(CPXgetnumrows(lpi->cpxenv, lpi->cpxlp) == nrows);
1214 assert(CPXgetnumnz(lpi->cpxenv, lpi->cpxlp) == nnonz);
1233 assert(lpi != NULL);
1234 assert(lpi->cpxlp != NULL);
1235 assert(lpi->cpxenv != NULL);
1237 SCIPdebugMessage( "adding %d columns with %d nonzeros to CPLEX\n", ncols, nnonz);
1239 invalidateSolution(lpi);
1243 CHECK_ZERO( lpi->messagehdlr, CPXaddcols(lpi->cpxenv, lpi->cpxlp, ncols, nnonz, obj, beg, ind, val, lb, ub, colnames) );
1247 CHECK_ZERO( lpi->messagehdlr, CPXnewcols(lpi->cpxenv, lpi->cpxlp, ncols, obj, lb, ub, NULL, colnames) );
1260 assert(lpi != NULL);
1261 assert(lpi->cpxlp != NULL);
1262 assert(lpi->cpxenv != NULL);
1263 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->cpxenv, lpi->cpxlp));
1265 SCIPdebugMessage( "deleting %d columns from CPLEX\n", lastcol - firstcol + 1);
1267 invalidateSolution(lpi);
1269 CHECK_ZERO( lpi->messagehdlr, CPXdelcols(lpi->cpxenv, lpi->cpxlp, firstcol, lastcol) );
1282 assert(lpi != NULL);
1283 assert(lpi->cpxlp != NULL);
1284 assert(lpi->cpxenv != NULL);
1288 invalidateSolution(lpi);
1290 CHECK_ZERO( lpi->messagehdlr, CPXdelsetcols(lpi->cpxenv, lpi->cpxlp, dstat) );
1310 assert(lpi != NULL);
1311 assert(lpi->cpxlp != NULL);
1312 assert(lpi->cpxenv != NULL);
1314 SCIPdebugMessage( "adding %d rows with %d nonzeros to CPLEX\n", nrows, nnonz);
1316 invalidateSolution(lpi);
1318 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
1321 convertSides(lpi, nrows, lhs, rhs, CPXgetnumrows(lpi->cpxenv, lpi->cpxlp), &rngcount);
1326 CHECK_ZERO( lpi->messagehdlr, CPXaddrows(lpi->cpxenv, lpi->cpxlp, 0, nrows, nnonz, lpi->rhsarray, lpi->senarray, beg, ind, val, NULL,
1331 CHECK_ZERO( lpi->messagehdlr, CPXnewrows(lpi->cpxenv, lpi->cpxlp, nrows, lpi->rhsarray, lpi->senarray, NULL, rownames) );
1335 #if (CPX_VERSION <= 1100)
1336 if( lpi->rngfound == FALSE )
1339 lpi->rngfound = TRUE;
1342 CHECK_ZERO( lpi->messagehdlr, CPXchgrngval(lpi->cpxenv, lpi->cpxlp, rngcount, lpi->rngindarray, lpi->rngarray) );
1355 assert(lpi != NULL);
1356 assert(lpi->cpxlp != NULL);
1357 assert(lpi->cpxenv != NULL);
1358 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->cpxenv, lpi->cpxlp));
1362 invalidateSolution(lpi);
1364 CHECK_ZERO( lpi->messagehdlr, CPXdelrows(lpi->cpxenv, lpi->cpxlp, firstrow, lastrow) );
1377 assert(lpi != NULL);
1378 assert(lpi->cpxlp != NULL);
1379 assert(lpi->cpxenv != NULL);
1383 invalidateSolution(lpi);
1385 CHECK_ZERO( lpi->messagehdlr, CPXdelsetrows(lpi->cpxenv, lpi->cpxlp, dstat) );
1398 assert(lpi != NULL);
1399 assert(lpi->cpxlp != NULL);
1400 assert(lpi->cpxenv != NULL);
1404 invalidateSolution(lpi);
1406 ncols = CPXgetnumcols(lpi->cpxenv, lpi->cpxlp);
1407 nrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
1410 CHECK_ZERO( lpi->messagehdlr, CPXdelcols(lpi->cpxenv, lpi->cpxlp, 0, ncols-1) );
1414 CHECK_ZERO( lpi->messagehdlr, CPXdelrows(lpi->cpxenv, lpi->cpxlp, 0, nrows-1) );
1429 assert(lpi != NULL);
1430 assert(lpi->cpxlp != NULL);
1431 assert(lpi->cpxenv != NULL);
1437 for( i = 0; i < ncols; ++i )
1442 invalidateSolution(lpi);
1444 SCIP_CALL( ensureBoundchgMem(lpi, ncols) );
1446 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, ncols, ind, lpi->larray, ( SCIP_Real*)lb) );
1447 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, ncols, ind, lpi->uarray, ( SCIP_Real*)ub) );
1452 for( i = 0; i < ncols; ++i )
1457 CHECK_ZERO( lpi->messagehdlr, CPXgetlb(lpi->cpxenv, lpi->cpxlp, &cpxlb, ind[i], ind[i]) );
1458 CHECK_ZERO( lpi->messagehdlr, CPXgetub(lpi->cpxenv, lpi->cpxlp, &cpxub, ind[i], ind[i]) );
1482 assert(lpi != NULL);
1483 assert(lpi->cpxlp != NULL);
1484 assert(lpi->cpxenv != NULL);
1488 invalidateSolution(lpi);
1490 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
1493 convertSides(lpi, nrows, lhs, rhs, 0, &rngcount);
1496 CHECK_ZERO( lpi->messagehdlr, CPXchgsense(lpi->cpxenv, lpi->cpxlp, nrows, ind, lpi->senarray) );
1497 CHECK_ZERO( lpi->messagehdlr, CPXchgrhs(lpi->cpxenv, lpi->cpxlp, nrows, ind, lpi->rhsarray) );
1501 for( i = 0; i < rngcount; ++i )
1503 assert(0 <= lpi->rngindarray[i] && lpi->rngindarray[i] < nrows);
1504 assert(lpi->senarray[lpi->rngindarray[i]] == 'R');
1505 lpi->rngindarray[i] = ind[lpi->rngindarray[i]];
1509 CHECK_ZERO( lpi->messagehdlr, CPXchgrngval(lpi->cpxenv, lpi->cpxlp, rngcount, lpi->rngindarray, lpi->rngarray) );
1523 assert(lpi != NULL);
1524 assert(lpi->cpxlp != NULL);
1525 assert(lpi->cpxenv != NULL);
1527 SCIPdebugMessage( "changing coefficient row %d, column %d in CPLEX to %g\n", row, col, newval);
1529 invalidateSolution(lpi);
1531 CHECK_ZERO( lpi->messagehdlr, CPXchgcoef(lpi->cpxenv, lpi->cpxlp, row, col, newval) );
1542 assert(lpi != NULL);
1543 assert(lpi->cpxlp != NULL);
1544 assert(lpi->cpxenv != NULL);
1548 invalidateSolution(lpi);
1550 CPXchgobjsen(lpi->cpxenv, lpi->cpxlp, cpxObjsen(objsen));
1563 assert(lpi != NULL);
1564 assert(lpi->cpxlp != NULL);
1565 assert(lpi->cpxenv != NULL);
1569 CHECK_ZERO( lpi->messagehdlr, CPXchgobj(lpi->cpxenv, lpi->cpxlp, ncols, ind, obj) );
1587 assert(lpi != NULL);
1588 assert(lpi->cpxlp != NULL);
1589 assert(lpi->cpxenv != NULL);
1590 assert(scaleval != 0.0);
1592 SCIPdebugMessage( "scaling row %d with factor %g in CPLEX\n", row, scaleval);
1594 invalidateSolution(lpi);
1596 SCIP_CALL( ensureValMem(lpi, CPXgetnumcols(lpi->cpxenv, lpi->cpxlp)) );
1602 for( i = 0; i < nnonz; ++i )
1608 if( lhs > -CPX_INFBOUND )
1610 else if( scaleval < 0.0 )
1612 if( rhs < CPX_INFBOUND )
1614 else if( scaleval < 0.0 )
1615 rhs = -CPX_INFBOUND;
1616 if( scaleval > 0.0 )
1644 assert(lpi != NULL);
1645 assert(lpi->cpxlp != NULL);
1646 assert(lpi->cpxenv != NULL);
1647 assert(scaleval != 0.0);
1649 SCIPdebugMessage( "scaling column %d with factor %g in CPLEX\n", col, scaleval);
1651 invalidateSolution(lpi);
1653 SCIP_CALL( ensureValMem(lpi, CPXgetnumrows(lpi->cpxenv, lpi->cpxlp)) );
1662 for( i = 0; i < nnonz; ++i )
1672 if( lb > -CPX_INFBOUND )
1674 else if( scaleval < 0.0 )
1676 if( ub < CPX_INFBOUND )
1678 else if( scaleval < 0.0 )
1680 if( scaleval > 0.0 )
1710 assert(lpi != NULL);
1711 assert(lpi->cpxenv != NULL);
1712 assert(nrows != NULL);
1716 *nrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
1727 assert(lpi != NULL);
1728 assert(lpi->cpxenv != NULL);
1729 assert(ncols != NULL);
1733 *ncols = CPXgetnumcols(lpi->cpxenv, lpi->cpxlp);
1744 assert(lpi != NULL);
1745 assert(lpi->cpxenv != NULL);
1746 assert(nnonz != NULL);
1750 *nnonz = CPXgetnumnz(lpi->cpxenv, lpi->cpxlp);
1771 assert(lpi != NULL);
1772 assert(lpi->cpxlp != NULL);
1773 assert(lpi->cpxenv != NULL);
1774 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->cpxenv, lpi->cpxlp));
1782 CHECK_ZERO( lpi->messagehdlr, CPXgetlb(lpi->cpxenv, lpi->cpxlp, lb, firstcol, lastcol) );
1783 CHECK_ZERO( lpi->messagehdlr, CPXgetub(lpi->cpxenv, lpi->cpxlp, ub, firstcol, lastcol) );
1792 assert(beg != NULL);
1793 assert(ind != NULL);
1794 assert(val != NULL);
1797 CHECK_ZERO( lpi->messagehdlr, CPXgetcols(lpi->cpxenv, lpi->cpxlp, nnonz, beg, ind, val,
1798 CPXgetnumnz(lpi->cpxenv, lpi->cpxlp), &surplus, firstcol, lastcol) );
1799 assert(surplus >= 0);
1803 assert(beg == NULL);
1804 assert(ind == NULL);
1805 assert(val == NULL);
1829 assert(lpi != NULL);
1830 assert(lpi->cpxlp != NULL);
1831 assert(lpi->cpxenv != NULL);
1832 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->cpxenv, lpi->cpxlp));
1839 SCIP_CALL( ensureSidechgMem(lpi, lastrow - firstrow + 1) );
1840 CHECK_ZERO( lpi->messagehdlr, CPXgetsense(lpi->cpxenv, lpi->cpxlp, lpi->senarray, firstrow, lastrow) );
1841 CHECK_ZERO( lpi->messagehdlr, CPXgetrhs(lpi->cpxenv, lpi->cpxlp, lpi->rhsarray, firstrow, lastrow) );
1842 retcode = CPXgetrngval(lpi->cpxenv, lpi->cpxlp, lpi->rngarray, firstrow, lastrow);
1843 if( retcode != CPXERR_NO_RNGVAL )
1848 BMSclearMemoryArray(lpi->rngarray, lastrow-firstrow+1);
1851 reconvertSides(lpi, lastrow - firstrow + 1, lhs, rhs);
1858 assert(beg != NULL);
1859 assert(ind != NULL);
1860 assert(val != NULL);
1863 CHECK_ZERO( lpi->messagehdlr, CPXgetrows(lpi->cpxenv, lpi->cpxlp, nnonz, beg, ind, val,
1864 CPXgetnumnz(lpi->cpxenv, lpi->cpxlp), &surplus, firstrow, lastrow) );
1865 assert(surplus >= 0);
1869 assert(beg == NULL);
1870 assert(ind == NULL);
1871 assert(val == NULL);
1884 int namestoragesize,
1890 assert(lpi != NULL);
1891 assert(lpi->cpxlp != NULL);
1892 assert(lpi->cpxenv != NULL);
1893 assert(colnames != NULL || namestoragesize == 0);
1894 assert(namestorage != NULL || namestoragesize == 0);
1895 assert(namestoragesize >= 0);
1896 assert(storageleft != NULL);
1897 assert(0 <= firstcol && firstcol <= lastcol && lastcol < CPXgetnumcols(lpi->cpxenv, lpi->cpxlp));
1901 retcode = CPXgetcolname(lpi->cpxenv, lpi->cpxlp, colnames, namestorage, namestoragesize, storageleft, firstcol, lastcol);
1902 assert( namestoragesize != 0 || retcode == CPXERR_NEGATIVE_SURPLUS );
1903 if( namestoragesize != 0 )
1918 int namestoragesize,
1924 assert(lpi != NULL);
1925 assert(lpi->cpxlp != NULL);
1926 assert(lpi->cpxenv != NULL);
1927 assert(rownames != NULL || namestoragesize == 0);
1928 assert(namestorage != NULL || namestoragesize == 0);
1929 assert(namestoragesize >= 0);
1930 assert(storageleft != NULL);
1931 assert(0 <= firstrow && firstrow <= lastrow && lastrow < CPXgetnumrows(lpi->cpxenv, lpi->cpxlp));
1935 retcode = CPXgetrowname(lpi->cpxenv, lpi->cpxlp, rownames, namestorage, namestoragesize, storageleft, firstrow, lastrow);
1936 assert( namestoragesize != 0 || retcode == CPXERR_NEGATIVE_SURPLUS );
1937 if( namestoragesize != 0 )
1951 assert(lpi != NULL);
1952 assert(objsen != NULL);
1953 assert(CPXgetobjsen(lpi->cpxenv, lpi->cpxlp) == CPX_MIN || CPXgetobjsen(lpi->cpxenv, lpi->cpxlp) == CPX_MAX);
1970 assert(lpi != NULL);
1971 assert(lpi->cpxlp != NULL);
1972 assert(lpi->cpxenv != NULL);
1973 assert(firstcol <= lastcol);
1974 assert(vals != NULL);
1976 SCIPdebugMessage( "getting objective values %d to %d\n", firstcol, lastcol);
1978 CHECK_ZERO( lpi->messagehdlr, CPXgetobj(lpi->cpxenv, lpi->cpxlp, vals, firstcol, lastcol) );
1992 assert(lpi != NULL);
1993 assert(lpi->cpxlp != NULL);
1994 assert(lpi->cpxenv != NULL);
1995 assert(firstcol <= lastcol);
2001 CHECK_ZERO( lpi->messagehdlr, CPXgetlb(lpi->cpxenv, lpi->cpxlp, lbs, firstcol, lastcol) );
2006 CHECK_ZERO( lpi->messagehdlr, CPXgetub(lpi->cpxenv, lpi->cpxlp, ubs, firstcol, lastcol) );
2023 assert(lpi != NULL);
2024 assert(lpi->cpxlp != NULL);
2025 assert(lpi->cpxenv != NULL);
2026 assert(firstrow <= lastrow);
2031 SCIP_CALL( ensureSidechgMem(lpi, lastrow - firstrow + 1) );
2032 CHECK_ZERO( lpi->messagehdlr, CPXgetsense(lpi->cpxenv, lpi->cpxlp, lpi->senarray, firstrow, lastrow) );
2033 CHECK_ZERO( lpi->messagehdlr, CPXgetrhs(lpi->cpxenv, lpi->cpxlp, lpi->rhsarray, firstrow, lastrow) );
2034 retval = CPXgetrngval(lpi->cpxenv, lpi->cpxlp, lpi->rngarray, firstrow, lastrow);
2035 if( retval != CPXERR_NO_RNGVAL )
2040 BMSclearMemoryArray(lpi->rngarray, lastrow-firstrow+1);
2043 reconvertSides(lpi, lastrow - firstrow + 1, lhss, rhss);
2056 assert(lpi != NULL);
2057 assert(lpi->cpxlp != NULL);
2058 assert(lpi->cpxenv != NULL);
2062 CHECK_ZERO( lpi->messagehdlr, CPXgetcoef(lpi->cpxenv, lpi->cpxlp, row, col, val) );
2089 assert(lpi != NULL);
2090 assert(lpi->cpxlp != NULL);
2091 assert(lpi->cpxenv != NULL);
2094 CPXgetnumcols(lpi->cpxenv, lpi->cpxlp), CPXgetnumrows(lpi->cpxenv, lpi->cpxlp));
2096 invalidateSolution(lpi);
2098 setIntParam(lpi, CPX_PARAM_ADVIND, lpi->fromscratch || lpi->clearstate ? CPX_OFF : CPX_ON);
2099 lpi->clearstate = FALSE;
2101 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2104 retval = CPXprimopt(lpi->cpxenv, lpi->cpxlp);
2105 lpi->iterations = CPXgetphase1cnt(lpi->cpxenv, lpi->cpxlp) + CPXgetitcnt(lpi->cpxenv, lpi->cpxlp);
2110 case CPXERR_NO_MEMORY:
2116 lpi->solstat = CPXgetstat(lpi->cpxenv, lpi->cpxlp);
2117 lpi->instabilityignored = FALSE;
2118 CHECK_ZERO( lpi->messagehdlr, CPXsolninfo(lpi->cpxenv, lpi->cpxlp, NULL, NULL, &primalfeasible, &dualfeasible) );
2119 SCIPdebugMessage( " -> CPLEX returned solstat=%d, pfeas=%d, dfeas=%d (%d iterations)\n",
2120 lpi->solstat, primalfeasible, dualfeasible, lpi->iterations);
2122 if( lpi->solstat == CPX_STAT_INForUNBD
2123 || (lpi->solstat == CPX_STAT_INFEASIBLE && !dualfeasible)
2124 || (lpi->solstat == CPX_STAT_UNBOUNDED && !primalfeasible) )
2126 if( getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON )
2129 SCIPdebugMessage( "presolver may have solved the problem -> calling CPLEX primal simplex again without presolve\n");
2132 setIntParam(lpi, CPX_PARAM_PREIND, CPX_OFF);
2133 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2135 retval = CPXprimopt(lpi->cpxenv, lpi->cpxlp);
2140 case CPXERR_NO_MEMORY:
2146 lpi->iterations += CPXgetphase1cnt(lpi->cpxenv, lpi->cpxlp) + CPXgetitcnt(lpi->cpxenv, lpi->cpxlp);
2147 lpi->solstat = CPXgetstat(lpi->cpxenv, lpi->cpxlp);
2148 lpi->instabilityignored = FALSE;
2149 SCIPdebugMessage( " -> CPLEX returned solstat=%d (%d iterations)\n", lpi->solstat, lpi->iterations);
2152 setIntParam(lpi, CPX_PARAM_PREIND, CPX_ON);
2155 if( lpi->solstat == CPX_STAT_INForUNBD )
2158 SCIPerrorMessage( "CPLEX primal simplex returned CPX_STAT_INForUNBD after presolving was turned off\n");
2165 if( lpi->solstat == CPX_STAT_OPTIMAL )
2168 lpi->solisbasic = TRUE;
2171 lpi->solisbasic = (solntype == CPX_BASIC_SOLN);
2172 assert(lpi->solisbasic);
2178 lpi->solisbasic = (solntype == CPX_BASIC_SOLN);
2194 assert(lpi != NULL);
2195 assert(lpi->cpxlp != NULL);
2196 assert(lpi->cpxenv != NULL);
2199 CPXgetnumcols(lpi->cpxenv, lpi->cpxlp), CPXgetnumrows(lpi->cpxenv, lpi->cpxlp));
2201 invalidateSolution(lpi);
2203 setIntParam(lpi, CPX_PARAM_ADVIND, lpi->fromscratch || lpi->clearstate ? CPX_OFF : CPX_ON);
2204 lpi->clearstate = FALSE;
2206 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2209 retval = CPXdualopt(lpi->cpxenv, lpi->cpxlp);
2210 lpi->iterations = CPXgetphase1cnt(lpi->cpxenv, lpi->cpxlp) + CPXgetitcnt(lpi->cpxenv, lpi->cpxlp);
2215 case CPXERR_NO_MEMORY:
2223 lpi->solstat = CPXgetstat(lpi->cpxenv, lpi->cpxlp);
2224 lpi->instabilityignored = FALSE;
2225 CHECK_ZERO( lpi->messagehdlr, CPXsolninfo(lpi->cpxenv, lpi->cpxlp, NULL, NULL, &primalfeasible, &dualfeasible) );
2226 SCIPdebugMessage( " -> CPLEX returned solstat=%d, pfeas=%d, dfeas=%d (%d iterations)\n",
2227 lpi->solstat, primalfeasible, dualfeasible, lpi->iterations);
2229 if( lpi->solstat == CPX_STAT_INForUNBD
2230 || (lpi->solstat == CPX_STAT_INFEASIBLE && !dualfeasible)
2231 || (lpi->solstat == CPX_STAT_UNBOUNDED && !primalfeasible) )
2233 if( getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON )
2236 SCIPdebugMessage( "presolver may have solved the problem -> calling CPLEX dual simplex again without presolve\n");
2239 setIntParam(lpi, CPX_PARAM_PREIND, CPX_OFF);
2240 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2242 retval = CPXdualopt(lpi->cpxenv, lpi->cpxlp);
2247 case CPXERR_NO_MEMORY:
2253 lpi->iterations += CPXgetphase1cnt(lpi->cpxenv, lpi->cpxlp) + CPXgetitcnt(lpi->cpxenv, lpi->cpxlp);
2254 lpi->solstat = CPXgetstat(lpi->cpxenv, lpi->cpxlp);
2255 lpi->instabilityignored = FALSE;
2256 CHECK_ZERO( lpi->messagehdlr, CPXsolninfo(lpi->cpxenv, lpi->cpxlp, NULL, NULL, &primalfeasible, &dualfeasible) );
2257 SCIPdebugMessage( " -> CPLEX returned solstat=%d (%d iterations)\n", lpi->solstat, lpi->iterations);
2260 setIntParam(lpi, CPX_PARAM_PREIND, CPX_ON);
2263 if( lpi->solstat == CPX_STAT_INForUNBD )
2266 SCIPerrorMessage( "CPLEX dual simplex returned CPX_STAT_INForUNBD after presolving was turned off\n");
2273 if( lpi->solstat == CPX_STAT_OPTIMAL )
2276 lpi->solisbasic = TRUE;
2279 lpi->solisbasic = (solntype == CPX_BASIC_SOLN);
2280 assert(lpi->solisbasic);
2286 lpi->solisbasic = (solntype == CPX_BASIC_SOLN);
2305 llim = getDblParam(lpi, CPX_PARAM_OBJLLIM);
2306 ulim = getDblParam(lpi, CPX_PARAM_OBJULIM);
2307 eps = getDblParam(lpi, CPX_PARAM_EPOPT);
2308 if( objval >= llim - eps && objval <= ulim + eps )
2314 SCIPdebugMessage( "dual solution %g does not exceed objective limit [%g,%g] (%d iterations) -> calling CPLEX dual simplex again for one iteration\n",
2315 objval, llim, ulim, lpi->iterations);
2316 itlim = getIntParam(lpi, CPX_PARAM_ITLIM);
2317 setIntParam(lpi, CPX_PARAM_ITLIM, 1);
2318 advind = getIntParam(lpi, CPX_PARAM_ADVIND);
2319 setIntParam(lpi, CPX_PARAM_ADVIND, CPX_ON);
2320 setDblParam(lpi, CPX_PARAM_OBJLLIM, -CPX_INFBOUND);
2321 setDblParam(lpi, CPX_PARAM_OBJULIM, CPX_INFBOUND);
2322 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2323 CHECK_ZERO( lpi->messagehdlr, CPXsetintparam(lpi->cpxenv, CPX_PARAM_FINALFACTOR, FALSE) );
2325 retval = CPXdualopt(lpi->cpxenv, lpi->cpxlp);
2330 case CPXERR_NO_MEMORY:
2336 lpi->iterations += CPXgetphase1cnt(lpi->cpxenv, lpi->cpxlp) + CPXgetitcnt(lpi->cpxenv, lpi->cpxlp);
2339 setIntParam(lpi, CPX_PARAM_ITLIM, itlim);
2340 setIntParam(lpi, CPX_PARAM_ADVIND, advind);
2341 setDblParam(lpi, CPX_PARAM_OBJLLIM, llim);
2342 setDblParam(lpi, CPX_PARAM_OBJULIM, ulim);
2343 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2344 CHECK_ZERO( lpi->messagehdlr, CPXsetintparam(lpi->cpxenv, CPX_PARAM_FINALFACTOR, TRUE) );
2347 retval = CPXdualopt(lpi->cpxenv, lpi->cpxlp);
2352 case CPXERR_NO_MEMORY:
2358 lpi->iterations += CPXgetphase1cnt(lpi->cpxenv, lpi->cpxlp) + CPXgetitcnt(lpi->cpxenv, lpi->cpxlp);
2359 lpi->solstat = CPXgetstat(lpi->cpxenv, lpi->cpxlp);
2360 lpi->instabilityignored = FALSE;
2361 SCIPdebugMessage( " -> CPLEX returned solstat=%d (%d iterations)\n", lpi->solstat, lpi->iterations);
2378 assert(lpi != NULL);
2379 assert(lpi->cpxlp != NULL);
2380 assert(lpi->cpxenv != NULL);
2383 CPXgetnumcols(lpi->cpxenv, lpi->cpxlp), CPXgetnumrows(lpi->cpxenv, lpi->cpxlp));
2385 invalidateSolution(lpi);
2387 setIntParam(lpi, CPX_PARAM_ADVIND, lpi->fromscratch || lpi->clearstate ? CPX_OFF : CPX_ON);
2388 lpi->clearstate = FALSE;
2390 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2393 retval = CPXhybbaropt(lpi->cpxenv, lpi->cpxlp, crossover ? 0 : CPX_ALG_NONE);
2394 lpi->iterations = CPXgetbaritcnt(lpi->cpxenv, lpi->cpxlp);
2399 case CPXERR_NO_MEMORY:
2407 lpi->solisbasic = (solntype == CPX_BASIC_SOLN);
2408 lpi->solstat = CPXgetstat(lpi->cpxenv, lpi->cpxlp);
2409 lpi->instabilityignored = FALSE;
2410 SCIPdebugMessage( " -> CPLEX returned solstat=%d (%d iterations)\n", lpi->solstat, lpi->iterations);
2412 if( lpi->solstat == CPX_STAT_INForUNBD )
2415 SCIPdebugMessage( "CPLEX returned INForUNBD -> calling CPLEX barrier again without presolve\n");
2418 setIntParam(lpi, CPX_PARAM_PREIND, CPX_OFF);
2419 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2421 retval = CPXhybbaropt(lpi->cpxenv, lpi->cpxlp, crossover ? 0 : CPX_ALG_NONE);
2426 case CPXERR_NO_MEMORY:
2434 lpi->solisbasic = (solntype == CPX_BASIC_SOLN);
2435 lpi->iterations += CPXgetbaritcnt(lpi->cpxenv, lpi->cpxlp);
2436 lpi->solstat = CPXgetstat(lpi->cpxenv, lpi->cpxlp);
2437 lpi->instabilityignored = FALSE;
2440 if( lpi->solstat == CPX_STAT_INForUNBD )
2443 SCIPerrorMessage( "CPLEX barrier returned CPX_STAT_INForUNBD after presolving was turned off\n");
2446 setIntParam(lpi, CPX_PARAM_PREIND, CPX_ON);
2468 const char lbound = 'L';
2469 const char ubound = 'U';
2480 assert( EPSISINT(psol, lpi->feastol) );
2482 objsen = CPXgetobjsen(lpi->cpxenv, lpi->cpxlp);
2490 CHECK_ZERO( lpi->messagehdlr, CPXgetlb(lpi->cpxenv, lpi->cpxlp, &oldlb, col, col) );
2491 CHECK_ZERO( lpi->messagehdlr, CPXgetub(lpi->cpxenv, lpi->cpxlp, &oldub, col, col) );
2496 olditlim = getIntParam(lpi, CPX_PARAM_ITLIM);
2497 setIntParam(lpi, CPX_PARAM_ITLIM, itlim);
2500 newub = EPSCEIL(psol-1.0, lpi->feastol);
2501 if( newub >= oldlb - 0.5 )
2503 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, 1, &col, &ubound, &newub) );
2506 *down = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJULIM) : getDblParam(lpi, CPX_PARAM_OBJLLIM);
2512 *down = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJLLIM) : getDblParam(lpi, CPX_PARAM_OBJULIM);
2520 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, 1, &col, &ubound, &oldub) );
2524 *down = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJULIM) : getDblParam(lpi, CPX_PARAM_OBJLLIM);
2527 newlb = EPSFLOOR(psol+1.0, lpi->feastol);
2528 if( newlb <= oldub + 0.5 )
2530 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, 1, &col, &lbound, &newlb) );
2533 *up = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJULIM) : getDblParam(lpi, CPX_PARAM_OBJLLIM);
2539 *up = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJLLIM) : getDblParam(lpi, CPX_PARAM_OBJULIM);
2547 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, 1, &col, &lbound, &oldlb) );
2551 *up = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJLLIM) : getDblParam(lpi, CPX_PARAM_OBJULIM);
2554 setIntParam(lpi, CPX_PARAM_ITLIM, olditlim);
2591 const char lbound = 'L';
2592 const char ubound = 'U';
2607 assert( ! EPSISINT(psol, lpi->feastol) );
2609 objsen = CPXgetobjsen(lpi->cpxenv, lpi->cpxlp);
2618 nrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
2620 SCIP_ALLOC( BMSallocMemoryArray(&norm, nrows) );
2621 SCIP_ALLOC( BMSallocMemoryArray(&head, nrows) );
2625 CHECK_ZERO( lpi->messagehdlr, CPXgetdnorms(lpi->cpxenv, lpi->cpxlp, norm, head, &dnormlen) );
2626 CHECK_ZERO( lpi->messagehdlr, CPXgetlb(lpi->cpxenv, lpi->cpxlp, &oldlb, col, col) );
2627 CHECK_ZERO( lpi->messagehdlr, CPXgetub(lpi->cpxenv, lpi->cpxlp, &oldub, col, col) );
2632 olditlim = getIntParam(lpi, CPX_PARAM_ITLIM);
2633 setIntParam(lpi, CPX_PARAM_ITLIM, itlim);
2636 newub = EPSFLOOR(psol, lpi->feastol);
2637 if( newub >= oldlb - 0.5 )
2639 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, 1, &col, &ubound, &newub) );
2642 *down = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJULIM) : getDblParam(lpi, CPX_PARAM_OBJLLIM);
2648 *down = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJLLIM) : getDblParam(lpi, CPX_PARAM_OBJULIM);
2656 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, 1, &col, &ubound, &oldub) );
2658 CHECK_ZERO( lpi->messagehdlr, CPXcopydnorms(lpi->cpxenv, lpi->cpxlp, norm, head, dnormlen) );
2661 *down = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJULIM) : getDblParam(lpi, CPX_PARAM_OBJLLIM);
2664 newlb = EPSCEIL(psol, lpi->feastol);
2665 if( newlb <= oldub + 0.5 )
2667 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, 1, &col, &lbound, &newlb) );
2670 *up = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJULIM) : getDblParam(lpi, CPX_PARAM_OBJLLIM);
2676 *up = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJLLIM) : getDblParam(lpi, CPX_PARAM_OBJULIM);
2684 CHECK_ZERO( lpi->messagehdlr, CPXchgbds(lpi->cpxenv, lpi->cpxlp, 1, &col, &lbound, &oldlb) );
2686 CHECK_ZERO( lpi->messagehdlr, CPXcopydnorms(lpi->cpxenv, lpi->cpxlp, norm, head, dnormlen) );
2689 *up = objsen == CPX_MIN ? getDblParam(lpi, CPX_PARAM_OBJLLIM) : getDblParam(lpi, CPX_PARAM_OBJULIM);
2694 BMSfreeMemoryArray(&norm);
2695 BMSfreeMemoryArray(&head);
2698 setIntParam(lpi, CPX_PARAM_ITLIM, olditlim);
2702 assert(lpi != NULL);
2703 assert(lpi->cpxlp != NULL);
2704 assert(lpi->cpxenv != NULL);
2705 assert(down != NULL);
2707 assert(downvalid != NULL);
2708 assert(upvalid != NULL);
2710 SCIPdebugMessage( "calling CPLEX strongbranching on fractional variable %d (%d iterations)\n", col, itlim);
2712 assert( ! EPSISINT(psol, lpi->feastol) );
2718 setIntParam(lpi, CPX_PARAM_ADVIND, lpi->fromscratch || lpi->clearstate ? CPX_OFF : CPX_ON);
2719 lpi->clearstate = FALSE;
2721 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2723 retval = CPXstrongbranch(lpi->cpxenv, lpi->cpxlp, &col, 1, down, up, itlim);
2724 if( retval == CPXERR_NEED_OPT_SOLN )
2729 else if( retval == CPXERR_TILIM_STRONGBRANCH )
2734 else if( retval == CPXERR_SINGULAR )
2768 assert(lpi != NULL);
2769 assert(lpi->cpxlp != NULL);
2770 assert(lpi->cpxenv != NULL);
2771 assert(cols != NULL);
2772 assert(psols != NULL);
2773 assert(down != NULL);
2775 assert(downvalid != NULL);
2776 assert(upvalid != NULL);
2778 SCIPdebugMessage( "calling CPLEX strongbranching on %d fractional variables (%d iterations)\n", ncols, itlim);
2780 setIntParam(lpi, CPX_PARAM_ADVIND, lpi->fromscratch || lpi->clearstate ? CPX_OFF : CPX_ON);
2781 lpi->clearstate = FALSE;
2783 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
2786 for( j = 0; j < ncols; ++j )
2792 assert( ! EPSISINT(psols[j], lpi->feastol) );
2795 retval = CPXstrongbranch(lpi->cpxenv, lpi->cpxlp, cols, ncols, down, up, itlim);
2796 if( retval == CPXERR_NEED_OPT_SOLN )
2801 else if( retval == CPXERR_TILIM_STRONGBRANCH )
2830 assert(lpi != NULL);
2831 assert(lpi->cpxlp != NULL);
2832 assert(down != NULL);
2834 assert(downvalid != NULL);
2835 assert(upvalid != NULL);
2837 SCIPdebugMessage( "calling CPLEX strongbranching on variable %d with integral value (%d iterations)\n", col, itlim);
2839 assert( EPSISINT(psol, lpi->feastol) );
2844 SCIP_CALL( lpiStrongbranchIntegral(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter) );
2867 assert(lpi != NULL);
2868 assert(lpi->cpxlp != NULL);
2869 assert(cols != NULL);
2870 assert(psols != NULL);
2871 assert(down != NULL);
2873 assert(downvalid != NULL);
2874 assert(upvalid != NULL);
2876 SCIPdebugMessage( "calling CPLEX strongbranching on %d variables with integer values (%d iterations)\n", ncols, itlim);
2882 for( j = 0; j < ncols; ++j )
2884 assert( EPSISINT(psols[j], lpi->feastol) );
2885 SCIP_CALL( lpiStrongbranchIntegral(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter) );
2907 assert(lpi != NULL);
2909 return (lpi->solstat != -1);
2922 assert(lpi != NULL);
2923 assert(lpi->cpxlp != NULL);
2924 assert(lpi->cpxenv != NULL);
2925 assert(primalfeasible != NULL);
2926 assert(dualfeasible != NULL);
2930 CHECK_ZERO( lpi->messagehdlr, CPXsolninfo(lpi->cpxenv, lpi->cpxlp, NULL, NULL, &pfeas, &dfeas) );
2944 assert(lpi != NULL);
2945 assert(lpi->cpxlp != NULL);
2946 assert(lpi->solstat >= 0);
2948 return (lpi->solstat == CPX_STAT_UNBOUNDED || lpi->solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED);
2958 assert(lpi != NULL);
2959 assert(lpi->cpxlp != NULL);
2960 assert(lpi->cpxenv != NULL);
2961 assert(lpi->solstat >= 0);
2963 return (lpi->solstat == CPX_STAT_UNBOUNDED && CPXgetmethod(lpi->cpxenv, lpi->cpxlp) == CPX_ALG_PRIMAL);
2973 assert(lpi != NULL);
2974 assert(lpi->cpxlp != NULL);
2975 assert(lpi->cpxenv != NULL);
2976 assert(lpi->solstat >= 0);
2986 return ((primalfeasible && (lpi->solstat == CPX_STAT_UNBOUNDED || lpi->solstat == CPX_STAT_INForUNBD))
2987 || lpi->solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED);
2997 assert(lpi != NULL);
2998 assert(lpi->cpxlp != NULL);
2999 assert(lpi->cpxenv != NULL);
3000 assert(lpi->solstat >= 0);
3006 return (lpi->solstat == CPX_STAT_INFEASIBLE || (lpi->solstat == CPX_STAT_INForUNBD && dualfeasible));
3016 assert(lpi != NULL);
3017 assert(lpi->cpxlp != NULL);
3018 assert(lpi->cpxenv != NULL);
3019 assert(lpi->solstat >= 0);
3035 assert(lpi != NULL);
3036 assert(lpi->solstat >= 0);
3038 return (lpi->solstat == CPX_STAT_INFEASIBLE);
3048 assert(lpi != NULL);
3049 assert(lpi->cpxlp != NULL);
3050 assert(lpi->cpxenv != NULL);
3051 assert(lpi->solstat >= 0);
3053 return (lpi->solstat == CPX_STAT_INFEASIBLE && CPXgetmethod(lpi->cpxenv, lpi->cpxlp) == CPX_ALG_DUAL);
3063 assert(lpi != NULL);
3064 assert(lpi->cpxlp != NULL);
3065 assert(lpi->cpxenv != NULL);
3066 assert(lpi->solstat >= 0);
3072 return (dualfeasible && (lpi->solstat == CPX_STAT_INFEASIBLE || lpi->solstat == CPX_STAT_INForUNBD));
3082 assert(lpi != NULL);
3083 assert(lpi->cpxlp != NULL);
3084 assert(lpi->cpxenv != NULL);
3085 assert(lpi->solstat >= 0);
3091 return (lpi->solstat == CPX_STAT_UNBOUNDED
3092 || lpi->solstat == CPX_STAT_OPTIMAL_FACE_UNBOUNDED
3093 || (lpi->solstat == CPX_STAT_INForUNBD && primalfeasible));
3103 assert(lpi != NULL);
3104 assert(lpi->cpxlp != NULL);
3105 assert(lpi->cpxenv != NULL);
3106 assert(lpi->solstat >= 0);
3120 assert(lpi != NULL);
3121 assert(lpi->solstat >= 0);
3123 return (lpi->solstat == CPX_STAT_OPTIMAL);
3131 assert(lpi != NULL);
3132 assert(lpi->cpxlp != NULL);
3133 assert(lpi->cpxenv != NULL);
3134 assert(lpi->solstat >= 0);
3136 SCIPdebugMessage( "checking for stability: CPLEX solstat = %d\n", lpi->solstat);
3142 if( lpi->solstat == CPX_STAT_UNBOUNDED )
3148 if( !primalfeasible )
3162 if( kappa != SCIP_INVALID || kappa > lpi->conditionlimit )
3166 return (lpi->solstat != CPX_STAT_NUM_BEST && lpi->solstat != CPX_STAT_OPTIMAL_INFEAS);
3174 assert(lpi != NULL);
3175 assert(lpi->solstat >= 0);
3177 return (lpi->solstat == CPX_STAT_ABORT_OBJ_LIM
3178 || lpi->solstat == CPX_STAT_ABORT_DUAL_OBJ_LIM
3179 || lpi->solstat == CPX_STAT_ABORT_PRIM_OBJ_LIM);
3187 assert(lpi != NULL);
3188 assert(lpi->solstat >= 0);
3190 return (lpi->solstat == CPX_STAT_ABORT_IT_LIM);
3198 assert(lpi != NULL);
3199 assert(lpi->solstat >= 0);
3201 return (lpi->solstat == CPX_STAT_ABORT_TIME_LIM);
3209 assert(lpi != NULL);
3210 assert(lpi->cpxlp != NULL);
3212 return lpi->solstat;
3221 assert(lpi != NULL);
3222 assert(lpi->cpxlp != NULL);
3223 assert(success != NULL);
3224 assert(lpi->solstat == CPX_STAT_UNBOUNDED
3225 || lpi->solstat == CPX_STAT_NUM_BEST
3226 || lpi->solstat == CPX_STAT_OPTIMAL_INFEAS);
3229 if( lpi->solstat == CPX_STAT_NUM_BEST || lpi->solstat == CPX_STAT_OPTIMAL_INFEAS )
3230 lpi->solstat = CPX_STAT_OPTIMAL;
3233 lpi->instabilityignored = TRUE;
3246 assert(lpi != NULL);
3247 assert(lpi->cpxlp != NULL);
3248 assert(lpi->cpxenv != NULL);
3252 retcode = CPXgetobjval(lpi->cpxenv, lpi->cpxlp, objval);
3255 if( retcode == CPXERR_NO_SOLN )
3279 assert(lpi != NULL);
3280 assert(lpi->cpxlp != NULL);
3281 assert(lpi->cpxenv != NULL);
3282 assert(lpi->solstat >= 0);
3286 CHECK_ZERO( lpi->messagehdlr, CPXsolution(lpi->cpxenv, lpi->cpxlp, &dummy, objval, primsol, dualsol, NULL, redcost) );
3287 assert(dummy == lpi->solstat || lpi->instabilityignored);
3289 if( activity != NULL )
3291 CHECK_ZERO( lpi->messagehdlr, CPXgetax(lpi->cpxenv, lpi->cpxlp, activity, 0, CPXgetnumrows(lpi->cpxenv, lpi->cpxlp)-1) );
3303 assert(lpi != NULL);
3304 assert(lpi->cpxlp != NULL);
3305 assert(lpi->cpxenv != NULL);
3306 assert(lpi->solstat >= 0);
3309 CPXgetnumcols(lpi->cpxenv, lpi->cpxlp), CPXgetnumrows(lpi->cpxenv, lpi->cpxlp));
3311 CHECK_ZERO( lpi->messagehdlr, CPXgetray(lpi->cpxenv, lpi->cpxlp, ray) );
3322 assert(lpi != NULL);
3323 assert(lpi->cpxlp != NULL);
3324 assert(lpi->cpxenv != NULL);
3325 assert(lpi->solstat >= 0);
3326 assert(dualfarkas != NULL);
3329 CPXgetnumcols(lpi->cpxenv, lpi->cpxlp), CPXgetnumrows(lpi->cpxenv, lpi->cpxlp));
3331 CHECK_ZERO( lpi->messagehdlr, CPXdualfarkas(lpi->cpxenv, lpi->cpxlp, dualfarkas, NULL) );
3342 assert(lpi != NULL);
3343 assert(iterations != NULL);
3345 *iterations = lpi->iterations;
3364 assert(lpi != NULL);
3365 assert(quality != NULL);
3369 SCIPdebugMessage( "requesting solution quality from CPLEX: quality %d\n", qualityindicator);
3371 switch( qualityindicator )
3378 what = CPX_EXACT_KAPPA;
3388 if( solntype == CPX_BASIC_SOLN )
3390 CHECK_ZERO( lpi->messagehdlr, CPXgetdblquality(lpi->cpxenv, lpi->cpxlp, quality, what) );
3419 assert(lpi != NULL);
3420 assert(lpi->cpxlp != NULL);
3421 assert(lpi->cpxenv != NULL);
3423 SCIPdebugMessage( "saving CPLEX basis into %p/%p\n", ( void *) cstat, ( void *) rstat);
3425 CHECK_ZERO( lpi->messagehdlr, CPXgetbase(lpi->cpxenv, lpi->cpxlp, cstat, rstat) );
3428 nrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
3429 for (i = 0; i < nrows; ++i)
3431 if ( rstat[i] == CPX_AT_LOWER )
3433 CHECK_ZERO( lpi->messagehdlr, CPXgetsense(lpi->cpxenv, lpi->cpxlp, &sense, i, i) );
3459 assert(lpi != NULL);
3460 assert(lpi->cpxlp != NULL);
3461 assert(lpi->cpxenv != NULL);
3462 assert(cstat != NULL);
3463 assert(rstat != NULL);
3465 SCIPdebugMessage( "loading basis %p/%p into CPLEX\n", ( void *) cstat, ( void *) rstat);
3467 invalidateSolution(lpi);
3476 nrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
3477 for (i = 0; i < nrows; ++i)
3481 CHECK_ZERO( lpi->messagehdlr, CPXgetsense(lpi->cpxenv, lpi->cpxlp, &sense, i, i) );
3483 rstat[i] = CPX_AT_LOWER;
3487 CHECK_ZERO( lpi->messagehdlr, CPXcopybase(lpi->cpxenv, lpi->cpxlp, cstat, rstat) );
3500 assert(lpi != NULL);
3501 assert(lpi->cpxlp != NULL);
3502 assert(lpi->cpxenv != NULL);
3507 setIntParam(lpi, CPX_PARAM_ADVIND, CPX_ON);
3508 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
3510 retval = CPXgetbhead(lpi->cpxenv, lpi->cpxlp, bind, NULL);
3511 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3514 retval = CPXgetbhead(lpi->cpxenv, lpi->cpxlp, bind, NULL);
3530 assert(lpi != NULL);
3531 assert(lpi->cpxlp != NULL);
3532 assert(lpi->cpxenv != NULL);
3537 setIntParam(lpi, CPX_PARAM_ADVIND, CPX_ON);
3538 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
3540 retval = CPXbinvrow(lpi->cpxenv, lpi->cpxlp, r, coef);
3541 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3544 retval = CPXbinvrow(lpi->cpxenv, lpi->cpxlp, r, coef);
3564 assert(lpi != NULL);
3565 assert(lpi->cpxlp != NULL);
3566 assert(lpi->cpxenv != NULL);
3571 setIntParam(lpi, CPX_PARAM_ADVIND, CPX_ON);
3572 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
3574 retval = CPXbinvcol(lpi->cpxenv, lpi->cpxlp, c, coef);
3575 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3578 retval = CPXbinvcol(lpi->cpxenv, lpi->cpxlp, c, coef);
3595 assert(lpi != NULL);
3596 assert(lpi->cpxlp != NULL);
3597 assert(lpi->cpxenv != NULL);
3602 setIntParam(lpi, CPX_PARAM_ADVIND, CPX_ON);
3603 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
3605 retval = CPXbinvarow(lpi->cpxenv, lpi->cpxlp, r, coef);
3606 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3609 retval = CPXbinvarow(lpi->cpxenv, lpi->cpxlp, r, coef);
3625 assert(lpi->cpxenv != NULL);
3626 assert(lpi != NULL);
3627 assert(lpi->cpxlp != NULL);
3632 setIntParam(lpi, CPX_PARAM_ADVIND, CPX_ON);
3633 SCIP_CALL( setParameterValues(lpi, &(lpi->cpxparam)) );
3635 retval = CPXbinvacol(lpi->cpxenv, lpi->cpxlp, c, coef);
3636 if( retval == CPXERR_NO_SOLN || retval == CPXERR_NO_LU_FACTOR || retval == CPXERR_NO_BASIC_SOLN || retval == CPXERR_NO_BASIS )
3639 retval = CPXbinvacol(lpi->cpxenv, lpi->cpxlp, c, coef);
3668 assert(blkmem != NULL);
3669 assert(lpi != NULL);
3670 assert(lpi->cpxlp != NULL);
3671 assert(lpi->cpxenv != NULL);
3672 assert(lpistate != NULL);
3677 if( !lpi->solisbasic || lpi->clearstate )
3683 ncols = CPXgetnumcols(lpi->cpxenv, lpi->cpxlp);
3684 nrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
3689 SCIP_CALL( lpistateCreate(lpistate, blkmem, ncols, nrows) );
3691 SCIPdebugMessage( "storing CPLEX LPI state in %p (%d cols, %d rows)\n", ( void *) *lpistate, ncols, nrows);
3697 (*lpistate)->ncols = ncols;
3698 (*lpistate)->nrows = nrows;
3699 lpistatePack(*lpistate, lpi->cstat, lpi->rstat);
3717 assert(blkmem != NULL);
3718 assert(lpi != NULL);
3719 assert(lpi->cpxlp != NULL);
3720 assert(lpi->cpxenv != NULL);
3723 if( lpistate == NULL )
3726 lpncols = CPXgetnumcols(lpi->cpxenv, lpi->cpxlp);
3727 lpnrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
3728 assert(lpistate->ncols <= lpncols);
3729 assert(lpistate->nrows <= lpnrows);
3731 SCIPdebugMessage( "loading LPI state %p (%d cols, %d rows) into CPLEX LP with %d cols and %d rows\n",
3732 ( void *) lpistate, lpistate->ncols, lpistate->nrows, lpncols, lpnrows);
3734 if( lpistate->ncols == 0 || lpistate->nrows == 0 )
3738 SCIP_CALL( ensureCstatMem(lpi, lpncols) );
3739 SCIP_CALL( ensureRstatMem(lpi, lpnrows) );
3742 lpistateUnpack(lpistate, lpi->cstat, lpi->rstat);
3745 for( i = lpistate->ncols; i < lpncols; ++i )
3748 CHECK_ZERO( lpi->messagehdlr, CPXgetlb(lpi->cpxenv, lpi->cpxlp, &bnd, i, i) );
3752 CHECK_ZERO( lpi->messagehdlr, CPXgetub(lpi->cpxenv, lpi->cpxlp, &bnd, i, i) );
3761 for( i = lpistate->nrows; i < lpnrows; ++i )
3775 assert(lpi != NULL);
3778 lpi->clearstate = TRUE;
3790 assert(lpi != NULL);
3791 assert(lpistate != NULL);
3793 if( *lpistate != NULL )
3795 lpistateFree(lpistate, blkmem);
3807 return (lpistate != NULL);
3816 assert(lpi != NULL);
3817 assert(lpi->cpxlp != NULL);
3818 assert(lpi->cpxenv != NULL);
3822 CHECK_ZERO( lpi->messagehdlr, CPXreadcopybase(lpi->cpxenv, lpi->cpxlp, fname) );
3833 assert(lpi != NULL);
3834 assert(lpi->cpxlp != NULL);
3835 assert(lpi->cpxenv != NULL);
3839 CHECK_ZERO( lpi->messagehdlr, CPXmbasewrite(lpi->cpxenv, lpi->cpxlp, fname) );
3869 assert(blkmem != NULL);
3870 assert(lpi != NULL);
3871 assert(lpi->cpxlp != NULL);
3872 assert(lpi->cpxenv != NULL);
3873 assert(lpi->messagehdlr != NULL);
3874 assert(lpinorms != NULL);
3879 if( !lpi->solisbasic || lpi->clearstate )
3885 nrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
3889 SCIP_ALLOC( BMSallocBlockMemory(blkmem, lpinorms) );
3890 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpinorms)->norm, nrows) );
3891 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpinorms)->head, nrows) );
3892 (*lpinorms)->normlen = 0;
3894 SCIPdebugMessage( "storing CPLEX LPI pricing norms in %p (%d rows)\n", ( void *) *lpinorms, nrows);
3897 retval = CPXgetdnorms(lpi->cpxenv, lpi->cpxlp, (*lpinorms)->norm, (*lpinorms)->head, &((*lpinorms)->normlen));
3900 if( retval == 1264 )
3903 BMSfreeBlockMemoryArray(blkmem, &(*lpinorms)->head, nrows);
3904 BMSfreeBlockMemoryArray(blkmem, &(*lpinorms)->norm, nrows);
3905 BMSfreeBlockMemory(blkmem, lpinorms);
3906 assert(*lpinorms == NULL);
3910 assert((*lpinorms)->normlen == nrows);
3928 assert(blkmem != NULL);
3929 assert(lpi != NULL);
3930 assert(lpi->cpxlp != NULL);
3931 assert(lpi->cpxenv != NULL);
3934 if( lpinorms == NULL )
3937 lpnrows = CPXgetnumrows(lpi->cpxenv, lpi->cpxlp);
3938 assert(lpinorms-> normlen <= lpnrows);
3940 SCIPdebugMessage( "loading LPI simplex norms %p (%d rows) into CPLEX LP with %d rows\n",
3941 ( void *) lpinorms, lpinorms-> normlen, lpnrows);
3947 CHECK_ZERO( lpi->messagehdlr, CPXcopydnorms(lpi->cpxenv, lpi->cpxlp, lpinorms-> norm, lpinorms-> head, lpinorms-> normlen) );
3959 assert(lpi != NULL);
3960 assert(lpinorms != NULL);
3962 BMSfreeBlockMemoryArray(blkmem, &(*lpinorms)->head, (*lpinorms)->normlen);
3963 BMSfreeBlockMemoryArray(blkmem, &(*lpinorms)->norm, (*lpinorms)->normlen);
3964 BMSfreeBlockMemory(blkmem, lpinorms);
3988 assert(lpi != NULL);
3989 assert(lpi->cpxlp != NULL);
3990 assert(ival != NULL);
3997 *ival = lpi->fromscratch;
4000 *ival = getIntParam(lpi, CPX_PARAM_FASTMIP);
4003 #if (CPX_VERSION <= 1100)
4007 *ival = (getIntParam(lpi, CPX_PARAM_SCAIND) == 0);
4010 *ival = (getIntParam(lpi, CPX_PARAM_PREIND) == CPX_ON);
4013 *ival = (int)lpi->pricing;
4017 switch( getIntParam(lpi, CPX_PARAM_PPRIIND) )
4019 case CPX_PPRIIND_FULL:
4022 case CPX_PPRIIND_PARTIAL:
4025 case CPX_PPRIIND_STEEP:
4028 case CPX_PPRIIND_STEEPQSTART:
4031 #if (CPX_VERSION >= 900)
4032 case CPX_PPRIIND_DEVEX:
4043 *ival = (getIntParam(lpi, CPX_PARAM_SCRIND) == CPX_ON);
4046 *ival = getIntParam(lpi, CPX_PARAM_ITLIM);
4047 #if (CPX_VERSION <= 1230)
4053 #if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
4056 *ival = lpi->pseudonthreads;
4057 assert(getIntParam(lpi, CPX_PARAM_THREADS) == 1);
4059 *ival = getIntParam(lpi, CPX_PARAM_THREADS);
4076 assert(lpi != NULL);
4077 assert(lpi->cpxlp != NULL);
4085 lpi->fromscratch = ival;
4088 assert(0 <= ival && ival <= 1);
4089 setIntParam(lpi, CPX_PARAM_FASTMIP, ival);
4093 #if (CPX_VERSION <= 1100)
4097 setIntParam(lpi, CPX_PARAM_SCAIND, ival == TRUE ? 0 : -1);
4101 setIntParam(lpi, CPX_PARAM_PREIND, ival == TRUE ? CPX_ON : CPX_OFF);
4108 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_AUTO);
4109 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_AUTO);
4112 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_FULL);
4113 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_FULL);
4116 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_PARTIAL);
4117 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_AUTO);
4121 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_STEEP);
4122 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_STEEP);
4125 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_STEEPQSTART);
4126 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_STEEPQSTART);
4128 #if (CPX_VERSION >= 900)
4130 setIntParam(lpi, CPX_PARAM_PPRIIND, CPX_PPRIIND_DEVEX);
4131 setIntParam(lpi, CPX_PARAM_DPRIIND, CPX_DPRIIND_DEVEX);
4141 setIntParam(lpi, CPX_PARAM_SCRIND, CPX_ON);
4143 setIntParam(lpi, CPX_PARAM_SCRIND, CPX_OFF);
4146 #if (CPX_VERSION <= 1230)
4149 setIntParam(lpi, CPX_PARAM_ITLIM, ival);
4152 #if (CPX_VERSION == 1100 || (CPX_VERSION == 1220 && (CPX_SUBVERSION == 0 || CPX_SUBVERSION == 2)))
4155 lpi->pseudonthreads = ival;
4160 setIntParam(lpi, CPX_PARAM_THREADS, ival);
4176 assert(lpi != NULL);
4177 assert(lpi->cpxlp != NULL);
4178 assert(dval != NULL);
4185 *dval = getDblParam(lpi, CPX_PARAM_EPRHS);
4188 *dval = getDblParam(lpi, CPX_PARAM_EPOPT);
4191 *dval = getDblParam(lpi, CPX_PARAM_BAREPCOMP);
4194 *dval = getDblParam(lpi, CPX_PARAM_OBJLLIM);
4197 *dval = getDblParam(lpi, CPX_PARAM_OBJULIM);
4200 *dval = getDblParam(lpi, CPX_PARAM_TILIM);
4203 *dval = getDblParam(lpi, CPX_PARAM_EPMRK);
4206 *dval = lpi->conditionlimit;
4222 assert(lpi != NULL);
4223 assert(lpi->cpxlp != NULL);
4230 setDblParam(lpi, CPX_PARAM_EPRHS, dval);
4231 lpi->feastol = dval;
4234 setDblParam(lpi, CPX_PARAM_EPOPT, dval);
4237 setDblParam(lpi, CPX_PARAM_BAREPCOMP, dval);
4240 setDblParam(lpi, CPX_PARAM_OBJLLIM, dval);
4243 setDblParam(lpi, CPX_PARAM_OBJULIM, dval);
4246 setDblParam(lpi, CPX_PARAM_TILIM, dval);
4249 setDblParam(lpi, CPX_PARAM_EPMRK, dval);
4252 lpi->conditionlimit = dval;
4253 lpi->checkcondition = (dval >= 0);
4279 return CPX_INFBOUND;
4288 return (val >= CPX_INFBOUND);
4311 assert(lpi != NULL);
4312 assert(lpi->cpxlp != NULL);
4313 assert(lpi->cpxenv != NULL);
4317 restat = CPXreadcopyprob(lpi->cpxenv, lpi->cpxlp, fname, NULL);
4335 assert(lpi != NULL);
4336 assert(lpi->cpxlp != NULL);
4337 assert(lpi->cpxenv != NULL);
4341 restat = CPXwriteprob(lpi->cpxenv, lpi->cpxlp, fname, NULL);
|