37 #define MAXCMIRSCALE 1e+6 68 for( i = 0; i < row->
len; ++i )
87 #define debugRowPrint(x) 106 assert(prob !=
NULL);
110 for( i = 0; i < prob->
nvars; ++i )
112 if( mircoef[i] != 0.0 )
120 if( mircoef[i] > 0.0 )
152 assert(weights !=
NULL);
153 assert(rowinds !=
NULL);
154 assert(nrowinds !=
NULL);
160 for( r = 0; r < lp->
nrows; ++r )
169 rowinds[*nrowinds] = r;
174 absweight =
REALABS(weights[r]);
175 maxabsweight =
MAX(maxabsweight, absweight);
198 assert(weights !=
NULL);
199 assert(rowinds !=
NULL);
200 assert(nrowinds !=
NULL);
206 for( r = 0; r < *nrowinds; ++r )
214 rowinds[w] = rowinds[r];
219 absweight =
REALABS(weights[rowinds[r]]);
220 maxabsweight =
MAX(maxabsweight, absweight);
240 assert(bestlb !=
NULL);
241 assert(bestlbtype !=
NULL);
265 && (bestvlb > *bestlb || (*bestlbtype < 0 &&
SCIPsetIsGE(
set, bestvlb, *bestlb))) )
274 assert(vlbvars !=
NULL);
278 *bestlbtype = bestvlbidx;
297 assert(bestub !=
NULL);
298 assert(bestubtype !=
NULL);
322 && (bestvub < *bestub || (*bestubtype < 0 &&
SCIPsetIsLE(
set, bestvub, *bestub))) )
331 assert(vubvars !=
NULL);
335 *bestubtype = bestvubidx;
357 for( i = 0; i < nvarinds; i++ )
362 assert(0 <= v && v < prob->nvars);
363 assert(mircoef[v] != 0.0);
384 for( i = 0; i < nvarinds; i++ )
389 assert(0 <= v && v < prob->nvars);
390 assert(mircoef[v] != 0.0);
392 if( mircoef[v] > 0.0 )
424 assert(mircoef !=
NULL);
425 assert(mirrhs !=
NULL);
426 assert(slacksign !=
NULL);
427 assert(varused !=
NULL);
428 assert(varinds !=
NULL);
429 assert(nvarinds !=
NULL);
431 assert(weight != 0.0);
451 (*mirrhs) += weight * sideval;
454 for( i = 0; i < row->
len; ++i )
464 mircoef[idx] += weight * row->
vals[i];
470 varinds[*nvarinds] = idx;
506 assert(prob !=
NULL);
508 assert(weights !=
NULL);
510 assert(maxweightrange >= 1.0);
511 assert(strongcgcoef !=
NULL);
512 assert(strongcgrhs !=
NULL);
513 assert(slacksign !=
NULL);
514 assert(varused !=
NULL);
515 assert(varinds !=
NULL);
516 assert(nvarinds !=
NULL);
517 assert(rowinds !=
NULL);
518 assert(nrowinds !=
NULL);
519 assert(emptyrow !=
NULL);
520 assert(localrowsused !=
NULL);
523 *localrowsused =
FALSE;
532 if( *nrowinds == -1 )
535 maxweight =
getMaxAbsWeight(
set, lp, weights, rowinds, nrowinds, &rowlensum);
538 maxweight *= ABS(scale);
541 if( rowlensum/5 > maxmksetcoefs )
550 while( i < *nrowinds )
559 assert(0 <= i && i < lp->nrows);
560 assert(weights[r] != 0.0);
572 weight = scale * weights[r];
573 absweight = ABS(weight);
576 && absweight * maxweightrange >= maxweight && !
SCIPsetIsSumZero(
set, weight) )
610 addRowToAggregation(
set, strongcgcoef, strongcgrhs, slacksign, varused, varinds, nvarinds, row, weight, uselhs);
612 *localrowsused = *localrowsused || row->
local;
614 maxrank =
MAX(maxrank, row->
rank);
616 SCIPdebugMessage(
"strong CG: %d: row <%s>, lhs = %g, rhs = %g, scale = %g, weight = %g, slacksign = %d -> rhs = %g\n",
618 scale, weights[r], slacksign[r], *strongcgrhs);
628 rowinds[i] = rowinds[(*nrowinds)-1];
639 if( *nrowinds > maxmksetcoefs )
643 if( cutrank !=
NULL )
644 *cutrank = maxrank + 1;
680 assert(prob !=
NULL);
682 assert(weights !=
NULL);
684 assert(maxweightrange >= 1.0);
685 assert(mircoef !=
NULL);
686 assert(mirrhs !=
NULL);
687 assert(slacksign !=
NULL);
688 assert(varused !=
NULL);
689 assert(varinds !=
NULL);
690 assert(nvarinds !=
NULL);
691 assert(rowinds !=
NULL);
692 assert(nrowinds !=
NULL);
693 assert(emptyrow !=
NULL);
694 assert(localrowsused !=
NULL);
695 assert(rowtoolong !=
NULL);
701 *localrowsused =
FALSE;
716 if( knownmaxweight == -1 )
718 assert(*nrowinds > -1);
719 maxweight =
getMaxAbsWeight(
set, lp, weights, rowinds, nrowinds, &rowlensum);
722 maxweight = knownmaxweight;
726 if( rowlensum/5 > maxmksetcoefs )
732 maxweight *= ABS(scale);
737 while( i < *nrowinds )
745 assert(0 <= r && r < lp->nrows);
746 assert(weights[r] != 0.0);
758 weight = scale * weights[r];
761 && absweight * maxweightrange >= maxweight && !
SCIPsetIsSumZero(
set, weight) )
766 if ( sidetypes !=
NULL )
768 assert( sidetypes[r] == -1 || sidetypes[r] == 0 || sidetypes[r] == 1 );
769 if ( sidetypes[r] == -1 )
774 else if ( sidetypes[r] == 1 )
802 addRowToAggregation(
set, mircoef, mirrhs, slacksign, varused, varinds, nvarinds, row, weight, uselhs);
804 *localrowsused = *localrowsused || row->
local;
806 SCIPdebugMessage(
"MIR: %d: row <%s>, lhs = %g, rhs = %g, scale = %g, weight = %g, slacksign = %d -> rhs = %g\n",
808 scale, weights[r], slacksign[r], *mirrhs);
812 maxrank =
MAX(maxrank, row->
rank);
819 rowinds[i] = rowinds[(*nrowinds)-1];
828 if( *nvarinds > maxmksetcoefs )
832 if( cutrank !=
NULL )
833 *cutrank = maxrank + 1;
854 assert(prob !=
NULL);
855 assert(mircoef !=
NULL);
856 assert(mirrhs !=
NULL);
857 assert(varused !=
NULL);
858 assert(varinds !=
NULL);
859 assert(nvarinds !=
NULL);
863 while( i < *nvarinds )
868 assert(0 <= v && v < prob->nvars);
875 SCIPdebugMessage(
"coefficient of <%s> in transformed MIR row is too small: %.12f\n",
891 *mirrhs -= bd * mircoef[v];
896 varinds[i] = varinds[(*nvarinds)-1];
954 assert(prob !=
NULL);
955 assert(strongcgcoef !=
NULL);
956 assert(strongcgrhs !=
NULL);
957 assert(varused !=
NULL);
958 assert(varinds !=
NULL);
959 assert(nvarinds !=
NULL);
960 assert(varsign !=
NULL);
961 assert(boundtype !=
NULL);
962 assert(freevariable !=
NULL);
963 assert(localbdsused !=
NULL);
965 *freevariable =
FALSE;
966 *localbdsused =
FALSE;
970 for( i = 0; i < prob->
nvars; i++ )
987 while( i < *nvarinds )
999 assert(0 <= v && v < prob->nvars);
1002 var = prob->
vars[v];
1012 strongcgcoef[v] = 0.0;
1014 varinds[i] = varinds[(*nvarinds)-1];
1040 && (bestvlb > bestlb || (bestlbtype < 0 &&
SCIPsetIsGE(
set, bestvlb, bestlb))) )
1043 bestlbtype = bestvlbidx;
1068 && (bestvub < bestub || (bestubtype < 0 &&
SCIPsetIsLE(
set, bestvub, bestub))) )
1071 bestubtype = bestvubidx;
1088 *freevariable =
TRUE;
1097 uselb = (strongcgcoef[v] > 0.0);
1098 else if(
SCIPsetIsLT(
set, varsol, (1.0 - boundswitch) * bestlb + boundswitch * bestub) )
1100 else if(
SCIPsetIsGT(
set, varsol, (1.0 - boundswitch) * bestlb + boundswitch * bestub) )
1102 else if( bestlbtype == -1 )
1104 else if( bestubtype == -1 )
1106 else if( bestlbtype >= 0 )
1108 else if( bestubtype >= 0 )
1119 boundtype[v] = bestlbtype;
1123 if( bestlbtype < 0 )
1125 (*strongcgrhs) -= strongcgcoef[v] * bestlb;
1126 *localbdsused = *localbdsused || (bestlbtype == -2);
1138 assert(0 <= zidx && zidx < v);
1140 (*strongcgrhs) -= strongcgcoef[v] * vlbconsts[bestlbtype];
1141 strongcgcoef[zidx] += strongcgcoef[v] * vlbcoefs[bestlbtype];
1144 if( !varused[zidx] )
1146 assert(*nvarinds < prob->nvars);
1147 varused[zidx] =
TRUE;
1148 varinds[*nvarinds] = zidx;
1158 boundtype[v] = bestubtype;
1162 if( bestubtype < 0 )
1164 (*strongcgrhs) -= strongcgcoef[v] * bestub;
1165 *localbdsused = *localbdsused || (bestubtype == -2);
1179 (*strongcgrhs) -= strongcgcoef[v] * vubconsts[bestubtype];
1180 strongcgcoef[zidx] += strongcgcoef[v] * vubcoefs[bestubtype];
1183 if( !varused[zidx] )
1185 assert(*nvarinds < prob->nvars);
1186 varused[zidx] =
TRUE;
1187 varinds[*nvarinds] = zidx;
1195 assert(strongcgcoef[v]*varsign[v] > 0.0);
1198 SCIPdebugMessage(
"strong CG var <%s>: varsign=%d, boundtype=%d, strongcgcoef=%g, lb=%g, ub=%g -> rhs=%g\n",
1199 SCIPvarGetName(var), varsign[v], boundtype[v], strongcgcoef[v], bestlb, bestub, *strongcgrhs);
1243 int* boundsfortrans,
1268 assert(prob !=
NULL);
1269 assert(mircoef !=
NULL);
1270 assert(mirrhs !=
NULL);
1271 assert(varused !=
NULL);
1272 assert(varinds !=
NULL);
1273 assert(nvarinds !=
NULL);
1274 assert(varsign !=
NULL);
1275 assert(boundtype !=
NULL);
1276 assert(freevariable !=
NULL);
1277 assert(localbdsused !=
NULL);
1279 *freevariable =
FALSE;
1280 *localbdsused =
FALSE;
1284 for( i = 0; i < prob->
nvars; i++ )
1307 while( i < *nvarinds )
1318 assert(0 <= v && v < prob->nvars);
1321 var = prob->
vars[v];
1333 varinds[i] = varinds[(*nvarinds)-1];
1339 if( boundsfortrans !=
NULL && boundsfortrans[v] > -3 )
1347 bestlbtype = boundsfortrans[v];
1348 if( bestlbtype == -1 )
1350 else if( bestlbtype == -2 )
1365 k = boundsfortrans[v];
1367 assert(vlbvars !=
NULL);
1368 assert(vlbcoefs !=
NULL);
1369 assert(vlbconsts !=
NULL);
1385 findBestUb(
set, stat, var, sol, usevbds && fixintegralrhs, allowlocal && fixintegralrhs, &bestub, &bestubtype);
1392 bestubtype = boundsfortrans[v];
1393 if( bestubtype == -1 )
1395 else if( bestubtype == -2 )
1410 k = boundsfortrans[v];
1412 assert(vubvars !=
NULL);
1413 assert(vubcoefs !=
NULL);
1414 assert(vubconsts !=
NULL);
1430 findBestLb(
set, stat, var, sol, usevbds && fixintegralrhs, allowlocal && fixintegralrhs, &bestlb, &bestlbtype);
1440 findBestLb(
set, stat, var, sol, usevbds, allowlocal, &bestlb, &bestlbtype);
1443 findBestUb(
set, stat, var, sol, usevbds, allowlocal, &bestub, &bestubtype);
1451 *freevariable =
TRUE;
1464 else if(
SCIPsetIsLT(
set, varsol, (1.0 - boundswitch) * bestlb + boundswitch * bestub) )
1466 else if(
SCIPsetIsGT(
set, varsol, (1.0 - boundswitch) * bestlb + boundswitch * bestub) )
1468 else if( bestlbtype == -1 )
1470 else if( bestubtype == -1 )
1472 else if( bestlbtype >= 0 )
1474 else if( bestubtype >= 0 )
1510 bestlbs[v] = bestlb;
1511 bestubs[v] = bestub;
1512 bestlbtypes[v] = bestlbtype;
1513 bestubtypes[v] = bestubtype;
1521 boundtype[v] = bestlbtype;
1525 if( bestlbtype < 0 )
1527 (*mirrhs) -= mircoef[v] * bestlb;
1528 *localbdsused = *localbdsused || (bestlbtype == -2);
1540 assert(vlbvars !=
NULL);
1541 assert(vlbcoefs !=
NULL);
1542 assert(vlbconsts !=
NULL);
1547 assert(0 <= zidx && zidx < v);
1549 (*mirrhs) -= mircoef[v] * vlbconsts[bestlbtype];
1550 mircoef[zidx] += mircoef[v] * vlbcoefs[bestlbtype];
1553 if( !varused[zidx] )
1555 assert(*nvarinds < prob->nvars);
1556 varused[zidx] =
TRUE;
1557 varinds[*nvarinds] = zidx;
1567 boundtype[v] = bestubtype;
1571 if( bestubtype < 0 )
1573 (*mirrhs) -= mircoef[v] * bestub;
1574 *localbdsused = *localbdsused || (bestubtype == -2);
1586 assert(vubvars !=
NULL);
1587 assert(vubcoefs !=
NULL);
1588 assert(vubconsts !=
NULL);
1595 (*mirrhs) -= mircoef[v] * vubconsts[bestubtype];
1596 mircoef[zidx] += mircoef[v] * vubcoefs[bestubtype];
1599 if( !varused[zidx] )
1601 assert(*nvarinds < prob->nvars);
1602 varused[zidx] =
TRUE;
1603 varinds[*nvarinds] = zidx;
1611 if( bestlbtype >= 0 )
1618 if( bestubtype >= 0 )
1628 SCIPdebugMessage(
"MIR var <%s>: varsign=%d, boundtype=%d, mircoef=%g, base=%d, sol=%g, lb=%g, ub=%g, vlb=%g<%s>%+g, vub=%g<%s>%+g -> rhs=%g\n",
1642 SCIPdebugMessage(
"MIR var <%s>: varsign=%d, boundtype=%d, mircoef=%g, base=%d, lb=%g, ub=%g, vlb=%g<%s>%+g, vub=%g<%s>%+g -> rhs=%g\n",
1657 if( fixintegralrhs )
1663 if( f0 < minfrac || f0 > maxfrac )
1671 bestviolgain = -1e+100;
1673 for( i = 0; i < *nvarinds; i++ )
1678 assert(0 <= v && v < prob->nvars);
1682 if( boundtype[v] < 0
1683 && ((varsign[v] == +1 && !
SCIPsetIsInfinity(
set, bestubs[v]) && bestubtypes[v] < 0)
1684 || (varsign[v] == -1 && !
SCIPsetIsInfinity(
set, -bestlbs[v]) && bestlbtypes[v] < 0)) )
1703 newrhs = *mirrhs + varsign[v] * mircoef[v] * (bestlbs[v] - bestubs[v]);
1705 if( newf0 < minfrac || newf0 > maxfrac )
1715 newfj =
SCIPsetFrac(
set, -varsign[v] * mircoef[v]);
1721 viol = f0 - fj * (varsign[v] == +1 ? solval - bestlbs[v] : bestubs[v] - solval);
1722 newviol = newf0 - newfj * (varsign[v] == -1 ? solval - bestlbs[v] : bestubs[v] - solval);
1723 violgain = newviol - viol;
1728 SCIPerrorMessage(
"Cannot handle closest bounds with ignoring the LP solution.\n");
1736 || (
SCIPsetIsGE(
set, violgain, bestviolgain) && newf0 < bestnewf0) )
1739 bestviolgain = violgain;
1747 assert(bestv < prob->nvars);
1748 assert(boundtype[bestv] < 0);
1753 (*mirrhs) += varsign[bestv] * mircoef[bestv] * (bestlbs[bestv] - bestubs[bestv]);
1754 if( varsign[bestv] == +1 )
1757 assert(bestubtypes[bestv] < 0);
1758 boundtype[bestv] = bestubtypes[bestv];
1759 varsign[bestv] = -1;
1764 assert(bestlbtypes[bestv] < 0);
1765 boundtype[bestv] = bestlbtypes[bestv];
1766 varsign[bestv] = +1;
1768 *localbdsused = *localbdsused || (boundtype[bestv] == -2);
1856 assert(prob !=
NULL);
1857 assert(strongcgcoef !=
NULL);
1858 assert(strongcgrhs !=
NULL);
1859 assert(varused !=
NULL);
1860 assert(varinds !=
NULL);
1861 assert(nvarinds !=
NULL);
1862 assert(varsign !=
NULL);
1863 assert(0.0 < f0 && f0 < 1.0);
1865 onedivoneminusf0 = 1.0 / (1.0 - f0);
1874 for( i = *nvarinds-1; i >= 0; i-- )
1884 assert(0 <= v && v < prob->nvars);
1895 var = prob->
vars[v];
1896 assert(var !=
NULL);
1899 assert(boundtype[v] == -1 || boundtype[v] == -2);
1900 assert(varsign[v] == +1 || varsign[v] == -1);
1903 aj = varsign[v] * strongcgcoef[v];
1908 cutaj = varsign[v] * downaj;
1913 pj =
SCIPsetCeil(
set, k * (fj - f0) * onedivoneminusf0);
1916 cutaj = varsign[v] * (downaj + pj / (k + 1));
1923 strongcgcoef[v] = 0.0;
1925 varinds[i] = varinds[(*nvarinds)-1];
1930 strongcgcoef[v] = cutaj;
1933 if( varsign[v] == +1 )
1936 if( boundtype[v] == -1 )
1950 if( boundtype[v] == -1 )
1964 for( ; i >= 0; i-- )
1969 assert(0 <= v && v < prob->nvars);
1978 var = prob->
vars[v];
1979 assert(var !=
NULL);
1982 assert(varsign[v] == +1 || varsign[v] == -1);
1985 aj = varsign[v] * strongcgcoef[v];
1990 strongcgcoef[v] = 0.0;
1994 varinds[i] = varinds[(*nvarinds)-1];
2066 assert(prob !=
NULL);
2067 assert(mircoef !=
NULL);
2068 assert(mirrhs !=
NULL);
2069 assert(varused !=
NULL);
2070 assert(varinds !=
NULL);
2071 assert(nvarinds !=
NULL);
2072 assert(varsign !=
NULL);
2073 assert(0.0 < f0 && f0 < 1.0);
2075 onedivoneminusf0 = 1.0 / (1.0 - f0);
2083 for( i = *nvarinds-1; i >= 0; i-- )
2090 assert(0 <= v && v < prob->nvars);
2093 var = prob->
vars[v];
2094 assert(var !=
NULL);
2096 assert(varsign[v] == +1 || varsign[v] == -1);
2105 aj = varsign[v] * mircoef[v];
2110 cutaj = varsign[v] * downaj;
2112 cutaj = varsign[v] * (downaj + (fj - f0) * onedivoneminusf0);
2118 aj = varsign[v] * mircoef[v];
2122 cutaj = varsign[v] * aj * onedivoneminusf0;
2130 varinds[i] = varinds[(*nvarinds)-1];
2138 if( boundtype[v] < 0 )
2143 if( varsign[v] == +1 )
2146 if( boundtype[v] == -1 )
2160 if( boundtype[v] == -1 )
2181 vbidx = boundtype[v];
2184 if( varsign[v] == +1 )
2202 assert(0 <= zidx && zidx < v);
2204 (*mirrhs) += cutaj * vbd[vbidx];
2205 mircoef[zidx] -= cutaj * vbb[vbidx];
2208 if( !varused[zidx] )
2210 assert(*nvarinds < prob->nvars);
2211 varused[zidx] =
TRUE;
2212 varinds[*nvarinds] = zidx;
2259 assert(weights !=
NULL);
2261 assert(strongcgcoef !=
NULL);
2262 assert(strongcgrhs !=
NULL);
2263 assert(slacksign !=
NULL);
2264 assert(varused !=
NULL);
2265 assert(varinds !=
NULL);
2266 assert(nvarinds !=
NULL);
2267 assert(rowinds !=
NULL);
2268 assert(0.0 < f0 && f0 < 1.0);
2270 onedivoneminusf0 = 1.0 / (1.0 - f0);
2272 for( i = 0; i < nrowinds; i++ )
2286 assert(0 <= r && r < lp->nrows);
2287 assert(slacksign[r] == -1 || slacksign[r] == +1);
2291 assert(row !=
NULL);
2297 ar = slacksign[r] * scale * weights[r];
2310 pr =
SCIPsetCeil(
set, k * (fr - f0) * onedivoneminusf0);
2313 cutar = downar + pr / (k + 1);
2331 mul = -slacksign[r] * cutar;
2334 for( j = 0; j < row->
len; ++j )
2342 strongcgcoef[idx] += mul * row->
vals[j];
2347 varused[idx] =
TRUE;
2348 varinds[*nvarinds] = idx;
2354 if( slacksign[r] == +1 )
2366 *strongcgrhs -= cutar * rhs;
2380 *strongcgrhs += cutar * lhs;
2428 assert(weights !=
NULL);
2430 assert(mircoef !=
NULL);
2431 assert(mirrhs !=
NULL);
2432 assert(slacksign !=
NULL);
2433 assert(varused !=
NULL);
2434 assert(varinds !=
NULL);
2435 assert(nvarinds !=
NULL);
2436 assert(rowinds !=
NULL);
2437 assert(0.0 < f0 && f0 < 1.0);
2439 onedivoneminusf0 = 1.0 / (1.0 - f0);
2440 for( i = 0; i < nrowinds; i++ )
2453 assert(0 <= r && r < lp->nrows);
2454 assert(slacksign[r] == -1 || slacksign[r] == +1);
2458 assert(row !=
NULL);
2464 ar = slacksign[r] * scale * weights[r];
2480 cutar = downar + (fr - f0) * onedivoneminusf0;
2491 cutar = ar * onedivoneminusf0;
2502 mul = -slacksign[r] * cutar;
2505 for( j = 0; j < row->
len; ++j )
2513 mircoef[idx] += mul * row->
vals[j];
2518 varused[idx] =
TRUE;
2519 varinds[*nvarinds] = idx;
2525 if( slacksign[r] == +1 )
2537 *mirrhs -= cutar * rhs;
2551 *mirrhs += cutar * lhs;
2608 assert(prob !=
NULL);
2609 assert(weights !=
NULL);
2611 assert(strongcgcoef !=
NULL);
2612 assert(strongcgrhs !=
NULL);
2613 assert(cutactivity !=
NULL);
2614 assert(success !=
NULL);
2615 assert(cutislocal !=
NULL);
2616 assert(rowinds !=
NULL || nrowinds == -1);
2623 *cutislocal =
FALSE;
2633 cleanuprowinds =
FALSE;
2634 if( rowinds ==
NULL )
2637 cleanuprowinds =
TRUE;
2642 maxmksetcoefs, maxweightrange, strongcgcoef, &rhs, slacksign, varused, varinds, &nvarinds, rowinds, &nrowinds,
2643 &emptyrow, &localrowsused, &rowtoolong, cutrank);
2644 assert(allowlocal || !localrowsused);
2645 *cutislocal = *cutislocal || localrowsused;
2646 if( emptyrow || rowtoolong )
2653 cutsCleanupMIRRow(
set, prob, strongcgcoef, &rhs, varused, varinds, &nvarinds, *cutislocal);
2672 strongcgcoef, &rhs, varused, varinds, &nvarinds, varsign, boundtype, &freevariable, &localbdsused);
2673 assert(allowlocal || !localbdsused);
2674 *cutislocal = *cutislocal || localbdsused;
2714 if( f0 < minfrac || f0 > maxfrac )
2718 *strongcgrhs = downrhs;
2719 cutsRoundStrongCGRow(
set, prob, strongcgcoef, strongcgrhs, varused, varinds, &nvarinds, varsign, boundtype, f0, k);
2737 varused, varinds, &nvarinds, rowinds, nrowinds, f0, k);
2743 cutsCleanupMIRRow(
set, prob, strongcgcoef, strongcgrhs, varused, varinds, &nvarinds, *cutislocal);
2752 if( cleanuprowinds )
2780 int* boundsfortrans,
2826 assert(prob !=
NULL);
2827 assert(weights !=
NULL);
2829 assert(mircoef !=
NULL);
2830 assert(mirrhs !=
NULL);
2831 assert(cutactivity !=
NULL);
2832 assert(success !=
NULL);
2833 assert(cutislocal !=
NULL);
2840 if( mksetcoefsvalid !=
NULL )
2841 *mksetcoefsvalid =
FALSE;
2852 if( weightinds ==
NULL )
2865 nrowinds = nweightinds;
2867 if( rowlensum/5 > maxmksetcoefs )
2869 *cutislocal =
FALSE;
2875 cutsSumMIRRow(
set, prob, lp, weights, maxweight, sidetypes, scale, allowlocal,
2876 maxmksetcoefs, maxweightrange, compress, mircoef, &rhs, slacksign, varused, varinds, &nvarinds, rowinds, &nrowinds,
2877 &emptyrow, &localrowsused, &rowtoolong, cutrank);
2878 assert(allowlocal || !localrowsused);
2879 *cutislocal = localrowsused;
2880 if( emptyrow || rowtoolong )
2887 cutsCleanupMIRRow(
set, prob, mircoef, &rhs, varused, varinds, &nvarinds, *cutislocal);
2906 boundsfortrans, boundtypesfortrans, minfrac, maxfrac, mircoef, &rhs, varused, varinds, &nvarinds,
2907 varsign, boundtype, &freevariable, &localbdsused) );
2908 assert(allowlocal || !localbdsused);
2909 *cutislocal = *cutislocal || localbdsused;
2912 if( mksetcoefs !=
NULL )
2914 if( mksetcoefsvalid !=
NULL )
2915 *mksetcoefsvalid =
TRUE;
2950 if( f0 < minfrac || f0 > maxfrac )
2960 cutsRoundMIRRow(
set, prob, mircoef, mirrhs, varused, varinds, &nvarinds, varsign, boundtype, f0);
2977 cutsSubstituteMIRRow(
set, stat, lp, weights, scale, mircoef, mirrhs, slacksign, varused, varinds, &nvarinds,
2978 rowinds, nrowinds, f0);
2984 cutsCleanupMIRRow(
set, prob, mircoef, mirrhs, varused, varinds, &nvarinds, *cutislocal);
2988 *cutactivity =
getMIRRowActivity(
set, stat, prob, sol, mircoef, varinds, nvarinds);
3015 int* boundsfortrans,
3044 assert(prob !=
NULL);
3046 assert(mircoef !=
NULL);
3047 assert(mirrhs !=
NULL);
3048 assert(success !=
NULL);
3049 assert(islocal !=
NULL);
3050 assert(*nvarinds >= 1);
3051 assert(varinds !=
NULL);
3052 assert(varused !=
NULL);
3055 assert(mksetcoefs ==
NULL);
3056 assert(mksetcoefsvalid ==
NULL);
3069 for( v = 0; v < *nvarinds; v++ )
3070 mircoef[varinds[v]] *= scale;
3077 cutsCleanupMIRRow(
set, prob, mircoef, &rhs, varused, varinds, nvarinds, *islocal);
3096 boundsfortrans, boundtypesfortrans, minfrac, maxfrac, mircoef, &rhs, varused, varinds,
3097 nvarinds, varsign, boundtype, &freevariable, &localbdsused) );
3098 assert(allowlocal || !localbdsused);
3099 *islocal = *islocal || localbdsused;
3134 if( f0 < minfrac || f0 > maxfrac )
3144 cutsRoundMIRRow(
set, prob, mircoef, mirrhs, varused, varinds, nvarinds, varsign, boundtype, f0);
3150 cutsCleanupMIRRow(
set, prob, mircoef, mirrhs, varused, varinds, nvarinds, *islocal);
3199 boundswitch, usevbds, allowlocal, maxmksetcoefs, maxweightrange, minfrac, maxfrac, weights, inds, ninds, scale,
3200 mircoef, mirrhs, cutactivity, success, cutislocal, cutrank) );
3223 int* boundsfortrans,
3252 boundswitch, usevbds, allowlocal, fixintegralrhs, boundsfortrans, boundtypesfortrans, maxmksetcoefs,
3253 maxweightrange, minfrac, maxfrac, weights, maxweight, weightinds, nweightinds, rowlensum, sidetypes,
3254 scale, mksetcoefs, mksetcoefsvalid, mircoef, mirrhs, cutactivity, success, cutislocal, cutrank) );
3275 int* boundsfortrans,
3296 boundsfortrans, boundtypesfortrans, minfrac, maxfrac, scale, mksetcoefs, mksetcoefsvalid, mircoef, mirrhs,
3297 varinds, nvarinds, minact, varused, success, islocal) );
enum SCIP_BoundType SCIP_BOUNDTYPE
SCIP_RETCODE SCIPcutsCalcStrongCG(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)
SCIP_Bool SCIPsetIsInfinity(SCIP_SET *set, SCIP_Real val)
SCIP_Real * SCIPvarGetVlbCoefs(SCIP_VAR *var)
static SCIP_RETCODE cutsLpCalcMIR(SCIP_LP *lp, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, 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)
void SCIPvarGetClosestVlb(SCIP_VAR *var, SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_Real *closestvlb, int *closestvlbidx)
SCIP_RETCODE SCIPcutsCalcLpMIR(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)
SCIP_Bool SCIPsetIsLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
internal methods for storing primal CIP solutions
SCIP_Bool SCIPsetIsSumZero(SCIP_SET *set, SCIP_Real val)
static void cutsSumMIRRow(SCIP_SET *set, SCIP_PROB *prob, SCIP_LP *lp, SCIP_Real *weights, SCIP_Real knownmaxweight, int *sidetypes, SCIP_Real scale, SCIP_Bool allowlocal, int maxmksetcoefs, SCIP_Real maxweightrange, SCIP_Bool compress, SCIP_Real *mircoef, SCIP_Real *mirrhs, int *slacksign, SCIP_Bool *varused, int *varinds, int *nvarinds, int *rowinds, int *nrowinds, SCIP_Bool *emptyrow, SCIP_Bool *localrowsused, SCIP_Bool *rowtoolong, int *cutrank)
SCIP_Real SCIPsetFloor(SCIP_SET *set, SCIP_Real val)
int SCIPvarGetNVlbs(SCIP_VAR *var)
#define SCIPsetDuplicateBufferArray(set, ptr, source, num)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_BASESTAT SCIPcolGetBasisStatus(SCIP_COL *col)
static SCIP_Real getMaxAbsWeight(SCIP_SET *set, SCIP_LP *lp, SCIP_Real *weights, int *rowinds, int *nrowinds, int *rowlensum)
static void cutsRoundMIRRow(SCIP_SET *set, SCIP_PROB *prob, SCIP_Real *mircoef, SCIP_Real *mirrhs, SCIP_Bool *varused, int *varinds, int *nvarinds, int *varsign, int *boundtype, SCIP_Real f0)
SCIP_Bool SCIPsetIsPositive(SCIP_SET *set, SCIP_Real val)
int SCIProwGetNNonz(SCIP_ROW *row)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
const char * SCIProwGetName(SCIP_ROW *row)
SCIP_Real SCIPsetInfinity(SCIP_SET *set)
common methods used to generate and strengthen cuts
SCIP_Bool SCIPsetIsFeasIntegral(SCIP_SET *set, SCIP_Real val)
static void cutsSumStrongCGRow(SCIP_SET *set, SCIP_PROB *prob, SCIP_LP *lp, SCIP_Real *weights, SCIP_Real scale, SCIP_Bool allowlocal, int maxmksetcoefs, SCIP_Real maxweightrange, SCIP_Real *strongcgcoef, SCIP_Real *strongcgrhs, int *slacksign, SCIP_Bool *varused, int *varinds, int *nvarinds, int *rowinds, int *nrowinds, SCIP_Bool *emptyrow, SCIP_Bool *localrowsused, SCIP_Bool *rowtoolong, int *cutrank)
SCIP_Bool SCIPsetIsZero(SCIP_SET *set, SCIP_Real val)
enum SCIP_Retcode SCIP_RETCODE
int SCIPvarGetNVubs(SCIP_VAR *var)
#define SCIPsetAllocBufferArray(set, ptr, num)
int SCIPvarGetProbindex(SCIP_VAR *var)
static SCIP_RETCODE cutsApplyMIR(SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Bool fixintegralrhs, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_Real scale, SCIP_Real *mksetcoefs, SCIP_Bool *mksetcoefsvalid, SCIP_Real *mircoef, SCIP_Real *mirrhs, int *varinds, int *nvarinds, SCIP_Real *minact, SCIP_Bool *varused, SCIP_Bool *success, SCIP_Bool *islocal)
SCIP_VAR ** SCIPvarGetVlbVars(SCIP_VAR *var)
static void cutsTransformStrongCGRow(SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Real *strongcgcoef, SCIP_Real *strongcgrhs, SCIP_Bool *varused, int *varinds, int *nvarinds, int *varsign, int *boundtype, SCIP_Bool *freevariable, SCIP_Bool *localbdsused)
SCIP_Bool SCIPsetIsNegative(SCIP_SET *set, SCIP_Real val)
#define SCIPsetFreeBufferArray(set, ptr)
SCIP_Real SCIPsetSumFloor(SCIP_SET *set, SCIP_Real val)
SCIP_Real SCIPsetCeil(SCIP_SET *set, SCIP_Real val)
internal methods for LP management
SCIP_Real SCIPsolGetVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
static void cutsSubstituteStrongCGRow(SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_Real *weights, SCIP_Real scale, SCIP_Real *strongcgcoef, SCIP_Real *strongcgrhs, int *slacksign, SCIP_Bool *varused, int *varinds, int *nvarinds, int *rowinds, int nrowinds, SCIP_Real f0, SCIP_Real k)
#define SCIP_DEFAULT_EPSILON
SCIP_Bool SCIPsetIsGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_Bool SCIPsetIsLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPsetIsSumLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
internal methods for storing and manipulating the main problem
static SCIP_RETCODE cutsTransformMIRRow(SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_SOL *sol, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Bool fixintegralrhs, SCIP_Bool ignoresol, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_Real *mircoef, SCIP_Real *mirrhs, SCIP_Bool *varused, int *varinds, int *nvarinds, int *varsign, int *boundtype, SCIP_Bool *freevariable, SCIP_Bool *localbdsused)
SCIP_Real * SCIPvarGetVubConstants(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPsetFeasCeil(SCIP_SET *set, SCIP_Real val)
void SCIPvarGetClosestVub(SCIP_VAR *var, SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_Real *closestvub, int *closestvubidx)
SCIP_Real SCIPsetFrac(SCIP_SET *set, SCIP_Real val)
SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
internal methods for global SCIP settings
SCIP main data structure.
SCIP_Real * SCIPvarGetVlbConstants(SCIP_VAR *var)
SCIP_Real * SCIPvarGetVubCoefs(SCIP_VAR *var)
SCIP_Bool SCIPsetIsEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
static void findBestLb(SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var, SCIP_SOL *sol, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Real *bestlb, int *bestlbtype)
internal methods for problem variables
static void cutsSubstituteMIRRow(SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_Real *weights, SCIP_Real scale, SCIP_Real *mircoef, SCIP_Real *mirrhs, int *slacksign, SCIP_Bool *varused, int *varinds, int *nvarinds, int *rowinds, int nrowinds, SCIP_Real f0)
public methods for LP management
static void findBestUb(SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var, SCIP_SOL *sol, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Real *bestub, int *bestubtype)
#define BMScopyMemoryArray(ptr, source, num)
SCIP_COL * SCIPvarGetCol(SCIP_VAR *var)
static void addRowToAggregation(SCIP_SET *set, SCIP_Real *mircoef, SCIP_Real *mirrhs, int *slacksign, SCIP_Bool *varused, int *varinds, int *nvarinds, SCIP_ROW *row, SCIP_Real weight, SCIP_Bool uselhs)
internal methods for return codes for SCIP methods
SCIP_RETCODE SCIPcutsApplyMIR(SCIP *scip, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Bool fixintegralrhs, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_Real scale, SCIP_Real *mksetcoefs, SCIP_Bool *mksetcoefsvalid, SCIP_Real *mircoef, SCIP_Real *mirrhs, int *varinds, int *nvarinds, SCIP_Real *minact, SCIP_Bool *varused, SCIP_Bool *success, SCIP_Bool *islocal)
SCIP_Real SCIPsetFeasFloor(SCIP_SET *set, SCIP_Real val)
void SCIPcutsCleanupRow(SCIP *scip, SCIP_Real *coefs, SCIP_Real *rhs, SCIP_Bool *varused, int *varinds, int *nvarinds, SCIP_Bool islocal)
static SCIP_Real getMaxAbsWeightCalcSparsity(SCIP_SET *set, SCIP_LP *lp, SCIP_Real *weights, int *rowinds, int *nrowinds, int *rowlensum)
SCIP_Bool SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
void SCIPsortDownInt(int *intarray, int len)
static SCIP_Real getMIRMinActivity(SCIP_PROB *prob, SCIP_Real *mircoef, int *varinds, int nvarinds, SCIP_Bool islocal)
SCIP_VAR ** SCIPvarGetVubVars(SCIP_VAR *var)
static void cutsCleanupMIRRow(SCIP_SET *set, SCIP_PROB *prob, SCIP_Real *mircoef, SCIP_Real *mirrhs, SCIP_Bool *varused, int *varinds, int *nvarinds, SCIP_Bool cutislocal)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
static SCIP_Real getMIRRowActivity(SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_SOL *sol, SCIP_Real *mircoef, int *varinds, int nvarinds)
SCIP_Real SCIPsetSumFrac(SCIP_SET *set, SCIP_Real val)
#define BMSclearMemoryArray(ptr, num)
common defines and data types used in all packages of SCIP
static SCIP_RETCODE cutsLpCalcStrongCG(SCIP_LP *lp, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, int maxmksetcoefs, SCIP_Real maxweightrange, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_Real *weights, int *rowinds, int nrowinds, SCIP_Real scale, SCIP_Real *strongcgcoef, SCIP_Real *strongcgrhs, SCIP_Real *cutactivity, SCIP_Bool *success, SCIP_Bool *cutislocal, int *cutrank)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
static void cutsRoundStrongCGRow(SCIP_SET *set, SCIP_PROB *prob, SCIP_Real *strongcgcoef, SCIP_Real *strongcgrhs, SCIP_Bool *varused, int *varinds, int *nvarinds, int *varsign, int *boundtype, SCIP_Real f0, SCIP_Real k)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)