73 #define SEPA_NAME "cgmip" 74 #define SEPA_DESC "Chvatal-Gomory cuts via MIPs separator" 75 #define SEPA_PRIORITY -1000 77 #define SEPA_MAXBOUNDDIST 0.0 78 #define SEPA_USESSUBSCIP TRUE 79 #define SEPA_DELAY FALSE 81 #define DEFAULT_MAXROUNDS 5 82 #define DEFAULT_MAXROUNDSROOT 50 83 #define DEFAULT_MAXDEPTH -1 84 #define DEFAULT_DECISIONTREE FALSE 85 #define DEFAULT_TIMELIMIT 1e20 86 #define DEFAULT_MEMORYLIMIT 1e20 87 #define DEFAULT_CUTCOEFBND 1000.0 88 #define DEFAULT_MINNODELIMIT 500LL 89 #define DEFAULT_MAXNODELIMIT 5000LL 90 #define DEFAULT_ONLYACTIVEROWS FALSE 91 #define DEFAULT_MAXROWAGE -1 92 #define DEFAULT_ONLYRANKONE FALSE 93 #define DEFAULT_ONLYINTVARS FALSE 94 #define DEFAULT_ALLOWLOCAL FALSE 95 #define DEFAULT_CONTCONVERT FALSE 96 #define DEFAULT_CONTCONVFRAC 0.1 97 #define DEFAULT_CONTCONVMIN 100 98 #define DEFAULT_INTCONVERT FALSE 99 #define DEFAULT_INTCONVFRAC 0.1 100 #define DEFAULT_INTCONVMIN 100 101 #define DEFAULT_SKIPMULTBOUNDS TRUE 102 #define DEFAULT_OBJLONE FALSE 103 #define DEFAULT_OBJWEIGHT 1e-03 104 #define DEFAULT_OBJWEIGHTSIZE TRUE 105 #define DEFAULT_DYNAMICCUTS TRUE 106 #define DEFAULT_USECMIR TRUE 107 #define DEFAULT_USESTRONGCG FALSE 108 #define DEFAULT_CMIROWNBOUNDS FALSE 109 #define DEFAULT_USECUTPOOL TRUE 110 #define DEFAULT_PRIMALSEPARATION TRUE 111 #define DEFAULT_EARLYTERM TRUE 112 #define DEFAULT_ADDVIOLATIONCONS FALSE 113 #define DEFAULT_ADDVIOLCONSHDLR FALSE 114 #define DEFAULT_CONSHDLRUSENORM TRUE 115 #define DEFAULT_USEOBJUB FALSE 116 #define DEFAULT_USEOBJLB FALSE 117 #define DEFAULT_SUBSCIPFAST TRUE 118 #define DEFAULT_OUTPUT FALSE 119 #define DEFAULT_RANDSEED 101 121 #define NROWSTOOSMALL 5 122 #define NCOLSTOOSMALL 5 124 #define EPSILONVALUE 1e-03 125 #define BETAEPSILONVALUE 1e-02 126 #define STALLNODELIMIT 1000LL 127 #define CONSHDLRFULLNORM FALSE 128 #define MINEFFICACY 0.05 129 #define MAXNSOLS 1000 130 #define OBJWEIGHTRANGE 0.01 133 #define BOUNDSWITCH 0.9999 135 #define MINFRAC 0.0009 136 #define MAXFRAC 0.9991 137 #define FIXINTEGRALRHS FALSE 138 #define MAKECONTINTEGRAL FALSE 139 #define MAXWEIGHTRANGE 1e+05 141 #define MAXAGGRLEN(nvars) nvars 208 unsigned int ntotalrows;
240 #define CONSHDLR_NAME "violatedCuts" 241 #define CONSHDLR_DESC "only allow solutions corresponding to violated cuts" 244 struct SCIP_ConshdlrData
285 assert( mipdata !=
NULL );
286 subscip = mipdata->subscip;
287 assert( subscip !=
NULL );
288 assert( violated !=
NULL );
296 if ( mipdata->conshdlrusenorm )
299 if ( mipdata->conshdlrfullnorm )
315 SCIP_CALL(
computeCut(mipdata->scip, mipdata->sepa, mipdata, mipdata->sepadata, sol, cutcoefs, &rhs, &localrowsused, &localboundsused, &cutrank, &success) );
317 #ifdef SCIP_MORE_DEBUG 318 for (j = 0; j < (
unsigned int) nvars; ++j)
332 for (j = 0; j < (
unsigned int) nvars; ++j)
337 cutsqrnorm += SQR(cutcoefs[j]);
340 norm = SQRT(cutsqrnorm);
346 switch ( mipdata->normtype )
350 for (j = 0; j < mipdata->ncols; ++j)
352 var = mipdata->alpha[j];
360 cutsqrnorm += SQR(val);
363 norm = SQRT(cutsqrnorm);
366 for (j = 0; j < mipdata->ncols; ++j)
368 var = mipdata->alpha[j];
382 for (j = 0; j < mipdata->ncols; ++j)
384 var = mipdata->alpha[j];
397 for (j = 0; j < mipdata->ncols; ++j)
399 var = mipdata->alpha[j];
414 SCIPerrorMessage(
"invalid efficacy norm parameter '%c'\n", mipdata->normtype);
427 for (j = 0; j < mipdata->ncols; ++j)
429 var = mipdata->alpha[j];
445 SCIPdebugMsg(scip,
"Violated cut from solution - act: %f, rhs: %f, norm: %f, eff.: %f\n", act, rhs, norm, (act-rhs)/norm);
449 SCIPdebugMsg(scip,
"Rejected cut from solution - act: %f, rhs: %f, norm: %f, eff.: %f\n", act, rhs, norm, (act-rhs)/norm);
465 assert( scip !=
NULL );
466 assert( conshdlr !=
NULL );
468 assert( conshdlrdata !=
NULL );
483 assert( scip !=
NULL );
484 assert( conshdlr !=
NULL );
485 assert( result !=
NULL );
490 assert( conshdlrdata !=
NULL );
507 assert( result !=
NULL );
524 assert( scip !=
NULL );
525 assert( conshdlr !=
NULL );
526 assert( sol !=
NULL );
527 assert( result !=
NULL );
530 assert( conshdlrdata !=
NULL );
563 conshdlrdata->mipdata = mipdata;
567 -1000000, -1000000, 100,
FALSE,
568 consEnfolpViolatedCuts, consEnfopsViolatedCuts, consCheckViolatedCuts, consLockViolatedCuts,
571 assert(conshdlr !=
NULL);
611 assert( nvars == 0 || cutcoefs !=
NULL );
612 assert( nvars == 0 || varsolvals !=
NULL );
613 assert( cutvars !=
NULL );
614 assert( cutvals !=
NULL );
615 assert( cutlen !=
NULL );
616 assert( cutact !=
NULL );
617 assert( cutnorm !=
NULL );
626 for (v = 0; v < nvars; ++v)
631 act += val * varsolvals[v];
632 cutsqrnorm += SQR(val);
633 cutvars[len] = vars[v];
634 cutvals[len++] = val;
637 norm = SQRT(cutsqrnorm);
640 for (v = 0; v < nvars; ++v)
645 act += val * varsolvals[v];
648 cutvars[len] = vars[v];
649 cutvals[len++] = val;
654 for (v = 0; v < nvars; ++v)
659 act += val * varsolvals[v];
661 cutvars[len] = vars[v];
662 cutvals[len++] = val;
667 for (v = 0; v < nvars; ++v)
672 act += val * varsolvals[v];
673 cutvars[len] = vars[v];
674 cutvals[len++] = val;
749 assert( scip !=
NULL );
750 assert( lhs !=
NULL );
751 assert( rhs !=
NULL );
752 assert( col !=
NULL );
766 assert( row !=
NULL );
773 assert( 0 <= pos && pos < (
int) mipdata->nrows );
777 lhs[pos] += sigma * colvals[i] * offset;
781 rhs[pos] += sigma * colvals[i] * offset;
785 if ( sepadata->useobjub || sepadata->useobjlb )
788 assert( mipdata->ntotalrows == mipdata->nrows + 1 );
804 l = *ub/sigma + offset;
810 *ub = *lb/sigma + offset;
819 *lb = *lb/sigma + offset;
822 *ub = *ub/sigma + offset;
824 *primsol = *primsol/sigma + offset;
850 assert( maxrowsize > 0 );
851 assert( minrowsize < INT_MAX );
852 assert( minrowsize <= maxrowsize );
853 assert( minrowsize <= rowsize && rowsize <= maxrowsize );
855 if ( minrowsize == maxrowsize )
860 return 1.0 - a * ((
SCIP_Real) (maxrowsize - rowsize));
1019 unsigned int nshifted;
1020 unsigned int ncomplemented;
1021 unsigned int ncontconverted;
1022 unsigned int nintconverted;
1023 unsigned int nlbounds;
1024 unsigned int nubounds;
1036 int minrowsize = INT_MAX;
1039 assert( scip !=
NULL );
1040 assert( sepadata !=
NULL );
1042 assert( mipdata->subscip ==
NULL );
1046 assert( ncols > 0 && nrows > 0 );
1050 mipdata->nrows = (
unsigned int) nrows;
1051 mipdata->ncols = (
unsigned int) ncols;
1052 mipdata->ntotalrows = mipdata->nrows;
1054 if ( sepadata->useobjub || sepadata->useobjlb )
1055 mipdata->ntotalrows = mipdata->nrows + 1;
1057 assert(mipdata->ntotalrows <= INT_MAX);
1058 ntotalrows = (int) mipdata->ntotalrows;
1061 mipdata->conshdlrusenorm = sepadata->conshdlrusenorm;
1065 subscip = mipdata->subscip;
1069 if ( sepadata->addviolconshdlr )
1096 for (i = 0; i < nrows; ++i)
1102 assert( row !=
NULL );
1119 if ( ! sepadata->onlyactiverows && sepadata->maxrowage > 0 &&
SCIProwGetAge(row) > sepadata->maxrowage )
1123 if ( sepadata->onlyrankone )
1155 assert( maxrowsize > 0 );
1156 assert( minrowsize < INT_MAX );
1159 if ( sepadata->useobjub )
1161 assert( mipdata->ntotalrows == mipdata->nrows + 1 );
1170 if ( sepadata->useobjlb )
1172 assert( mipdata->ntotalrows == mipdata->nrows + 1 );
1192 for (j = 0; j < ncols; ++j)
1198 assert( col !=
NULL );
1200 assert( var !=
NULL );
1220 mipdata->iscomplemented[j] =
FALSE;
1221 mipdata->isshifted[j] =
FALSE;
1230 if ( sepadata->intconvert && ncols >= sepadata->intconvmin )
1233 if (
SCIPrandomGetReal(sepadata->randnumgen, 0.0, 1.0) <= sepadata->intconvfrac )
1244 if ( ub[j] - primsol[j] < primsol[j] - lb[j] )
1275 if ( sepadata->contconvert && ncols >= sepadata->contconvmin )
1278 if (
SCIPrandomGetReal(sepadata->randnumgen, 0.0, 1.0) <= sepadata->contconvfrac )
1297 SCIP_CALL(
transformColumn(scip, sepadata, mipdata, col, ub[j], -1.0, lhs, rhs, &(lb[j]), &(ub[j]), &(primsol[j])) );
1298 mipdata->iscomplemented[j] =
TRUE;
1299 mipdata->coltype[j] =
colAtUb;
1309 SCIP_CALL(
transformColumn(scip, sepadata, mipdata, col, -lb[j], 1.0, lhs, rhs, &(lb[j]), &(ub[j]), &(primsol[j])) );
1311 mipdata->isshifted[j] =
TRUE;
1318 mipdata->coltype[j] =
colAtLb;
1328 SCIP_CALL(
transformColumn(scip, sepadata, mipdata, col, ub[j], -1.0, lhs, rhs, &(lb[j]), &(ub[j]), &(primsol[j])) );
1330 mipdata->iscomplemented[j] =
TRUE;
1336 mipdata->coltype[j] =
colAtLb;
1348 if ( sepadata->intconvert && ncols >= sepadata->intconvmin )
1350 SCIPdebugMsg(scip,
"Converted %u fractional integral variables to have integral value.\n", nintconverted);
1352 if ( sepadata->contconvert && ncols >= sepadata->contconvmin )
1354 SCIPdebugMsg(scip,
"Converted %u integral variables to be continuous.\n", ncontconverted);
1357 SCIPdebugMsg(scip,
"original variables: %d integral, %d continuous, %u shifted, %u complemented, %u at lb, %u at ub\n",
1359 nshifted, ncomplemented, nlbounds, nubounds);
1362 if ( sepadata->skipmultbounds )
1369 for (i = 0; i < nrows; ++i)
1374 assert( row !=
NULL );
1376 mipdata->ylhs[i] =
NULL;
1377 mipdata->yrhs[i] =
NULL;
1384 if ( ! sepadata->onlyactiverows && sepadata->maxrowage > 0 &&
SCIProwGetAge(row) > sepadata->maxrowage )
1388 if ( sepadata->onlyrankone )
1395 if (
SCIPisEQ(scip, lhs[i], rhs[i]) )
1397 SCIP_Real weight = -sepadata->objweight;
1403 if ( sepadata->objweightsize )
1413 #ifdef SCIP_MORE_DEBUG 1423 #ifdef SCIP_MORE_DEBUG 1439 if ( sepadata->objweightsize )
1442 weight = -sepadata->objweight;
1445 if ( ! sepadata->onlyactiverows || isactive )
1454 #ifdef SCIP_MORE_DEBUG 1470 if ( sepadata->objweightsize )
1473 weight = -sepadata->objweight;
1476 if ( ! sepadata->onlyactiverows || isactive )
1484 #ifdef SCIP_MORE_DEBUG 1491 assert( (
int) cnt <= 2 * nrows );
1495 if ( sepadata->useobjub || sepadata->useobjlb )
1499 assert( mipdata->ntotalrows == mipdata->nrows + 1 );
1500 mipdata->ylhs[mipdata->nrows] =
NULL;
1501 mipdata->yrhs[mipdata->nrows] =
NULL;
1504 if ( sepadata->objweightsize )
1507 weight = -sepadata->objweight;
1510 if ( sepadata->useobjub && !
SCIPisInfinity(scip, rhs[mipdata->nrows]) )
1518 #ifdef SCIP_MORE_DEBUG 1519 SCIPdebugMsg(scip,
"Created variable <%s> for upper bound on objective (weight: %f).\n", name, weight);
1524 if ( sepadata->useobjlb && !
SCIPisInfinity(scip, -lhs[mipdata->nrows]) )
1532 #ifdef SCIP_MORE_DEBUG 1533 SCIPdebugMsg(scip,
"Created variable <%s> for lower bound on objective (weight: %f).\n", name, weight);
1537 assert( (
int) cnt <= 2 * ntotalrows );
1544 for (j = 0; j < ncols; ++j)
1546 mipdata->z[j] =
NULL;
1547 mipdata->alpha[j] =
NULL;
1548 mipdata->fracalpha[j] =
NULL;
1554 if ( sepadata->objlone )
1561 SCIP_CALL(
SCIPcreateVar(subscip, &(mipdata->alpha[j]), name, -sepadata->cutcoefbnd, sepadata->cutcoefbnd, obj,
1594 assert( (
int) cnt <= 2 * ncols );
1595 assert( (
int) ucnt <= ncols );
1598 if ( sepadata->objlone )
1600 SCIP_CALL(
SCIPcreateVar(subscip, &(mipdata->beta),
"beta", -sepadata->cutcoefbnd, sepadata->cutcoefbnd, 0.0,
1605 SCIP_CALL(
SCIPcreateVar(subscip, &(mipdata->beta),
"beta", -sepadata->cutcoefbnd, sepadata->cutcoefbnd, -1.0,
1614 mipdata->n += cnt + ucnt + 2;
1622 for (j = 0; j < ncols; ++j)
1632 assert( cols[j] !=
NULL );
1637 if ( mipdata->iscomplemented[j] )
1649 assert( row !=
NULL );
1656 assert( 0 <= pos && pos < nrows );
1658 if ( mipdata->ylhs[pos] !=
NULL )
1660 consvars[nconsvars] = mipdata->ylhs[pos];
1661 consvals[nconsvars] = -sigma * colvals[i];
1664 if ( mipdata->yrhs[pos] !=
NULL )
1666 consvars[nconsvars] = mipdata->yrhs[pos];
1667 consvals[nconsvars] = sigma * colvals[i];
1670 assert( nconsvars <= (
int) mipdata->n );
1673 if ( mipdata->z[j] !=
NULL )
1676 consvars[nconsvars] = mipdata->z[j];
1677 consvals[nconsvars] = 1.0;
1680 assert( nconsvars <= (
int) mipdata->n );
1683 consvars[nconsvars] = mipdata->alpha[j];
1684 consvals[nconsvars] = -1.0;
1686 assert( nconsvars <= (
int) mipdata->n );
1689 consvars[nconsvars] = mipdata->fracalpha[j];
1690 consvals[nconsvars] = -1.0;
1692 assert( nconsvars <= (
int) mipdata->n );
1698 if ( mipdata->ylhs[mipdata->nrows] !=
NULL )
1700 assert( sepadata->useobjlb );
1701 consvars[nconsvars] = mipdata->ylhs[mipdata->nrows];
1707 if ( mipdata->yrhs[mipdata->nrows] !=
NULL )
1709 assert( sepadata->useobjub );
1710 consvars[nconsvars] = mipdata->yrhs[mipdata->nrows];
1730 assert( cols[j] !=
NULL );
1735 if ( mipdata->iscomplemented[j] )
1747 assert( row !=
NULL );
1754 assert( 0 <= pos && pos < nrows );
1756 if ( mipdata->ylhs[pos] !=
NULL )
1758 consvars[nconsvars] = mipdata->ylhs[pos];
1759 consvals[nconsvars] = -sigma * colvals[i];
1762 if ( mipdata->yrhs[pos] !=
NULL )
1764 consvars[nconsvars] = mipdata->yrhs[pos];
1765 consvals[nconsvars] = sigma * colvals[i];
1768 assert( nconsvars <= (
int) mipdata->n );
1775 if ( mipdata->ylhs[mipdata->nrows] )
1777 assert( sepadata->useobjlb );
1778 consvars[nconsvars] = mipdata->ylhs[mipdata->nrows];
1784 if ( mipdata->yrhs[mipdata->nrows] )
1786 assert( sepadata->useobjub );
1787 consvars[nconsvars] = mipdata->yrhs[mipdata->nrows];
1810 assert( (
int) cnt <= ncols );
1817 for (i = 0; i < nrows; ++i)
1819 assert( rows[i] !=
NULL );
1829 consvars[nconsvars] = mipdata->ylhs[i];
1830 consvals[nconsvars] = -lhs[i];
1837 consvars[nconsvars] = mipdata->yrhs[i];
1838 consvals[nconsvars] = rhs[i];
1841 assert( nconsvars <= (
int) mipdata->n );
1844 if ( sepadata->useobjub || sepadata->useobjlb )
1847 if ( mipdata->ylhs[mipdata->nrows] !=
NULL && !
SCIPisZero(scip, lhs[mipdata->nrows]) )
1849 assert( sepadata->useobjlb );
1851 consvars[nconsvars] = mipdata->ylhs[mipdata->nrows];
1852 consvals[nconsvars] = -lhs[mipdata->nrows];
1857 if ( mipdata->yrhs[mipdata->nrows] !=
NULL && !
SCIPisZero(scip, rhs[mipdata->nrows]) )
1859 assert( sepadata->useobjub );
1861 consvars[nconsvars] = mipdata->yrhs[mipdata->nrows];
1862 consvals[nconsvars] = rhs[mipdata->nrows];
1865 assert( nconsvars <= (
int) mipdata->n );
1869 for (j = 0; j < ncols; ++j)
1876 consvars[nconsvars] = mipdata->z[j];
1877 consvals[nconsvars] = ub[j];
1879 assert( nconsvars <= (
int) mipdata->n );
1883 consvars[nconsvars] = mipdata->beta;
1884 consvals[nconsvars] = -1.0;
1888 consvars[nconsvars] = mipdata->fracbeta;
1889 consvals[nconsvars] = -1.0;
1891 assert( nconsvars <= (
int) mipdata->n );
1901 if ( sepadata->primalseparation )
1905 if ( bestsol !=
NULL )
1908 for (j = 0; j < ncols; ++j)
1910 if ( mipdata->alpha[j] !=
NULL )
1916 consvars[nconsvars] = mipdata->alpha[j];
1917 consvals[nconsvars] = val;
1919 assert( nconsvars <= (
int) mipdata->n );
1922 consvars[nconsvars] = mipdata->beta;
1923 consvals[nconsvars] = -1.0;
1936 if ( sepadata->addviolationcons )
1939 for (j = 0; j < ncols; ++j)
1941 if ( mipdata->alpha[j] !=
NULL )
1943 consvars[nconsvars] = mipdata->alpha[j];
1944 consvals[nconsvars] = primsol[j];
1946 assert( nconsvars <= (
int) mipdata->n );
1949 consvars[nconsvars] = mipdata->beta;
1950 consvals[nconsvars] = -1.0;
1961 SCIPdebugMsg(scip,
"Subscip has %u vars (%d integral, %d continuous), %u conss.\n",
1976 #ifdef SCIP_WRITEPROB 1979 sepadata->objlone ?
"_l1" :
"",
1980 sepadata->addviolationcons ?
"_vc" :
"",
1981 sepadata->skipmultbounds ?
"_ub" :
"",
1982 sepadata->primalseparation ?
"_ps" :
"",
2003 assert( sepadata !=
NULL );
2004 assert( mipdata !=
NULL );
2005 assert( success !=
NULL );
2009 subscip = mipdata->subscip;
2010 assert( subscip !=
NULL );
2013 if ( ! sepadata->addviolationcons && ! sepadata->addviolconshdlr )
2035 if ( sepadata->output )
2047 if ( sepadata->subscipfast )
2065 #ifdef SCIP_DISABLED_CODE 2076 if ( sepadata->subscipfast )
2142 assert( scip !=
NULL );
2143 assert( sepadata !=
NULL );
2144 assert( mipdata !=
NULL );
2145 assert( success !=
NULL );
2149 subscip = mipdata->subscip;
2161 if ( sepadata->timelimit < timelimit )
2165 if ( sepadata->memorylimit < memorylimit )
2174 if ( sepadata->minnodelimit < 0 || sepadata->maxnodelimit < 0 )
2178 assert( sepadata->minnodelimit >= 0 && sepadata->maxnodelimit >= 0 );
2180 nodelimit =
MAX(sepadata->minnodelimit, nodelimit);
2181 nodelimit =
MIN(sepadata->maxnodelimit, nodelimit);
2183 assert( nodelimit >= 0 );
2186 SCIPdebugMsg(scip,
"Solving sub-SCIP (time limit: %f mem limit: %f node limit: %" SCIP_LONGINT_FORMAT
") ...\n", timelimit, memorylimit, nodelimit);
2189 if( !sepadata->output )
2195 if ( ! sepadata->earlyterm )
2206 SCIPwarningMessage(scip,
"Error while solving subproblem in CGMIP separator; sub-SCIP terminated with code <%d>\n", retcode);
2216 if ( sepadata->output )
2232 SCIPerrorMessage(
"Solution of subscip for CG-separation returned with invalid status %d.\n", status);
2252 SCIPwarningMessage(scip,
"Error while solving subproblem in CGMIP separator; sub-SCIP terminated with code <%d>\n", retcode);
2267 if ( sepadata->output )
2279 SCIPerrorMessage(
"Solution of subscip for CG-separation returned with invalid status %d.\n", status);
2286 SCIPdebugMsg(scip,
"Continue solving separation problem ...\n");
2299 SCIPwarningMessage(scip,
"Error while solving subproblem in CGMIP separator; sub-SCIP terminated with code <%d>\n", retcode);
2310 if ( sepadata->output )
2326 SCIPerrorMessage(
"Solution of subscip for CG-separation returned with invalid status %d.\n", status);
2392 assert( scip !=
NULL );
2393 assert( mipdata !=
NULL );
2394 assert( sepadata !=
NULL );
2395 assert( cutcoefs !=
NULL );
2396 assert( cutrhs !=
NULL );
2397 assert( localrowsused !=
NULL );
2398 assert( cutrank !=
NULL );
2399 assert( success !=
NULL );
2401 subscip = mipdata->subscip;
2402 assert( subscip !=
NULL );
2408 assert( nrows == (
int) mipdata->nrows );
2409 assert( ncols == (
int) mipdata->ncols );
2413 *localrowsused =
FALSE;
2415 *localboundsused =
FALSE;
2421 for (i = 0; i < nrows; ++i)
2427 assert( row !=
NULL );
2432 assert( mipdata->ylhs[i] ==
NULL && mipdata->yrhs[i] ==
NULL );
2437 if ( mipdata->ylhs[i] !=
NULL )
2441 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
2449 if ( mipdata->yrhs[i] !=
NULL )
2453 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
2464 if ( absweight > maxabsweight )
2465 maxabsweight = absweight;
2469 if ( sepadata->useobjub || sepadata->useobjlb )
2473 assert( mipdata->ntotalrows == mipdata->nrows + 1 );
2475 if ( mipdata->ylhs[mipdata->nrows] !=
NULL )
2477 val =
SCIPgetSolVal(subscip, sol, mipdata->ylhs[mipdata->nrows]);
2483 if ( mipdata->yrhs[mipdata->nrows] !=
NULL )
2485 val =
SCIPgetSolVal(subscip, sol, mipdata->yrhs[mipdata->nrows]);
2493 if ( absweight > maxabsweight )
2494 maxabsweight = absweight;
2498 for (i = 0; i < nrows; ++i)
2506 assert( row !=
NULL );
2511 assert( mipdata->ylhs[i] ==
NULL && mipdata->yrhs[i] ==
NULL );
2518 if ( mipdata->ylhs[i] !=
NULL )
2523 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
2532 if ( mipdata->yrhs[i] !=
NULL )
2537 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
2561 assert( rowcols[j] !=
NULL );
2564 assert( var !=
NULL );
2569 assert( 0 <= idx && idx < nvars );
2571 cutcoefs[idx] += weight * rowvals[j];
2589 (*cutrhs) += weight * val;
2601 if ( sepadata->useobjub || sepadata->useobjlb )
2607 assert( mipdata->ntotalrows == mipdata->nrows + 1 );
2609 if ( mipdata->ylhs[mipdata->nrows] !=
NULL )
2611 val =
SCIPgetSolVal(subscip, sol, mipdata->ylhs[mipdata->nrows]);
2613 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
2622 if ( mipdata->yrhs[mipdata->nrows] !=
NULL )
2624 val =
SCIPgetSolVal(subscip, sol, mipdata->yrhs[mipdata->nrows]);
2626 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
2641 for (j = 0; j < ncols; ++j)
2645 cutcoefs[j] += weight * obj;
2663 (*cutrhs) += weight * val;
2668 for (j = 0; j < ncols; ++j)
2670 assert( cols[j] !=
NULL );
2671 if ( mipdata->z[j] !=
NULL )
2678 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
2689 assert( var !=
NULL );
2695 assert( 0 <= idx && idx < nvars );
2698 if ( mipdata->iscomplemented[j] )
2714 *localboundsused =
TRUE;
2717 cutcoefs[idx] -= val;
2718 *cutrhs -= lbnd * val;
2733 *localboundsused =
TRUE;
2736 cutcoefs[idx] += val;
2737 *cutrhs += ubnd * val;
2744 for (j = 0; j < nvars; ++j)
2750 assert( var !=
NULL );
2756 assert( pos < ncols );
2761 if ( mipdata->iscomplemented[pos] )
2763 assert( ! mipdata->isshifted[pos] );
2786 *localboundsused =
TRUE;
2794 *cutrhs += ubnd * val;
2819 *localboundsused =
TRUE;
2827 *cutrhs -= lbnd * val;
2888 assert( scip !=
NULL );
2889 assert( sepadata !=
NULL );
2890 assert( mipdata !=
NULL );
2891 assert( sol !=
NULL );
2892 assert( cutcoefs !=
NULL );
2893 assert( cutvars !=
NULL );
2894 assert( cutvals !=
NULL );
2895 assert( varsolvals !=
NULL );
2896 assert( weights !=
NULL );
2897 assert( nprevrows !=
NULL );
2898 assert( prevrows !=
NULL );
2899 assert( cutoff !=
NULL );
2900 assert( ngen !=
NULL );
2906 localrowsused =
FALSE;
2907 localboundsused =
FALSE;
2912 SCIP_CALL(
computeCut(scip, sepa, mipdata, sepadata, sol, cutcoefs, &cutrhs, &localrowsused, &localboundsused, &cutrank, &success) );
2913 cutislocal = localrowsused || localboundsused;
2924 for (k = 0; k < nvars; ++k)
2925 cutact += cutcoefs[k] * varsolvals[k];
2927 #ifdef SCIP_DISABLED_CODE 2939 subscip = mipdata->subscip;
2940 assert( subscip !=
NULL );
2945 for (j = 0; j < mipdata->ncols; ++j)
2950 assert( mipdata->alpha[j] !=
NULL );
2960 contVarShifted =
TRUE;
2963 assert( mipdata->beta !=
NULL );
2967 assert( contVarShifted ||
SCIPisFeasEQ(scip, obj, cutact - cutrhs) );
2979 cutvars, cutvals, &cutlen, &cutact, &cutnorm) );
2981 SCIPdebugMsg(scip,
"act=%f, rhs=%f, norm=%f, eff=%f\n", cutact, cutrhs, cutnorm, (cutact - cutrhs)/cutnorm);
2988 if ( violated || (sepadata->usecutpool && ! cutislocal ) )
3005 assert( violated || sepadata->usecutpool );
3013 for (k = 0; k < *nprevrows; ++k)
3017 assert( prevrows[k] !=
NULL );
3025 if ( k >= *nprevrows )
3027 prevrows[*nprevrows] = cut;
3030 SCIPdebugMsg(scip,
" -> CG-cut <%s>: act=%f, rhs=%f, norm=%f, eff=%f, min=%f, max=%f (range=%f)\n",
3038 if ( sepadata->output )
3079 int* boundsfortrans,
3102 assert( scip !=
NULL );
3103 assert( sepadata !=
NULL );
3104 assert( mipdata !=
NULL );
3105 assert( sol !=
NULL );
3106 assert( cutcoefs !=
NULL );
3107 assert( cutvars !=
NULL );
3108 assert( cutvals !=
NULL );
3109 assert( varsolvals !=
NULL );
3110 assert( weights !=
NULL );
3111 assert( nprevrows !=
NULL );
3112 assert( prevrows !=
NULL );
3113 assert( cutoff !=
NULL );
3114 assert( ngen !=
NULL );
3117 subscip = mipdata->subscip;
3118 assert( subscip !=
NULL );
3121 assert( nrows > 0 );
3122 assert( (
int) mipdata->nrows == nrows );
3132 for (k = 0; k < nrows; ++k)
3137 if ( mipdata->ylhs[k] !=
NULL )
3144 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
3150 if ( mipdata->yrhs[k] !=
NULL )
3157 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
3167 if ( sepadata->cmirownbounds )
3171 assert( boundsfortrans !=
NULL );
3172 assert( boundtypesfortrans !=
NULL );
3174 if ( sepadata->allowlocal )
3180 for (k = 0; k < nvars; ++k)
3186 assert( var !=
NULL );
3192 assert( pos < (
int) mipdata->ncols );
3195 boundsfortrans[k] = typefortrans;
3208 if ( ! mipdata->iscomplemented[pos] )
3215 if ( mipdata->iscomplemented[pos] )
3227 weights, -1.0,
NULL, -1, -1,
NULL, 1.0,
NULL,
NULL, cutcoefs, &cutrhs, &cutact, &success, &cutislocal, &cutrank) );
3228 assert( sepadata->allowlocal || !cutislocal );
3229 SCIPdebugMsg(scip,
"CMIR: success = %u, cut is%sviolated (cutact: %g, cutrhs: %g)\n", success,
3230 SCIPisFeasGT(scip, cutact, cutrhs) ?
" " :
" not ", cutact, cutrhs);
3240 cutvars, cutvals, &cutlen, &cutact, &cutnorm) );
3250 if ( violated || ( sepadata->usecutpool && ! cutislocal) )
3266 if ( sepadata->output )
3282 assert( violated || sepadata->usecutpool );
3288 SCIPdebugMsg(scip,
" -> CG-cut <%s> no longer efficacious: act=%f, rhs=%f, norm=%f, eff=%f\n",
3298 for (k = 0; k < *nprevrows; ++k)
3302 assert( prevrows[k] !=
NULL );
3310 if ( k >= *nprevrows )
3312 prevrows[*nprevrows] = cut;
3315 SCIPdebugMsg(scip,
" -> CG-cut <%s>: act=%f, rhs=%f, norm=%f, eff=%f, rank=%d, min=%f, max=%f (range=%f)\n",
3323 if ( sepadata->output )
3341 SCIPdebugMsg(scip,
" -> CG-cut <%s> could not be scaled to integral coefficients: act=%f, rhs=%f, norm=%f, eff=%f\n",
3389 assert( scip !=
NULL );
3390 assert( sepadata !=
NULL );
3391 assert( mipdata !=
NULL );
3392 assert( sol !=
NULL );
3393 assert( cutcoefs !=
NULL );
3394 assert( cutvars !=
NULL );
3395 assert( cutvals !=
NULL );
3396 assert( varsolvals !=
NULL );
3397 assert( weights !=
NULL );
3398 assert( nprevrows !=
NULL );
3399 assert( prevrows !=
NULL );
3400 assert( cutoff !=
NULL );
3401 assert( ngen !=
NULL );
3404 subscip = mipdata->subscip;
3405 assert( subscip !=
NULL );
3408 assert( nrows > 0 );
3409 assert( (
int) mipdata->nrows == nrows );
3419 for (k = 0; k < nrows; ++k)
3424 if ( mipdata->ylhs[k] !=
NULL )
3431 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
3437 if ( mipdata->yrhs[k] !=
NULL )
3444 assert( sepadata->skipmultbounds ||
SCIPisFeasLT(subscip, val, 1.0) );
3457 weights,
NULL, -1, 1.0, cutcoefs, &cutrhs, &cutact, &success, &cutislocal, &cutrank) );
3458 assert( sepadata->allowlocal || !cutislocal );
3459 SCIPdebugMsg(scip,
"Strong-CG: success = %u, cut is%sviolated (cutact: %g, cutrhs: %g)\n", success,
3460 SCIPisFeasGT(scip, cutact, cutrhs) ?
" " :
" not ", cutact, cutrhs);
3470 cutvars, cutvals, &cutlen, &cutact, &cutnorm) );
3480 if ( violated || ( sepadata->usecutpool && ! cutislocal) )
3495 if ( sepadata->output )
3511 assert( violated || sepadata->usecutpool );
3517 SCIPdebugMsg(scip,
" -> CG-cut <%s> no longer efficacious: act=%f, rhs=%f, norm=%f, eff=%f rank=%d\n",
3527 for (k = 0; k < *nprevrows; ++k)
3531 assert( prevrows[k] !=
NULL );
3539 if ( k >= *nprevrows )
3541 prevrows[*nprevrows] = cut;
3544 SCIPdebugMsg(scip,
" -> CG-cut <%s>: act=%f, rhs=%f, norm=%f, eff=%f, min=%f, max=%f (range=%f)\n",
3553 if ( sepadata->output )
3572 SCIPdebugMsg(scip,
" -> CG-cut <%s> could not be scaled to integral coefficients: act=%f, rhs=%f, norm=%f, eff=%f\n",
3608 int* boundsfortrans;
3616 assert( scip !=
NULL );
3617 assert( sepadata !=
NULL );
3618 assert( mipdata !=
NULL );
3619 assert( cutoff !=
NULL );
3620 assert( ngen !=
NULL );
3622 subscip = mipdata->subscip;
3623 assert( subscip !=
NULL );
3639 SCIPdebugMsg(scip,
"Generating CG-cuts from %d sols (cmir: %u, strong-cg: %u) ...\n", nsols, sepadata->usecmir, sepadata->usestrongcg);
3647 assert(mipdata->ntotalrows <= INT_MAX);
3648 ntotalrows = (int)mipdata->ntotalrows;
3658 if ( sepadata->usecmir && sepadata->cmirownbounds )
3665 boundsfortrans =
NULL;
3666 boundtypesfortrans =
NULL;
3670 for (k = 0; k < nvars; ++k)
3675 varsolvals[k] = 0.0;
3680 for (s = 0; s < nsols; ++s)
3686 if ( sepadata->usecmir )
3688 SCIP_CALL(
createCGCutCMIR(scip, sepa, sepadata, mipdata, sol, cutcoefs, cutvars, cutvals, varsolvals, weights,
3689 boundsfortrans, boundtypesfortrans, &nprevrows, prevrows, cutoff, ngen) );
3692 if ( sepadata->usestrongcg )
3694 SCIP_CALL(
createCGCutStrongCG(scip, sepa, sepadata, mipdata, sol, cutcoefs, cutvars, cutvals, varsolvals, weights,
3695 &nprevrows, prevrows, cutoff, ngen) );
3698 if ( ! sepadata->usecmir && ! sepadata->usestrongcg )
3700 SCIP_CALL(
createCGCutDirect(scip, sepa, sepadata, mipdata, sol, cutcoefs, cutvars, cutvals, varsolvals, weights,
3701 &nprevrows, prevrows, cutoff, ngen) );
3704 assert( nprevrows <= 2 * nsols );
3705 assert( sepadata->usecmir || nprevrows <= nsols );
3706 assert( sepadata->usestrongcg || nprevrows <= nsols );
3709 for (k = 0; k < nprevrows; ++k)
3741 assert( scip !=
NULL );
3742 assert( sepa !=
NULL );
3743 assert( mipdata !=
NULL );
3747 assert( sepadata !=
NULL );
3751 subscip = mipdata->subscip;
3752 assert( subscip !=
NULL );
3754 for (j = 0; j < mipdata->ncols; ++j)
3758 assert( mipdata->alpha[j] !=
NULL );
3766 for (i = 0; i < mipdata->nrows; ++i)
3768 if ( mipdata->ylhs[i] !=
NULL )
3772 if ( mipdata->yrhs[i] !=
NULL )
3778 if ( sepadata->useobjub || sepadata->useobjlb )
3780 if ( mipdata->yrhs[mipdata->nrows] )
3784 if ( mipdata->ylhs[mipdata->nrows] )
3790 for (j = 0; j < mipdata->ncols; ++j)
3792 if ( mipdata->z[j] !=
NULL )
3825 assert(sepadata !=
NULL);
3840 assert(sepadata !=
NULL);
3851 assert( scip !=
NULL );
3852 assert( sepa !=
NULL );
3868 assert( scip !=
NULL );
3869 assert( sepa !=
NULL );
3874 assert( sepadata !=
NULL );
3899 assert( scip !=
NULL );
3900 assert( sepa !=
NULL );
3902 assert( result !=
NULL );
3908 assert(sepadata !=
NULL);
3917 if ( sepadata->maxdepth >= 0 && depth > sepadata->maxdepth )
3922 if ( (depth == 0 && sepadata->maxroundsroot >= 0 && ncalls >= sepadata->maxroundsroot)
3923 || (depth > 0 && sepadata->maxrounds >= 0 && ncalls >= sepadata->maxrounds) )
3939 if ( ( sepadata->useobjub || sepadata->useobjlb ) && ( sepadata->usecmir || sepadata->usestrongcg ) )
3942 "WARNING - sepa_cgmip: Using objective function bounds and CMIR or Strong-CG functions is useless. Turning off usage of objective function bounds.\n");
3954 if ( sepadata->decisiontree )
3962 if ( nrows <= 136 && firstlptime <= 0.05 && ncols <= 143 )
3964 else if ( nrows <= 136 && 0.05 < firstlptime && firstlptime <= 0.15 && ncols <= 143 )
3966 else if ( 136 < nrows && nrows <= 332 && ncols <= 143 )
3968 else if ( 136 < nrows && nrows <= 332 && 655 < ncols && ncols <= 1290 )
3970 else if ( 333 < nrows && nrows <= 874 && 0.15 < firstlptime && firstlptime <= 0.25 && 2614 < ncols && ncols <= 5141 )
3972 else if ( 875 < nrows && nrows <= 1676 && firstlptime <= 0.05 && 143 < ncols && ncols <= 265 )
3974 else if ( 875 < nrows && nrows <= 1676 && firstlptime <= 0.05 && 265 < ncols && ncols <= 654 )
3976 else if ( 875 < nrows && nrows <= 1676 && 0.05 < firstlptime && firstlptime <= 0.15 )
3978 else if ( 875 < nrows && nrows <= 1676 && 0.15 < firstlptime && firstlptime <= 0.25 && 1291 < ncols && ncols <= 2613 )
3980 else if ( nrows > 8146 && 0.75 < firstlptime && firstlptime <= 6.25 && 655 < ncols && ncols <= 1290 )
3982 else if ( nrows > 8146 && 0.75 < firstlptime && firstlptime <= 6.25 && 1291 < ncols && ncols <= 2613 )
3984 else if ( nrows > 8146 && firstlptime > 6.25 )
3996 SCIPdebugMsg(scip,
"separating CG-cuts via sub-MIPs: %d cols, %d rows\n", ncols, nrows);
4000 mipdata->subscip =
NULL;
4001 mipdata->alpha =
NULL;
4002 mipdata->fracalpha =
NULL;
4003 mipdata->beta =
NULL;
4004 mipdata->fracbeta =
NULL;
4005 mipdata->coltype =
NULL;
4006 mipdata->iscomplemented =
NULL;
4007 mipdata->isshifted =
NULL;
4008 mipdata->ylhs =
NULL;
4009 mipdata->yrhs =
NULL;
4011 mipdata->normtype =
' ';
4014 mipdata->scip = scip;
4015 mipdata->sepa = sepa;
4046 else if ( ngen > 0 )
4076 assert(sepa !=
NULL);
4086 "maximal number of cgmip separation rounds per node (-1: unlimited)",
4090 "separating/" SEPA_NAME "/maxroundsroot",
4091 "maximal number of cgmip separation rounds in the root node (-1: unlimited)",
4096 "maximal depth at which the separator is applied (-1: unlimited)",
4100 "separating/" SEPA_NAME "/decisiontree",
4101 "Use decision tree to turn separation on/off?",
4106 "time limit for sub-MIP",
4111 "memory limit for sub-MIP",
4115 "separating/" SEPA_NAME "/minnodelimit",
4116 "minimum number of nodes considered for sub-MIP (-1: unlimited)",
4120 "separating/" SEPA_NAME "/maxnodelimit",
4121 "maximum number of nodes considered for sub-MIP (-1: unlimited)",
4126 "bounds on the values of the coefficients in the CG-cut",
4130 "separating/" SEPA_NAME "/onlyactiverows",
4131 "Use only active rows to generate cuts?",
4136 "maximal age of rows to consider if onlyactiverows is false",
4141 "Separate only rank 1 inequalities w.r.t. CG-MIP separator?",
4146 "Generate cuts for problems with only integer variables?",
4151 "Allow to generate local cuts?",
4156 "Convert some integral variables to be continuous to reduce the size of the sub-MIP?",
4160 "separating/" SEPA_NAME "/contconvfrac",
4161 "fraction of integral variables converted to be continuous (if contconvert)",
4166 "minimum number of integral variables before some are converted to be continuous",
4171 "Convert some integral variables attaining fractional values to have integral value?",
4176 "fraction of frac. integral variables converted to have integral value (if intconvert)",
4181 "minimum number of integral variables before some are converted to have integral value",
4185 "separating/" SEPA_NAME "/skipmultbounds",
4186 "Skip the upper bounds on the multipliers in the sub-MIP?",
4191 "Should the objective of the sub-MIP minimize the l1-norm of the multipliers?",
4196 "weight used for the row combination coefficient in the sub-MIP objective",
4200 "separating/" SEPA_NAME "/objweightsize",
4201 "Weight each row by its size?",
4206 "should generated cuts be removed from the LP if they are no longer tight?",
4211 "use CMIR-generator (otherwise add cut directly)?",
4216 "use strong CG-function to strengthen cut?",
4220 "separating/" SEPA_NAME "/cmirownbounds",
4221 "tell CMIR-generator which bounds to used in rounding?",
4226 "use cutpool to store CG-cuts even if the are not efficient?",
4230 "separating/" SEPA_NAME "/primalseparation",
4231 "only separate cuts that are tight for the best feasible solution?",
4236 "terminate separation if a violated (but possibly sub-optimal) cut has been found?",
4240 "separating/" SEPA_NAME "/addviolationcons",
4241 "add constraint to subscip that only allows violated cuts (otherwise add obj. limit)?",
4245 "separating/" SEPA_NAME "/addviolconshdlr",
4246 "add constraint handler to filter out violated cuts?",
4250 "separating/" SEPA_NAME "/conshdlrusenorm",
4251 "should the violation constraint handler use the norm of a cut to check for feasibility?",
4256 "Use upper bound on objective function (via primal solution)?",
4261 "Use lower bound on objective function (via primal solution)?",
4266 "Should the settings for the sub-MIP be optimized for speed?",
4271 "Should information about the sub-MIP and cuts be displayed?",
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
enum SCIP_BoundType SCIP_BOUNDTYPE
int SCIPgetNIntVars(SCIP *scip)
SCIP_RETCODE SCIPrandomCreate(SCIP_RANDNUMGEN **randnumgen, BMS_BLKMEM *blkmem, unsigned int initialseed)
SCIP_RETCODE SCIPgetCharParam(SCIP *scip, const char *name, char *value)
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
#define DEFAULT_INTCONVERT
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int SCIProwGetAge(SCIP_ROW *row)
SCIP_SEPA * SCIProwGetOriginSepa(SCIP_ROW *row)
#define DEFAULT_CMIROWNBOUNDS
enum CGMIP_ColType CGMIP_COLTYPE
SCIP_RETCODE SCIPcalcStrongCG(SCIP *scip, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, int maxmksetcoefs, SCIP_Real maxweightrange, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_Real *weights, int *inds, int ninds, SCIP_Real scale, SCIP_Real *mircoef, SCIP_Real *mirrhs, SCIP_Real *cutactivity, SCIP_Bool *success, SCIP_Bool *cutislocal, int *cutrank)
#define DEFAULT_ALLOWLOCAL
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
SCIP_RETCODE SCIPcreateProb(SCIP *scip, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata)
SCIP_Real * SCIPcolGetVals(SCIP_COL *col)
SCIP_Bool SCIPisSumPositive(SCIP *scip, SCIP_Real val)
static SCIP_DECL_CONSFREE(consFreeViolatedCuts)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
const char * SCIProwGetName(SCIP_ROW *row)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
int SCIProwGetNLPNonz(SCIP_ROW *row)
static SCIP_DECL_SEPAINIT(sepaInitCGMIP)
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
#define DEFAULT_INTCONVMIN
SCIP_SOL ** SCIPgetSols(SCIP *scip)
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
#define DEFAULT_CUTCOEFBND
SCIP_Bool SCIPcolIsIntegral(SCIP_COL *col)
SCIP_RETCODE SCIPaddLongintParam(SCIP *scip, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_Real SCIPcolGetUb(SCIP_COL *col)
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
SCIP_RETCODE SCIPincludeConshdlrBasic(SCIP *scip, SCIP_CONSHDLR **conshdlrptr, const char *name, const char *desc, int enfopriority, int chckpriority, int eagerfreq, SCIP_Bool needscons, SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_CONSHDLRDATA *conshdlrdata)
SCIP_Real SCIPcolGetObj(SCIP_COL *col)
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
const char * SCIPsepaGetName(SCIP_SEPA *sepa)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPwriteOrigProblem(SCIP *scip, const char *filename, const char *extension, SCIP_Bool genericnames)
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
static SCIP_RETCODE solveSubscip(SCIP *scip, SCIP_SEPADATA *sepadata, CGMIP_MIPDATA *mipdata, SCIP_Bool *success)
int SCIPvarGetProbindex(SCIP_VAR *var)
SCIP_RETCODE SCIPcalcMIR(SCIP *scip, SCIP_SOL *sol, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Bool fixintegralrhs, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, int maxmksetcoefs, SCIP_Real maxweightrange, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_Real *weights, SCIP_Real maxweight, int *weightinds, int nweightinds, int rowlensum, int *sidetypes, SCIP_Real scale, SCIP_Real *mksetcoefs, SCIP_Bool *mksetcoefsvalid, SCIP_Real *mircoef, SCIP_Real *mirrhs, SCIP_Real *cutactivity, SCIP_Bool *success, SCIP_Bool *cutislocal, int *cutrank)
#define DEFAULT_CONTCONVMIN
#define SCIPfreeBlockMemory(scip, ptr)
static SCIP_RETCODE SCIPincludeConshdlrViolatedCut(SCIP *scip, CGMIP_MIPDATA *mipdata)
#define DEFAULT_EARLYTERM
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_RETCODE SCIPcreate(SCIP **scip)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPgetLPColsData(SCIP *scip, SCIP_COL ***cols, int *ncols)
int SCIPgetNLPBranchCands(SCIP *scip)
SCIP_RETCODE SCIPsetSepaCopy(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPACOPY((*sepacopy)))
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_Bool SCIPisSumZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
int SCIPgetNContVars(SCIP *scip)
static SCIP_RETCODE solCutIsViolated(SCIP *scip, CGMIP_MIPDATA *mipdata, SCIP_SOL *sol, SCIP_Bool *violated)
SCIP_Real SCIPepsilon(SCIP *scip)
SCIP_Real SCIPgetRowMaxCoef(SCIP *scip, SCIP_ROW *row)
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
#define MAXAGGRLEN(nvars)
SCIP_SEPADATA * SCIPsepaGetData(SCIP_SEPA *sepa)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
#define DEFAULT_TIMELIMIT
const char * SCIPgetProbName(SCIP *scip)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
void SCIPrandomFree(SCIP_RANDNUMGEN **randnumgen)
SCIP_Bool SCIPisCutEfficacious(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut)
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
SCIP_Real SCIPcolGetPrimsol(SCIP_COL *col)
SCIP_RETCODE SCIPsolve(SCIP *scip)
#define DEFAULT_ADDVIOLATIONCONS
#define DEFAULT_DECISIONTREE
#define DEFAULT_ONLYINTVARS
SCIP_Real SCIPgetRowMinCoef(SCIP *scip, SCIP_ROW *row)
#define DEFAULT_MAXROUNDSROOT
static SCIP_RETCODE createCGCutDirect(SCIP *scip, SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata, CGMIP_MIPDATA *mipdata, SCIP_SOL *sol, SCIP_Real *cutcoefs, SCIP_VAR **cutvars, SCIP_Real *cutvals, SCIP_Real *varsolvals, SCIP_Real *weights, int *nprevrows, SCIP_ROW **prevrows, SCIP_Bool *cutoff, unsigned int *ngen)
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_ROW ** SCIPcolGetRows(SCIP_COL *col)
#define DEFAULT_MINNODELIMIT
SCIP_RETCODE SCIPsetSepaExit(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAEXIT((*sepaexit)))
#define DEFAULT_ONLYACTIVEROWS
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
struct CGMIP_MIPData CGMIP_MIPDATA
#define SCIPfreeBufferArrayNull(scip, ptr)
int SCIPsepaGetNCallsAtNode(SCIP_SEPA *sepa)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
SCIP_STATUS SCIPgetStatus(SCIP *scip)
SCIP_Bool SCIPisEfficacious(SCIP *scip, SCIP_Real efficacy)
static SCIP_DECL_CONSCHECK(consCheckViolatedCuts)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
static SCIP_DECL_CONSLOCK(consLockViolatedCuts)
SCIP_Real SCIPcolGetLb(SCIP_COL *col)
#define DEFAULT_OBJWEIGHTSIZE
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSFREE((*consfree)))
SCIP_Bool SCIProwIsIntegral(SCIP_ROW *row)
static SCIP_RETCODE subscipSetParams(SCIP_SEPADATA *sepadata, CGMIP_MIPDATA *mipdata, SCIP_Bool *success)
void SCIPsepaSetData(SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata)
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
#define DEFAULT_MAXROWAGE
static SCIP_DECL_SEPAEXECLP(sepaExeclpCGMIP)
#define DEFAULT_CONSHDLRUSENORM
SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
int SCIPgetNLPRows(SCIP *scip)
#define DEFAULT_ONLYRANKONE
SCIP_Real SCIPgetLowerbound(SCIP *scip)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPsetEmphasis(SCIP *scip, SCIP_PARAMEMPHASIS paramemphasis, SCIP_Bool quiet)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
#define DEFAULT_SUBSCIPFAST
SCIP_Real SCIPgetRowLPActivity(SCIP *scip, SCIP_ROW *row)
#define DEFAULT_PRIMALSEPARATION
SCIP_RETCODE SCIPaddCut(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut, SCIP_Bool forcecut, SCIP_Bool *infeasible)
static SCIP_Real computeObjWeightSize(int rowsize, int minrowsize, int maxrowsize)
SCIP_Bool SCIProwIsModifiable(SCIP_ROW *row)
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
#define DEFAULT_SKIPMULTBOUNDS
SCIP_RETCODE SCIPincludeSepaBasic(SCIP *scip, SCIP_SEPA **sepa, const char *name, const char *desc, int priority, int freq, SCIP_Real maxbounddist, SCIP_Bool usessubscip, SCIP_Bool delay, SCIP_DECL_SEPAEXECLP((*sepaexeclp)), SCIP_DECL_SEPAEXECSOL((*sepaexecsol)), SCIP_SEPADATA *sepadata)
SCIP_RETCODE SCIPincludeSepaCGMIP(SCIP *scip)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
#define DEFAULT_USECUTPOOL
public data structures and miscellaneous methods
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
int SCIPgetNImplVars(SCIP *scip)
static SCIP_DECL_SEPAEXIT(sepaExitCGMIP)
enum SCIP_Status SCIP_STATUS
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
int SCIPgetDepth(SCIP *scip)
SCIP_RETCODE SCIPaddPoolCut(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
public methods for LP management
SCIP_RETCODE SCIPcreateEmptyRowSepa(SCIP *scip, SCIP_ROW **row, SCIP_SEPA *sepa, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
unsigned int SCIPinitializeRandomSeed(SCIP *scip, int initialseedvalue)
SCIP_Real SCIPgetCutEfficacy(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
int SCIPgetNSols(SCIP *scip)
static SCIP_DECL_SEPACOPY(sepaCopyCGMIP)
#define DEFAULT_OBJWEIGHT
#define DEFAULT_DYNAMICCUTS
SCIP_COL * SCIPvarGetCol(SCIP_VAR *var)
Constraint handler for linear constraints in their most general form, .
int SCIPgetNObjVars(SCIP *scip)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
static SCIP_DECL_SEPAFREE(sepaFreeCGMIP)
int SCIPgetNBinVars(SCIP *scip)
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
int SCIProwGetRank(SCIP_ROW *row)
#define DEFAULT_USESTRONGCG
SCIP_Real SCIProwGetParallelism(SCIP_ROW *row1, SCIP_ROW *row2, char orthofunc)
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
SCIP_Bool SCIPisObjIntegral(SCIP *scip)
static SCIP_RETCODE freeSubscip(SCIP *scip, SCIP_SEPA *sepa, CGMIP_MIPDATA *mipdata)
static SCIP_RETCODE createCGCutStrongCG(SCIP *scip, SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata, CGMIP_MIPDATA *mipdata, SCIP_SOL *sol, SCIP_Real *cutcoefs, SCIP_VAR **cutvars, SCIP_Real *cutvals, SCIP_Real *varsolvals, SCIP_Real *weights, int *nprevrows, SCIP_ROW **prevrows, SCIP_Bool *cutoff, unsigned int *ngen)
SCIP_RETCODE SCIPsetSepaFree(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAFREE((*sepafree)))
SCIP_RETCODE SCIPsetSepaInit(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAINIT((*sepainit)))
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
void SCIProwChgRank(SCIP_ROW *row, int rank)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
#define DEFAULT_MAXROUNDS
#define DEFAULT_CONTCONVERT
#define DEFAULT_INTCONVFRAC
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
Chvatal-Gomory cuts computed via a sub-MIP.
#define DEFAULT_ADDVIOLCONSHDLR
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
int SCIProwGetLPPos(SCIP_ROW *row)
SCIP_RETCODE SCIPaddVarsToRow(SCIP *scip, SCIP_ROW *row, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
enum SCIP_Stage SCIP_STAGE
static SCIP_DECL_CONSENFOLP(consEnfolpViolatedCuts)
SCIP_Bool SCIPisStopped(SCIP *scip)
SCIP_RETCODE SCIPprintRow(SCIP *scip, SCIP_ROW *row, FILE *file)
SCIP_Real SCIPfrac(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
static SCIP_RETCODE createSubscip(SCIP *scip, SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata, CGMIP_MIPDATA *mipdata)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
SCIP_Real SCIPgetVarSol(SCIP *scip, SCIP_VAR *var)
int SCIPgetNLPCols(SCIP *scip)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE transformColumn(SCIP *scip, SCIP_SEPADATA *sepadata, CGMIP_MIPDATA *mipdata, SCIP_COL *col, SCIP_Real offset, SCIP_Real sigma, SCIP_Real *lhs, SCIP_Real *rhs, SCIP_Real *lb, SCIP_Real *ub, SCIP_Real *primsol)
SCIP_Real SCIPsumepsilon(SCIP *scip)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
#define DEFAULT_MEMORYLIMIT
static SCIP_RETCODE createCGCuts(SCIP *scip, SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata, CGMIP_MIPDATA *mipdata, SCIP_Bool *cutoff, unsigned int *ngen)
#define DEFAULT_MAXNODELIMIT
#define BMSclearMemoryArray(ptr, num)
SCIP_RETCODE SCIPgetLPRowsData(SCIP *scip, SCIP_ROW ***rows, int *nrows)
static SCIP_RETCODE createCGCutCMIR(SCIP *scip, SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata, CGMIP_MIPDATA *mipdata, SCIP_SOL *sol, SCIP_Real *cutcoefs, SCIP_VAR **cutvars, SCIP_Real *cutvals, SCIP_Real *varsolvals, SCIP_Real *weights, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, int *nprevrows, SCIP_ROW **prevrows, SCIP_Bool *cutoff, unsigned int *ngen)
SCIP_Longint SCIPgetNLPs(SCIP *scip)
int SCIPcolGetNLPNonz(SCIP_COL *col)
int SCIPcolGetLPPos(SCIP_COL *col)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
static SCIP_RETCODE storeCutInArrays(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_Real *cutcoefs, SCIP_Real *varsolvals, char normtype, SCIP_VAR **cutvars, SCIP_Real *cutvals, int *cutlen, SCIP_Real *cutact, SCIP_Real *cutnorm)
static SCIP_DECL_CONSENFOPS(consEnfopsViolatedCuts)
SCIP_RETCODE SCIPmakeRowIntegral(SCIP *scip, SCIP_ROW *row, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Real maxscale, SCIP_Bool usecontvars, SCIP_Bool *success)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_Real SCIProwGetNorm(SCIP_ROW *row)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_Real SCIPgetFirstLPTime(SCIP *scip)
SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet)
#define DEFAULT_CONTCONVFRAC
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
struct SCIP_SepaData SCIP_SEPADATA
#define SEPA_MAXBOUNDDIST
static SCIP_RETCODE computeCut(SCIP *scip, SCIP_SEPA *sepa, CGMIP_MIPDATA *mipdata, SCIP_SEPADATA *sepadata, SCIP_SOL *sol, SCIP_Real *cutcoefs, SCIP_Real *cutrhs, SCIP_Bool *localrowsused, SCIP_Bool *localboundsused, int *cutrank, SCIP_Bool *success)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPfree(SCIP **scip)
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)