|
Go to the documentation of this file.
51 #define CHECK_ZERO(messagehdlr, x) { int _restat_; \
52 if( (_restat_ = (x)) != 0 ) \
54 SCIPmessagePrintWarning((messagehdlr), "Gurobi error %d: %s\n", _restat_, GRBgeterrormsg(grbenv)); \
55 return SCIP_LPERROR; \
59 #if( GRB_VERSION_MAJOR < 4 )
60 #define GRB_METHOD_DUAL GRB_LPMETHOD_DUAL
61 #define GRB_METHOD_PRIMAL GRB_LPMETHOD_PRIMAL
62 #define GRB_INT_PAR_METHOD GRB_INT_PAR_LPMETHOD
66 #define SCIP_SINGLEPACKETSIZE (sizeof(SCIP_SINGLEPACKET)*8)
68 #define SCIP_DUALPACKETSIZE (sizeof(SCIP_DUALPACKET)*4)
71 #define COLS_PER_PACKET SCIP_DUALPACKETSIZE
73 #define ROWS_PER_PACKET SCIP_DUALPACKETSIZE
79 #define GRB_REFACTORMAXITERS 50
87 GRB_INT_PAR_SCALEFLAG,
89 GRB_INT_PAR_SIMPLEXPRICING,
90 GRB_INT_PAR_OUTPUTFLAG
97 GRB_DBL_PAR_FEASIBILITYTOL,
98 GRB_DBL_PAR_OPTIMALITYTOL,
100 GRB_DBL_PAR_TIMELIMIT,
101 GRB_DBL_PAR_ITERATIONLIMIT,
102 GRB_DBL_PAR_MARKOWITZTOL
160 static GRBenv* grbenv = NULL;
161 static int numlp = 0;
178 if( num > lpi->sidechgsize )
182 newsize = MAX(2*lpi->sidechgsize, num);
183 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->senarray, newsize) );
184 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rhsarray, newsize) );
185 lpi->sidechgsize = newsize;
187 assert(num <= lpi->sidechgsize);
201 if( num > lpi->valsize )
205 newsize = MAX(2*lpi->valsize, num);
206 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->valarray, newsize) );
207 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->indarray, newsize) );
208 lpi->valsize = newsize;
210 assert(num <= lpi->valsize);
224 if( num > lpi->cstatsize )
228 newsize = MAX(2*lpi->cstatsize, num);
229 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->cstat, newsize) );
230 lpi->cstatsize = newsize;
232 assert(num <= lpi->cstatsize);
246 if( num > lpi->rstatsize )
250 newsize = MAX(2*lpi->rstatsize, num);
251 SCIP_ALLOC( BMSreallocMemoryArray(&lpi->rstat, newsize) );
252 lpi->rstatsize = newsize;
254 assert(num <= lpi->rstatsize);
270 assert( lpi != NULL );
271 assert( lpi->grbmodel != NULL );
272 assert( lpi->grbenv != NULL );
275 if ( success != NULL )
278 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
279 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
286 res = GRBgetintattrarray(lpi->grbmodel, GRB_INT_ATTR_VBASIS, 0, ncols, lpi->cstat);
287 if ( res == GRB_ERROR_DATA_NOT_AVAILABLE )
290 if ( success != NULL )
296 SCIPerrorMessage( "Gurobi error %d: %s\n", res, GRBgeterrormsg(lpi->grbenv));
300 res = GRBgetintattrarray(lpi->grbmodel, GRB_INT_ATTR_CBASIS, 0, nrows, lpi->rstat);
301 if ( res == GRB_ERROR_DATA_NOT_AVAILABLE )
304 if ( success != NULL )
310 SCIPerrorMessage( "Gurobi error %d: %s\n", res, GRBgeterrormsg(lpi->grbenv));
326 assert( lpi != NULL );
327 assert( lpi->grbmodel != NULL );
331 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
332 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
335 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrarray(lpi->grbmodel, GRB_INT_ATTR_VBASIS, 0, ncols, lpi->cstat) );
336 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrarray(lpi->grbmodel, GRB_INT_ATTR_CBASIS, 0, nrows, lpi->rstat) );
338 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
373 void SCIPencodeDualBitNeg(
380 {0x00000000, 0x00000001, 0x00000002, 0x00000003},
381 {0x00000000, 0x00000004, 0x00000008, 0x0000000C},
382 {0x00000000, 0x00000010, 0x00000020, 0x00000030},
383 {0x00000000, 0x00000040, 0x00000080, 0x000000C0},
384 {0x00000000, 0x00000100, 0x00000200, 0x00000300},
385 {0x00000000, 0x00000400, 0x00000800, 0x00000C00},
386 {0x00000000, 0x00001000, 0x00002000, 0x00003000},
387 {0x00000000, 0x00004000, 0x00008000, 0x0000C000},
388 {0x00000000, 0x00010000, 0x00020000, 0x00030000},
389 {0x00000000, 0x00040000, 0x00080000, 0x000C0000},
390 {0x00000000, 0x00100000, 0x00200000, 0x00300000},
391 {0x00000000, 0x00400000, 0x00800000, 0x00C00000},
392 {0x00000000, 0x01000000, 0x02000000, 0x03000000},
393 {0x00000000, 0x04000000, 0x08000000, 0x0C000000},
394 {0x00000000, 0x10000000, 0x20000000, 0x30000000},
395 {0x00000000, 0x40000000, 0x80000000, 0xC0000000}
401 assert(inp != NULL || count == 0);
402 assert(out != NULL || count == 0);
407 nfull = count - rest;
418 assert(0 <= -inp[j] && -inp[j] <= 3);
422 mask[0][-inp[0]] | mask[1][-inp[1]] | mask[2][-inp[2]] | mask[3][inp[3]]
423 | mask[4][-inp[4]] | mask[5][-inp[5]] | mask[6][-inp[6]]
424 | mask[7][-inp[7]] | mask[8][-inp[8]] | mask[9][-inp[9]]
425 | mask[10][-inp[10]] | mask[11][-inp[11]] | mask[12][-inp[12]]
426 | mask[13][-inp[13]] | mask[14][-inp[14]] | mask[15][-inp[15]];
436 for( i = 0; i < rest; i++ )
437 m |= mask[i][-inp[i]];
444 void SCIPdecodeDualBitNeg(
455 assert(inp != NULL || count == 0);
456 assert(out != NULL || count == 0);
461 nfull = count - rest;
470 *out++ = -(int)(m & 3);
472 *out++ = -(int)(m & 3);
474 *out++ = -(int)(m & 3);
476 *out++ = -(int)(m & 3);
478 *out++ = -(int)(m & 3);
480 *out++ = -(int)(m & 3);
482 *out++ = -(int)(m & 3);
484 *out++ = -(int)(m & 3);
486 *out++ = -(int)(m & 3);
488 *out++ = -(int)(m & 3);
490 *out++ = -(int)(m & 3);
492 *out++ = -(int)(m & 3);
494 *out++ = -(int)(m & 3);
496 *out++ = -(int)(m & 3);
498 *out++ = -(int)(m & 3);
500 *out++ = -(int)(m & 3);
510 for( i = 0; i < rest; i++ )
512 *out++ = -(int)(m & 3);
526 assert(lpistate != NULL);
527 assert(lpistate->packcstat != NULL);
528 assert(lpistate->packrstat != NULL);
530 SCIPencodeDualBitNeg(cstat, lpistate->packcstat, lpistate->ncols);
531 SCIPencodeDualBitNeg(rstat, lpistate->packrstat, lpistate->nrows);
542 assert(lpistate != NULL);
543 assert(lpistate->packcstat != NULL);
544 assert(lpistate->packrstat != NULL);
546 SCIPdecodeDualBitNeg(lpistate->packcstat, cstat, lpistate->ncols);
547 SCIPdecodeDualBitNeg(lpistate->packrstat, rstat, lpistate->nrows);
559 assert(lpistate != NULL);
560 assert(blkmem != NULL);
564 SCIP_ALLOC( BMSallocBlockMemory(blkmem, lpistate) );
565 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->packcstat, colpacketNum(ncols)) );
566 SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &(*lpistate)->packrstat, rowpacketNum(nrows)) );
578 assert(blkmem != NULL);
579 assert(lpistate != NULL);
580 assert(*lpistate != NULL);
582 BMSfreeBlockMemoryArrayNull(blkmem, &(*lpistate)->packcstat, colpacketNum((*lpistate)->ncols));
583 BMSfreeBlockMemoryArrayNull(blkmem, &(*lpistate)->packrstat, rowpacketNum((*lpistate)->nrows));
584 BMSfreeBlockMemory(blkmem, lpistate);
602 assert( lpi != NULL );
603 assert( lpi->grbenv != NULL );
604 assert( grbparam != NULL );
610 CHECK_ZERO( lpi->messagehdlr, GRBgetintparam(lpi->grbenv, intparam[i], &(grbparam->intparval[i])) );
614 CHECK_ZERO( lpi->messagehdlr, GRBgetdblparam(lpi->grbenv, dblparam[i], &(grbparam->dblparval[i])) );
630 SCIP_CALL( getParameterValues(lpi, &par) );
632 assert( lpi->curparam.intparval[i] == par.intparval[i] );
634 assert( MAX(lpi->curparam.dblparval[i], dblparammin[i]) == par.dblparval[i]);
649 assert( lpi != NULL );
650 assert( lpi->grbenv != NULL );
651 assert( grbparam != NULL );
657 if( lpi->curparam.intparval[i] != grbparam->intparval[i] )
660 intparam[i], lpi->curparam.intparval[i], grbparam->intparval[i]);
661 lpi->curparam.intparval[i] = grbparam->intparval[i];
662 CHECK_ZERO( lpi->messagehdlr, GRBsetintparam(lpi->grbenv, intparam[i], lpi->curparam.intparval[i]) );
667 if( lpi->curparam.dblparval[i] != grbparam->dblparval[i] )
670 dblparam[i], lpi->curparam.dblparval[i], MAX(grbparam->dblparval[i], dblparammin[i]));
671 lpi->curparam.dblparval[i] = MAX(grbparam->dblparval[i], dblparammin[i]);
672 CHECK_ZERO( lpi->messagehdlr, GRBsetdblparam(lpi->grbenv, dblparam[i], lpi->curparam.dblparval[i]) );
683 void copyParameterValues(
691 dest->intparval[i] = source->intparval[i];
692 for( i = 0; i < NUMDBLPARAM; ++i )
693 dest->dblparval[i] = source->dblparval[i];
706 assert( lpi != NULL );
710 if( strcmp(intparam[i], param) == 0 )
712 *p = lpi->grbparam.intparval[i];
731 assert( lpi != NULL );
735 if( strcmp(intparam[i], param) == 0 )
737 lpi->grbparam.intparval[i] = parval;
756 if( strcmp(dblparam[i], param) == 0 )
758 *p = lpi->grbparam.dblparval[i];
777 assert( lpi != NULL );
781 if( strcmp(dblparam[i], param) == 0 )
783 lpi->grbparam.dblparval[i] = parval;
794 void invalidateSolution(
821 for( i = 0; i < nrows; ++i )
823 assert(lhs[i] <= rhs[i]);
825 if( lhs[i] == rhs[i] )
827 assert(-GRB_INFINITY < rhs[i] && rhs[i] < GRB_INFINITY);
828 lpi->senarray[i] = GRB_EQUAL;
829 lpi->rhsarray[i] = rhs[i];
831 else if( lhs[i] <= -GRB_INFINITY )
833 assert(-GRB_INFINITY < rhs[i] && rhs[i] < GRB_INFINITY);
834 lpi->senarray[i] = GRB_LESS_EQUAL;
835 lpi->rhsarray[i] = rhs[i];
837 else if( rhs[i] >= GRB_INFINITY )
839 assert(-GRB_INFINITY < lhs[i] && lhs[i] < GRB_INFINITY);
840 lpi->senarray[i] = GRB_GREATER_EQUAL;
841 lpi->rhsarray[i] = lhs[i];
871 for (i = 0; i < nrows; ++i)
873 switch( lpi->senarray[i] )
876 lhs[i] = lpi->rhsarray[i];
877 rhs[i] = lpi->rhsarray[i];
881 lhs[i] = -GRB_INFINITY;
882 rhs[i] = lpi->rhsarray[i];
885 case GRB_GREATER_EQUAL:
886 lhs[i] = lpi->rhsarray[i];
887 rhs[i] = GRB_INFINITY;
895 assert(lhs[i] <= rhs[i]);
914 for (i = 0; i < nrows; ++i)
916 switch( lpi->senarray[i] )
919 lhs[i] = lpi->rhsarray[i];
923 lhs[i] = -GRB_INFINITY;
926 case GRB_GREATER_EQUAL:
927 lhs[i] = lpi->rhsarray[i];
953 for (i = 0; i < nrows; ++i)
955 switch( lpi->senarray[i] )
958 rhs[i] = lpi->rhsarray[i];
962 rhs[i] = lpi->rhsarray[i];
965 case GRB_GREATER_EQUAL:
966 rhs[i] = GRB_INFINITY;
989 SCIP_CALL( reconvertBothSides(lpi, nrows, lhs, rhs) );
991 else if( lhs != NULL )
993 SCIP_CALL( reconvertLhs(lpi, nrows, lhs) );
995 else if( rhs != NULL )
997 SCIP_CALL( reconvertRhs(lpi, nrows, rhs) );
1008 assert( lpi != NULL );
1012 CHECK_ZERO( lpi->messagehdlr, GRBoptimize(lpi->grbmodel) );
1024 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_ITERCOUNT, &cnt) );
1026 SCIPmessagePrintWarning(lpi->messagehdlr, "Gurobi needed %d iterations to restore optimal basis.\n", ( int) cnt);
1044 static char grbname[100];
1058 GRBversion(&major, &minor, &technical);
1059 snprintf(grbname, 100, "Gurobi %d.%d.%d", major, minor, technical);
1068 return "Linear Programming Solver developed by Gurobi Optimization (www.gurobi.com)";
1079 return ( void*) lpi->grbmodel;
1101 assert( sizeof( SCIP_Real) == sizeof( double));
1102 assert( sizeof( SCIP_Bool) == sizeof( int));
1103 assert(lpi != NULL);
1112 if ( grbenv == NULL )
1118 CHECK_ZERO( messagehdlr, GRBsetintparam(grbenv, GRB_INT_PAR_OUTPUTFLAG, 0) );
1121 CHECK_ZERO( messagehdlr, GRBsetintparam(grbenv, GRB_INT_PAR_INFUNBDINFO, 1) );
1123 assert( grbenv != NULL );
1130 (*lpi)->grbenv = GRBgetenv((*lpi)->grbmodel);
1131 (*lpi)->senarray = NULL;
1132 (*lpi)->rhsarray = NULL;
1133 (*lpi)->valarray = NULL;
1134 (*lpi)->cstat = NULL;
1135 (*lpi)->rstat = NULL;
1136 (*lpi)->indarray = NULL;
1137 (*lpi)->sidechgsize = 0;
1138 (*lpi)->valsize = 0;
1139 (*lpi)->cstatsize = 0;
1140 (*lpi)->rstatsize = 0;
1141 (*lpi)->iterations = 0;
1142 (*lpi)->solisbasic = FALSE;
1143 (*lpi)->fromscratch = FALSE;
1145 (*lpi)->messagehdlr = messagehdlr;
1146 invalidateSolution(*lpi);
1149 SCIP_CALL( getParameterValues((*lpi), &((*lpi)->defparam)) );
1150 copyParameterValues(&((*lpi)->curparam), &((*lpi)->defparam));
1151 copyParameterValues(&((*lpi)->grbparam), &((*lpi)->defparam));
1170 assert(grbenv != NULL);
1171 assert(lpi != NULL);
1172 assert(*lpi != NULL);
1177 CHECK_ZERO( (*lpi)->messagehdlr, GRBfreemodel((*lpi)->grbmodel) );
1180 BMSfreeMemoryArrayNull(&(*lpi)->senarray);
1181 BMSfreeMemoryArrayNull(&(*lpi)->rhsarray);
1182 BMSfreeMemoryArrayNull(&(*lpi)->cstat);
1183 BMSfreeMemoryArrayNull(&(*lpi)->rstat);
1232 assert(lpi != NULL);
1233 assert(lpi->grbmodel != NULL);
1234 assert(lpi->grbenv != NULL);
1237 SCIPdebugMessage( "loading LP in column format into Gurobi: %d cols, %d rows\n", ncols, nrows);
1239 invalidateSolution(lpi);
1241 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
1244 SCIP_CALL( convertSides(lpi, nrows, lhs, rhs, &rngcount) );
1245 assert( rngcount == 0 );
1248 SCIP_ALLOC( BMSallocMemoryArray(&cnt, ncols) );
1249 for( c = 0; c < ncols-1; ++c )
1251 cnt[c] = beg[c+1] - beg[c];
1252 assert(cnt[c] >= 0);
1254 cnt[ncols-1] = nnonz - beg[ncols-1];
1255 assert(cnt[ncols-1] >= 0);
1258 assert( lpi->grbmodel != NULL );
1259 CHECK_ZERO( lpi->messagehdlr, GRBfreemodel(lpi->grbmodel) );
1262 CHECK_ZERO( lpi->messagehdlr, GRBloadmodel(lpi->grbenv, &(lpi->grbmodel), NULL, ncols, nrows, objsen, 0.0, ( SCIP_Real*)obj,
1263 lpi->senarray, lpi->rhsarray, ( int*)beg, cnt, ( int*)ind, ( SCIP_Real*)val, ( SCIP_Real*)lb, ( SCIP_Real*)ub, NULL, colnames, rownames) );
1264 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1267 BMSfreeMemoryArray(&cnt);
1273 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &temp) );
1274 assert( temp == ncols);
1276 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &temp) );
1277 assert( temp == nrows);
1279 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMNZS, &temp) );
1280 assert( temp == nnonz);
1301 assert(lpi != NULL);
1302 assert(lpi->grbmodel != NULL);
1304 SCIPdebugMessage( "adding %d columns with %d nonzeros to Gurobi\n", ncols, nnonz);
1306 invalidateSolution(lpi);
1309 CHECK_ZERO( lpi->messagehdlr, GRBaddvars(lpi->grbmodel, ncols, nnonz, ( int*)beg, ( int*)ind, ( SCIP_Real*)val, ( SCIP_Real*)obj, ( SCIP_Real*)lb, ( SCIP_Real*)ub, NULL, colnames) )
1310 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1325 assert(lpi != NULL);
1326 assert(lpi->grbmodel != NULL);
1331 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &temp) );
1332 assert(0 <= firstcol && firstcol <= lastcol && lastcol < temp);
1336 SCIPdebugMessage( "deleting %d columns from Gurobi\n", lastcol - firstcol + 1);
1338 invalidateSolution(lpi);
1341 SCIP_ALLOC( BMSallocMemoryArray(&which, lastcol-firstcol+1) );;
1342 for( j = firstcol; j <= lastcol; ++j )
1343 which[j - firstcol] = j;
1345 CHECK_ZERO( lpi->messagehdlr, GRBdelvars(lpi->grbmodel, lastcol-firstcol+1, which) );
1346 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1348 BMSfreeMemoryArray( &which );
1364 assert(lpi != NULL);
1365 assert(lpi->grbmodel != NULL);
1369 invalidateSolution(lpi);
1372 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &nvars) );
1374 SCIP_ALLOC( BMSallocMemoryArray(&which, nvars) );;
1376 for( j = 0; j < nvars; ++j )
1381 CHECK_ZERO( lpi->messagehdlr, GRBdelvars(lpi->grbmodel, num, which) );
1382 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1384 BMSfreeMemoryArray( &which );
1404 assert(lpi != NULL);
1405 assert(lpi->grbmodel != NULL);
1407 SCIPdebugMessage( "adding %d rows with %d nonzeros to Gurobi\n", nrows, nnonz);
1409 invalidateSolution(lpi);
1411 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
1414 SCIP_CALL( convertSides(lpi, nrows, lhs, rhs, &rngcount) );
1415 assert( rngcount == 0 );
1418 CHECK_ZERO( lpi->messagehdlr, GRBaddconstrs(lpi->grbmodel, nrows, nnonz, ( int*)beg, ( int*)ind, ( SCIP_Real*)val, lpi->senarray, lpi->rhsarray, rownames) );
1419 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1434 assert(lpi != NULL);
1435 assert(lpi->grbmodel != NULL);
1439 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
1440 assert(0 <= firstrow && firstrow <= lastrow && lastrow < nrows);
1444 SCIPdebugMessage( "deleting %d rows from Gurobi\n", lastrow - firstrow + 1);
1446 invalidateSolution(lpi);
1449 SCIP_ALLOC( BMSallocMemoryArray(&which, lastrow-firstrow+1) );;
1450 for( i = firstrow; i <= lastrow; ++i )
1451 which[i - firstrow] = i;
1453 CHECK_ZERO( lpi->messagehdlr, GRBdelconstrs(lpi->grbmodel, lastrow-firstrow+1, which) );
1454 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1456 BMSfreeMemoryArray( &which );
1473 assert(lpi != NULL);
1474 assert(lpi->grbmodel != NULL);
1478 invalidateSolution(lpi);
1481 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
1482 SCIP_ALLOC( BMSallocMemoryArray(&which, nrows) );;
1484 for( i = 0; i < nrows; ++i )
1489 CHECK_ZERO( lpi->messagehdlr, GRBdelconstrs(lpi->grbmodel, num, which) );
1490 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1494 for( i = 0; i < nrows; ++i )
1505 BMSfreeMemoryArray( &which );
1515 assert( lpi != NULL );
1516 assert( lpi->grbmodel != NULL );
1517 assert( lpi->grbenv != NULL );
1521 invalidateSolution(lpi);
1523 CHECK_ZERO( lpi->messagehdlr, GRBfreemodel(lpi->grbmodel) );
1525 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1539 assert(lpi != NULL);
1540 assert(lpi->grbmodel != NULL);
1546 for( i = 0; i < ncols; ++i )
1551 invalidateSolution(lpi);
1553 CHECK_ZERO( lpi->messagehdlr, GRBsetdblattrlist(lpi->grbmodel, GRB_DBL_ATTR_LB, ncols, ( int*)ind, ( SCIP_Real*)lb) );
1554 CHECK_ZERO( lpi->messagehdlr, GRBsetdblattrlist(lpi->grbmodel, GRB_DBL_ATTR_UB, ncols, ( int*)ind, ( SCIP_Real*)ub) );
1556 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1572 assert(lpi != NULL);
1573 assert(lpi->grbmodel != NULL);
1577 invalidateSolution(lpi);
1580 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
1581 SCIP_CALL( convertSides(lpi, nrows, lhs, rhs, &rngcount) );
1582 assert( rngcount == 0 );
1585 CHECK_ZERO( lpi->messagehdlr, GRBsetdblattrlist(lpi->grbmodel, GRB_DBL_ATTR_RHS, nrows, ( int*)ind, lpi->rhsarray) );
1586 CHECK_ZERO( lpi->messagehdlr, GRBsetcharattrlist(lpi->grbmodel, GRB_CHAR_ATTR_SENSE, nrows, ( int*)ind, lpi->senarray) );
1588 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1601 assert(lpi != NULL);
1602 assert(lpi->grbmodel != NULL);
1604 SCIPdebugMessage( "changing coefficient row %d, column %d in Gurobi to %g\n", row, col, newval);
1606 invalidateSolution(lpi);
1608 CHECK_ZERO( lpi->messagehdlr, GRBchgcoeffs(lpi->grbmodel, 1, &row, &col, &newval) );
1609 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1620 assert(lpi != NULL);
1621 assert(lpi->grbmodel != NULL);
1626 invalidateSolution(lpi);
1629 CHECK_ZERO( lpi->messagehdlr, GRBsetintattr(lpi->grbmodel, GRB_INT_ATTR_MODELSENSE, objsen) );
1631 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1644 assert(lpi != NULL);
1645 assert(lpi->grbmodel != NULL);
1649 CHECK_ZERO( lpi->messagehdlr, GRBsetdblattrlist(lpi->grbmodel, GRB_DBL_ATTR_OBJ, ncols, ind, obj) );
1651 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
1670 assert(lpi != NULL);
1671 assert(lpi->grbmodel != NULL);
1672 assert(scaleval != 0.0);
1674 SCIPdebugMessage( "scaling row %d with factor %g in Gurobi\n", row, scaleval);
1676 invalidateSolution(lpi);
1678 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
1685 for( i = 0; i < nnonz; ++i )
1691 if( lhs > -GRB_INFINITY )
1693 else if( scaleval < 0.0 )
1695 if( rhs < GRB_INFINITY )
1697 else if( scaleval < 0.0 )
1698 rhs = -GRB_INFINITY;
1699 if( scaleval > 0.0 )
1728 assert(lpi != NULL);
1729 assert(lpi->grbmodel != NULL);
1730 assert(scaleval != 0.0);
1732 SCIPdebugMessage( "scaling column %d with factor %g in Gurobi\n", col, scaleval);
1734 invalidateSolution(lpi);
1736 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
1746 for( i = 0; i < nnonz; ++i )
1756 if( lb > -GRB_INFINITY )
1758 else if( scaleval < 0.0 )
1760 if( ub < GRB_INFINITY )
1762 else if( scaleval < 0.0 )
1764 if( scaleval > 0.0 )
1794 assert(lpi != NULL);
1795 assert(nrows != NULL);
1799 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, nrows) );
1810 assert(lpi != NULL);
1811 assert(ncols != NULL);
1815 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, ncols) );
1826 assert(lpi != NULL);
1827 assert(nnonz != NULL);
1831 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMNZS, nnonz) );
1852 assert(lpi != NULL);
1853 assert(lpi->grbmodel != NULL);
1857 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
1858 assert(0 <= firstcol && firstcol <= lastcol && lastcol < ncols);
1868 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_LB, firstcol, lastcol-firstcol+1, lb) );
1869 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_UB, firstcol, lastcol-firstcol+1, ub) );
1876 assert(beg != NULL);
1877 assert(ind != NULL);
1878 assert(val != NULL);
1881 CHECK_ZERO( lpi->messagehdlr, GRBgetvars(lpi->grbmodel, nnonz, beg, ind, val, firstcol, lastcol-firstcol+1) )
1885 assert(beg == NULL);
1886 assert(ind == NULL);
1887 assert(val == NULL);
1909 assert(lpi != NULL);
1910 assert(lpi->grbmodel != NULL);
1914 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
1915 assert(0 <= firstrow && firstrow <= lastrow && lastrow < nrows);
1924 SCIP_CALL( ensureSidechgMem(lpi, lastrow - firstrow + 1) );
1925 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_RHS, firstrow, lastrow-firstrow+1, lpi->rhsarray) );
1926 CHECK_ZERO( lpi->messagehdlr, GRBgetcharattrarray(lpi->grbmodel, GRB_CHAR_ATTR_SENSE, firstrow, lastrow-firstrow+1, lpi->senarray) );
1929 SCIP_CALL( reconvertSides(lpi, lastrow - firstrow + 1, lhs, rhs) );
1934 assert(beg != NULL);
1935 assert(ind != NULL);
1936 assert(val != NULL);
1939 CHECK_ZERO( lpi->messagehdlr, GRBgetconstrs(lpi->grbmodel, nnonz, beg, ind, val, firstrow, lastrow-firstrow+1) );
1943 assert(beg == NULL);
1944 assert(ind == NULL);
1945 assert(val == NULL);
1958 int namestoragesize,
1973 int namestoragesize,
1989 assert( lpi != NULL );
1990 assert( lpi->grbmodel != NULL );
1991 assert( objsen != NULL );
1995 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_MODELSENSE, &grbobjsen) );
1996 assert(grbobjsen == GRB_MINIMIZE || grbobjsen == GRB_MAXIMIZE);
2011 assert(lpi != NULL);
2012 assert(lpi->grbmodel != NULL);
2013 assert(firstcol <= lastcol);
2014 assert(vals != NULL);
2016 SCIPdebugMessage( "getting objective values %d to %d\n", firstcol, lastcol);
2018 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_OBJ, firstcol, lastcol-firstcol+1, vals) );
2032 assert(lpi != NULL);
2033 assert(lpi->grbmodel != NULL);
2037 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
2038 assert(0 <= firstcol && firstcol <= lastcol && lastcol < ncols);
2046 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_LB, firstcol, lastcol-firstcol+1, lbs) );
2051 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_UB, firstcol, lastcol-firstcol+1, ubs) );
2066 assert(lpi != NULL);
2067 assert(lpi->grbmodel != NULL);
2068 assert(firstrow <= lastrow);
2073 SCIP_CALL( ensureSidechgMem(lpi, lastrow - firstrow + 1) );
2075 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_RHS, firstrow, lastrow-firstrow+1, lpi->rhsarray) );
2076 CHECK_ZERO( lpi->messagehdlr, GRBgetcharattrarray(lpi->grbmodel, GRB_CHAR_ATTR_SENSE, firstrow, lastrow-firstrow+1, lpi->senarray) );
2079 SCIP_CALL( reconvertSides(lpi, lastrow - firstrow + 1, lhss, rhss) );
2092 assert(lpi != NULL);
2093 assert(lpi->grbmodel != NULL);
2097 CHECK_ZERO( lpi->messagehdlr, GRBgetcoeff(lpi->grbmodel, row, col, val) );
2127 assert( lpi != NULL );
2128 assert( lpi->grbmodel != NULL );
2129 assert( lpi->grbenv != NULL );
2134 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
2135 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
2136 SCIPdebugMessage( "calling Gurobi primal simplex: %d cols, %d rows\n", ncols, nrows);
2140 invalidateSolution(lpi);
2142 if ( lpi->fromscratch )
2144 CHECK_ZERO( lpi->messagehdlr, GRBresetmodel(lpi->grbmodel) );
2150 SCIP_CALL( setParameterValues(lpi, &(lpi->grbparam)) );
2153 retval = GRBoptimize(lpi->grbmodel);
2158 case GRB_ERROR_OUT_OF_MEMORY:
2164 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_ITERCOUNT, &cnt) );
2165 lpi->iterations = (int) cnt;
2167 lpi->solisbasic = TRUE;
2168 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &lpi->solstat) );
2170 SCIPdebugMessage( "Gurobi primal simplex needed %d iterations to gain LP status %d\n", ( int) cnt, lpi->solstat);
2177 primalfeasible = FALSE;
2178 dualfeasible = FALSE;
2180 if( lpi->solstat == GRB_INF_OR_UNBD
2181 || (lpi->solstat == GRB_INFEASIBLE && !dualfeasible)
2182 || (lpi->solstat == GRB_UNBOUNDED && !primalfeasible) )
2186 CHECK_ZERO( lpi->messagehdlr, GRBgetintparam(lpi->grbenv, GRB_INT_PAR_PRESOLVE, &presolve) );
2188 if( presolve != GRB_PRESOLVE_OFF )
2191 SCIPdebugMessage( "presolver may have solved the problem -> calling Gurobi primal simplex again without presolve\n");
2194 CHECK_ZERO( lpi->messagehdlr, GRBsetintparam(lpi->grbenv, GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_OFF) );
2196 retval = GRBoptimize(lpi->grbmodel);
2201 case GRB_ERROR_OUT_OF_MEMORY:
2207 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_ITERCOUNT, &cnt) );
2208 lpi->iterations += (int) cnt;
2209 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &lpi->solstat) );
2210 SCIPdebugMessage( " -> Gurobi returned solstat=%d (%d iterations)\n", lpi->solstat, lpi->iterations);
2213 CHECK_ZERO( lpi->messagehdlr, GRBsetintparam(lpi->grbenv, GRB_INT_PAR_PRESOLVE, presolve) );
2216 if( lpi->solstat == GRB_INF_OR_UNBD )
2219 SCIPerrorMessage( "Gurobi primal simplex returned GRB_INF_OR_UNBD after presolving was turned off\n");
2237 assert( lpi != NULL );
2238 assert( lpi->grbmodel != NULL );
2239 assert( lpi->grbenv != NULL );
2244 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
2245 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
2246 SCIPdebugMessage( "calling Gurobi dual simplex: %d cols, %d rows\n", ncols, nrows);
2250 invalidateSolution(lpi);
2252 if ( lpi->fromscratch )
2254 CHECK_ZERO( lpi->messagehdlr, GRBresetmodel(lpi->grbmodel) );
2259 SCIP_CALL( setParameterValues(lpi, &(lpi->grbparam)) );
2264 retval = GRBoptimize(lpi->grbmodel);
2269 case GRB_ERROR_OUT_OF_MEMORY:
2275 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_ITERCOUNT, &cnt) );
2276 lpi->iterations = (int) cnt;
2278 lpi->solisbasic = TRUE;
2279 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &lpi->solstat) );
2281 SCIPdebugMessage( "Gurobi dual simplex needed %d iterations to gain LP status %d\n", ( int) cnt, lpi->solstat);
2288 if( lpi->solstat == GRB_INF_OR_UNBD )
2291 CHECK_ZERO( lpi->messagehdlr, getIntParam(lpi, GRB_INT_PAR_PRESOLVE, &presolve) );
2293 if( presolve != GRB_PRESOLVE_OFF )
2296 SCIPdebugMessage( "presolver may have solved the problem -> calling Gurobi dual simplex again without presolve\n");
2299 CHECK_ZERO( lpi->messagehdlr, setIntParam(lpi, GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_OFF) );
2300 SCIP_CALL( setParameterValues(lpi, &(lpi->grbparam)) );
2302 retval = GRBoptimize(lpi->grbmodel);
2307 case GRB_ERROR_OUT_OF_MEMORY:
2313 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_ITERCOUNT, &cnt) );
2314 lpi->iterations += (int) cnt;
2315 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &lpi->solstat) );
2316 SCIPdebugMessage( " -> Gurobi returned solstat=%d (%d iterations)\n", lpi->solstat, lpi->iterations);
2319 CHECK_ZERO( lpi->messagehdlr, setIntParam(lpi, GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_AUTO) );
2322 if( lpi->solstat == GRB_INF_OR_UNBD )
2325 SCIPerrorMessage( "Gurobi dual simplex returned GRB_INF_OR_UNBD after presolving was turned off\n");
2341 assert( lpi != NULL );
2342 assert( lpi->grbmodel != NULL );
2343 assert( lpi->grbenv != NULL );
2348 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
2349 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
2350 SCIPdebugMessage( "calling Gurobi barrier: %d cols, %d rows\n", ncols, nrows);
2354 invalidateSolution(lpi);
2356 if ( lpi->fromscratch )
2358 CHECK_ZERO( lpi->messagehdlr, GRBresetmodel(lpi->grbmodel) );
2364 SCIP_CALL( setParameterValues(lpi, &(lpi->grbparam)) );
2369 CHECK_ZERO( lpi->messagehdlr, GRBsetintparam(lpi->grbenv, GRB_INT_PAR_CROSSOVER, -1) );
2374 CHECK_ZERO( lpi->messagehdlr, GRBsetintparam(lpi->grbenv, GRB_INT_PAR_CROSSOVER, 0) );
2379 retval = GRBoptimize(lpi->grbmodel);
2384 case GRB_ERROR_OUT_OF_MEMORY:
2390 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_ITERCOUNT, &cnt) );
2391 lpi->iterations = (int) cnt;
2393 lpi->solisbasic = crossover;
2394 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &lpi->solstat) );
2396 SCIPdebugMessage( "Gurobi barrier needed %d iterations to gain LP status %d\n", ( int) cnt, lpi->solstat);
2403 if( lpi->solstat == GRB_INF_OR_UNBD )
2406 CHECK_ZERO( lpi->messagehdlr, getIntParam(lpi, GRB_INT_PAR_PRESOLVE, &presolve) );
2408 if( presolve != GRB_PRESOLVE_OFF )
2411 SCIPdebugMessage( "presolver may have solved the problem -> calling Gurobi barrier again without presolve\n");
2414 CHECK_ZERO( lpi->messagehdlr, setIntParam(lpi, GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_OFF) );
2415 SCIP_CALL( setParameterValues(lpi, &(lpi->grbparam)) );
2417 retval = GRBoptimize(lpi->grbmodel);
2422 case GRB_ERROR_OUT_OF_MEMORY:
2428 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_ITERCOUNT, &cnt) );
2429 lpi->iterations += (int) cnt;
2430 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &lpi->solstat) );
2431 SCIPdebugMessage( " -> Gurobi returned solstat=%d (%d iterations)\n", lpi->solstat, lpi->iterations);
2434 CHECK_ZERO( lpi->messagehdlr, setIntParam(lpi, GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_AUTO) );
2437 if( lpi->solstat == GRB_INF_OR_UNBD )
2440 SCIPerrorMessage( "Gurobi dual simplex returned GRB_INF_OR_UNBD after presolving was turned off\n");
2490 assert( lpi != NULL );
2491 assert( lpi->grbmodel != NULL );
2492 assert( lpi->grbenv != NULL );
2493 assert( down != NULL );
2494 assert( up != NULL );
2495 assert( downvalid != NULL );
2496 assert( upvalid != NULL );
2498 SCIPdebugMessage( "performing strong branching on variable %d (%d iterations)\n", col, itlim);
2500 SCIP_CALL( setParameterValues(lpi, &(lpi->grbparam)) );
2508 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_MODELSENSE, &objsen) );
2512 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrelement(lpi->grbmodel, GRB_DBL_ATTR_LB, col, &oldlb) );
2513 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrelement(lpi->grbmodel, GRB_DBL_ATTR_UB, col, &oldub) );
2515 if ( lpi->fromscratch )
2517 CHECK_ZERO( lpi->messagehdlr, GRBresetmodel(lpi->grbmodel) );
2521 if( itlim > INT_MAX )
2524 SCIP_CALL( getDblParam(lpi, GRB_DBL_PAR_ITERATIONLIMIT, &olditlim) );
2525 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_ITERATIONLIMIT, ( double) itlim) );
2528 newub = EPSCEIL(psol-1.0, 1e-06);
2529 if( newub >= oldlb - 0.5 )
2531 SCIPdebugMessage( "strong branching down (%g) on x%d (%g) with %d iterations\n", newub, col, psol, itlim);
2533 CHECK_ZERO( lpi->messagehdlr, GRBsetdblattrelement(lpi->grbmodel, GRB_DBL_ATTR_UB, col, newub) );
2544 CHECK_ZERO( lpi->messagehdlr, GRBgetdblparam(lpi->grbenv, GRB_DBL_PAR_CUTOFF, down) );
2556 CHECK_ZERO( lpi->messagehdlr, GRBsetdblattrelement(lpi->grbmodel, GRB_DBL_ATTR_UB, col, oldub) );
2557 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
2561 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrelement(lpi->grbmodel, GRB_DBL_ATTR_UB, col, &b) );
2562 assert( b == oldub );
2573 CHECK_ZERO( lpi->messagehdlr, GRBgetdblparam(lpi->grbenv, GRB_DBL_PAR_CUTOFF, down) );
2581 if( newlb <= oldub + 0.5 )
2583 SCIPdebugMessage( "strong branching up (%g) on x%d (%g) with %d iterations\n", newlb, col, psol, itlim);
2585 CHECK_ZERO( lpi->messagehdlr, GRBsetdblattrelement(lpi->grbmodel, GRB_DBL_ATTR_LB, col, newlb) );
2596 CHECK_ZERO( lpi->messagehdlr, GRBgetdblparam(lpi->grbenv, GRB_DBL_PAR_CUTOFF, up) );
2608 CHECK_ZERO( lpi->messagehdlr, GRBsetdblattrelement(lpi->grbmodel, GRB_DBL_ATTR_LB, col, oldlb) );
2609 CHECK_ZERO( lpi->messagehdlr, GRBupdatemodel(lpi->grbmodel) );
2613 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrelement(lpi->grbmodel, GRB_DBL_ATTR_LB, col, &b) );
2614 assert( b == oldlb );
2625 CHECK_ZERO( lpi->messagehdlr, GRBgetdblparam(lpi->grbenv, GRB_DBL_PAR_CUTOFF, up) );
2631 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_ITERATIONLIMIT, olditlim) );
2659 SCIP_CALL( lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter) );
2682 assert( iter != NULL );
2683 assert( cols != NULL );
2684 assert( psols != NULL );
2685 assert( down != NULL );
2686 assert( up != NULL );
2687 assert( downvalid != NULL );
2688 assert( upvalid != NULL );
2689 assert( down != NULL );
2694 for( j = 0; j < ncols; ++j )
2697 SCIP_CALL( lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter) );
2718 SCIP_CALL( lpiStrongbranch(lpi, col, psol, itlim, down, up, downvalid, upvalid, iter) );
2741 assert( iter != NULL );
2742 assert( cols != NULL );
2743 assert( psols != NULL );
2744 assert( down != NULL );
2745 assert( up != NULL );
2746 assert( downvalid != NULL );
2747 assert( upvalid != NULL );
2748 assert( down != NULL );
2753 for( j = 0; j < ncols; ++j )
2756 SCIP_CALL( lpiStrongbranch(lpi, cols[j], psols[j], itlim, &(down[j]), &(up[j]), &(downvalid[j]), &(upvalid[j]), iter) );
2777 assert(lpi != NULL);
2779 return (lpi->solstat != -1);
2791 assert( lpi != NULL );
2792 assert( lpi->grbmodel != NULL );
2793 assert( lpi->grbenv != NULL );
2794 assert( lpi->solstat >= 1 );
2800 if( primalfeasible != NULL )
2802 *primalfeasible = (lpi->solstat == GRB_OPTIMAL || (lpi->solstat == GRB_UNBOUNDED && algo == GRB_METHOD_PRIMAL));
2805 if( dualfeasible != NULL )
2807 *dualfeasible = (lpi->solstat == GRB_OPTIMAL || (lpi->solstat == GRB_INFEASIBLE && algo == GRB_METHOD_DUAL));
2816 assert( lpi != NULL );
2817 assert( lpi->grbmodel != NULL );
2818 assert( lpi->solstat >= 1 );
2822 if( primalfeasible != NULL )
2824 if(lpi->solstat != GRB_INF_OR_UNBD && lpi->solstat != GRB_INFEASIBLE)
2827 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_CONSTR_SRESIDUAL, &viol) );
2828 CHECK_ZERO( lpi->messagehdlr, GRBgetdblparam(lpi->grbenv, GRB_DBL_PAR_FEASIBILITYTOL, &tol) );
2829 *primalfeasible = (viol <= tol) ? TRUE : FALSE;
2833 *primalfeasible = FALSE;
2836 if( dualfeasible != NULL )
2838 if(lpi->solstat != GRB_UNBOUNDED && lpi->solstat != GRB_INFEASIBLE)
2841 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_DUAL_SRESIDUAL, &viol) );
2842 CHECK_ZERO( lpi->messagehdlr, GRBgetdblparam(lpi->grbenv, GRB_DBL_PAR_OPTIMALITYTOL, &tol) );
2843 *dualfeasible = (viol <= tol) ? TRUE : FALSE;
2847 *dualfeasible = FALSE;
2861 assert(lpi != NULL);
2862 assert(lpi->grbmodel != NULL);
2863 assert(lpi->solstat >= 0);
2865 return (lpi->solstat == GRB_UNBOUNDED);
2875 assert(lpi != NULL);
2876 assert(lpi->grbmodel != NULL);
2877 assert(lpi->solstat >= 0);
2879 return (lpi->solstat == GRB_UNBOUNDED);
2890 assert(lpi != NULL);
2891 assert(lpi->grbmodel != NULL);
2892 assert(lpi->solstat >= 0);
2896 primalfeasible = FALSE;
2902 return (primalfeasible && (lpi->solstat == GRB_UNBOUNDED || lpi->solstat == GRB_INF_OR_UNBD));
2910 assert(lpi != NULL);
2911 assert(lpi->grbmodel != NULL);
2912 assert(lpi->solstat >= 0);
2916 assert( lpi->solstat != GRB_INF_OR_UNBD );
2917 return (lpi->solstat == GRB_INFEASIBLE);
2927 assert( lpi != NULL );
2928 assert( lpi->grbmodel != NULL );
2929 assert( lpi->grbenv != NULL );
2930 assert( lpi->solstat >= 0 );
2936 return (lpi->solstat == GRB_OPTIMAL || (lpi->solstat == GRB_UNBOUNDED && algo == GRB_METHOD_PRIMAL));
2946 assert(lpi != NULL);
2947 assert(lpi->grbmodel != NULL);
2948 assert(lpi->solstat >= 0);
2950 return (lpi->solstat == GRB_INFEASIBLE);
2962 assert( lpi != NULL );
2963 assert( lpi->grbmodel != NULL );
2964 assert( lpi->grbenv != NULL );
2965 assert( lpi->solstat >= 0 );
2979 assert( lpi != NULL );
2980 assert( lpi->grbmodel != NULL );
2981 assert( lpi->grbenv != NULL );
2982 assert( lpi->solstat >= 0 );
2996 assert( lpi != NULL );
2997 assert( lpi->grbmodel != NULL );
2998 assert( lpi->solstat >= 0 );
3002 return (lpi->solstat == GRB_UNBOUNDED);
3012 assert( lpi != NULL );
3013 assert( lpi->grbmodel != NULL );
3014 assert( lpi->grbenv != NULL );
3015 assert( lpi->solstat >= 0 );
3021 return (lpi->solstat == GRB_OPTIMAL || (lpi->solstat == GRB_INFEASIBLE && algo == GRB_METHOD_DUAL));
3029 assert(lpi != NULL);
3030 assert(lpi->grbmodel != NULL);
3031 assert(lpi->solstat >= 0);
3033 return (lpi->solstat == GRB_OPTIMAL);
3041 assert(lpi != NULL);
3042 assert(lpi->grbmodel != NULL);
3043 assert(lpi->solstat >= 0);
3045 SCIPdebugMessage( "checking for stability: Gurobi solstat = %d\n", lpi->solstat);
3047 return (lpi->solstat != GRB_NUMERIC);
3055 assert(lpi != NULL);
3056 assert(lpi->grbmodel != NULL);
3057 assert(lpi->solstat >= 0);
3059 return (lpi->solstat == GRB_CUTOFF);
3067 assert(lpi != NULL);
3068 assert(lpi->grbmodel != NULL);
3069 assert(lpi->solstat >= 0);
3071 return (lpi->solstat == GRB_ITERATION_LIMIT);
3079 assert(lpi != NULL);
3080 assert(lpi->grbmodel != NULL);
3081 assert(lpi->solstat >= 0);
3083 return (lpi->solstat == GRB_TIME_LIMIT);
3091 assert(lpi != NULL);
3092 assert(lpi->grbmodel != NULL);
3094 return lpi->solstat;
3103 assert(lpi != NULL);
3104 assert(lpi->grbmodel != NULL);
3105 assert(success != NULL);
3121 assert(lpi != NULL);
3122 assert(lpi->grbmodel != NULL);
3126 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_OBJVAL, objval) );
3144 assert(lpi != NULL);
3145 assert(lpi->grbmodel != NULL);
3146 assert(lpi->solstat >= 0);
3150 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
3151 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3152 assert( ncols >= 0 && nrows >= 0 );
3154 if( objval != NULL )
3156 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_OBJVAL, objval) );
3159 if( primsol != NULL )
3161 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_X, 0, ncols, primsol) );
3164 if( dualsol != NULL )
3166 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_PI, 0, nrows, dualsol) );
3169 if( activity != NULL )
3174 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_SLACK, 0, nrows, activity) );
3176 SCIP_CALL( ensureSidechgMem(lpi, nrows) );
3178 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_RHS, 0, nrows, lpi->rhsarray) );
3179 CHECK_ZERO( lpi->messagehdlr, GRBgetcharattrarray(lpi->grbmodel, GRB_CHAR_ATTR_SENSE, 0, nrows, lpi->senarray) );
3181 for( i = 0; i < nrows; ++i )
3183 switch(lpi->senarray[i])
3185 case GRB_LESS_EQUAL:
3187 activity[i] = lpi->rhsarray[i] - activity[i];
3189 case GRB_GREATER_EQUAL:
3190 activity[i] = lpi->rhsarray[i] - activity[i];
3200 if( redcost != NULL )
3202 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_RC, 0, ncols, redcost) );
3216 assert(lpi != NULL);
3217 assert(lpi->grbmodel != NULL);
3218 assert(lpi->solstat >= 0);
3220 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
3221 assert( ncols >= 0 );
3225 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_UNBDRAY, 0, ncols, ray) );
3238 assert(lpi != NULL);
3239 assert(lpi->grbmodel != NULL);
3240 assert(lpi->solstat >= 0);
3241 assert(dualfarkas != NULL);
3243 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3244 assert( nrows >= 0 );
3248 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_FARKASDUAL, 0, nrows, dualfarkas) );
3259 assert(lpi != NULL);
3260 assert(lpi->grbmodel != NULL);
3261 assert(iterations != NULL);
3263 *iterations = lpi->iterations;
3279 assert(lpi != NULL);
3280 assert(quality != NULL);
3282 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattr(lpi->grbmodel, GRB_DBL_ATTR_KAPPA, quality) );
3306 assert(lpi != NULL);
3307 assert(lpi->grbmodel != NULL);
3309 SCIPdebugMessage( "saving Gurobi basis into %p/%p\n", ( void*) cstat, ( void*) rstat);
3316 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3318 for( i = 0; i < nrows; ++i )
3321 CHECK_ZERO( lpi->messagehdlr, GRBgetintattrelement(lpi->grbmodel, GRB_INT_ATTR_CBASIS, i, &stat) );
3329 case GRB_NONBASIC_LOWER:
3333 case GRB_NONBASIC_UPPER:
3337 case GRB_SUPERBASIC:
3354 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
3356 for( j = 0; j < ncols; ++j )
3359 CHECK_ZERO( lpi->messagehdlr, GRBgetintattrelement(lpi->grbmodel, GRB_INT_ATTR_VBASIS, j, &stat) );
3367 case GRB_NONBASIC_LOWER:
3371 case GRB_NONBASIC_UPPER:
3374 case GRB_SUPERBASIC:
3399 assert(lpi != NULL);
3400 assert(lpi->grbmodel != NULL);
3401 assert(cstat != NULL);
3402 assert(rstat != NULL);
3404 SCIPdebugMessage( "loading basis %p/%p into Gurobi\n", ( void*) cstat, ( void*) rstat);
3406 invalidateSolution(lpi);
3408 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3409 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
3411 for( i = 0; i < nrows; ++i )
3416 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrelement(lpi->grbmodel, GRB_INT_ATTR_CBASIS, i, GRB_BASIC) );
3420 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrelement(lpi->grbmodel, GRB_INT_ATTR_CBASIS, i, GRB_NONBASIC_LOWER) );
3424 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrelement(lpi->grbmodel, GRB_INT_ATTR_CBASIS, i, GRB_NONBASIC_UPPER) );
3428 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrelement(lpi->grbmodel, GRB_INT_ATTR_CBASIS, i, GRB_SUPERBASIC) );
3438 for( j = 0; j < ncols; ++j )
3443 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrelement(lpi->grbmodel, GRB_INT_ATTR_VBASIS, j, GRB_BASIC) );
3447 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrelement(lpi->grbmodel, GRB_INT_ATTR_VBASIS, j, GRB_NONBASIC_LOWER) );
3451 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrelement(lpi->grbmodel, GRB_INT_ATTR_VBASIS, j, GRB_NONBASIC_UPPER) );
3454 CHECK_ZERO( lpi->messagehdlr, GRBsetintattrelement(lpi->grbmodel, GRB_INT_ATTR_VBASIS, j, GRB_SUPERBASIC) );
3480 assert(lpi != NULL);
3481 assert(lpi->grbmodel != NULL);
3486 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &status) );
3487 if ( status == GRB_LOADED || status == GRB_INTERRUPTED || status == GRB_INPROGRESS )
3492 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3493 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
3497 SCIP_ALLOC( BMSallocMemoryArray(&bhead, nrows+ncols) );
3500 CHECK_ZERO( lpi->messagehdlr, GRBgetBasisHead(lpi->grbmodel, bhead) );
3502 for (i = 0; i < nrows; ++i)
3505 if ( bhead[i] < ncols )
3508 bind[i] = -1 - (bhead[i] - ncols);
3510 BMSfreeMemoryArray(&bhead);
3515 for( i = 0; i < nrows; ++i )
3518 CHECK_ZERO( lpi->messagehdlr, GRBgetintattrelement(lpi->grbmodel, GRB_INT_ATTR_CBASIS, i, &stat) );
3520 if( stat == GRB_BASIC )
3521 bind[cnt++] = -1 - i;
3524 for( j = 0; j < ncols; ++j )
3527 CHECK_ZERO( lpi->messagehdlr, GRBgetintattrelement(lpi->grbmodel, GRB_INT_ATTR_VBASIS, j, &stat) );
3529 if( stat == GRB_BASIC )
3532 assert( cnt == nrows );
3554 assert(lpi != NULL);
3555 assert(lpi->grbmodel != NULL);
3560 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &status) );
3561 if ( status == GRB_LOADED || status == GRB_INTERRUPTED || status == GRB_INPROGRESS )
3566 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3570 SCIP_ALLOC( BMSallocMemoryArray(&(x.ind), nrows) );
3571 SCIP_ALLOC( BMSallocMemoryArray(&(x.val), nrows) );
3581 CHECK_ZERO( lpi->messagehdlr, GRBBSolve(lpi->grbmodel, &b, &x) );
3584 assert( x.len <= nrows );
3588 for (i = 0; i < nrows; ++i)
3590 assert( k <= x.len );
3591 if ( k < x.len && (x.ind)[k] == i )
3592 coef[i] = (x.val)[k++];
3598 BMSfreeMemoryArray(&(x.val));
3599 BMSfreeMemoryArray(&(x.ind));
3624 assert(lpi != NULL);
3625 assert(lpi->grbmodel != NULL);
3630 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &status) );
3631 if ( status == GRB_LOADED || status == GRB_INTERRUPTED || status == GRB_INPROGRESS )
3636 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3640 SCIP_ALLOC( BMSallocMemoryArray(&(x.ind), nrows) );
3641 SCIP_ALLOC( BMSallocMemoryArray(&(x.val), nrows) );
3651 CHECK_ZERO( lpi->messagehdlr, GRBFSolve(lpi->grbmodel, &b, &x) );
3654 assert( x.len <= nrows );
3658 for (i = 0; i < nrows; ++i)
3660 assert( k <= x.len );
3661 if ( k < x.len && (x.ind)[k] == i )
3662 coef[i] = (x.val)[k++];
3668 BMSfreeMemoryArray(&(x.val));
3669 BMSfreeMemoryArray(&(x.ind));
3689 assert(lpi != NULL);
3690 assert(lpi->grbmodel != NULL);
3695 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &status) );
3696 if ( status == GRB_LOADED || status == GRB_INTERRUPTED || status == GRB_INPROGRESS )
3701 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
3702 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3705 SCIP_ALLOC( BMSallocMemoryArray(&(x.ind), ncols + nrows) );
3706 SCIP_ALLOC( BMSallocMemoryArray(&(x.val), ncols + nrows) );
3708 CHECK_ZERO( lpi->messagehdlr, GRBBinvRowi(lpi->grbmodel, r, &x) );
3711 assert( x.len <= ncols + nrows );
3714 for (j = 0; j < ncols; ++j)
3716 assert( k <= x.len );
3717 if ( k < x.len && (x.ind)[k] == j )
3718 coef[j] = (x.val)[k++];
3724 BMSfreeMemoryArray(&(x.val));
3725 BMSfreeMemoryArray(&(x.ind));
3743 assert(lpi != NULL);
3744 assert(lpi->grbmodel != NULL);
3749 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_STATUS, &status) );
3750 if ( status == GRB_LOADED || status == GRB_INTERRUPTED || status == GRB_INPROGRESS )
3755 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3758 SCIP_ALLOC( BMSallocMemoryArray(&(x.ind), nrows) );
3759 SCIP_ALLOC( BMSallocMemoryArray(&(x.val), nrows) );
3761 CHECK_ZERO( lpi->messagehdlr, GRBBinvColj(lpi->grbmodel, c, &x) );
3764 assert( x.len <= nrows );
3767 for (j = 0; j < nrows; ++j)
3769 assert( k <= x.len );
3770 if ( k < x.len && (x.ind)[k] == j )
3771 coef[j] = (x.val)[k++];
3777 BMSfreeMemoryArray(&(x.val));
3778 BMSfreeMemoryArray(&(x.ind));
3806 assert(blkmem != NULL);
3807 assert(lpi != NULL);
3808 assert(lpi->grbmodel != NULL);
3809 assert(lpistate != NULL);
3812 if( !lpi->solisbasic )
3818 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3819 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
3829 SCIP_CALL( lpistateCreate(lpistate, blkmem, ncols, nrows) );
3830 (*lpistate)->ncols = ncols;
3831 (*lpistate)->nrows = nrows;
3833 SCIPdebugMessage( "stored Gurobi LPI state in %p (%d cols, %d rows)\n", ( void*) *lpistate, ncols, nrows);
3836 lpistatePack(*lpistate, lpi->cstat, lpi->rstat);
3844 SCIP_ALLOC( BMSallocBlockMemory(blkmem, lpistate) );
3845 (*lpistate)->ncols = ncols;
3846 (*lpistate)->nrows = nrows;
3847 (*lpistate)->packrstat = NULL;
3848 (*lpistate)->packcstat = NULL;
3867 assert(blkmem != NULL);
3868 assert(lpi != NULL);
3869 assert(lpi->grbmodel != NULL);
3872 if( lpistate == NULL || lpistate->packrstat == NULL || lpistate->packcstat )
3875 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMCONSTRS, &nrows) );
3876 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_NUMVARS, &ncols) );
3877 assert(lpistate->ncols <= ncols);
3878 assert(lpistate->nrows <= nrows);
3880 SCIPdebugMessage( "loading LPI state %p (%d cols, %d rows) into Gurobi LP with %d cols and %d rows\n",
3881 ( void*) lpistate, lpistate->ncols, lpistate->nrows, ncols, nrows);
3883 if( lpistate->ncols == 0 || lpistate->nrows == 0 )
3887 SCIP_CALL( ensureCstatMem(lpi, ncols) );
3888 SCIP_CALL( ensureRstatMem(lpi, nrows) );
3891 lpistateUnpack(lpistate, lpi->cstat, lpi->rstat);
3894 for( i = lpistate->ncols; i < ncols; ++i )
3897 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_LB, i, i, &bnd) );
3901 CHECK_ZERO( lpi->messagehdlr, GRBgetdblattrarray(lpi->grbmodel, GRB_DBL_ATTR_UB, i, i, &bnd) );
3910 for( i = lpistate->nrows; i < nrows; ++i )
3924 assert(lpi != NULL);
3926 CHECK_ZERO( lpi->messagehdlr, GRBresetmodel(lpi->grbmodel) );
3938 assert(lpi != NULL);
3939 assert(lpistate != NULL);
3941 if( *lpistate != NULL )
3942 lpistateFree(lpistate, blkmem);
3953 return (lpistate != NULL);
3963 assert(lpi != NULL);
3964 assert(lpi->grbmodel != NULL);
3970 if ( l > 4 && fname[l-4] == '.' && fname[l-3] == 'b' && fname[l-2] == 'a' && fname[l-1] == 's' )
3972 CHECK_ZERO( lpi->messagehdlr, GRBread(lpi->grbmodel, fname) );
3976 SCIPerrorMessage( "To read a basis with gurobi, the extension has to be '.bas'.\n");
3990 assert(lpi != NULL);
3991 assert(lpi->grbmodel != NULL);
3997 if ( l > 4 && fname[l-4] == '.' && fname[l-3] == 'b' && fname[l-2] == 'a' && fname[l-1] == 's' )
3999 CHECK_ZERO( lpi->messagehdlr, GRBwrite(lpi->grbmodel, fname) );
4007 CHECK_ZERO( lpi->messagehdlr, GRBwrite(lpi->grbmodel, fname) );
4034 assert(lpinorms != NULL);
4050 assert(lpinorms == NULL);
4063 assert(lpinorms == NULL);
4091 assert(lpi != NULL);
4092 assert(lpi->grbmodel != NULL);
4093 assert(ival != NULL);
4100 *ival = (int) lpi->fromscratch;
4106 SCIP_CALL( getIntParam(lpi, GRB_INT_PAR_SCALEFLAG, &temp) );
4107 assert( temp == 0 || temp == 1 );
4111 SCIP_CALL( getIntParam(lpi, GRB_INT_PAR_PRESOLVE, &temp) );
4112 assert( temp == GRB_PRESOLVE_AUTO || temp == GRB_PRESOLVE_OFF || temp == GRB_PRESOLVE_CONSERVATIVE || temp == GRB_PRESOLVE_AGGRESSIVE );
4113 *ival = (temp == GRB_PRESOLVE_OFF) ? FALSE : TRUE;
4116 *ival = (int) lpi->pricing;
4119 SCIP_CALL( getIntParam(lpi, GRB_INT_PAR_OUTPUTFLAG, &temp) );
4120 assert( temp == 0 || temp == 1 );
4124 SCIP_CALL( getDblParam(lpi, GRB_DBL_PAR_ITERATIONLIMIT, &dtemp) );
4125 assert( dtemp >= 0.0 );
4126 if( dtemp >= GRB_INFINITY )
4129 *ival = (int) dtemp;
4145 assert(lpi != NULL);
4146 assert(lpi->grbmodel != NULL);
4163 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_SCALEFLAG, 1) );
4165 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_SCALEFLAG, 0) );
4170 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_AUTO) );
4172 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_OFF) );
4180 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_SIMPLEXPRICING, GRB_SIMPLEXPRICING_AUTO) );
4184 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_SIMPLEXPRICING, GRB_SIMPLEXPRICING_AUTO) );
4187 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_SIMPLEXPRICING, GRB_SIMPLEXPRICING_PARTIAL) );
4190 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_SIMPLEXPRICING, GRB_SIMPLEXPRICING_STEEPEST_EDGE) );
4193 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_SIMPLEXPRICING, GRB_SIMPLEXPRICING_STEEPEST_QUICK) );
4196 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_SIMPLEXPRICING, GRB_SIMPLEXPRICING_DEVEX) );
4205 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_OUTPUTFLAG, 1) );
4207 SCIP_CALL( setIntParam(lpi, GRB_INT_PAR_OUTPUTFLAG, 0) );
4210 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_ITERATIONLIMIT, ( double) ival) );
4228 assert(lpi != NULL);
4229 assert(lpi->grbmodel != NULL);
4230 assert(dval != NULL);
4237 SCIP_CALL( getDblParam(lpi, GRB_DBL_PAR_FEASIBILITYTOL, dval) );
4240 SCIP_CALL( getDblParam(lpi, GRB_DBL_PAR_OPTIMALITYTOL, dval) );
4246 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_MODELSENSE, &objsen) );
4248 SCIP_CALL( getDblParam(lpi, GRB_DBL_PAR_CUTOFF, dval) );
4253 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_MODELSENSE, &objsen) );
4255 SCIP_CALL( getDblParam(lpi, GRB_DBL_PAR_CUTOFF, dval) );
4260 SCIP_CALL( getDblParam(lpi, GRB_DBL_PAR_TIMELIMIT, dval) );
4263 SCIP_CALL( getDblParam(lpi, GRB_DBL_PAR_MARKOWITZTOL, dval) );
4281 assert(lpi != NULL);
4282 assert(lpi->grbmodel != NULL);
4289 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_FEASIBILITYTOL, dval) );
4292 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_OPTIMALITYTOL, dval) );
4298 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_MODELSENSE, &objsen) );
4300 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_CUTOFF, dval) );
4303 CHECK_ZERO( lpi->messagehdlr, GRBgetintattr(lpi->grbmodel, GRB_INT_ATTR_MODELSENSE, &objsen) );
4305 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_CUTOFF, dval) );
4308 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_TIMELIMIT, dval) );
4311 SCIP_CALL( setDblParam(lpi, GRB_DBL_PAR_MARKOWITZTOL, dval) );
4337 return GRB_INFINITY;
4346 return (val >= GRB_INFINITY);
4367 assert(lpi != NULL);
4368 assert(lpi->grbmodel != NULL);
4372 CHECK_ZERO( lpi->messagehdlr, GRBread(lpi->grbmodel, fname) );
4383 assert(lpi != NULL);
4384 assert(lpi->grbmodel != NULL);
4388 CHECK_ZERO( lpi->messagehdlr, GRBwrite(lpi->grbmodel, fname) );
|