|
Go to the documentation of this file.
37 int XPRS_CC XPRSstrongbranch( XPRSprob prob, const int _nbnd, const int *_mbndind, const char *_cbndtype,
38 const double *_dbndval, const int _itrlimit, double *_dsbobjval, int *_msbstatus );
41 #ifndef XPRS_LPQUICKPRESOLVE
42 #define XPRS_LPQUICKPRESOLVE 8207
47 #define XPRS_LP_OPTIMAL_SCALEDINFEAS 16
50 #include "scip/bitencode.h"
65 XPRSgetlasterror(prob, errmsg);
67 *msg = "LP Error: Xpress returned %d - %s\n";
69 *msg = "LP Error: Xpress returned %d\n";
72 #define CHECK_ZEROE(p, x) { int restat = (x); \
76 xprs_error((p), restat, &msg, errmsg); \
77 SCIPerrorMessage(msg, restat, errmsg); \
78 return SCIP_LPERROR; \
82 #define CHECK_ZEROW(p, messagehdlr, x) { int restat = (x); \
86 xprs_error((p), restat, &msg, errmsg); \
87 SCIPmessagePrintWarning((messagehdlr), msg, restat, errmsg); \
91 #define CHECK_ZEROLPIE(x) CHECK_ZEROE(lpi->xprslp, x)
92 #define CHECK_ZEROLPIW(x) CHECK_ZEROW(lpi->xprslp, lpi->messagehdlr, x)
93 #define CHECK_ZEROPLPIE(x) CHECK_ZEROE((*lpi)->xprslp, x)
94 #define CHECK_ZERO CHECK_ZEROLPIE
98 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE
100 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
143 static int numlp = 0;
159 if( num > lpi->boundchgsize )
164 newsize = MAX(2*lpi->boundchgsize, num);
165 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->larray, newsize) );
166 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->uarray, newsize) );
167 for( i = lpi->boundchgsize; i < newsize; ++i )
169 lpi->larray[i] = 'L';
170 lpi->uarray[i] = 'U';
172 lpi->boundchgsize = newsize;
174 assert(num <= lpi->boundchgsize);
188 if( num > lpi->sidechgsize )
192 newsize = MAX(2*lpi->sidechgsize, num);
193 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->senarray, newsize) );
194 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rhsarray, newsize) );
195 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rngarray, newsize) );
196 lpi->sidechgsize = newsize;
198 assert(num <= lpi->sidechgsize);
212 if( num > lpi->valsize )
216 newsize = MAX(2*lpi->valsize, num);
217 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->valarray, newsize) );
218 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->indarray, newsize) );
219 lpi->valsize = newsize;
221 assert(num <= lpi->valsize);
235 if( num > lpi->cstatsize )
239 newsize = MAX(2*lpi->cstatsize, num);
240 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->cstat, newsize) );
241 lpi->cstatsize = newsize;
243 assert(num <= lpi->cstatsize);
257 if( num > lpi->rstatsize )
261 newsize = MAX(2*lpi->rstatsize, num);
262 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rstat, newsize) );
263 lpi->rstatsize = newsize;
265 assert(num <= lpi->rstatsize);
280 assert(lpi->xprslp != NULL);
284 XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols);
285 XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows);
292 CHECK_ZERO( XPRSgetbasis(lpi->xprslp, lpi->rstat, lpi->cstat) );
308 CHECK_ZERO( XPRSloadbasis(lpi->xprslp, lpi->rstat, lpi->cstat) );
346 assert(lpistate != NULL);
347 assert(lpistate->packcstat != NULL);
348 assert(lpistate->packrstat != NULL);
350 SCIPencodeDualBit(cstat, lpistate->packcstat, lpistate->ncols);
351 SCIPencodeDualBit(rstat, lpistate->packrstat, lpistate->nrows);
362 assert(lpistate != NULL);
363 assert(lpistate->packcstat != NULL);
364 assert(lpistate->packrstat != NULL);
366 SCIPdecodeDualBit(lpistate->packcstat, cstat, lpistate->ncols);
367 SCIPdecodeDualBit(lpistate->packrstat, rstat, lpistate->nrows);
379 assert(lpistate != NULL);
380 assert(blkmem != NULL);
384 SCIP_ALLOC( BMSallocBlockMemory(blkmem, lpistate) );
385 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->packcstat, colpacketNum(ncols)) );
386 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->packrstat, rowpacketNum(nrows)) );
398 assert(blkmem != NULL);
399 assert(lpistate != NULL);
400 assert(*lpistate != NULL);
402 BMSfreeBlockMemoryArray(blkmem, &(*lpistate)->packcstat, colpacketNum((*lpistate)->ncols));
403 BMSfreeBlockMemoryArray(blkmem, &(*lpistate)->packrstat, rowpacketNum((*lpistate)->nrows));
404 BMSfreeBlockMemory(blkmem, lpistate);
415 void invalidateSolution( SCIP_LPI* lpi)
455 for( i = 0; i < nrows; ++i )
457 assert(lhs[i] <= rhs[i]);
458 if( lhs[i] == rhs[i] )
460 assert(XPRS_MINUSINFINITY < rhs[i] && rhs[i] < XPRS_PLUSINFINITY);
461 lpi->senarray[i] = 'E';
462 lpi->rhsarray[i] = rhs[i];
463 lpi->rngarray[i] = 0.0;
465 else if( lhs[i] <= XPRS_MINUSINFINITY )
467 assert(XPRS_MINUSINFINITY < rhs[i] && rhs[i] < XPRS_PLUSINFINITY);
468 lpi->senarray[i] = 'L';
469 lpi->rhsarray[i] = rhs[i];
470 lpi->rngarray[i] = 0.0;
472 else if( rhs[i] >= XPRS_PLUSINFINITY )
474 assert(XPRS_MINUSINFINITY < lhs[i] && lhs[i] < XPRS_PLUSINFINITY);
475 lpi->senarray[i] = 'G';
476 lpi->rhsarray[i] = lhs[i];
477 lpi->rngarray[i] = 0.0;
483 lpi->senarray[i] = 'R';
484 lpi->rhsarray[i] = rhs[i];
485 lpi->rngarray[i] = rhs[i] - lhs[i];
492 void reconvertBothSides(
506 for( i = 0; i < nrows; ++i )
508 switch( lpi->senarray[i] )
511 lhs[i] = lpi->rhsarray[i];
512 rhs[i] = lpi->rhsarray[i];
516 lhs[i] = XPRS_MINUSINFINITY;
517 rhs[i] = lpi->rhsarray[i];
521 lhs[i] = lpi->rhsarray[i];
522 rhs[i] = XPRS_PLUSINFINITY;
526 assert(lpi->rngarray[i] >= 0.0);
527 rhs[i] = lpi->rhsarray[i];
528 lhs[i] = lpi->rhsarray[i] - lpi->rngarray[i];
535 assert(lhs[i] <= rhs[i]);
553 for( i = 0; i < nrows; ++i )
555 switch( lpi->senarray[i] )
558 assert(lpi->rngarray[i] == 0.0);
559 lhs[i] = lpi->rhsarray[i];
563 assert(lpi->rngarray[i] == 0.0);
564 lhs[i] = XPRS_MINUSINFINITY;
568 assert(lpi->rngarray[i] == 0.0);
569 lhs[i] = lpi->rhsarray[i];
573 assert(lpi->rngarray[i] >= 0.0);
574 lhs[i] = lpi->rhsarray[i] - lpi->rngarray[i];
598 for( i = 0; i < nrows; ++i )
600 switch( lpi->senarray[i] )
603 assert(lpi->rngarray[i] == 0.0);
604 rhs[i] = lpi->rhsarray[i];
608 assert(lpi->rngarray[i] == 0.0);
609 rhs[i] = lpi->rhsarray[i];
613 assert(lpi->rngarray[i] == 0.0);
614 rhs[i] = XPRS_PLUSINFINITY;
618 assert(lpi->rngarray[i] >= 0.0);
619 rhs[i] = lpi->rhsarray[i];
639 reconvertBothSides(lpi, nrows, lhs, rhs);
640 else if( lhs != NULL )
641 reconvertLhs(lpi, nrows, lhs);
642 else if( rhs != NULL )
643 reconvertRhs(lpi, nrows, rhs);
658 static char xprsname[100];
668 sprintf(xprsname, "Xpress %d", XPVERSION);
678 return "Linear Programming Solver developed by FICO (www.fico.com/xpress)";
689 return ( void*) lpi->xprslp;
713 assert( sizeof( SCIP_Real) == sizeof( double));
714 assert( sizeof( SCIP_Bool) == sizeof( int));
728 assert(strlen(name) < 64);
729 strcpy((*lpi)->name, name);
730 (*lpi)->larray = NULL;
731 (*lpi)->uarray = NULL;
732 (*lpi)->senarray = NULL;
733 (*lpi)->rhsarray = NULL;
734 (*lpi)->rngarray = NULL;
735 (*lpi)->valarray = NULL;
736 (*lpi)->cstat = NULL;
737 (*lpi)->rstat = NULL;
738 (*lpi)->indarray = NULL;
739 (*lpi)->boundchgsize = 0;
740 (*lpi)->sidechgsize = 0;
742 (*lpi)->cstatsize = 0;
743 (*lpi)->rstatsize = 0;
744 (*lpi)->iterations = 0;
745 (*lpi)->solisbasic = TRUE;
746 (*lpi)->solmethod = ' ';
747 (*lpi)->par_lobjlim = -1e+40;
748 (*lpi)->par_uobjlim = +1e+40;
749 (*lpi)->par_fastlp = 1;
750 (*lpi)->par_presolve = 1;
751 (*lpi)->messagehdlr = messagehdlr;
754 invalidateSolution(*lpi);
758 CHECK_ZEROPLPIE( XPRSsetintcontrol((*lpi)->xprslp, XPRS_OUTPUTLOG, 0) );
761 CHECK_ZEROPLPIE( XPRSsetintcontrol((*lpi)->xprslp, XPRS_MPSNAMELENGTH, 16) );
763 #ifdef XPRS_SOLUTIONFILE
765 CHECK_ZEROPLPIE( XPRSsetintcontrol((*lpi)->xprslp, XPRS_SOLUTIONFILE, 0) );
770 CHECK_ZEROPLPIE( XPRSloadlp((*lpi)->xprslp, "temp", 0, 0, NULL, NULL, NULL, NULL, &izero, NULL, NULL, NULL, NULL, NULL) );
773 CHECK_ZEROPLPIE( XPRSsetintcontrol((*lpi)->xprslp, XPRS_PRESOLVE, -1) );
789 assert(*lpi != NULL);
797 BMSfreeMemoryArrayNull(&(*lpi)->larray);
798 BMSfreeMemoryArrayNull(&(*lpi)->uarray);
799 BMSfreeMemoryArrayNull(&(*lpi)->senarray);
800 BMSfreeMemoryArrayNull(&(*lpi)->rhsarray);
801 BMSfreeMemoryArrayNull(&(*lpi)->rngarray);
802 BMSfreeMemoryArrayNull(&(*lpi)->cstat);
803 BMSfreeMemoryArrayNull(&(*lpi)->rstat);
852 char *cnamestore = NULL;
853 char *rnamestore = NULL;
856 assert(lpi->xprslp != NULL);
858 SCIPdebugMessage( "loading LP in column format into Xpress: %d cols, %d rows\n", ncols, nrows);
860 invalidateSolution(lpi);
862 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
865 lpi->objsense = objsen;
868 convertSides(lpi, nrows, lhs, rhs);
875 for (c = 0; c < ncols; c++)
877 int isize = strlen(colnames[c]);
878 cnamesize += isize+1;
879 if (namelength < isize)
886 for (r = 0; r < nrows; r++)
888 int isize = strlen(rownames[r]);
889 rnamesize += isize+1;
890 if (namelength < isize)
896 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_MPSNAMELENGTH, namelength) );
900 SCIP_ALLOC( BMSallocMemoryArray(&cnt, ncols) );
901 for( c = 0; c < ncols-1; ++c )
903 cnt[c] = beg[c+1] - beg[c];
906 cnt[ncols-1] = nnonz - beg[ncols-1];
907 assert(cnt[ncols-1] >= 0);
910 CHECK_ZERO( XPRSloadlp(lpi->xprslp, lpi->name, ncols, nrows, lpi->senarray, lpi->rhsarray,
911 lpi->rngarray, obj, beg, cnt, ind, val, lb, ub) );
916 SCIP_ALLOC( BMSallocMemoryArray(&cnamestore, cnamesize) );
917 for (c = 0; c < ncols; c++)
919 strcpy(cnamestore+isize, colnames[c]);
920 isize += strlen(colnames[c])+1;
922 CHECK_ZEROLPIW( XPRSaddnames(lpi->xprslp, 2, cnamestore, 0, ncols-1) );
923 BMSfreeMemoryArray(&cnamestore);
929 SCIP_ALLOC( BMSallocMemoryArray(&rnamestore, rnamesize) );
930 for (c = 0; c < nrows; c++)
932 strcpy(rnamestore+isize, rownames[c]);
933 isize += strlen(rownames[c])+1;
935 CHECK_ZEROLPIW( XPRSaddnames(lpi->xprslp, 1, rnamestore, 0, nrows-1) );
936 BMSfreeMemoryArray(&rnamestore);
940 BMSfreeMemoryArray(&cnt);
946 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &chk_ncols) );
947 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &chk_nrows) );
948 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ELEMS, &chk_nnonz) );
949 assert(chk_ncols == ncols);
950 assert(chk_nrows == nrows);
951 assert(chk_nnonz == nnonz);
976 assert(lpi->xprslp != NULL);
978 SCIPdebugMessage( "adding %d columns with %d nonzeros to Xpress\n", ncols, nnonz);
980 invalidateSolution(lpi);
983 SCIP_ALLOC( BMSallocMemoryArray(&mstart, ncols+1) );
984 for (c = 0; c < ncols; c++)
986 mstart[ncols] = nnonz;
987 CHECK_ZERO( XPRSaddcols(lpi->xprslp, ncols, nnonz, obj, mstart, ind, val, lb, ub) );
988 BMSfreeMemoryArray(&mstart);
990 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_NAMELENGTH, &imaxnamelength) );
998 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &lp_ncols) );
999 for (c = 0; c < ncols; c++)
1001 isize = strlen(colnames[c]);
1002 #if (XPVERSION < 19)
1004 if (isize > imaxnamelength)
1005 isize = imaxnamelength;
1007 cnamesize += isize+1;
1009 SCIP_ALLOC( BMSallocMemoryArray(&cnamestore, cnamesize) );
1011 for (c = 0; c < ncols; c++)
1014 for (i = 0; colnames[c][i]; i++)
1016 #if (XPVERSION < 19)
1017 if (i >= imaxnamelength)
1020 cnamestore[isize++] = colnames[c][i];
1022 cnamestore[isize++] = '\0';
1024 assert(isize == cnamesize);
1025 CHECK_ZEROLPIW( XPRSaddnames(lpi->xprslp, 2, cnamestore, lp_ncols-ncols, lp_ncols-1) );
1026 BMSfreeMemoryArray(&cnamestore);
1043 assert(lpi != NULL);
1044 assert(lpi->xprslp != NULL);
1045 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
1046 assert(0 <= firstcol && firstcol <= lastcol && lastcol < ncols);
1048 SCIPdebugMessage( "deleting %d columns from Xpress\n", lastcol - firstcol + 1);
1050 invalidateSolution(lpi);
1052 SCIP_ALLOC( BMSallocMemoryArray(&mind, lastcol-firstcol+1) );
1053 for (c = firstcol; c <= lastcol; c++)
1054 mind[c-firstcol] = c;
1055 CHECK_ZERO( XPRSdelcols(lpi->xprslp, lastcol-firstcol+1, mind) );
1056 BMSfreeMemoryArray(&mind);
1075 assert(lpi != NULL);
1076 assert(lpi->xprslp != NULL);
1080 invalidateSolution(lpi);
1082 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
1084 for (c = 0; c < ncols; c++)
1089 SCIP_ALLOC( BMSallocMemoryArray(&mind, ndel) );
1092 for (c = 0; c < ncols; c++)
1104 CHECK_ZERO( XPRSdelcols(lpi->xprslp, ndel, mind) );
1105 BMSfreeMemoryArray(&mind);
1127 assert(lpi != NULL);
1128 assert(lpi->xprslp != NULL);
1130 SCIPdebugMessage( "adding %d rows with %d nonzeros to Xpress\n", nrows, nnonz);
1132 invalidateSolution(lpi);
1134 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
1137 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &lp_nrows) );
1138 convertSides(lpi, nrows, lhs, rhs);
1140 SCIP_ALLOC( BMSallocMemoryArray(&mstart, nrows+1) );
1141 for (r = 0; r < nrows; r++)
1143 mstart[nrows] = nnonz;
1144 CHECK_ZERO( XPRSaddrows(lpi->xprslp, nrows, nnonz, lpi->senarray, lpi->rhsarray, lpi->rngarray, mstart, ind, val) );
1145 BMSfreeMemoryArray(&mstart);
1154 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_NAMELENGTH, &imaxnamelength) );
1155 imaxnamelength *= 8;
1156 for (r = 0; r < nrows; r++)
1158 isize = strlen(rownames[r]);
1159 #if (XPVERSION < 19)
1160 if (isize > imaxnamelength)
1161 isize = imaxnamelength;
1163 rnamesize += isize+1;
1165 SCIP_ALLOC( BMSallocMemoryArray(&rnamestore, rnamesize) );
1167 for (r = 0; r < nrows; r++)
1170 for (i = 0; rownames[r][i]; i++)
1172 #if (XPVERSION < 19)
1173 if (i >= imaxnamelength)
1176 rnamestore[isize++] = rownames[r][i];
1178 rnamestore[isize++] = '\0';
1180 assert(isize == rnamesize);
1181 CHECK_ZEROLPIW( XPRSaddnames(lpi->xprslp, 1, rnamestore, lp_nrows, lp_nrows+nrows-1) );
1182 BMSfreeMemoryArray(&rnamestore);
1199 assert(lpi != NULL);
1200 assert(lpi->xprslp != NULL);
1201 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
1202 assert(0 <= firstrow && firstrow <= lastrow && lastrow < nrows);
1204 SCIPdebugMessage( "deleting %d rows from Xpress\n", lastrow - firstrow + 1);
1206 invalidateSolution(lpi);
1208 SCIP_ALLOC( BMSallocMemoryArray(&mind, lastrow-firstrow+1) );
1209 for (r = firstrow; r <= lastrow; r++)
1210 mind[r-firstrow] = r;
1211 CHECK_ZERO( XPRSdelrows(lpi->xprslp, lastrow-firstrow+1, mind) );
1212 BMSfreeMemoryArray(&mind);
1230 assert(lpi != NULL);
1231 assert(lpi->xprslp != NULL);
1235 invalidateSolution(lpi);
1237 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
1239 for (r = 0; r < nrows; r++)
1244 SCIP_ALLOC( BMSallocMemoryArray(&mind, ndel) );
1247 for (r = 0; r < nrows; r++)
1259 CHECK_ZERO( XPRSdelrows(lpi->xprslp, ndel, mind) );
1260 BMSfreeMemoryArray(&mind);
1273 assert(lpi != NULL);
1274 assert(lpi->xprslp != NULL);
1278 invalidateSolution(lpi);
1280 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
1281 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
1304 assert(lpi != NULL);
1305 assert(lpi->xprslp != NULL);
1311 for( i = 0; i < ncols; ++i )
1316 invalidateSolution(lpi);
1318 SCIP_CALL( ensureBoundchgMem(lpi, ncols) );
1335 assert(lpi != NULL);
1336 assert(lpi->xprslp != NULL);
1340 invalidateSolution(lpi);
1342 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
1345 convertSides(lpi, nrows, lhs, rhs);
1348 CHECK_ZERO( XPRSchgrowtype(lpi->xprslp, nrows, ind, lpi->senarray) );
1349 CHECK_ZERO( XPRSchgrhs(lpi->xprslp, nrows, ind, lpi->rhsarray) );
1350 CHECK_ZERO( XPRSchgrhsrange(lpi->xprslp, nrows, ind, lpi->rngarray) );
1363 assert(lpi != NULL);
1364 assert(lpi->xprslp != NULL);
1366 SCIPdebugMessage( "changing coefficient row %d, column %d in Xpress to %g\n", row, col, newval);
1368 invalidateSolution(lpi);
1370 CHECK_ZERO( XPRSchgcoef(lpi->xprslp, row, col, newval) );
1381 assert(lpi != NULL);
1382 assert(lpi->xprslp != NULL);
1386 invalidateSolution(lpi);
1388 lpi->objsense = xprsObjsen(objsen);
1401 assert(lpi != NULL);
1402 assert(lpi->xprslp != NULL);
1406 CHECK_ZERO( XPRSchgobj(lpi->xprslp, ncols, ind, obj) );
1425 assert(lpi != NULL);
1426 assert(lpi->xprslp != NULL);
1427 assert(scaleval != 0.0);
1429 SCIPdebugMessage( "scaling row %d with factor %g in Xpress\n", row, scaleval);
1431 invalidateSolution(lpi);
1433 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncol) );
1440 for( i = 0; i < nnonz; ++i )
1446 if( lhs > XPRS_MINUSINFINITY )
1448 else if( scaleval < 0.0 )
1449 lhs = XPRS_PLUSINFINITY;
1450 if( rhs < XPRS_PLUSINFINITY )
1452 else if( scaleval < 0.0 )
1453 rhs = XPRS_MINUSINFINITY;
1454 if( scaleval > 0.0 )
1483 assert(lpi != NULL);
1484 assert(lpi->xprslp != NULL);
1485 assert(scaleval != 0.0);
1487 SCIPdebugMessage( "scaling column %d with factor %g in Xpress\n", col, scaleval);
1489 invalidateSolution(lpi);
1491 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncol) );
1501 for( i = 0; i < nnonz; ++i )
1511 if( lb > XPRS_MINUSINFINITY )
1513 else if( scaleval < 0.0 )
1514 lb = XPRS_PLUSINFINITY;
1515 if( ub < XPRS_PLUSINFINITY )
1517 else if( scaleval < 0.0 )
1518 ub = XPRS_MINUSINFINITY;
1519 if( scaleval > 0.0 )
1549 assert(lpi != NULL);
1550 assert(lpi->xprslp != NULL);
1551 assert(nrows != NULL);
1555 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, nrows) );
1566 assert(lpi != NULL);
1567 assert(lpi->xprslp != NULL);
1568 assert(ncols != NULL);
1572 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, ncols) );
1583 assert(lpi != NULL);
1584 assert(lpi->xprslp != NULL);
1585 assert(nnonz != NULL);
1589 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ELEMS, nnonz) );
1612 assert(lpi != NULL);
1613 assert(lpi->xprslp != NULL);
1614 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncol) );
1615 assert(0 <= firstcol && firstcol <= lastcol && lastcol < ncol);
1623 CHECK_ZERO( XPRSgetlb(lpi->xprslp, lb, firstcol, lastcol) );
1624 CHECK_ZERO( XPRSgetub(lpi->xprslp, ub, firstcol, lastcol) );
1635 assert(beg != NULL);
1636 assert(ind != NULL);
1637 assert(val != NULL);
1640 SCIP_ALLOC( BMSallocMemoryArray(&mstart, lastcol-firstcol+2) );
1642 CHECK_ZERO( XPRSgetcols(lpi->xprslp, mstart, ind, val, ndim, nnonz, firstcol, lastcol) );
1643 assert(*nnonz <= ndim);
1644 assert(mstart[lastcol-firstcol+1] == *nnonz);
1645 for (c = 0; c < lastcol-firstcol+1; c++)
1647 BMSfreeMemoryArray(&mstart);
1651 assert(beg == NULL);
1652 assert(ind == NULL);
1653 assert(val == NULL);
1677 assert(lpi != NULL);
1678 assert(lpi->xprslp != NULL);
1679 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
1680 assert(0 <= firstrow && firstrow <= lastrow && lastrow < nrows);
1687 SCIP_CALL( ensureSidechgMem(lpi, lastrow - firstrow + 1) );
1688 CHECK_ZERO( XPRSgetrowtype(lpi->xprslp, lpi->senarray, firstrow, lastrow) );
1689 CHECK_ZERO( XPRSgetrhs(lpi->xprslp, lpi->rhsarray, firstrow, lastrow) );
1690 CHECK_ZERO( XPRSgetrhsrange(lpi->xprslp, lpi->rngarray, firstrow, lastrow) );
1693 reconvertSides(lpi, lastrow - firstrow + 1, lhs, rhs);
1702 assert(beg != NULL);
1703 assert(ind != NULL);
1704 assert(val != NULL);
1707 SCIP_ALLOC( BMSallocMemoryArray(&mstart, lastrow-firstrow+2) );
1709 CHECK_ZERO( XPRSgetrows(lpi->xprslp, mstart, ind, val, ndim, nnonz, firstrow, lastrow) );
1710 assert(*nnonz <= ndim);
1711 assert(mstart[lastrow-firstrow+1] == *nnonz);
1712 for (r = 0; r < lastrow-firstrow+1; r++)
1714 BMSfreeMemoryArray(&mstart);
1718 assert(beg == NULL);
1719 assert(ind == NULL);
1720 assert(val == NULL);
1733 int namestoragesize,
1748 int namestoragesize,
1774 assert(lpi != NULL);
1775 assert(lpi->xprslp != NULL);
1776 assert(firstcol <= lastcol);
1777 assert(vals != NULL);
1779 SCIPdebugMessage( "getting objective values %d to %d\n", firstcol, lastcol);
1781 CHECK_ZERO( XPRSgetobj(lpi->xprslp, vals, firstcol, lastcol) );
1795 assert(lpi != NULL);
1796 assert(lpi->xprslp != NULL);
1797 assert(firstcol <= lastcol);
1803 CHECK_ZERO( XPRSgetlb(lpi->xprslp, lbs, firstcol, lastcol) );
1808 CHECK_ZERO( XPRSgetub(lpi->xprslp, ubs, firstcol, lastcol) );
1823 assert(lpi != NULL);
1824 assert(lpi->xprslp != NULL);
1825 assert(firstrow <= lastrow);
1830 SCIP_CALL( ensureSidechgMem(lpi, lastrow - firstrow + 1) );
1831 CHECK_ZERO( XPRSgetrowtype(lpi->xprslp, lpi->senarray, firstrow, lastrow) );
1832 CHECK_ZERO( XPRSgetrhs(lpi->xprslp, lpi->rhsarray, firstrow, lastrow) );
1833 CHECK_ZERO( XPRSgetrhsrange(lpi->xprslp, lpi->rngarray, firstrow, lastrow) );
1836 reconvertSides(lpi, lastrow - firstrow + 1, lhss, rhss);
1853 double *dval = NULL;
1855 assert(lpi != NULL);
1856 assert(lpi->xprslp != NULL);
1862 SCIP_ALLOC( BMSallocMemoryArray(&mind, nnonz) );
1863 SCIP_ALLOC( BMSallocMemoryArray(&dval, nnonz) );
1864 CHECK_ZERO( XPRSgetrows(lpi->xprslp, mstart, mind, dval, nnonz, &nnonz, row, row) );
1866 for (i = 0; i < nnonz; i++)
1874 BMSfreeMemoryArray(&dval);
1875 BMSfreeMemoryArray(&mind);
1900 int primalinfeasible;
1904 assert(lpi != NULL);
1905 assert(lpi->xprslp != NULL);
1907 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
1908 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
1909 SCIPdebugMessage( "calling Xpress lp solver type %s: %d cols, %d rows\n", method, ncols, nrows);
1911 invalidateSolution(lpi);
1913 if (lpi->par_fastlp)
1917 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_KEEPBASIS, &keepbasis) );
1918 if (keepbasis || !lpi->par_presolve)
1922 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_PRESOLVE, 0) );
1929 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_PRESOLVE, -1) );
1933 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_REFACTOR, 0) );
1938 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_PRESOLVE, (lpi->par_presolve) ? -1 : 0) );
1939 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_REFACTOR, 1) );
1942 if (lpi->objsense > 0)
1944 CHECK_ZERO( XPRSsetdblcontrol(lpi->xprslp, XPRS_MIPABSCUTOFF, lpi->par_uobjlim) );
1946 CHECK_ZERO( XPRSminim(lpi->xprslp, method) );
1950 CHECK_ZERO( XPRSsetdblcontrol(lpi->xprslp, XPRS_MIPABSCUTOFF, lpi->par_lobjlim) );
1952 CHECK_ZERO( XPRSmaxim(lpi->xprslp, method) );
1955 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_LPSTATUS, &lpi->solstat) );
1956 if (lpi->solstat == XPRS_LP_UNBOUNDED || lpi->solstat == XPRS_LP_INFEAS)
1958 CHECK_ZERO( XPRSgetunbvec(lpi->xprslp, &lpi->unbvec) );
1964 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_PRESOLVESTATE, &state) );
1971 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_SIMPLEXITER, &lpi->iterations) );
1972 lpi->solisbasic = TRUE;
1973 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_PRIMALINFEAS, &primalinfeasible) );
1974 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_DUALINFEAS, &dualinfeasible) );
1975 SCIPdebugMessage( " -> Xpress returned solstat=%d, pinfeas=%d, dinfeas=%d (%d iterations)\n",
1976 lpi->solstat, primalinfeasible, dualinfeasible, lpi->iterations);
1978 if ((lpi->solstat == XPRS_LP_OPTIMAL) && (primalinfeasible || dualinfeasible))
1989 lpi->solmethod = 'p';
1990 return lpiSolve(lpi, "p");
1998 lpi->solmethod = 'd';
1999 return lpiSolve(lpi, "d");
2010 assert(lpi != NULL);
2011 assert(lpi->xprslp != NULL);
2013 lpi->solmethod = 'b';
2015 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_CROSSOVER, crossover) );
2017 retval = lpiSolve(lpi, "b");
2018 lpi->solisbasic = crossover;
2059 assert(lpi != NULL);
2060 assert(lpi->xprslp != NULL);
2061 assert(down != NULL);
2063 assert(downvalid != NULL);
2064 assert(upvalid != NULL);
2066 SCIPdebugMessage( "calling Xpress strong branching on variable %d (%d iterations)\n", col, itlim);
2077 objsen = lpi->objsense;
2079 #if (XPVERSION >= 18)
2091 dbndval[0] = EPSCEIL(psol-1.0, 1e-06);
2094 dbndval[1] = EPSFLOOR(psol+1.0, 1e-06);
2098 CHECK_ZERO( XPRSstrongbranch(lpi->xprslp, 2, mbndind, cbndtype, dbndval, itlim, dobjval, mstatus) );
2101 if ((mstatus[0] == XPRS_LP_INFEAS) || (mstatus[0] == XPRS_LP_CUTOFF_IN_DUAL))
2103 *down = objsen == +1 ? 1e+40 : -1e+40;
2105 else if ((mstatus[0] == XPRS_LP_OPTIMAL) || (mstatus[0] == XPRS_LP_UNFINISHED))
2116 if ((mstatus[1] == XPRS_LP_INFEAS) || (mstatus[1] == XPRS_LP_CUTOFF_IN_DUAL))
2118 *up = objsen == +1 ? 1e+40 : -1e+40;
2120 else if ((mstatus[1] == XPRS_LP_OPTIMAL) || (mstatus[1] == XPRS_LP_UNFINISHED))
2139 const char lbound = 'L';
2140 const char ubound = 'U';
2150 CHECK_ZERO( XPRSgetlb(lpi->xprslp, &oldlb, col, col) );
2151 CHECK_ZERO( XPRSgetub(lpi->xprslp, &oldub, col, col) );
2155 if( itlim > XPRS_MAXINT ) itlim = XPRS_MAXINT;
2156 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, &olditlim) );
2157 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, itlim) );
2160 newub = EPSCEIL(psol-1.0, 1e-06);
2161 if( newub >= oldlb - 0.5 )
2163 CHECK_ZERO( XPRSchgbounds(lpi->xprslp, 1, &col, &ubound, &newub) );
2166 *down = objsen == +1 ? 1e+40 : -1e+40;
2172 *down = objsen == +1 ? 1e+40 : -1e+40;
2180 CHECK_ZERO( XPRSchgbounds(lpi->xprslp, 1, &col, &ubound, &oldub) );
2184 *down = objsen == +1 ? 1e+40 : -1e+40;
2188 if( newlb <= oldub + 0.5 )
2190 CHECK_ZERO( XPRSchgbounds(lpi->xprslp, 1, &col, &lbound, &newlb) );
2193 *up = objsen == +1 ? 1e+40 : -1e+40;
2199 *up = objsen == +1 ? 1e+40 : -1e+40;
2207 CHECK_ZERO( XPRSchgbounds(lpi->xprslp, 1, &col, &lbound, &oldlb) );
2211 *up = objsen == +1 ? 1e+40 : -1e+40;
2214 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, olditlim) );
2243 assert( lpi != NULL );
2244 assert( lpi->xprslp != NULL );
2245 assert( cols != NULL );
2246 assert( psols != NULL );
2247 assert( down != NULL );
2248 assert( up != NULL );
2249 assert( downvalid != NULL );
2250 assert( upvalid != NULL );
2252 SCIPdebugMessage( "calling Xpress strong branching on %d variables (%d iterations)\n", ncols, itlim);
2257 objsen = lpi->objsense;
2259 #if (XPVERSION >= 18)
2270 SCIP_ALLOC( BMSallocMemoryArray(&mbndind, 2*ncols) );
2271 SCIP_ALLOC( BMSallocMemoryArray(&dbndval, 2*ncols) );
2272 SCIP_ALLOC( BMSallocMemoryArray(&cbndtype, 2*ncols) );
2273 SCIP_ALLOC( BMSallocMemoryArray(&dobjval, 2*ncols) );
2274 SCIP_ALLOC( BMSallocMemoryArray(&mstatus, 2*ncols) );
2276 for (j = 0; j < ncols; ++j)
2278 mbndind[2*j] = cols[j];
2279 dbndval[2*j] = EPSCEIL(psols[j] - 1.0, 1e-06);
2280 cbndtype[2*j] = 'U';
2282 mbndind[2*j+1] = cols[j];
2283 dbndval[2*j+1] = EPSFLOOR(psols[j] + 1.0, 1e-06);
2284 cbndtype[2*j+1] = 'L';
2288 CHECK_ZERO( XPRSstrongbranch(lpi->xprslp, 2*ncols, mbndind, cbndtype, dbndval, itlim, dobjval, mstatus) );
2290 for (j = 0; j < ncols; ++j)
2293 downvalid[j] = TRUE;
2296 if ((mstatus[2*j] == XPRS_LP_INFEAS) || (mstatus[2*j] == XPRS_LP_CUTOFF_IN_DUAL))
2297 down[j] = objsen == +1 ? 1e+40 : -1e+40;
2298 else if ((mstatus[2*j] == XPRS_LP_OPTIMAL) || (mstatus[2*j] == XPRS_LP_UNFINISHED))
2299 down[j] = dobjval[2*j];
2303 downvalid[j] = FALSE;
2307 if ((mstatus[2*j+1] == XPRS_LP_INFEAS) || (mstatus[2*j+1] == XPRS_LP_CUTOFF_IN_DUAL))
2308 up[j] = objsen == +1 ? 1e+40 : -1e+40;
2309 else if ((mstatus[2*j+1] == XPRS_LP_OPTIMAL) || (mstatus[2*j+1] == XPRS_LP_UNFINISHED))
2310 up[j] = dobjval[2*j+1];
2323 BMSfreeMemoryArray(&mstatus);
2324 BMSfreeMemoryArray(&dobjval);
2325 BMSfreeMemoryArray(&cbndtype);
2326 BMSfreeMemoryArray(&dbndval);
2327 BMSfreeMemoryArray(&mbndind)
2338 if ( itlim > XPRS_MAXINT )
2339 itlim = XPRS_MAXINT;
2340 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, &olditlim) );
2341 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, itlim) );
2343 for (j = 0; j < ncols; ++j)
2345 const char lbound = 'L';
2346 const char ubound = 'U';
2356 downvalid[j] = TRUE;
2362 CHECK_ZERO( XPRSgetlb(lpi->xprslp, &oldlb, col, col) );
2363 CHECK_ZERO( XPRSgetub(lpi->xprslp, &oldub, col, col) );
2366 newub = EPSCEIL(psol-1.0, 1e-06);
2367 if( newub >= oldlb - 0.5 )
2369 CHECK_ZERO( XPRSchgbounds(lpi->xprslp, 1, &col, &ubound, &newub) );
2372 down[j] = objsen == +1 ? 1e+40 : -1e+40;
2378 down[j] = objsen == +1 ? 1e+40 : -1e+40;
2387 CHECK_ZERO( XPRSchgbounds(lpi->xprslp, 1, &col, &ubound, &oldub) );
2391 down[j] = objsen == +1 ? 1e+40 : -1e+40;
2395 if( newlb <= oldub + 0.5 )
2397 CHECK_ZERO( XPRSchgbounds(lpi->xprslp, 1, &col, &lbound, &newlb) );
2400 up[j] = objsen == +1 ? 1e+40 : -1e+40;
2406 up[j] = objsen == +1 ? 1e+40 : -1e+40;
2414 CHECK_ZERO( XPRSchgbounds(lpi->xprslp, 1, &col, &lbound, &oldlb) );
2418 up[j] = objsen == +1 ? 1e+40 : -1e+40;
2422 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, olditlim) );
2445 SCIP_CALL( lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter) );
2467 SCIP_CALL( lpiStrongbranches(lpi, cols, ncols, psols, itlim, down, up, downvalid, upvalid, iter) );
2488 SCIP_CALL( lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter) );
2510 SCIP_CALL( lpiStrongbranches(lpi, cols, ncols, psols, itlim, down, up, downvalid, upvalid, iter) );
2531 assert(lpi != NULL);
2533 return (lpi->solstat != -1);
2544 assert(lpi != NULL);
2545 assert(lpi->xprslp != NULL);
2546 assert(primalfeasible != NULL);
2547 assert(dualfeasible != NULL);
2564 assert(lpi != NULL);
2565 assert(lpi->xprslp != NULL);
2566 assert(lpi->solstat >= 0);
2568 return (lpi->solstat == XPRS_LP_UNBOUNDED);
2578 assert(lpi != NULL);
2579 assert(lpi->xprslp != NULL);
2580 assert(lpi->solstat >= 0);
2583 if (lpi->solstat != XPRS_LP_UNBOUNDED)
2586 if (lpi->unbvec < 0)
2604 assert(lpi != NULL);
2605 assert(lpi->xprslp != NULL);
2606 assert(lpi->solstat >= 0);
2615 return lpi->solstat == XPRS_LP_UNBOUNDED && lpi->solmethod == 'p';
2623 assert(lpi != NULL);
2624 assert(lpi->xprslp != NULL);
2625 assert(lpi->solstat >= 0);
2629 return (lpi->solstat == XPRS_LP_INFEAS);
2637 assert(lpi != NULL);
2638 assert(lpi->xprslp != NULL);
2639 assert(lpi->solstat >= 0);
2644 return lpi->solstat == XPRS_LP_OPTIMAL || lpi->solstat == XPRS_LP_OPTIMAL_SCALEDINFEAS || (lpi->solstat == XPRS_LP_UNBOUNDED && lpi->solmethod == 'p');
2654 assert(lpi != NULL);
2655 assert(lpi->xprslp != NULL);
2656 assert(lpi->solstat >= 0);
2658 return (lpi->solstat == XPRS_LP_INFEAS);
2668 assert(lpi != NULL);
2669 assert(lpi->xprslp != NULL);
2670 assert(lpi->solstat >= 0);
2673 if (lpi->solmethod != 'p')
2679 if (lpi->solstat != XPRS_LP_INFEAS)
2697 assert(lpi != NULL);
2698 assert(lpi->xprslp != NULL);
2699 assert(lpi->solstat >= 0);
2703 return ((lpi->solstat == XPRS_LP_INFEAS) && (lpi->solmethod == 'd'));
2711 assert(lpi != NULL);
2712 assert(lpi->xprslp != NULL);
2713 assert(lpi->solstat >= 0);
2717 return (lpi->solstat == XPRS_LP_UNBOUNDED);
2725 assert(lpi != NULL);
2726 assert(lpi->xprslp != NULL);
2727 assert(lpi->solstat >= 0);
2732 return lpi->solstat == XPRS_LP_OPTIMAL || lpi->solstat == XPRS_LP_OPTIMAL_SCALEDINFEAS || (lpi->solstat == XPRS_LP_INFEAS && lpi->solmethod == 'd');
2740 assert(lpi != NULL);
2741 assert(lpi->xprslp != NULL);
2742 assert(lpi->solstat >= 0);
2752 assert(lpi != NULL);
2753 assert(lpi->xprslp != NULL);
2754 assert(lpi->solstat >= 0);
2756 SCIPdebugMessage( "checking for stability: Xpress solstat = %d\n", lpi->solstat);
2762 if( lpi->solstat == XPRS_LP_UNBOUNDED )
2766 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_PRIMALINFEAS, &pinfeas) );
2786 assert(lpi != NULL);
2787 assert(lpi->xprslp != NULL);
2788 assert(lpi->solstat >= 0);
2790 return (lpi->solstat == XPRS_LP_CUTOFF_IN_DUAL);
2801 assert(lpi != NULL);
2802 assert(lpi->xprslp != NULL);
2803 assert(lpi->solstat >= 0);
2805 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_SIMPLEXITER, &lpiter) );
2806 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, &lpiterlimit) );
2808 if ( (lpi->solstat == XPRS_LP_UNFINISHED) && (lpiter >= lpiterlimit) )
2822 assert(lpi != NULL);
2823 assert(lpi->xprslp != NULL);
2824 assert(lpi->solstat >= 0);
2826 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_SIMPLEXITER, &lpiter) );
2827 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, &lpiterlimit) );
2829 if ( (lpi->solstat == XPRS_LP_UNFINISHED) && (lpiter < lpiterlimit) )
2840 assert(lpi != NULL);
2841 assert(lpi->xprslp != NULL);
2843 return lpi->solstat;
2852 assert(lpi != NULL);
2853 assert(lpi->xprslp != NULL);
2867 assert(lpi != NULL);
2868 assert(lpi->xprslp != NULL);
2872 CHECK_ZERO( XPRSgetdblattrib(lpi->xprslp, XPRS_LPOBJVAL, objval) );
2887 assert(lpi != NULL);
2888 assert(lpi->xprslp != NULL);
2889 assert(lpi->solstat >= 0);
2893 CHECK_ZERO( XPRSgetsol(lpi->xprslp, primsol, activity, dualsol, redcost) );
2896 CHECK_ZERO( XPRSgetdblattrib(lpi->xprslp, XPRS_LPOBJVAL, objval) );
2899 if( activity != NULL )
2905 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
2906 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
2907 CHECK_ZERO( XPRSgetrhs(lpi->xprslp, lpi->rhsarray, 0, nrows-1) );
2908 for (r = 0; r < nrows; r++)
2909 activity[r] = lpi->rhsarray[r] - activity[r];
2930 double *bvec = NULL;
2933 assert(lpi != NULL);
2934 assert(lpi->xprslp != NULL);
2935 assert(ray != NULL);
2936 assert(lpi->solstat >= 0);
2940 if ((lpi->solstat != XPRS_LP_UNBOUNDED) || (lpi->unbvec < 0))
2946 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
2947 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &ncols) );
2948 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_SPAREROWS, &cfirst) );
2951 if (lpi->solmethod == 'd')
2957 memset(ray, 0, ncols* sizeof(*ray));
2960 SCIP_ALLOC( BMSallocMemoryArray(&bind, nrows) );
2961 SCIP_ALLOC( BMSallocMemoryArray(&bvec, nrows) );
2962 memset(bvec, 0, nrows* sizeof(*bvec));
2963 if (lpi->unbvec >= cfirst)
2966 int icol = lpi->unbvec-cfirst;
2969 int *mcolind = NULL;
2970 double *dcolval = NULL;
2972 assert(lpi->cstat[icol] != 1);
2974 dmult = lpi->cstat[icol] ? -1.0 : +1.0;
2975 SCIP_ALLOC( BMSallocMemoryArray(&dcolval, nrows) );
2976 SCIP_ALLOC( BMSallocMemoryArray(&mcolind, nrows) );
2981 for (i = 0; i < nnonz; i++)
2982 bvec[mcolind[i]] = dmult*dcolval[i];
2984 BMSfreeMemoryArray(&dcolval);
2985 BMSfreeMemoryArray(&mcolind);
2991 assert(lpi->rstat[irow] != 1);
2992 dmult = lpi->rstat[irow] ? -1.0 : +1.0;
2998 CHECK_ZERO( XPRSgetpivotorder(lpi->xprslp, bind) );
3001 for (irow = 0; irow < nrows; irow++)
3003 if (bind[irow] >= cfirst)
3004 ray[bind[irow]-cfirst] = bvec[irow];
3007 BMSfreeMemoryArray(&bind);
3008 BMSfreeMemoryArray(&bvec);
3012 CHECK_ZERO( XPRSgetprimalray(lpi->xprslp, ray, &hasRay) );
3027 assert(lpi != NULL);
3028 assert(lpi->xprslp != NULL);
3029 assert(lpi->solstat >= 0);
3030 assert(dualfarkas != NULL);
3034 if (lpi->solstat != XPRS_LP_INFEAS)
3039 if (lpi->solmethod != 'p')
3048 CHECK_ZERO( XPRSgetdualray(lpi->xprslp, dualfarkas, &hasRay) );
3063 assert(lpi != NULL);
3064 assert(lpi->xprslp != NULL);
3065 assert(lpi->solstat >= 0);
3066 assert(iterations != NULL);
3068 *iterations = lpi->iterations;
3084 assert(lpi != NULL);
3085 assert(quality != NULL);
3111 assert(lpi != NULL);
3112 assert(lpi->xprslp != NULL);
3114 SCIPdebugMessage( "saving Xpress basis into %p/%p\n", ( void*)rstat, ( void*)cstat);
3116 CHECK_ZERO( XPRSgetbasis(lpi->xprslp, rstat, cstat) );
3119 #if (XPVERSION < 17)
3125 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
3128 for (c = 0; c < ncols; c++)
3130 assert(cstat[c] >=0 && cstat[c] <= 2);
3134 CHECK_ZERO( XPRSgetlb(lpi->xprslp, &dlb, c, c) );
3135 if (dlb <= XPRS_MINUSINFINITY)
3152 assert(lpi != NULL);
3153 assert(lpi->xprslp != NULL);
3154 assert(cstat != NULL);
3155 assert(rstat != NULL);
3157 SCIPdebugMessage( "loading basis %p/%p into Xpress\n", ( void*)rstat, ( void*)cstat);
3159 invalidateSolution(lpi);
3161 #if (XPVERSION < 17)
3165 int *cstat_xprs = NULL;
3168 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
3169 SCIP_ALLOC( BMSallocMemoryArray(&cstat_xprs, ncols) );
3171 for (c = 0; c < ncols; c++)
3172 cstat_xprs[c] = (cstat[c] == 3) ? 0 : cstat[c];
3173 CHECK_ZERO( XPRSloadbasis(lpi->xprslp, rstat, cstat_xprs) );
3174 BMSfreeMemoryArray(&cstat_xprs);
3177 CHECK_ZERO( XPRSloadbasis(lpi->xprslp, rstat, cstat) );
3197 assert(lpi != NULL);
3198 assert(lpi->xprslp != NULL);
3199 assert(bind != NULL);
3203 CHECK_ZERO( XPRSgetpivotorder(lpi->xprslp, bind) );
3206 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
3207 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_SPAREROWS, &irspace) );
3210 for (r = 0; r < nrows; r++)
3212 if (bind[r] < nrows)
3213 bind[r] = -bind[r]-1;
3216 assert(bind[r] >= irspace);
3217 bind[r] = bind[r] - irspace;
3233 assert(lpi != NULL);
3234 assert(lpi->xprslp != NULL);
3238 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
3239 memset(coef, 0, nrows* sizeof(*coef));
3259 assert(lpi != NULL);
3260 assert(lpi->xprslp != NULL);
3264 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
3265 memset(coef, 0, nrows* sizeof(*coef));
3286 assert(lpi != NULL);
3287 assert(lpi->xprslp != NULL);
3288 assert(binvrow != NULL);
3292 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
3293 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
3297 binvrow = ( double *) binvrow_in;
3299 SCIP_ALLOC( BMSallocMemoryArray(&binvrow, nrows) );
3304 for (c = 0; c < ncols; c++)
3310 CHECK_ZERO( XPRSgetcols(lpi->xprslp, NULL, lpi->indarray, lpi->valarray, nrows, &nnonz, c, c) );
3313 for (i = 0; i < nnonz; i++)
3314 dsum += binvrow[lpi->indarray[i]]*lpi->valarray[i];
3319 if (binvrow_in == NULL)
3320 BMSfreeMemoryArray(&binvrow);
3336 assert(lpi != NULL);
3337 assert(lpi->xprslp != NULL);
3341 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
3347 CHECK_ZERO( XPRSgetcols(lpi->xprslp, NULL, lpi->indarray, lpi->valarray, nrows, &nnonz, c, c) );
3350 memset(coef, 0, nrows* sizeof(*coef));
3351 for (i = 0; i < nnonz; i++)
3352 coef[lpi->indarray[i]] = lpi->valarray[i];
3380 assert(blkmem != NULL);
3381 assert(lpi != NULL);
3382 assert(lpi->xprslp != NULL);
3383 assert(lpistate != NULL);
3386 if( !lpi->solisbasic )
3392 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
3393 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
3398 SCIP_CALL( lpistateCreate(lpistate, blkmem, ncols, nrows) );
3400 SCIPdebugMessage( "storing Xpress LPI state in %p (%d cols, %d rows)\n", ( void*)*lpistate, ncols, nrows);
3406 (*lpistate)->ncols = ncols;
3407 (*lpistate)->nrows = nrows;
3408 lpistatePack(*lpistate, lpi->cstat, lpi->rstat);
3426 assert(blkmem != NULL);
3427 assert(lpi != NULL);
3428 assert(lpi->xprslp != NULL);
3430 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_ROWS, &nrows) );
3431 CHECK_ZERO( XPRSgetintattrib(lpi->xprslp, XPRS_COLS, &ncols) );
3433 assert(lpistate == NULL || lpistate->ncols == ncols);
3434 assert(lpistate == NULL || lpistate->nrows == nrows);
3437 if( lpistate == NULL )
3440 SCIPdebugMessage( "loading LPI state %p (%d cols, %d rows) into Xpress\n", ( void*)lpistate, lpistate->ncols, lpistate->nrows);
3442 if( lpistate->ncols == 0 || lpistate->nrows == 0 )
3446 SCIP_CALL( ensureCstatMem(lpi, lpistate->ncols) );
3447 SCIP_CALL( ensureRstatMem(lpi, lpistate->nrows) );
3450 lpistateUnpack(lpistate, lpi->cstat, lpi->rstat);
3453 for (i = lpistate->ncols; i < ncols; ++i)
3456 CHECK_ZERO( XPRSgetlb(lpi->xprslp, &bnd, i, i) );
3460 CHECK_ZERO( XPRSgetub(lpi->xprslp, &bnd, i, i) );
3469 for (i = lpistate->nrows; i < nrows; ++i)
3483 assert(lpi != NULL);
3498 assert(lpi != NULL);
3499 assert(lpistate != NULL);
3501 if( *lpistate != NULL )
3503 lpistateFree(lpistate, blkmem);
3515 assert(lpi != NULL);
3516 return (lpistate != NULL);
3525 assert(lpi != NULL);
3526 assert(lpi->xprslp != NULL);
3530 CHECK_ZERO( XPRSreadbasis(lpi->xprslp, fname, "") );
3541 assert(lpi != NULL);
3542 assert(lpi->xprslp != NULL);
3546 CHECK_ZERO( XPRSwritebasis(lpi->xprslp, fname, "") );
3572 assert(lpinorms != NULL);
3588 assert(lpinorms == NULL);
3601 assert(lpinorms == NULL);
3628 assert(lpi != NULL);
3629 assert(lpi->xprslp != NULL);
3630 assert(ival != NULL);
3637 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_KEEPBASIS, &ictrlval) );
3638 *ival = (ictrlval == 0);
3641 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_SCALING, &ictrlval) );
3642 *ival = (ictrlval != 0);
3645 *ival = lpi->par_presolve;
3648 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_OUTPUTLOG, &ictrlval) );
3649 *ival = (ictrlval != 0);
3652 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, &ictrlval) );
3654 if( *ival >= XPRS_MAXINT )
3655 *ival = XPRS_MAXINT;
3660 *ival = lpi->par_fastlp;
3676 assert(lpi != NULL);
3677 assert(lpi->xprslp != NULL);
3685 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_KEEPBASIS, (ival == FALSE) ? 1 : 0) );
3689 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_SCALING, (ival == TRUE) ? 35 : 0) );
3693 lpi->par_presolve = ival;
3697 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_OUTPUTLOG, (ival == TRUE) ? 1 : 0) );
3700 ival = MIN(ival, XPRS_MAXINT);
3701 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_LPITERLIMIT, ival) );
3707 lpi->par_fastlp = ival;
3726 assert(lpi != NULL);
3727 assert(lpi->xprslp != NULL);
3728 assert(dval != NULL);
3735 CHECK_ZERO( XPRSgetdblcontrol(lpi->xprslp, XPRS_FEASTOL, &dctrlval) );
3739 CHECK_ZERO( XPRSgetdblcontrol(lpi->xprslp, XPRS_OPTIMALITYTOL, &dctrlval) );
3743 CHECK_ZERO( XPRSgetdblcontrol(lpi->xprslp, XPRS_BARGAPSTOP, &dctrlval) );
3747 CHECK_ZERO( XPRSgetintcontrol(lpi->xprslp, XPRS_MAXTIME, &ictrlval) );
3748 *dval = (double) ictrlval;
3751 CHECK_ZERO( XPRSgetdblcontrol(lpi->xprslp, XPRS_MARKOWITZTOL, &dctrlval) );
3755 *dval = lpi->par_lobjlim;
3758 *dval = lpi->par_uobjlim;
3774 assert(lpi != NULL);
3775 assert(lpi->xprslp != NULL);
3782 CHECK_ZERO( XPRSsetdblcontrol(lpi->xprslp, XPRS_FEASTOL, dval) );
3785 CHECK_ZERO( XPRSsetdblcontrol(lpi->xprslp, XPRS_OPTIMALITYTOL, dval) );
3788 CHECK_ZERO( XPRSsetdblcontrol(lpi->xprslp, XPRS_BARGAPSTOP, dval) );
3792 int ival = (int) dval;
3793 CHECK_ZERO( XPRSsetintcontrol(lpi->xprslp, XPRS_MAXTIME, ival) );
3797 CHECK_ZERO( XPRSsetdblcontrol(lpi->xprslp, XPRS_MARKOWITZTOL, dval) );
3800 lpi->par_lobjlim = dval;
3803 lpi->par_uobjlim = dval;
3829 assert(lpi != NULL);
3830 return XPRS_PLUSINFINITY;
3839 assert(lpi != NULL);
3840 return (val >= XPRS_PLUSINFINITY);
3861 assert(lpi != NULL);
3862 assert(lpi->xprslp != NULL);
3866 CHECK_ZERO( XPRSreadprob(lpi->xprslp, fname, "") );
3877 assert(lpi != NULL);
3878 assert(lpi->xprslp != NULL);
3882 CHECK_ZERO( XPRSwriteprob(lpi->xprslp, fname, "p") );
|