58 for( i = 0; i < cutnnz; ++i )
72 if( cutcoefs[i] > 0.0 )
95 #define NONZERO(x) (COPYSIGN(1e-100, (x)) + (x)) 112 assert(inds != NULL);
113 assert(vals != NULL);
118 for( i = 0 ; i < row->
len; ++i )
123 val = vals[probindex];
126 inds[(*nnz)++] = probindex;
128 val += row->
vals[i] * scale;
134 vals[probindex] = val;
155 assert(inds != NULL);
156 assert(vals != NULL);
161 for( i = 0 ; i < row->
len; ++i )
169 inds[(*nnz)++] = probindex;
199 assert(scip != NULL);
200 assert(cutcoefs != NULL);
201 assert(cutinds != NULL);
206 for( i = 0; i < cutnnz; ++i )
207 activity += cutcoefs[i] *
SCIPgetSolVal(scip, sol, vars[cutinds[i]]);
210 return (activity - cutrhs) /
MAX(1e-6, norm);
225 assert(scip != NULL);
226 assert(scip->
set != NULL);
232 for( i = 0; i < nnz; ++i )
240 for( i = 0; i < nnz; ++i )
246 norm =
MAX(norm, absval);
250 for( i = 0; i < nnz; ++i )
257 for( i = 0; i < nnz; ++i )
292 assert(scip != NULL);
293 assert(cutcoefs != NULL);
294 assert(cutinds != NULL);
295 assert(scip->
set != NULL);
300 for( i = 0; i < cutnnz; ++i )
307 return (activity - cutrhs) /
MAX(1e-6, norm);
327 for( i = 0; i < *cutnnz; )
368 cutinds[i] = cutinds[*cutnnz];
401 for( i = 0; i < *cutnnz; )
408 if(
EPSZ(val, minval) )
439 cutinds[i] = cutinds[*cutnnz];
467 if( abscoef1 < abscoef2 )
469 if( abscoef2 < abscoef1 )
482 abscoef1 =
REALABS(coefs[ind1]);
483 abscoef2 =
REALABS(coefs[ind2]);
485 if( abscoef1 < abscoef2 )
487 if( abscoef2 < abscoef1 )
613 for( i = 0; i < *cutnnz; ++i )
617 assert(cutinds[i] >= 0);
618 assert(vars[cutinds[i]] != NULL);
629 if( cutinds[i] < nintegralvars )
648 if( cutinds[i] < nintegralvars )
681 equiscale = 1.0 / MIN((maxact -
QUAD_TO_DBL(*cutrhs)), maxabsintval);
683 for( i = 0; i < *cutnnz; ++i )
701 intscalar *= equiscale;
705 for( i = 0; i < *cutnnz; )
732 cutinds[i] = cutinds[*cutnnz];
742 for( i = 0; i < *cutnnz; ++i )
746 assert(cutinds[i] >= 0);
747 assert(vars[cutinds[i]] != NULL);
795 maxabsintval *= equiscale;
797 for( i = 0; i < *cutnnz; ++i )
814 maxabsval = MIN(maxabsval, maxabsintval);
815 maxabsval =
MAX(maxabsval, maxabscontval);
817 scale = 1.0 / maxabsval;
824 maxabsintval *= scale;
826 for( i = 0; i < *cutnnz; ++i )
840 SCIPsortDownInd(cutinds, compareAbsCoefsQuad, (
void*) cutcoefs, *cutnnz);
843 for( i = 0; i < *cutnnz; )
847 if( cutinds[i] >= nintegralvars )
883 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
902 cutinds[i] = cutinds[*cutnnz];
933 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
951 cutinds[i] = cutinds[*cutnnz];
997 for( i = 0; i < *cutnnz; ++i )
1001 assert(cutinds[i] >= 0);
1002 assert(vars[cutinds[i]] != NULL);
1004 val = cutcoefs[cutinds[i]];
1013 if( cutinds[i] < nintegralvars )
1014 maxabsintval =
MAX(maxabsintval, -val);
1017 maxabscontval =
MAX(maxabscontval, -val);
1030 if( cutinds[i] < nintegralvars )
1031 maxabsintval =
MAX(maxabsintval, val);
1034 maxabscontval =
MAX(maxabscontval, val);
1061 equiscale = 1.0 / MIN((maxact -
QUAD_TO_DBL(*cutrhs)), maxabsintval);
1063 for( i = 0; i < *cutnnz; ++i )
1068 val = cutcoefs[cutinds[i]];
1070 scaleval = val * equiscale;
1072 intcoeffs[i] = scaleval;
1083 intscalar *= equiscale;
1087 for( i = 0; i < *cutnnz; )
1092 val = cutcoefs[cutinds[i]];
1104 cutcoefs[cutinds[i]] = intval;
1113 cutinds[i] = cutinds[*cutnnz];
1123 for( i = 0; i < *cutnnz; ++i )
1127 assert(cutinds[i] >= 0);
1128 assert(vars[cutinds[i]] != NULL);
1130 val = cutcoefs[cutinds[i]];
1136 maxabsintval =
MAX(maxabsintval, -val);
1146 maxabsintval =
MAX(maxabsintval, val);
1176 maxabsintval *= equiscale;
1178 for( i = 0; i < *cutnnz; ++i )
1179 cutcoefs[cutinds[i]] *= equiscale;
1189 maxabsval = MIN(maxabsval, maxabsintval);
1190 maxabsval =
MAX(maxabsval, maxabscontval);
1192 scale = 1.0 / maxabsval;
1199 maxabsintval *= scale;
1201 for( i = 0; i < *cutnnz; ++i )
1202 cutcoefs[cutinds[i]] *= scale;
1212 for( i = 0; i < *cutnnz; )
1216 if( cutinds[i] >= nintegralvars )
1222 val = cutcoefs[cutinds[i]];
1251 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
1267 cutcoefs[cutinds[i]] = 0.0;
1269 cutinds[i] = cutinds[*cutnnz];
1299 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
1315 cutcoefs[cutinds[i]] = 0.0;
1317 cutinds[i] = cutinds[*cutnnz];
1353 assert(nchgcoefs != NULL);
1365 for( i = 0; i < *cutnnz; ++i )
1367 assert(cutinds[i] >= 0);
1368 assert(vars[cutinds[i]] != NULL);
1370 if( cutcoefs[i] < 0.0 )
1377 if( cutinds[i] < nintegralvars )
1379 maxabsval =
MAX(maxabsval, -cutcoefs[i]);
1380 absvals[i] = -cutcoefs[i];
1396 if( cutinds[i] < nintegralvars )
1398 maxabsval =
MAX(maxabsval, cutcoefs[i]);
1399 absvals[i] = cutcoefs[i];
1420 if(
SCIPisGT(scip, maxact - maxabsval, *cutrhs) )
1427 for( i = 0; i < *cutnnz;)
1429 if( cutinds[i] >= nintegralvars )
1437 if( cutcoefs[i] < 0.0 &&
SCIPisLE(scip, maxact + cutcoefs[i], *cutrhs) )
1444 if( coef > cutcoefs[i] )
1453 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
1454 cutcoefs[i], coef, (*cutrhs),
QUAD_TO_DBL(tmp), lb,
1472 cutinds[i] = cutinds[*cutnnz];
1473 cutcoefs[i] = cutcoefs[*cutnnz];
1478 else if( cutcoefs[i] > 0.0 &&
SCIPisLE(scip, maxact - cutcoefs[i], *cutrhs) )
1485 if( coef < cutcoefs[i] )
1494 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
1513 cutinds[i] = cutinds[*cutnnz];
1514 cutcoefs[i] = cutcoefs[*cutnnz];
1541 assert(scip != NULL);
1542 assert(aggrrow != NULL);
1553 (*aggrrow)->local =
FALSE;
1554 (*aggrrow)->nnz = 0;
1555 (*aggrrow)->rank = 0;
1557 (*aggrrow)->rowsinds = NULL;
1558 (*aggrrow)->slacksign = NULL;
1559 (*aggrrow)->rowweights = NULL;
1560 (*aggrrow)->nrows = 0;
1561 (*aggrrow)->rowssize = 0;
1573 assert(scip != NULL);
1574 assert(aggrrow != NULL);
1597 assert(scip != NULL);
1598 assert(aggrrow != NULL);
1601 assert(vars != NULL);
1604 assert(messagehdlr);
1607 if( aggrrow->
nnz == 0 )
1610 for( i = 0; i < aggrrow->
nnz; ++i )
1632 assert(scip != NULL);
1633 assert(aggrrow != NULL);
1634 assert(source != NULL);
1641 (*aggrrow)->nnz = source->
nnz;
1644 if( source->
nrows > 0 )
1656 (*aggrrow)->rowsinds = NULL;
1657 (*aggrrow)->slacksign = NULL;
1658 (*aggrrow)->rowweights = NULL;
1661 (*aggrrow)->nrows = source->
nrows;
1662 (*aggrrow)->rowssize = source->
nrows;
1663 (*aggrrow)->rank = source->
rank;
1664 (*aggrrow)->local = source->
local;
1680 assert(row->
lppos >= 0);
1692 i = aggrrow->
nrows++;
1705 if ( sidetype == -1 )
1710 else if ( sidetype == 1 )
1768 assert(valid != NULL);
1771 v = aggrrow->
inds[pos];
1825 assert(scip != NULL);
1826 assert(aggrrow != NULL);
1832 if( aggrrow->
nnz == 0 )
1835 for( i = 0; i < nvars; ++i )
1845 aggrrow->
inds[aggrrow->
nnz++] = i;
1855 for( i = 0 ; i < nvars; ++i )
1866 aggrrow->
inds[aggrrow->
nnz++] = i;
1899 assert(weight >= 0.0);
1912 for( i = 0 ; i < len; ++i )
1915 int probindex = inds[i];
1920 aggrrow->
inds[aggrrow->
nnz++] = probindex;
1944 for( i = 0; i < aggrrow->
nnz; ++i )
1988 *rowtoolong =
FALSE;
2032 if( weight > 0.0 && ((negslack == 0) || (negslack == 1 && !row->
integral)) )
2044 if( weight < 0.0 && ((negslack == 0) || (negslack == 1 && !row->
integral)) )
2059 i = aggrrow->
nrows++;
2072 aggrrow->
slacksign[i] = uselhs ? -1 : 1;
2078 if( aggrrow->
nnz > maxaggrlen )
2113 if( rowinds != NULL && nrowinds > -1 )
2115 for( k = 0; k < nrowinds; ++k )
2117 SCIP_CALL(
addOneRow(scip, aggrrow, rows[rowinds[k]], weights[rowinds[k]], sidetypebasis, allowlocal,
2118 negslack, maxaggrlen, &rowtoolong) );
2126 for( k = 0; k < nrows; ++k )
2129 negslack, maxaggrlen, &rowtoolong) );
2162 assert(scip != NULL);
2163 assert(cutinds != NULL);
2164 assert(cutcoefs != NULL);
2165 assert(cutrhs != NULL);
2186 for( i = 0; i < *nnz; ++i )
2189 maxcoef =
MAX(absval, maxcoef);
2194 minallowedcoef =
MAX(minallowedcoef, maxcoef);
2196 *success = !
removeZeros(scip, minallowedcoef, cutislocal, cutcoefs,
QUAD(&rhs), cutinds, nnz);
2226 assert(scip != NULL);
2227 assert(cutinds != NULL);
2228 assert(cutcoefs != NULL);
2229 assert(
QUAD_HI(cutrhs) != NULL);
2247 for( i = 0; i < *nnz; ++i )
2253 maxcoef =
MAX(abscoef, maxcoef);
2258 minallowedcoef =
MAX(minallowedcoef, maxcoef);
2260 *success = !
removeZerosQuad(scip, minallowedcoef, cutislocal, cutcoefs,
QUAD(cutrhs), cutinds, nnz);
2272 assert(aggrrow != NULL);
2282 assert(aggrrow != NULL);
2284 return aggrrow->
nrows;
2292 assert(aggrrow != NULL);
2303 assert(aggrrow != NULL);
2318 assert(aggrrow != NULL);
2319 assert(row != NULL);
2323 for( i = 0; i < aggrrow->
nrows; ++i )
2324 if( aggrrow->
rowsinds[i] == rowind )
2335 assert(aggrrow != NULL);
2337 return aggrrow->
inds;
2345 assert(aggrrow != NULL);
2347 return aggrrow->
nnz;
2355 assert(aggrrow != NULL);
2357 return aggrrow->
rank;
2365 assert(aggrrow != NULL);
2367 return aggrrow->
local;
2375 assert(aggrrow != NULL);
2382 #define MAXCMIRSCALE 1e+6 2396 assert(bestlb != NULL);
2397 assert(bestlbtype != NULL);
2407 if(
SCIPisGT(scip, loclb, *bestlb) )
2421 && (bestvlb > *bestlb || (*bestlbtype < 0 &&
SCIPisGE(scip, bestvlb, *bestlb))) )
2430 assert(vlbvars != NULL);
2434 *bestlbtype = bestvlbidx;
2454 assert(bestub != NULL);
2455 assert(bestubtype != NULL);
2465 if(
SCIPisLT(scip, locub, *bestub) )
2479 && (bestvub < *bestub || (*bestubtype < 0 &&
SCIPisLE(scip, bestvub, *bestub))) )
2488 assert(vubvars != NULL);
2492 *bestubtype = bestvubidx;
2511 int* boundsfortrans,
2529 if( boundsfortrans != NULL && boundsfortrans[v] > -3 )
2537 *bestlbtype = boundsfortrans[v];
2538 if( *bestlbtype == -1 )
2540 else if( *bestlbtype == -2 )
2555 k = boundsfortrans[v];
2557 assert(vlbvars != NULL);
2558 assert(vlbcoefs != NULL);
2559 assert(vlbconsts != NULL);
2568 SCIP_CALL(
findBestUb(scip, var, sol, usevbds && fixintegralrhs, allowlocal && fixintegralrhs, bestub, bestubtype) );
2575 *bestubtype = boundsfortrans[v];
2576 if( *bestubtype == -1 )
2578 else if( *bestubtype == -2 )
2593 k = boundsfortrans[v];
2595 assert(vubvars != NULL);
2596 assert(vubcoefs != NULL);
2597 assert(vubconsts != NULL);
2607 SCIP_CALL(
findBestLb(scip, var, sol, usevbds && fixintegralrhs, allowlocal && fixintegralrhs, bestlb, bestlbtype) );
2628 *freevariable =
TRUE;
2641 else if(
SCIPisLT(scip, varsol, (1.0 - boundswitch) * (*bestlb) + boundswitch * (*bestub)) )
2643 else if(
SCIPisGT(scip, varsol, (1.0 - boundswitch) * (*bestlb) + boundswitch * (*bestub)) )
2645 else if( *bestlbtype == -1 )
2647 else if( *bestubtype == -1 )
2649 else if( *bestlbtype >= 0 )
2651 else if( *bestubtype >= 0 )
2673 else if(
SCIPisLE(scip, distlb, distub) )
2725 int* boundsfortrans,
2750 int aggrrowintstart;
2755 assert(varsign != NULL);
2756 assert(boundtype != NULL);
2757 assert(freevariable != NULL);
2758 assert(localbdsused != NULL);
2760 *freevariable =
FALSE;
2761 *localbdsused =
FALSE;
2781 for( i = 0; i < *nnz && cutinds[i] >= firstcontvar; ++i )
2784 ignoresol, boundsfortrans, boundtypesfortrans,
2785 bestlbs + i, bestubs + i, bestlbtypes + i, bestubtypes + i, selectedbounds + i, freevariable) );
2792 aggrrowintstart = i;
2795 for( i = 0; i < aggrrowintstart; ++i )
2808 boundtype[i] = bestlbtypes[i];
2812 if( bestlbtypes[i] < 0 )
2816 *localbdsused = *localbdsused || (bestlbtypes[i] == -2);
2829 assert(vlbvars != NULL);
2830 assert(vlbcoefs != NULL);
2831 assert(vlbconsts != NULL);
2836 assert(0 <= zidx && zidx < firstcontvar);
2844 cutinds[(*nnz)++] = zidx;
2850 assert(
QUAD_HI(zcoef) != 0.0);
2858 boundtype[i] = bestubtypes[i];
2862 if( bestubtypes[i] < 0 )
2866 *localbdsused = *localbdsused || (bestubtypes[i] == -2);
2879 assert(vubvars != NULL);
2880 assert(vubcoefs != NULL);
2881 assert(vubconsts != NULL);
2894 cutinds[(*nnz)++] = zidx;
2900 assert(
QUAD_HI(zcoef) != 0.0);
2912 assert(cutinds[i] < firstcontvar);
2922 cutinds[i] = cutinds[*nnz];
2929 ignoresol, boundsfortrans, boundtypesfortrans,
2930 bestlbs + i, bestubs + i, bestlbtypes + i, bestubtypes + i, selectedbounds + i, freevariable) );
2940 for( i = aggrrowintstart; i < *nnz; ++i )
2951 assert(bestlbtypes[i] < 0);
2954 boundtype[i] = bestlbtypes[i];
2960 *localbdsused = *localbdsused || (bestlbtypes[i] == -2);
2965 assert(bestubtypes[i] < 0);
2968 boundtype[i] = bestubtypes[i];
2974 *localbdsused = *localbdsused || (bestubtypes[i] == -2);
2978 if( fixintegralrhs )
2984 if( f0 < minfrac || f0 > maxfrac )
2992 bestviolgain = -1e+100;
2994 for( i = 0; i < *nnz; i++ )
3000 assert(0 <= v && v < nvars);
3005 if( boundtype[i] < 0
3006 && ((varsign[i] == +1 && !
SCIPisInfinity(scip, bestubs[i]) && bestubtypes[i] < 0)
3007 || (varsign[i] == -1 && !
SCIPisInfinity(scip, -bestlbs[i]) && bestlbtypes[i] < 0)) )
3028 if( newf0 < minfrac || newf0 > maxfrac )
3030 if( v >= firstcontvar )
3044 viol = f0 - fj * (varsign[i] == +1 ? solval - bestlbs[i] : bestubs[i] - solval);
3045 newviol = newf0 - newfj * (varsign[i] == -1 ? solval - bestlbs[i] : bestubs[i] - solval);
3046 violgain = newviol - viol;
3051 SCIPerrorMessage(
"Cannot handle closest bounds with ignoring the LP solution.\n");
3058 if(
SCIPisGT(scip, violgain, bestviolgain)
3059 || (
SCIPisGE(scip, violgain, bestviolgain) && newf0 < bestnewf0) )
3062 bestviolgain = violgain;
3071 assert(besti < *nnz);
3072 assert(boundtype[besti] < 0);
3084 if( varsign[besti] == +1 )
3087 assert(bestubtypes[besti] < 0);
3088 boundtype[besti] = bestubtypes[besti];
3089 varsign[besti] = -1;
3094 assert(bestlbtypes[besti] < 0);
3095 boundtype[besti] = bestlbtypes[besti];
3096 varsign[besti] = +1;
3098 *localbdsused = *localbdsused || (boundtype[besti] == -2);
3170 int*RESTRICT cutinds,
3172 int*RESTRICT varsign,
3173 int*RESTRICT boundtype,
3184 assert(
QUAD_HI(cutrhs) != NULL);
3185 assert(cutcoefs != NULL);
3186 assert(cutinds != NULL);
3187 assert(nnz != NULL);
3188 assert(boundtype != NULL);
3189 assert(varsign != NULL);
3205 while( i < *nnz && cutinds[i] >= firstcontvar )
3210 assert(cutinds[i] < firstcontvar);
3215 for( i = *nnz - 1; i >= 0 && cutinds[i] < firstcontvar; --i )
3225 assert(var != NULL);
3227 assert(varsign[i] == +1 || varsign[i] == -1);
3262 cutinds[i] = cutinds[*nnz];
3269 assert(boundtype[i] < 0);
3272 if( varsign[i] == +1 )
3275 if( boundtype[i] == -1 )
3291 if( boundtype[i] == -1 )
3308 while( i >= ndelcontvars )
3318 assert(var != NULL);
3320 assert(varsign[i] == +1 || varsign[i] == -1);
3321 assert( v >= firstcontvar );
3343 cutinds[i] = cutinds[ndelcontvars];
3344 varsign[i] = varsign[ndelcontvars];
3345 boundtype[i] = boundtype[ndelcontvars];
3353 if( boundtype[i] < 0 )
3358 if( varsign[i] == +1 )
3361 if( boundtype[i] == -1 )
3377 if( boundtype[i] == -1 )
3401 vbidx = boundtype[i];
3404 if( varsign[i] == +1 )
3422 assert(0 <= zidx && zidx < firstcontvar);
3432 cutinds[(*nnz)++] = zidx;
3437 assert(
QUAD_HI(zcoef) != 0.0);
3445 if( ndelcontvars > 0 )
3447 assert(ndelcontvars <= *nnz);
3448 *nnz -= ndelcontvars;
3449 if( *nnz < ndelcontvars )
3498 assert(scip != NULL);
3499 assert(weights != NULL || nrowinds == 0);
3500 assert(slacksign != NULL || nrowinds == 0);
3501 assert(rowinds != NULL || nrowinds == 0);
3502 assert(scale > 0.0);
3503 assert(cutcoefs != NULL);
3504 assert(
QUAD_HI(cutrhs) != NULL);
3505 assert(cutinds != NULL);
3506 assert(nnz != NULL);
3513 for( i = 0; i < nrowinds; i++ )
3526 assert(slacksign[i] == -1 || slacksign[i] == +1);
3530 assert(row != NULL);
3531 assert(row->
len == 0 || row->
cols != NULL);
3533 assert(row->
len == 0 || row->
vals != NULL);
3536 ar = slacksign[i] * scale * weights[i];
3584 if( slacksign[i] == +1 )
3642 int* boundsfortrans,
3673 assert(aggrrow != NULL);
3675 assert(success != NULL);
3688 *cutnnz = aggrrow->
nnz;
3689 *cutislocal = aggrrow->
local;
3697 for( i = 0; i < *cutnnz; ++i )
3701 int k = aggrrow->
inds[i];
3727 boundsfortrans, boundtypesfortrans, minfrac, maxfrac, tmpcoefs,
QUAD(&rhs), cutinds, cutnnz, varsign, boundtype, &freevariable, &localbdsused) );
3728 assert(allowlocal || !localbdsused);
3729 *cutislocal = *cutislocal || localbdsused;
3802 aggrrow->
nrows, scale, tmpcoefs, QUAD(&rhs), cutinds, cutnnz,
QUAD(f0)) );
3824 for( i = 0; i < *cutnnz; ++i )
3836 if( cutefficacy != NULL )
3837 *cutefficacy =
calcEfficacy(scip, sol, cutcoefs, *cutrhs, cutinds, *cutnnz);
3839 if( cutrank != NULL )
3840 *cutrank = aggrrow->
rank + 1;
3849 for( i = 0; i < *cutnnz; ++i )
3888 scale = 1.0 / delta;
3896 if( f0 < minfrac || f0 > maxfrac )
3899 onedivoneminusf0 = 1.0 / (1.0 - f0);
3901 contscale = scale * onedivoneminusf0;
3910 rhs -= contscale * contactivity;
3911 norm = SQR(contscale) * contsqrnorm;
3918 for( i = 0; i < nvars; ++i )
3920 SCIP_Real floorai = floor(scale * coefs[i]);
3921 SCIP_Real fi = (scale * coefs[i]) - floorai;
3923 if( fi > f0pluseps )
3924 floorai += (fi - f0) * onedivoneminusf0;
3926 rhs -= solvals[i] * floorai;
3927 norm += SQR(floorai);
3932 return - rhs /
MAX(norm, 1e-6);
3959 int* boundsfortrans,
4005 assert(aggrrow != NULL);
4006 assert(aggrrow->
nrows + aggrrow->
nnz >= 1);
4007 assert(success != NULL);
4032 mksetnnz = aggrrow->
nnz;
4037 for( i = 0; i < mksetnnz; ++i )
4039 int j = mksetinds[i];
4046 *cutislocal = aggrrow->
local;
4064 boundsfortrans, boundtypesfortrans, minfrac, maxfrac, mksetcoefs,
QUAD(&mksetrhs), mksetinds, &mksetnnz, varsign, boundtype, &freevariable, &localbdsused) );
4066 assert(allowlocal || !localbdsused);
4075 maxabsmksetcoef = -1.0;
4078 for( i = mksetnnz - 1; i >= 0 && mksetinds[i] < firstcontvar; --i )
4080 SCIP_VAR* var = vars[mksetinds[i]];
4091 maxabsmksetcoef =
MAX(absmksetcoef, maxabsmksetcoef);
4096 bounddist[nbounddist] = MIN(ub - primsol, primsol - lb);
4097 bounddistpos[nbounddist] = i;
4098 deltacands[nbounddist] = absmksetcoef;
4103 if( nbounddist == 0 )
4107 ndeltacands = nbounddist;
4112 if( maxabsmksetcoef != -1.0 )
4114 deltacands[ndeltacands++] = maxabsmksetcoef + 1.0;
4117 deltacands[ndeltacands++] = 1.0;
4119 maxtestdelta = MIN(ndeltacands, maxtestdelta);
4151 for( i = intstart; i < mksetnnz; ++i )
4157 var = vars[mksetinds[i]];
4163 if( boundtype[i] == -1 )
4166 if( varsign[i] == -1 )
4173 assert(boundtype[i] == -2);
4176 if( varsign[i] == -1 )
4182 tmpvalues[ntmpcoefs] = solval;
4184 tmpcoefs[ntmpcoefs] = varsign[i] *
QUAD_TO_DBL(coef);
4188 assert(ntmpcoefs == mksetnnz - intstart);
4192 for( i = 0; i < intstart; ++i )
4206 switch( boundtype[i] )
4210 if( varsign[i] == -1 )
4217 if( varsign[i] == -1 )
4224 if( varsign[i] == -1 )
4234 solval = (coef * vbdsolval + constant) - solval;
4246 solval = solval - (coef * vbdsolval + constant);
4250 contactivity += solval * (
QUAD_TO_DBL(mksetcoef) * varsign[i]);
4259 for( i = 0; i < aggrrow->
nrows; ++i )
4277 slackval = row->
rhs - slackval;
4285 slackval = slackval - row->
lhs;
4291 tmpvalues[ntmpcoefs] = slackval;
4300 contactivity += slackval * slackcoeff;
4301 contsqrnorm += SQR(slackcoeff);
4310 for( i = 0; i < maxtestdelta; ++i )
4317 for( j = 0; j < i; ++j )
4319 if(
SCIPisEQ(scip, deltacands[i], deltacands[j]) )
4321 deltaseenbefore =
TRUE;
4327 if( deltaseenbefore )
4329 maxtestdelta = MIN(maxtestdelta + 1, ndeltacands);
4333 efficacy =
computeMIREfficacy(scip, tmpcoefs, tmpvalues,
QUAD_TO_DBL(mksetrhs), contactivity, contsqrnorm, deltacands[i], ntmpcoefs, minfrac, maxfrac);
4335 if( efficacy > bestefficacy )
4337 bestefficacy = efficacy;
4338 bestdelta = deltacands[i];
4347 for( i = 2; i <= 8 ; i *= 2 )
4352 delta = bestdelta / i;
4354 efficacy =
computeMIREfficacy(scip, tmpcoefs, tmpvalues,
QUAD_TO_DBL(mksetrhs), contactivity, contsqrnorm, delta, ntmpcoefs, minfrac, maxfrac);
4356 if( efficacy >= bestefficacy )
4358 bestefficacy = efficacy;
4366 for( i = 0; i < nbounddist; ++i )
4377 k = bounddistpos[i];
4399 SCIPquadprecSumQD(newrhs, mksetrhs, tmpcoefs[k - intstart] * (bestlb - bestub));
4400 tmpcoefs[k - intstart] = -tmpcoefs[k - intstart];
4402 oldsolval = tmpvalues[k - intstart];
4403 tmpvalues[k - intstart] = varsign[k] == +1 ? bestub -
SCIPgetSolVal(scip, sol, vars[mksetinds[k]]) :
SCIPgetSolVal(scip, sol, vars[mksetinds[k]]) - bestlb;
4406 newefficacy =
computeMIREfficacy(scip, tmpcoefs, tmpvalues,
QUAD_TO_DBL(newrhs), contactivity, contsqrnorm, bestdelta, ntmpcoefs, minfrac, maxfrac);
4409 if( newefficacy > bestefficacy )
4412 bestefficacy = newefficacy;
4415 if( varsign[k] == +1 )
4418 assert(bestubtype < 0);
4419 boundtype[k] = bestubtype;
4425 assert(bestlbtype < 0);
4426 boundtype[k] = bestlbtype;
4430 localbdsused = localbdsused || (boundtype[k] == -2);
4435 tmpcoefs[k - intstart] = -tmpcoefs[k - intstart];
4436 tmpvalues[k - intstart] = oldsolval;
4440 if( bestefficacy > 0.0 )
4447 scale = 1.0 / bestdelta;
4456 for( i = 0; i < mksetnnz; ++i )
4489 aggrrow->
nrows, scale, mksetcoefs, QUAD(&mksetrhs), mksetinds, &mksetnnz,
QUAD(f0)) );
4497 for( i = 0; i < mksetnnz; ++i )
4506 SCIPdebugMessage(
"efficacy of cmir cut is different than expected efficacy: %f != %f\n", efficacy, bestefficacy);
4511 *cutislocal = *cutislocal || localbdsused;
4525 SCIPdebugMessage(
"post-processed cut (success = %s):\n", *success ?
"TRUE" :
"FALSE");
4535 for( i = 0; i < mksetnnz; ++i )
4548 *cutefficacy = mirefficacy;
4549 if( cutrank != NULL )
4550 *cutrank = aggrrow->
rank + 1;
4551 *cutislocal = *cutislocal || localbdsused;
4567 for( i = 0; i < mksetnnz; ++i )
4589 #define NO_EXACT_KNAPSACK 4591 #ifndef NO_EXACT_KNAPSACK 4592 #define MAXDNOM 1000LL 4593 #define MINDELTA 1e-03 4594 #define MAXDELTA 1e-09 4595 #define MAXSCALE 1000.0 4596 #define MAXDYNPROGSPACE 1000000 4599 #define MAXABSVBCOEF 1e+5 4600 #define MAXBOUND 1e+10 4665 assert(scip != NULL);
4666 assert(var != NULL);
4670 assert(rowcoefs != NULL);
4671 assert(binvarused != NULL);
4672 assert(closestvlb != NULL);
4673 assert(closestvlbidx != NULL);
4678 *closestvlbidx = -1;
4691 for( i = 0; i < nvlbs; i++ )
4700 if( bestsub > vlbconsts[i] )
4715 if( (
unsigned int)probidxbinvar >= (
unsigned int)nbinvars )
4736 if( binvarused[probidxbinvar] == 1 )
4745 rowcoefsign = COPYSIGN(1.0, rowcoef);
4747 val2 = rowcoefsign * ((rowcoef * vlbcoefs[i]) + rowcoefbinvar);
4753 val1 = rowcoefsign * ((rowcoef * (bestsub - vlbconsts[i])) + rowcoefbinvar);
4759 vlbsol = vlbcoefs[i] *
SCIPgetSolVal(scip, sol, vlbvars[i]) + vlbconsts[i];
4760 if( vlbsol > *closestvlb )
4762 *closestvlb = vlbsol;
4765 assert(*closestvlbidx >= 0);
4796 assert(scip != NULL);
4797 assert(var != NULL);
4801 assert(rowcoefs != NULL);
4802 assert(binvarused != NULL);
4803 assert(closestvub != NULL);
4804 assert(closestvubidx != NULL);
4809 *closestvubidx = -1;
4822 for( i = 0; i < nvubs; i++ )
4831 if( bestslb < vubconsts[i] )
4846 if( (
unsigned int)probidxbinvar >= (
unsigned int)nbinvars )
4868 if( binvarused[probidxbinvar] == 1 )
4877 rowcoefsign = COPYSIGN(1.0, rowcoef);
4879 val2 = rowcoefsign * ((rowcoef * vubcoefs[i]) + rowcoefbinvar);
4885 val1 = rowcoefsign * ((rowcoef * (bestslb - vubconsts[i])) + rowcoefbinvar);
4891 vubsol = vubcoefs[i] *
SCIPgetSolVal(scip, sol, vubvars[i]) + vubconsts[i];
4892 if( vubsol < *closestvub )
4894 *closestvub = vubsol;
4897 assert(*closestvubidx >= 0);
4941 bestlbtype[varposinrow] = -3;
4942 bestubtype[varposinrow] = -3;
4944 probidx = rowinds[varposinrow];
4945 var = vars[probidx];
4959 if( bestslb[varposinrow] <= -
MAXBOUND )
4962 if( bestsub[varposinrow] >=
MAXBOUND )
4967 SCIPdebugMsg(scip,
" %d: %g <%s, idx=%d, lp=%g, [%g(%d),%g(%d)]>:\n", varposinrow, rowcoef,
SCIPvarGetName(var), probidx,
4968 solval, bestslb[varposinrow], bestslbtype[varposinrow], bestsub[varposinrow], bestsubtype[varposinrow]);
4975 *freevariable =
TRUE;
4984 bestlb[varposinrow] = bestslb[varposinrow];
4985 bestlbtype[varposinrow] = bestslbtype[varposinrow];
4992 SCIP_CALL(
getClosestVlb(scip, var, sol, rowcoefs, binvarused, bestsub[varposinrow], rowcoef, &bestvlb, &bestvlbidx) );
4993 if(
SCIPisGT(scip, bestvlb, bestlb[varposinrow]) )
4995 bestlb[varposinrow] = bestvlb;
4996 bestlbtype[varposinrow] = bestvlbidx;
5006 bestub[varposinrow] = bestsub[varposinrow];
5007 bestubtype[varposinrow] = bestsubtype[varposinrow];
5014 SCIP_CALL(
getClosestVub(scip, var, sol, rowcoefs, binvarused, bestslb[varposinrow], rowcoef, &bestvub, &bestvubidx) );
5015 if(
SCIPisLT(scip, bestvub, bestub[varposinrow]) )
5017 bestub[varposinrow] = bestvub;
5018 bestubtype[varposinrow] = bestvubidx;
5022 SCIPdebugMsg(scip,
" bestlb=%g(%d), bestub=%g(%d)\n", bestlb[varposinrow], bestlbtype[varposinrow], bestub[varposinrow], bestubtype[varposinrow]);
5029 *freevariable =
TRUE;
5033 *freevariable =
FALSE;
5039 if(
SCIPisEQ(scip, solval, (1.0 - boundswitch) * bestlb[varposinrow] + boundswitch * bestub[varposinrow]) && bestlbtype[varposinrow] >= 0 )
5043 else if(
SCIPisEQ(scip, solval, (1.0 - boundswitch) * bestlb[varposinrow] + boundswitch * bestub[varposinrow])
5044 && bestubtype[varposinrow] >= 0 )
5048 else if(
SCIPisLE(scip, solval, (1.0 - boundswitch) * bestlb[varposinrow] + boundswitch * bestub[varposinrow]) )
5054 assert(
SCIPisGT(scip, solval, (1.0 - boundswitch) * bestlb[varposinrow] + boundswitch * bestub[varposinrow]));
5067 binvarused[vlbvarprobidx] = 1;
5069 else if ( selectedbounds[varposinrow] ==
SCIP_BOUNDTYPE_UPPER && bestubtype[varposinrow] >= 0 )
5078 binvarused[vubvarprobidx] = 1;
5122 SCIPdebugMsg(scip,
"--------------------- construction of SNF relaxation ------------------------------------\n");
5143 for( i = nnz - 1; i >= 0 && rowinds[i] < nbinvars; --i )
5149 nnonbinvarsrow = i + 1;
5151 for( i = 0; i < nnonbinvarsrow; ++i )
5155 assert(rowinds[i] >= nbinvars);
5158 bestlb, bestub, bestslb, bestsub, bestlbtype, bestubtype, bestslbtype, bestsubtype, selectedbounds, &freevariable) );
5165 for( j = nnz - 1; j >= nnonbinvarsrow; --j )
5166 binvarused[rowinds[j]] = 0;
5169 for( j = 0; j < i; ++j )
5188 *localbdsused =
FALSE;
5193 for( i = 0; i < nnonbinvarsrow; ++i )
5200 probidx = rowinds[i];
5201 var = vars[probidx];
5205 assert(probidx >= nbinvars);
5213 assert(bestsubtype[i] == -1 || bestsubtype[i] == -2);
5221 if( bestlbtype[i] < 0 )
5241 if( bestlbtype[i] == -2 || bestsubtype[i] == -2 )
5242 *localbdsused =
TRUE;
5275 SCIPdebugMsg(scip,
" --> bestlb used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=1), rhs=%g-(%g*%g)=%g\n",
5303 assert(binvarused[vlbvarprobidx] == 1);
5304 assert(vlbvarprobidx < nbinvars);
5307 varsolvalbinary =
SCIPgetSolVal(scip, sol, vlbvars[bestlbtype[i]]);
5323 binvarused[vlbvarprobidx] = 0;
5355 SCIPdebugMsg(scip,
" --> bestlb used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=%s), rhs=%g-(%g*%g)=%g\n",
5358 vlbconsts[bestlbtype[i]], snf->
transrhs );
5367 assert(bestslbtype[i] == -1 || bestslbtype[i] == -2);
5375 if( bestubtype[i] < 0 )
5395 if( bestubtype[i] == -2 || bestslbtype[i] == -2 )
5396 *localbdsused =
TRUE;
5429 SCIPdebugMsg(scip,
" --> bestub used for trans: ... %s y'_%d + ..., Y'_%d <= %g x_%d (=1), rhs=%g-(%g*%g)=%g\n",
5457 assert(binvarused[vubvarprobidx] == 1);
5458 assert(vubvarprobidx < nbinvars);
5461 varsolvalbinary =
SCIPgetSolVal(scip, sol, vubvars[bestubtype[i]]);
5464 binvarused[vubvarprobidx] = 0;
5509 SCIPdebugMsg(scip,
" --> bestub used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=%s), rhs=%g-(%g*%g)=%g\n",
5526 for( i = nnonbinvarsrow; i < nnz; ++i )
5535 probidx = rowinds[i];
5537 assert(probidx < nbinvars);
5540 if( binvarused[probidx] == 0 )
5544 assert(binvarused[probidx] == -1);
5547 binvarused[probidx] = 0;
5549 var = vars[probidx];
5555 SCIPdebugMsg(scip,
" %d: %g <%s, idx=%d, lp=%g, [%g, %g]>:\n", i,
QUAD_TO_DBL(rowcoef),
SCIPvarGetName(var), probidx, varsolval,
5613 SCIPdebugMsg(scip,
"constraint in constructed 0-1 single node flow relaxation: ");
5701 assert(weights != NULL);
5702 assert(profits != NULL);
5705 assert(items != NULL);
5706 assert(nitems >= 0);
5708 if( solitems != NULL )
5713 if( solval != NULL )
5720 for( i = nitems - 1; i >= 0; --i )
5721 tempsort[i] = profits[i] / weights[i];
5724 mediancapacity = capacity * (1 -
SCIPfeastol(scip));
5733 solitemsweight = 0.0;
5734 for( j = 0; j < nitems &&
SCIPisFeasLT(scip, solitemsweight + weights[j], capacity); j++ )
5736 if( solitems != NULL )
5738 solitems[*nsolitems] = items[j];
5741 if( solval != NULL )
5742 (*solval) += profits[j];
5743 solitemsweight += weights[j];
5748 for( ; j < nitems; j++ )
5750 if(
SCIPisFeasLT(scip, solitemsweight + weights[j], capacity) )
5752 if( solitems != NULL )
5754 solitems[*nsolitems] = items[j];
5757 if( solval != NULL )
5758 (*solval) += profits[j];
5759 solitemsweight += weights[j];
5761 else if( solitems != NULL )
5763 nonsolitems[*nnonsolitems] = items[j];
5785 int* nflowcovervars,
5786 int* nnonflowcovervars,
5787 int* flowcoverstatus,
5795 assert(scip != NULL);
5796 assert(coefs != NULL);
5797 assert(vubcoefs != NULL);
5798 assert(solitems != NULL);
5799 assert(nonsolitems != NULL);
5800 assert(nsolitems >= 0);
5801 assert(nnonsolitems >= 0);
5802 assert(nflowcovervars != NULL && *nflowcovervars >= 0);
5803 assert(nnonflowcovervars != NULL && *nnonflowcovervars >= 0);
5804 assert(flowcoverstatus != NULL);
5805 assert(
QUAD_HI(flowcoverweight) != NULL);
5806 assert(lambda != NULL);
5809 for( j = 0; j < nsolitems; j++ )
5812 if( coefs[solitems[j]] == 1 )
5814 flowcoverstatus[solitems[j]] = -1;
5815 (*nnonflowcovervars)++;
5820 assert(coefs[solitems[j]] == -1);
5821 flowcoverstatus[solitems[j]] = 1;
5822 (*nflowcovervars)++;
5826 for( j = 0; j < nnonsolitems; j++ )
5829 if( coefs[nonsolitems[j]] == 1 )
5831 flowcoverstatus[nonsolitems[j]] = 1;
5832 (*nflowcovervars)++;
5833 SCIPquadprecSumQD(*flowcoverweight, *flowcoverweight, vubcoefs[nonsolitems[j]]);
5838 assert(coefs[nonsolitems[j]] == -1);
5839 flowcoverstatus[nonsolitems[j]] = -1;
5840 (*nnonflowcovervars)++;
5849 #ifndef NO_EXACT_KNAPSACK 5864 assert(mindelta <= 0.0);
5865 assert(maxdelta >= 0.0);
5867 sval = val * scalar;
5868 downval = floor(sval);
5889 assert(mindelta <= 0.0);
5890 assert(maxdelta >= 0.0);
5892 sval = val * scalar;
5911 int* nflowcovervars,
5912 int* nnonflowcovervars,
5913 int* flowcoverstatus,
5932 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 5938 int nflowcovervarsafterfix;
5941 int nnonflowcovervarsafterfix;
5946 assert(scip != NULL);
5951 assert(nflowcovervars != NULL);
5952 assert(nnonflowcovervars != NULL);
5953 assert(flowcoverstatus != NULL);
5954 assert(lambda != NULL);
5955 assert(found != NULL);
5957 SCIPdebugMsg(scip,
"--------------------- get flow cover ----------------------------------------------------\n");
5971 *nflowcovervars = 0;
5972 *nnonflowcovervars = 0;
5975 nflowcovervarsafterfix = 0;
5976 nnonflowcovervarsafterfix = 0;
5978 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 5989 SCIPdebugMsg(scip,
"0. Fix some variables in advance:\n");
5992 n1itemsweight = 0.0;
6003 flowcoverstatus[j] = -1;
6004 (*nnonflowcovervars)++;
6024 flowcoverstatus[j] = -1;
6025 (*nnonflowcovervars)++;
6031 flowcoverstatus[j] = 1;
6032 (*nflowcovervars)++;
6039 flowcoverstatus[j] = 1;
6040 (*nflowcovervars)++;
6048 flowcoverstatus[j] = -1;
6049 (*nnonflowcovervars)++;
6053 assert((*nflowcovervars) + (*nnonflowcovervars) + nitems == snf->
ntransvars);
6054 assert(nn1items >= 0);
6084 SCIPdebugMsg(scip,
"1. Transform KP^SNF to KP^SNF_rat:\n");
6087 transweightsrealintegral =
TRUE;
6088 for( j = 0; j < nitems; j++ )
6093 transweightsrealintegral =
FALSE;
6098 SCIPdebugMsg(scip,
" <%d>: j in N1: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
6099 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
6104 SCIPdebugMsg(scip,
" <%d>: j in N2: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
6105 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
6110 SCIPdebugMsg(scip,
" transcapacity = -rhs(%g) + flowcoverweight(%g) + n1itemsweight(%g) = %g\n",
6123 assert(nitems >= 0);
6139 if( transweightsrealintegral )
6143 scalesuccess =
TRUE;
6147 scalesuccess =
FALSE;
6163 for( j = 0; j < nitems; ++j )
6165 transweightsint[j] = getIntegralVal(transweightsreal[j], scalar, -MINDELTA, MAXDELTA);
6166 transprofitsint[j] = transprofitsreal[j];
6167 itemsint[j] = items[j];
6171 transcapacityint = getIntegralVal(transcapacityreal, scalar, -MINDELTA, MAXDELTA);
6172 transcapacityint -= 1;
6175 transcapacityint = (
SCIP_Longint) (transcapacityreal * scalar);
6176 nflowcovervarsafterfix = *nflowcovervars;
6177 nnonflowcovervarsafterfix = *nnonflowcovervars;
6181 tmp2 = (
SCIP_Real) ((transcapacityint) + 1);
6182 if( transcapacityint * nitems <= MAXDYNPROGSPACE && tmp1 * tmp2 <= INT_MAX / 8.0)
6188 itemsint, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL, &success));
6194 transcapacityreal, items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6196 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 6205 items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6213 items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6217 assert(nsolitems != -1);
6218 assert(nnonsolitems != -1);
6221 assert(*nflowcovervars + *nnonflowcovervars + nsolitems + nnonsolitems == snf->
ntransvars);
6223 nnonflowcovervars, flowcoverstatus, QUAD(&flowcoverweight), lambda);
6224 assert(*nflowcovervars + *nnonflowcovervars == snf->
ntransvars);
6233 items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6239 *nflowcovervars = nflowcovervarsafterfix;
6240 *nnonflowcovervars = nnonflowcovervarsafterfix;
6243 assert(*nflowcovervars + *nnonflowcovervars + nsolitems + nnonsolitems == snf->
ntransvars);
6245 nnonflowcovervars, flowcoverstatus, QUAD(&flowcoverweight), lambda);
6246 assert(*nflowcovervars + *nnonflowcovervars == snf->
ntransvars);
6255 SCIPdebugMsg(scip,
"2. %s solution:\n", kpexact ?
"exact" :
"approximate");
6262 else if( snf->
transvarcoefs[j] == -1 && flowcoverstatus[j] == 1 )
6295 int* nflowcovervars,
6296 int* nnonflowcovervars,
6297 int* flowcoverstatus,
6319 assert(scip != NULL);
6324 assert(nflowcovervars != NULL);
6325 assert(nnonflowcovervars != NULL);
6326 assert(flowcoverstatus != NULL);
6327 assert(lambda != NULL);
6328 assert(found != NULL);
6330 SCIPdebugMsg(scip,
"--------------------- get flow cover ----------------------------------------------------\n");
6343 *nflowcovervars = 0;
6344 *nnonflowcovervars = 0;
6355 SCIPdebugMsg(scip,
"0. Fix some variables in advance:\n");
6358 n1itemsweight = 0.0;
6369 flowcoverstatus[j] = -1;
6370 (*nnonflowcovervars)++;
6390 flowcoverstatus[j] = -1;
6391 (*nnonflowcovervars)++;
6397 flowcoverstatus[j] = 1;
6398 (*nflowcovervars)++;
6405 flowcoverstatus[j] = 1;
6406 (*nflowcovervars)++;
6414 flowcoverstatus[j] = -1;
6415 (*nnonflowcovervars)++;
6419 assert((*nflowcovervars) + (*nnonflowcovervars) + nitems == snf->
ntransvars);
6420 assert(nn1items >= 0);
6450 SCIPdebugMsg(scip,
"1. Transform KP^SNF to KP^SNF_rat:\n");
6453 for( j = 0; j < nitems; j++ )
6460 SCIPdebugMsg(scip,
" <%d>: j in N1: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
6461 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
6466 SCIPdebugMsg(scip,
" <%d>: j in N2: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
6467 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
6472 SCIPdebugMsg(scip,
" transcapacity = -rhs(%g) + flowcoverweight(%g) + n1itemsweight(%g) = %g\n",
6485 assert(nitems >= 0);
6504 items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6506 assert(nsolitems != -1);
6507 assert(nnonsolitems != -1);
6510 assert(*nflowcovervars + *nnonflowcovervars + nsolitems + nnonsolitems == snf->
ntransvars);
6512 nnonflowcovervars, flowcoverstatus, QUAD(&flowcoverweight), lambda);
6513 assert(*nflowcovervars + *nnonflowcovervars == snf->
ntransvars);
6529 else if( snf->
transvarcoefs[j] == -1 && flowcoverstatus[j] == 1 )
6566 xpluslambda = x + liftingdata->
lambda;
6569 while( i < liftingdata->
r &&
SCIPisGT(scip, xpluslambda, liftingdata->
M[i+1]) )
6572 if( i < liftingdata->
t )
6574 if(
SCIPisLE(scip, liftingdata->
M[i], x) )
6576 assert(
SCIPisLE(scip, xpluslambda, liftingdata->
M[i+1]));
6577 return i * liftingdata->
lambda;
6580 assert(i > 0 &&
SCIPisLE(scip, liftingdata->
M[i], xpluslambda) && x <= liftingdata->
M[i]);
6589 if( i < liftingdata->
r )
6608 return i * liftingdata->
lambda;
6610 assert(
SCIPisFeasLE(scip, liftingdata->
M[i], xpluslambda) &&
6612 MAX(0.0, liftingdata->
m[i] - (liftingdata->
mp - liftingdata->
lambda) - liftingdata->
ml)));
6620 assert(i == liftingdata->
r &&
SCIPisLE(scip, liftingdata->
M[liftingdata->
r], xpluslambda));
6649 vubcoefpluslambda = vubcoef + liftingdata->
lambda;
6652 while( i < liftingdata->
r &&
SCIPisGT(scip, vubcoefpluslambda, liftingdata->
M[i+1]) )
6655 if(
SCIPisLT(scip, vubcoef, liftingdata->
M[i]) )
6658 assert(liftingdata->
M[i] < vubcoefpluslambda);
6667 assert(i == liftingdata->
r ||
SCIPisLE(scip, vubcoefpluslambda, liftingdata->
M[i+1]));
6678 int* transvarflowcoverstatus,
6705 int s = (snf->
transvarcoefs[i] + 1) + (transvarflowcoverstatus[i] + 1)/2;
6711 assert(snf->
transvarcoefs[i] == -1 && transvarflowcoverstatus[i] == -1);
6725 assert(snf->
transvarcoefs[i] == -1 && transvarflowcoverstatus[i] == 1);
6730 assert(snf->
transvarcoefs[i] == 1 && transvarflowcoverstatus[i] == 1);
6771 for( i = 0; i < liftingdata->
r; ++i)
6780 assert(liftingdata->
m[liftingdata->
t] == liftingdata->
mp ||
SCIPisInfinity(scip, liftingdata->
mp));
6786 while( liftingdata->
t < liftingdata->
r && liftingdata->
m[liftingdata->
t] == liftingdata->
mp )
6813 int* flowcoverstatus,
6836 int s = (snf->
transvarcoefs[i] + 1) + (flowcoverstatus[i] + 1)/2;
6881 assert(snf->
transvarcoefs[i] == -1 && flowcoverstatus[i] == 1);
6887 if( liftedbincoef != 0.0 )
6902 assert(snf->
transvarcoefs[i] == 1 && flowcoverstatus[i] == -1);
6905 assert(alpha == 0 || alpha == 1);
6992 for( i = 0; i < aggrrow->
nrows; ++i )
7001 assert(slackcoef != 0.0);
7004 if( slackcoef > 0.0 )
7022 slackub = rowrhs - rowlhs;
7035 slackub = -aggrrow->
rowweights[i] * MIN(rhsslack, slackub);
7037 if(
SCIPisGE(scip, slackub, lambda) )
7049 slackub = aggrrow->
rowweights[i] * MIN(lhsslack, slackub);
7051 if(
SCIPisGE(scip, slackub, lambda) )
7062 if( *cutrhs < 0.0 && *cutrhs >=
SCIPepsilon(scip) )
7107 int *transvarflowcoverstatus;
7109 int nnonflowcovervars;
7121 SCIP_CALL(
constructSNFRelaxation(scip, sol, boundswitch, allowlocal, aggrrow->
vals,
QUAD(aggrrow->rhs), aggrrow->
inds, aggrrow->
nnz, &snf, success, &localbdsused) );
7128 *cutislocal = aggrrow->
local || localbdsused;
7132 SCIP_CALL(
getFlowCover(scip, &snf, &nflowcovervars, &nnonflowcovervars, transvarflowcoverstatus, &lambda, success) );
7163 for( i = 0; i < *cutnnz; ++i )
7166 assert(tmpcoefs[j] != 0.0);
7167 cutcoefs[i] = tmpcoefs[j];
7171 if( cutefficacy != NULL )
7172 *cutefficacy =
calcEfficacy(scip, sol, cutcoefs, *cutrhs, cutinds, *cutnnz);
7174 if( cutrank != NULL )
7175 *cutrank = aggrrow->
rank + 1;
7180 for( i = 0; i < *cutnnz; ++i )
7183 assert(tmpcoefs[j] != 0.0);
7248 int aggrrowintstart;
7253 assert(varsign != NULL);
7254 assert(boundtype != NULL);
7255 assert(freevariable != NULL);
7256 assert(localbdsused != NULL);
7258 *freevariable =
FALSE;
7259 *localbdsused =
FALSE;
7275 for( i = 0; i < *nnz && cutinds[i] >= firstcontvar; ++i )
7285 SCIP_CALL(
findBestLb(scip, vars[v], sol, usevbds, allowlocal, bestbds + i, boundtype + i) );
7290 *freevariable =
TRUE;
7299 SCIP_CALL(
findBestUb(scip, vars[cutinds[i]], sol, usevbds, allowlocal, bestbds + i, boundtype + i) );
7304 *freevariable =
TRUE;
7313 aggrrowintstart = i;
7316 for( i = 0; i < aggrrowintstart; ++i )
7327 if( boundtype[i] < 0 )
7331 *localbdsused = *localbdsused || (boundtype[i] == -2);
7341 if( varsign[i] == +1 )
7356 assert(vbdvars != NULL);
7357 assert(vbdcoefs != NULL);
7358 assert(vbdconsts != NULL);
7362 assert(0 <= zidx && zidx < firstcontvar);
7371 cutinds[(*nnz)++] = zidx;
7377 assert(
QUAD_HI(zcoef) != 0.0);
7383 assert(i == aggrrowintstart);
7399 assert(v < firstcontvar);
7408 cutinds[i] = cutinds[*nnz];
7415 SCIP_CALL(
determineBestBounds(scip, vars[v], sol, boundswitch,
FALSE, allowlocal,
FALSE,
FALSE, NULL, NULL,
7416 &bestlb, &bestub, &bestlbtype, &bestubtype, &selectedbound, freevariable) );
7427 boundtype[i] = bestlbtype;
7435 boundtype[i] = bestubtype;
7441 assert(boundtype[i] == -1 || boundtype[i] == -2);
7442 *localbdsused = *localbdsused || (boundtype[i] == -2);
7529 int aggrrowintstart;
7531 assert(
QUAD_HI(cutrhs) != NULL);
7532 assert(cutcoefs != NULL);
7533 assert(cutinds != NULL);
7534 assert(nnz != NULL);
7535 assert(boundtype != NULL);
7536 assert(varsign != NULL);
7552 while( i < *nnz && cutinds[i] >= firstcontvar )
7557 assert(cutinds[i] < firstcontvar);
7563 for( i = *nnz - 1; i >= 0 && cutinds[i] < firstcontvar; --i )
7576 assert(var != NULL);
7578 assert(boundtype[i] == -1 || boundtype[i] == -2);
7579 assert(varsign[i] == +1 || varsign[i] == -1);
7612 cutinds[i] = cutinds[*nnz];
7619 assert(boundtype[i] < 0);
7622 if( varsign[i] == +1 )
7627 if( boundtype[i] == -1 )
7645 if( boundtype[i] == -1 )
7661 aggrrowintstart = i + 1;
7665 for( i = 0; i < aggrrowintstart; ++i )
7677 assert(var != NULL);
7680 assert(varsign[i] == +1 || varsign[i] == -1);
7692 if( aggrrowintstart > 0 )
7695 assert(aggrrowintstart <= *nnz);
7699 for( i = 0; i < aggrrowintstart; ++i )
7704 *nnz -= aggrrowintstart;
7705 if( *nnz < aggrrowintstart )
7755 assert(scip != NULL);
7756 assert(weights != NULL);
7757 assert(slacksign != NULL);
7758 assert(rowinds != NULL);
7760 assert(cutcoefs != NULL);
7761 assert(
QUAD_HI(cutrhs) != NULL);
7762 assert(cutinds != NULL);
7763 assert(nnz != NULL);
7770 for( i = 0; i < nrowinds; i++ )
7783 assert(slacksign[i] == -1 || slacksign[i] == +1);
7787 assert(row != NULL);
7788 assert(row->
len == 0 || row->
cols != NULL);
7790 assert(row->
len == 0 || row->
vals != NULL);
7837 if( slacksign[i] == +1 )
7925 assert(scip != NULL);
7926 assert(aggrrow != NULL);
7928 assert(cutcoefs != NULL);
7929 assert(cutrhs != NULL);
7930 assert(cutinds != NULL);
7931 assert(success != NULL);
7932 assert(cutislocal != NULL);
7945 *cutnnz = aggrrow->
nnz;
7946 *cutislocal = aggrrow->
local;
7953 for( i = 0; i < *cutnnz; ++i )
7983 tmpcoefs,
QUAD(&rhs), cutinds, cutnnz, varsign, boundtype, &freevariable, &localbdsused) );
7985 assert(allowlocal || !localbdsused);
7986 *cutislocal = *cutislocal || localbdsused;
8062 aggrrow->
nrows, scale, tmpcoefs, QUAD(&rhs), cutinds, cutnnz,
QUAD(f0), k) );
8083 for( i = 0; i < *cutnnz; ++i )
8096 if( cutefficacy != NULL )
8097 *cutefficacy =
calcEfficacy(scip, sol, cutcoefs, *cutrhs, cutinds, *cutnnz);
8099 if( cutrank != NULL )
8100 *cutrank = aggrrow->
rank + 1;
8110 for( i = 0; i < *cutnnz; ++i )
void SCIPsortDownRealRealInt(SCIP_Real *realarray1, SCIP_Real *realarray2, int *intarray, int len)
SCIP_Real * transbinvarsolvals
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
enum SCIP_BoundType SCIP_BOUNDTYPE
SCIP_ROW ** SCIPgetLPRows(SCIP *scip)
static SCIP_RETCODE postprocessCutQuad(SCIP *scip, SCIP_Bool cutislocal, int *cutinds, SCIP_Real *cutcoefs, int *nnz, QUAD(SCIP_Real *cutrhs), SCIP_Bool *success)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
SCIP_RETCODE SCIPcalcStrongCG(SCIP *scip, SCIP_SOL *sol, SCIP_Bool postprocess, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_Real scale, SCIP_AGGRROW *aggrrow, SCIP_Real *cutcoefs, SCIP_Real *cutrhs, int *cutinds, int *cutnnz, SCIP_Real *cutefficacy, int *cutrank, SCIP_Bool *cutislocal, SCIP_Bool *success)
void SCIPaggrRowFree(SCIP *scip, SCIP_AGGRROW **aggrrow)
static SCIP_RETCODE computeLiftingData(SCIP *scip, SNF_RELAXATION *snf, int *transvarflowcoverstatus, SCIP_Real lambda, LIFTINGDATA *liftingdata, SCIP_Bool *valid)
int SCIPaggrRowGetNRows(SCIP_AGGRROW *aggrrow)
SCIP_Real * SCIPvarGetVlbCoefs(SCIP_VAR *var)
SCIP_Real SCIPfeastol(SCIP *scip)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPsolveKnapsackExactly(SCIP *scip, int nitems, SCIP_Longint *weights, SCIP_Real *profits, SCIP_Longint capacity, int *items, int *solitems, int *nonsolitems, int *nsolitems, int *nnonsolitems, SCIP_Real *solval, SCIP_Bool *success)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPaggrRowAddRow(SCIP *scip, SCIP_AGGRROW *aggrrow, SCIP_ROW *row, SCIP_Real weight, int sidetype)
#define SCIPquadprecDivDQ(r, a, b)
#define SCIPquadprecSumQD(r, a, b)
static SCIP_RETCODE varVecAddScaledRowCoefsQuad(int *RESTRICT inds, SCIP_Real *RESTRICT vals, int *RESTRICT nnz, SCIP_ROW *row, SCIP_Real scale)
SCIP_Real * aggrcoefscont
int SCIPvarGetNVlbs(SCIP_VAR *var)
enum SCIP_BaseStat SCIP_BASESTAT
static SCIP_RETCODE cutTightenCoefsQuad(SCIP *scip, SCIP_Bool cutislocal, SCIP_Real *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *cutnnz, SCIP_Bool *redundant)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
void SCIPaggrRowCancelVarWithBound(SCIP *scip, SCIP_AGGRROW *aggrrow, SCIP_VAR *var, int pos, SCIP_Bool *valid)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
#define QUAD_ARRAY_STORE(a, idx, x)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE SCIPsolveKnapsackApproximatelyLT(SCIP *scip, int nitems, SCIP_Real *weights, SCIP_Real *profits, SCIP_Real capacity, int *items, int *solitems, int *nonsolitems, int *nsolitems, int *nnonsolitems, SCIP_Real *solval)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
static SCIP_Real computeMIREfficacy(SCIP *scip, SCIP_Real *RESTRICT coefs, SCIP_Real *RESTRICT solvals, SCIP_Real rhs, SCIP_Real contactivity, SCIP_Real contsqrnorm, SCIP_Real delta, int nvars, SCIP_Real minfrac, SCIP_Real maxfrac)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPquadprecProdQQ(r, a, b)
static SCIP_DECL_SORTINDCOMP(compareAbsCoefsQuad)
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
static SCIP_RETCODE generateLiftedFlowCoverCut(SCIP *scip, SNF_RELAXATION *snf, SCIP_AGGRROW *aggrrow, int *flowcoverstatus, SCIP_Real lambda, SCIP_Real *cutcoefs, SCIP_Real *cutrhs, int *cutinds, int *nnz, SCIP_Bool *success)
struct LiftingData LIFTINGDATA
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
methods for the aggregation rows
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
SCIP_BASESTAT SCIProwGetBasisStatus(SCIP_ROW *row)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPaggrRowIsLocal(SCIP_AGGRROW *aggrrow)
enum SCIP_Retcode SCIP_RETCODE
static SCIP_RETCODE cutsTransformStrongCG(SCIP *scip, SCIP_SOL *sol, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Real *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *nnz, int *varsign, int *boundtype, SCIP_Bool *freevariable, SCIP_Bool *localbdsused)
SCIP_RETCODE SCIPcutGenerationHeuristicCMIR(SCIP *scip, SCIP_SOL *sol, SCIP_Bool postprocess, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, int maxtestdelta, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_AGGRROW *aggrrow, SCIP_Real *cutcoefs, SCIP_Real *cutrhs, int *cutinds, int *cutnnz, SCIP_Real *cutefficacy, int *cutrank, SCIP_Bool *cutislocal, SCIP_Bool *success)
int SCIPvarGetNVubs(SCIP_VAR *var)
static SCIP_RETCODE cutsSubstituteMIR(SCIP *scip, SCIP_Real *weights, int *slacksign, int *rowinds, int nrowinds, SCIP_Real scale, SCIP_Real *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *nnz, QUAD(SCIP_Real f0))
int SCIPvarGetProbindex(SCIP_VAR *var)
SCIP_Real SCIPgetVectorEfficacyNorm(SCIP *scip, SCIP_Real *vals, int nvals)
static SCIP_Real evaluateLiftingFunction(SCIP *scip, LIFTINGDATA *liftingdata, SCIP_Real x)
int SCIPaggrRowGetNNz(SCIP_AGGRROW *aggrrow)
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_Real SCIPaggrRowGetRhs(SCIP_AGGRROW *aggrrow)
SCIP_VAR ** SCIPvarGetVlbVars(SCIP_VAR *var)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPaggrRowPrint(SCIP *scip, SCIP_AGGRROW *aggrrow, FILE *file)
#define SCIPfreeBufferArray(scip, ptr)
#define QUAD_ASSIGN(a, constant)
defines macros for basic operations in double-double arithmetic giving roughly twice the precision of...
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugMsgPrint
static SCIP_RETCODE determineBestBounds(SCIP *scip, SCIP_VAR *var, 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 *bestlb, SCIP_Real *bestub, int *bestlbtype, int *bestubtype, SCIP_BOUNDTYPE *selectedbound, SCIP_Bool *freevariable)
internal methods for LP management
int SCIPgetNContVars(SCIP *scip)
SCIP_Real SCIPepsilon(SCIP *scip)
SCIP_RETCODE SCIPgetVarClosestVlb(SCIP *scip, SCIP_VAR *var, SCIP_SOL *sol, SCIP_Real *closestvlb, int *closestvlbidx)
SCIP_Real SCIPgetRowMaxActivity(SCIP *scip, SCIP_ROW *row)
static void getAlphaAndBeta(SCIP *scip, LIFTINGDATA *liftingdata, SCIP_Real vubcoef, int *alpha, SCIP_Real *beta)
SCIP_Bool SCIPaggrRowHasRowBeenAdded(SCIP_AGGRROW *aggrrow, SCIP_ROW *row)
static void destroyLiftingData(SCIP *scip, LIFTINGDATA *liftingdata)
SCIP_RETCODE SCIPaggrRowAddObjectiveFunction(SCIP *scip, SCIP_AGGRROW *aggrrow, SCIP_Real rhs, SCIP_Real scale)
static SCIP_Real calcEfficacyNormQuad(SCIP *scip, SCIP_Real *vals, int *inds, int nnz)
static SCIP_RETCODE cutTightenCoefs(SCIP *scip, SCIP_Bool cutislocal, SCIP_Real *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *cutnnz, SCIP_Bool *redundant)
#define SCIPallocCleanBufferArray(scip, ptr, num)
static SCIP_Bool removeZerosQuad(SCIP *scip, SCIP_Real minval, SCIP_Bool cutislocal, SCIP_Real *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *cutnnz)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
void SCIPsortDownInd(int *indarray, SCIP_DECL_SORTINDCOMP((*indcomp)), void *dataptr, int len)
Constraint handler for knapsack constraints of the form , x binary and .
static SCIP_RETCODE varVecAddScaledRowCoefs(int *RESTRICT inds, SCIP_Real *RESTRICT vals, int *RESTRICT nnz, SCIP_ROW *row, SCIP_Real scale)
SCIP_Bool SCIPsortedvecFindDownReal(SCIP_Real *realarray, SCIP_Real val, int len, int *pos)
int * SCIPaggrRowGetRowInds(SCIP_AGGRROW *aggrrow)
static SCIP_Bool isIntegralScalar(SCIP_Real val, SCIP_Real scalar, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Real *intval)
static SCIP_RETCODE findBestLb(SCIP *scip, SCIP_VAR *var, SCIP_SOL *sol, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Real *bestlb, int *bestlbtype)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPquadprecEpsFloorQ(r, a, eps)
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
#define SCIPfreeBufferArrayNull(scip, ptr)
SCIP_Bool SCIPisEfficacious(SCIP *scip, SCIP_Real efficacy)
SCIP_Real * SCIPvarGetVubConstants(SCIP_VAR *var)
SCIP_Real sepa_maxcoefratio
const char * SCIPvarGetName(SCIP_VAR *var)
static SCIP_Bool chgCoeffWithBound(SCIP *scip, SCIP_VAR *var, SCIP_Real oldcoeff, SCIP_Real newcoeff, SCIP_Bool cutislocal, QUAD(SCIP_Real *cutrhs))
int SCIPaggrRowGetRank(SCIP_AGGRROW *aggrrow)
static SCIP_RETCODE cutsTransformMIR(SCIP *scip, 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 *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *nnz, int *varsign, int *boundtype, SCIP_Bool *freevariable, SCIP_Bool *localbdsused)
internal miscellaneous methods
static SCIP_RETCODE findBestUb(SCIP *scip, SCIP_VAR *var, SCIP_SOL *sol, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Real *bestub, int *bestubtype)
int * SCIPaggrRowGetInds(SCIP_AGGRROW *aggrrow)
SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
void SCIPaggrRowRemoveZeros(SCIP *scip, SCIP_AGGRROW *aggrrow, SCIP_Bool *valid)
int SCIPgetNLPRows(SCIP *scip)
#define QUAD_ARRAY_LOAD(r, a, idx)
SCIP main data structure.
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real * SCIPvarGetVlbConstants(SCIP_VAR *var)
SCIP_RETCODE SCIPgetVarClosestVub(SCIP *scip, SCIP_VAR *var, SCIP_SOL *sol, SCIP_Real *closestvub, int *closestvubidx)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
SCIP_Real * SCIPvarGetVubCoefs(SCIP_VAR *var)
SCIP_RETCODE SCIPaggrRowAddCustomCons(SCIP *scip, SCIP_AGGRROW *aggrrow, int *inds, SCIP_Real *vals, int len, SCIP_Real rhs, SCIP_Real weight, int rank, SCIP_Bool local)
static SCIP_RETCODE getClosestVlb(SCIP *scip, SCIP_VAR *var, SCIP_SOL *sol, SCIP_Real *rowcoefs, int8_t *binvarused, SCIP_Real bestsub, SCIP_Real rowcoef, SCIP_Real *closestvlb, int *closestvlbidx)
#define SCIPquadprecProdDD(r, a, b)
SCIP_Bool SCIProwIsModifiable(SCIP_ROW *row)
static SCIP_Bool chgQuadCoeffWithBound(SCIP *scip, SCIP_VAR *var, QUAD(SCIP_Real oldcoeff), SCIP_Real newcoeff, SCIP_Bool cutislocal, QUAD(SCIP_Real *cutrhs))
static SCIP_RETCODE allocSNFRelaxation(SCIP *scip, SNF_RELAXATION *snf, int nvars)
SCIP_RETCODE SCIPcalcMIR(SCIP *scip, SCIP_SOL *sol, SCIP_Bool postprocess, 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_AGGRROW *aggrrow, SCIP_Real *cutcoefs, SCIP_Real *cutrhs, int *cutinds, int *cutnnz, SCIP_Real *cutefficacy, int *cutrank, SCIP_Bool *cutislocal, SCIP_Bool *success)
#define SCIPallocBufferArray(scip, ptr, num)
static SCIP_RETCODE cutsSubstituteStrongCG(SCIP *scip, SCIP_Real *weights, int *slacksign, int *rowinds, int nrowinds, SCIP_Real scale, SCIP_Real *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *nnz, QUAD(SCIP_Real f0), SCIP_Real k)
SCIP_Real SCIPaggrRowCalcEfficacyNorm(SCIP *scip, SCIP_AGGRROW *aggrrow)
#define QUAD_ARRAY_SIZE(size)
SCIP_Bool SCIPcutsTightenCoefficients(SCIP *scip, SCIP_Bool cutislocal, SCIP_Real *cutcoefs, SCIP_Real *cutrhs, int *cutinds, int *cutnnz, int *nchgcoefs)
SCIP_Bool SCIPisSumLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPcalcFlowCover(SCIP *scip, SCIP_SOL *sol, SCIP_Bool postprocess, SCIP_Real boundswitch, SCIP_Bool allowlocal, SCIP_AGGRROW *aggrrow, SCIP_Real *cutcoefs, SCIP_Real *cutrhs, int *cutinds, int *cutnnz, SCIP_Real *cutefficacy, int *cutrank, SCIP_Bool *cutislocal, SCIP_Bool *success)
static SCIP_RETCODE determineBoundForSNF(SCIP *scip, SCIP_SOL *sol, SCIP_VAR **vars, SCIP_Real *rowcoefs, int *rowinds, int varposinrow, int8_t *binvarused, SCIP_Bool allowlocal, SCIP_Real boundswitch, SCIP_Real *bestlb, SCIP_Real *bestub, SCIP_Real *bestslb, SCIP_Real *bestsub, int *bestlbtype, int *bestubtype, int *bestslbtype, int *bestsubtype, SCIP_BOUNDTYPE *selectedbounds, SCIP_Bool *freevariable)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
static SCIP_RETCODE constructSNFRelaxation(SCIP *scip, SCIP_SOL *sol, SCIP_Real boundswitch, SCIP_Bool allowlocal, SCIP_Real *rowcoefs, QUAD(SCIP_Real rowrhs), int *rowinds, int nnz, SNF_RELAXATION *snf, SCIP_Bool *success, SCIP_Bool *localbdsused)
#define SCIPquadprecProdQD(r, a, b)
SCIP_Real * SCIPaggrRowGetRowWeights(SCIP_AGGRROW *aggrrow)
#define BMScopyMemoryArray(ptr, source, num)
static SCIP_RETCODE cutsRoundStrongCG(SCIP *scip, SCIP_Real *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *nnz, int *varsign, int *boundtype, QUAD(SCIP_Real f0), SCIP_Real k)
static SCIP_RETCODE addOneRow(SCIP *scip, SCIP_AGGRROW *aggrrow, SCIP_ROW *row, SCIP_Real weight, SCIP_Bool sidetypebasis, SCIP_Bool allowlocal, int negslack, int maxaggrlen, SCIP_Bool *rowtoolong)
static SCIP_RETCODE getClosestVub(SCIP *scip, SCIP_VAR *var, SCIP_SOL *sol, SCIP_Real *rowcoefs, int8_t *binvarused, SCIP_Real bestslb, SCIP_Real rowcoef, SCIP_Real *closestvub, int *closestvubidx)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPgetRowSolActivity(SCIP *scip, SCIP_ROW *row, SCIP_SOL *sol)
SCIP_Real * transvarvubcoefs
struct SNF_Relaxation SNF_RELAXATION
#define SCIPquadprecSumQQ(r, a, b)
int SCIPgetNBinVars(SCIP *scip)
#define QUAD_ASSIGN_Q(a, b)
int SCIPgetNVars(SCIP *scip)
static SCIP_RETCODE cutsRoundMIR(SCIP *scip, SCIP_Real *RESTRICT cutcoefs, QUAD(SCIP_Real *RESTRICT cutrhs), int *RESTRICT cutinds, int *RESTRICT nnz, int *RESTRICT varsign, int *RESTRICT boundtype, QUAD(SCIP_Real f0))
SCIP_RETCODE SCIPaggrRowCopy(SCIP *scip, SCIP_AGGRROW **aggrrow, SCIP_AGGRROW *source)
#define SCIPquadprecDivDD(r, a, b)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPaggrRowSumRows(SCIP *scip, SCIP_AGGRROW *aggrrow, SCIP_Real *weights, int *rowinds, int nrowinds, SCIP_Bool sidetypebasis, SCIP_Bool allowlocal, int negslack, int maxaggrlen, SCIP_Bool *valid)
void SCIPselectWeightedDownRealRealInt(SCIP_Real *realarray1, SCIP_Real *realarray2, int *intarray, SCIP_Real *weights, SCIP_Real capacity, int len, int *medianpos)
static SCIP_Bool removeZeros(SCIP *scip, SCIP_Real minval, SCIP_Bool cutislocal, SCIP_Real *cutcoefs, QUAD(SCIP_Real *cutrhs), int *cutinds, int *cutnnz)
static void destroySNFRelaxation(SCIP *scip, SNF_RELAXATION *snf)
int SCIPgetNCuts(SCIP *scip)
static void buildFlowCover(SCIP *scip, int *coefs, SCIP_Real *vubcoefs, SCIP_Real rhs, int *solitems, int *nonsolitems, int nsolitems, int nnonsolitems, int *nflowcovervars, int *nnonflowcovervars, int *flowcoverstatus, QUAD(SCIP_Real *flowcoverweight), SCIP_Real *lambda)
data structures for LP management
SCIP_Real * aggrconstants
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
int SCIProwGetLPPos(SCIP_ROW *row)
void SCIPsortDownInt(int *intarray, int len)
static SCIP_RETCODE postprocessCut(SCIP *scip, SCIP_Bool cutislocal, int *cutinds, SCIP_Real *cutcoefs, int *nnz, SCIP_Real *cutrhs, SCIP_Bool *success)
#define SCIPfreeCleanBufferArray(scip, ptr)
SCIP_Real SCIPgetRowMinActivity(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPaggrRowCreate(SCIP *scip, SCIP_AGGRROW **aggrrow)
#define SCIPquadprecSumDD(r, a, b)
SCIP_VAR ** SCIPvarGetVubVars(SCIP_VAR *var)
SCIP_RETCODE SCIPcalcIntegralScalar(SCIP_Real *vals, int nvals, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Real maxscale, SCIP_Real *intscalar, SCIP_Bool *success)
SCIP_Real SCIPfrac(SCIP *scip, SCIP_Real val)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPsumepsilon(SCIP *scip)
#define BMSclearMemoryArray(ptr, num)
SCIP_RETCODE SCIPgetLPRowsData(SCIP *scip, SCIP_ROW ***rows, int *nrows)
static SCIP_RETCODE getFlowCover(SCIP *scip, SNF_RELAXATION *snf, int *nflowcovervars, int *nnonflowcovervars, int *flowcoverstatus, SCIP_Real *lambda, SCIP_Bool *found)
void SCIPaggrRowClear(SCIP_AGGRROW *aggrrow)
#define SCIP_CALL_ABORT(x)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Longint SCIPgetNLPs(SCIP *scip)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
static SCIP_Real calcEfficacyDenseStorageQuad(SCIP *scip, SCIP_SOL *sol, SCIP_Real *cutcoefs, SCIP_Real cutrhs, int *cutinds, int cutnnz)
struct definitions for cuts
void SCIPsortDownReal(SCIP_Real *realarray, int len)
SCIP_Real * transcontvarsolvals
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
static SCIP_Real calcEfficacy(SCIP *scip, SCIP_SOL *sol, SCIP_Real *cutcoefs, SCIP_Real cutrhs, int *cutinds, int cutnnz)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)