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; )
734 cutinds[i] = cutinds[*cutnnz];
744 for( i = 0; i < *cutnnz; ++i )
748 assert(cutinds[i] >= 0);
749 assert(vars[cutinds[i]] != NULL);
797 maxabsintval *= equiscale;
799 for( i = 0; i < *cutnnz; ++i )
816 maxabsval = MIN(maxabsval, maxabsintval);
817 maxabsval =
MAX(maxabsval, maxabscontval);
819 scale = 1.0 / maxabsval;
826 maxabsintval *= scale;
828 for( i = 0; i < *cutnnz; ++i )
842 SCIPsortDownInd(cutinds, compareAbsCoefsQuad, (
void*) cutcoefs, *cutnnz);
845 for( i = 0; i < *cutnnz; )
849 if( cutinds[i] >= nintegralvars )
885 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
904 cutinds[i] = cutinds[*cutnnz];
935 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
953 cutinds[i] = cutinds[*cutnnz];
999 for( i = 0; i < *cutnnz; ++i )
1003 assert(cutinds[i] >= 0);
1004 assert(vars[cutinds[i]] != NULL);
1006 val = cutcoefs[cutinds[i]];
1015 if( cutinds[i] < nintegralvars )
1016 maxabsintval =
MAX(maxabsintval, -val);
1019 maxabscontval =
MAX(maxabscontval, -val);
1032 if( cutinds[i] < nintegralvars )
1033 maxabsintval =
MAX(maxabsintval, val);
1036 maxabscontval =
MAX(maxabscontval, val);
1063 equiscale = 1.0 / MIN((maxact -
QUAD_TO_DBL(*cutrhs)), maxabsintval);
1065 for( i = 0; i < *cutnnz; ++i )
1070 val = cutcoefs[cutinds[i]];
1072 scaleval = val * equiscale;
1074 intcoeffs[i] = scaleval;
1085 intscalar *= equiscale;
1089 for( i = 0; i < *cutnnz; )
1094 val = cutcoefs[cutinds[i]];
1108 cutcoefs[cutinds[i]] = intval;
1114 cutcoefs[cutinds[i]] = 0.0;
1116 cutinds[i] = cutinds[*cutnnz];
1126 for( i = 0; i < *cutnnz; ++i )
1130 assert(cutinds[i] >= 0);
1131 assert(vars[cutinds[i]] != NULL);
1133 val = cutcoefs[cutinds[i]];
1139 maxabsintval =
MAX(maxabsintval, -val);
1149 maxabsintval =
MAX(maxabsintval, val);
1179 maxabsintval *= equiscale;
1181 for( i = 0; i < *cutnnz; ++i )
1182 cutcoefs[cutinds[i]] *= equiscale;
1192 maxabsval = MIN(maxabsval, maxabsintval);
1193 maxabsval =
MAX(maxabsval, maxabscontval);
1195 scale = 1.0 / maxabsval;
1202 maxabsintval *= scale;
1204 for( i = 0; i < *cutnnz; ++i )
1205 cutcoefs[cutinds[i]] *= scale;
1215 for( i = 0; i < *cutnnz; )
1219 if( cutinds[i] >= nintegralvars )
1225 val = cutcoefs[cutinds[i]];
1254 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
1270 cutcoefs[cutinds[i]] = 0.0;
1272 cutinds[i] = cutinds[*cutnnz];
1302 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
1318 cutcoefs[cutinds[i]] = 0.0;
1320 cutinds[i] = cutinds[*cutnnz];
1356 assert(nchgcoefs != NULL);
1368 for( i = 0; i < *cutnnz; ++i )
1370 assert(cutinds[i] >= 0);
1371 assert(vars[cutinds[i]] != NULL);
1373 if( cutcoefs[i] < 0.0 )
1380 if( cutinds[i] < nintegralvars )
1382 maxabsval =
MAX(maxabsval, -cutcoefs[i]);
1383 absvals[i] = -cutcoefs[i];
1399 if( cutinds[i] < nintegralvars )
1401 maxabsval =
MAX(maxabsval, cutcoefs[i]);
1402 absvals[i] = cutcoefs[i];
1423 if(
SCIPisGT(scip, maxact - maxabsval, *cutrhs) )
1430 for( i = 0; i < *cutnnz;)
1432 if( cutinds[i] >= nintegralvars )
1440 if( cutcoefs[i] < 0.0 &&
SCIPisLE(scip, maxact + cutcoefs[i], *cutrhs) )
1447 if( coef > cutcoefs[i] )
1456 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
1457 cutcoefs[i], coef, (*cutrhs),
QUAD_TO_DBL(tmp), lb,
1475 cutinds[i] = cutinds[*cutnnz];
1476 cutcoefs[i] = cutcoefs[*cutnnz];
1481 else if( cutcoefs[i] > 0.0 &&
SCIPisLE(scip, maxact - cutcoefs[i], *cutrhs) )
1488 if( coef < cutcoefs[i] )
1497 SCIPdebugPrintf(
"tightened coefficient from %g to %g; rhs changed from %g to %g; the bounds are [%g,%g]\n",
1516 cutinds[i] = cutinds[*cutnnz];
1517 cutcoefs[i] = cutcoefs[*cutnnz];
1544 assert(scip != NULL);
1545 assert(aggrrow != NULL);
1556 (*aggrrow)->local =
FALSE;
1557 (*aggrrow)->nnz = 0;
1558 (*aggrrow)->rank = 0;
1560 (*aggrrow)->rowsinds = NULL;
1561 (*aggrrow)->slacksign = NULL;
1562 (*aggrrow)->rowweights = NULL;
1563 (*aggrrow)->nrows = 0;
1564 (*aggrrow)->rowssize = 0;
1576 assert(scip != NULL);
1577 assert(aggrrow != NULL);
1600 assert(scip != NULL);
1601 assert(aggrrow != NULL);
1604 assert(vars != NULL);
1607 assert(messagehdlr);
1610 if( aggrrow->
nnz == 0 )
1613 for( i = 0; i < aggrrow->
nnz; ++i )
1635 assert(scip != NULL);
1636 assert(aggrrow != NULL);
1637 assert(source != NULL);
1644 (*aggrrow)->nnz = source->
nnz;
1647 if( source->
nrows > 0 )
1659 (*aggrrow)->rowsinds = NULL;
1660 (*aggrrow)->slacksign = NULL;
1661 (*aggrrow)->rowweights = NULL;
1664 (*aggrrow)->nrows = source->
nrows;
1665 (*aggrrow)->rowssize = source->
nrows;
1666 (*aggrrow)->rank = source->
rank;
1667 (*aggrrow)->local = source->
local;
1683 assert(row->
lppos >= 0);
1695 i = aggrrow->
nrows++;
1708 if ( sidetype == -1 )
1713 else if ( sidetype == 1 )
1771 assert(valid != NULL);
1774 v = aggrrow->
inds[pos];
1828 assert(scip != NULL);
1829 assert(aggrrow != NULL);
1835 if( aggrrow->
nnz == 0 )
1838 for( i = 0; i < nvars; ++i )
1848 aggrrow->
inds[aggrrow->
nnz++] = i;
1858 for( i = 0 ; i < nvars; ++i )
1869 aggrrow->
inds[aggrrow->
nnz++] = i;
1902 assert(weight >= 0.0);
1915 for( i = 0 ; i < len; ++i )
1918 int probindex = inds[i];
1923 aggrrow->
inds[aggrrow->
nnz++] = probindex;
1947 for( i = 0; i < aggrrow->
nnz; ++i )
1991 *rowtoolong =
FALSE;
2035 if( weight > 0.0 && ((negslack == 0) || (negslack == 1 && !row->
integral)) )
2047 if( weight < 0.0 && ((negslack == 0) || (negslack == 1 && !row->
integral)) )
2062 i = aggrrow->
nrows++;
2075 aggrrow->
slacksign[i] = uselhs ? -1 : 1;
2081 if( aggrrow->
nnz > maxaggrlen )
2116 if( rowinds != NULL && nrowinds > -1 )
2118 for( k = 0; k < nrowinds; ++k )
2120 SCIP_CALL(
addOneRow(scip, aggrrow, rows[rowinds[k]], weights[rowinds[k]], sidetypebasis, allowlocal,
2121 negslack, maxaggrlen, &rowtoolong) );
2129 for( k = 0; k < nrows; ++k )
2132 negslack, maxaggrlen, &rowtoolong) );
2165 assert(scip != NULL);
2166 assert(cutinds != NULL);
2167 assert(cutcoefs != NULL);
2168 assert(cutrhs != NULL);
2189 for( i = 0; i < *nnz; ++i )
2192 maxcoef =
MAX(absval, maxcoef);
2197 minallowedcoef =
MAX(minallowedcoef, maxcoef);
2199 *success = !
removeZeros(scip, minallowedcoef, cutislocal, cutcoefs,
QUAD(&rhs), cutinds, nnz);
2229 assert(scip != NULL);
2230 assert(cutinds != NULL);
2231 assert(cutcoefs != NULL);
2232 assert(
QUAD_HI(cutrhs) != NULL);
2250 for( i = 0; i < *nnz; ++i )
2256 maxcoef =
MAX(abscoef, maxcoef);
2261 minallowedcoef =
MAX(minallowedcoef, maxcoef);
2263 *success = !
removeZerosQuad(scip, minallowedcoef, cutislocal, cutcoefs,
QUAD(cutrhs), cutinds, nnz);
2275 assert(aggrrow != NULL);
2285 assert(aggrrow != NULL);
2287 return aggrrow->
nrows;
2295 assert(aggrrow != NULL);
2306 assert(aggrrow != NULL);
2321 assert(aggrrow != NULL);
2322 assert(row != NULL);
2326 for( i = 0; i < aggrrow->
nrows; ++i )
2327 if( aggrrow->
rowsinds[i] == rowind )
2338 assert(aggrrow != NULL);
2340 return aggrrow->
inds;
2348 assert(aggrrow != NULL);
2350 return aggrrow->
nnz;
2358 assert(aggrrow != NULL);
2360 return aggrrow->
rank;
2368 assert(aggrrow != NULL);
2370 return aggrrow->
local;
2378 assert(aggrrow != NULL);
2385 #define MAXCMIRSCALE 1e+6 2399 assert(bestlb != NULL);
2400 assert(bestlbtype != NULL);
2410 if(
SCIPisGT(scip, loclb, *bestlb) )
2424 && (bestvlb > *bestlb || (*bestlbtype < 0 &&
SCIPisGE(scip, bestvlb, *bestlb))) )
2433 assert(vlbvars != NULL);
2437 *bestlbtype = bestvlbidx;
2457 assert(bestub != NULL);
2458 assert(bestubtype != NULL);
2468 if(
SCIPisLT(scip, locub, *bestub) )
2482 && (bestvub < *bestub || (*bestubtype < 0 &&
SCIPisLE(scip, bestvub, *bestub))) )
2491 assert(vubvars != NULL);
2495 *bestubtype = bestvubidx;
2514 int* boundsfortrans,
2532 if( boundsfortrans != NULL && boundsfortrans[v] > -3 )
2540 *bestlbtype = boundsfortrans[v];
2541 if( *bestlbtype == -1 )
2543 else if( *bestlbtype == -2 )
2558 k = boundsfortrans[v];
2560 assert(vlbvars != NULL);
2561 assert(vlbcoefs != NULL);
2562 assert(vlbconsts != NULL);
2571 SCIP_CALL(
findBestUb(scip, var, sol, usevbds && fixintegralrhs, allowlocal && fixintegralrhs, bestub, bestubtype) );
2578 *bestubtype = boundsfortrans[v];
2579 if( *bestubtype == -1 )
2581 else if( *bestubtype == -2 )
2596 k = boundsfortrans[v];
2598 assert(vubvars != NULL);
2599 assert(vubcoefs != NULL);
2600 assert(vubconsts != NULL);
2610 SCIP_CALL(
findBestLb(scip, var, sol, usevbds && fixintegralrhs, allowlocal && fixintegralrhs, bestlb, bestlbtype) );
2631 *freevariable =
TRUE;
2644 else if(
SCIPisLT(scip, varsol, (1.0 - boundswitch) * (*bestlb) + boundswitch * (*bestub)) )
2646 else if(
SCIPisGT(scip, varsol, (1.0 - boundswitch) * (*bestlb) + boundswitch * (*bestub)) )
2648 else if( *bestlbtype == -1 )
2650 else if( *bestubtype == -1 )
2652 else if( *bestlbtype >= 0 )
2654 else if( *bestubtype >= 0 )
2676 else if(
SCIPisLE(scip, distlb, distub) )
2728 int* boundsfortrans,
2753 int aggrrowintstart;
2758 assert(varsign != NULL);
2759 assert(boundtype != NULL);
2760 assert(freevariable != NULL);
2761 assert(localbdsused != NULL);
2763 *freevariable =
FALSE;
2764 *localbdsused =
FALSE;
2784 for( i = 0; i < *nnz && cutinds[i] >= firstcontvar; ++i )
2787 ignoresol, boundsfortrans, boundtypesfortrans,
2788 bestlbs + i, bestubs + i, bestlbtypes + i, bestubtypes + i, selectedbounds + i, freevariable) );
2795 aggrrowintstart = i;
2798 for( i = 0; i < aggrrowintstart; ++i )
2811 boundtype[i] = bestlbtypes[i];
2815 if( bestlbtypes[i] < 0 )
2819 *localbdsused = *localbdsused || (bestlbtypes[i] == -2);
2832 assert(vlbvars != NULL);
2833 assert(vlbcoefs != NULL);
2834 assert(vlbconsts != NULL);
2839 assert(0 <= zidx && zidx < firstcontvar);
2847 cutinds[(*nnz)++] = zidx;
2853 assert(
QUAD_HI(zcoef) != 0.0);
2861 boundtype[i] = bestubtypes[i];
2865 if( bestubtypes[i] < 0 )
2869 *localbdsused = *localbdsused || (bestubtypes[i] == -2);
2882 assert(vubvars != NULL);
2883 assert(vubcoefs != NULL);
2884 assert(vubconsts != NULL);
2897 cutinds[(*nnz)++] = zidx;
2903 assert(
QUAD_HI(zcoef) != 0.0);
2915 assert(cutinds[i] < firstcontvar);
2925 cutinds[i] = cutinds[*nnz];
2932 ignoresol, boundsfortrans, boundtypesfortrans,
2933 bestlbs + i, bestubs + i, bestlbtypes + i, bestubtypes + i, selectedbounds + i, freevariable) );
2943 for( i = aggrrowintstart; i < *nnz; ++i )
2954 assert(bestlbtypes[i] < 0);
2957 boundtype[i] = bestlbtypes[i];
2963 *localbdsused = *localbdsused || (bestlbtypes[i] == -2);
2968 assert(bestubtypes[i] < 0);
2971 boundtype[i] = bestubtypes[i];
2977 *localbdsused = *localbdsused || (bestubtypes[i] == -2);
2981 if( fixintegralrhs )
2987 if( f0 < minfrac || f0 > maxfrac )
2995 bestviolgain = -1e+100;
2997 for( i = 0; i < *nnz; i++ )
3003 assert(0 <= v && v < nvars);
3008 if( boundtype[i] < 0
3009 && ((varsign[i] == +1 && !
SCIPisInfinity(scip, bestubs[i]) && bestubtypes[i] < 0)
3010 || (varsign[i] == -1 && !
SCIPisInfinity(scip, -bestlbs[i]) && bestlbtypes[i] < 0)) )
3031 if( newf0 < minfrac || newf0 > maxfrac )
3033 if( v >= firstcontvar )
3047 viol = f0 - fj * (varsign[i] == +1 ? solval - bestlbs[i] : bestubs[i] - solval);
3048 newviol = newf0 - newfj * (varsign[i] == -1 ? solval - bestlbs[i] : bestubs[i] - solval);
3049 violgain = newviol - viol;
3054 SCIPerrorMessage(
"Cannot handle closest bounds with ignoring the LP solution.\n");
3061 if(
SCIPisGT(scip, violgain, bestviolgain)
3062 || (
SCIPisGE(scip, violgain, bestviolgain) && newf0 < bestnewf0) )
3065 bestviolgain = violgain;
3074 assert(besti < *nnz);
3075 assert(boundtype[besti] < 0);
3087 if( varsign[besti] == +1 )
3090 assert(bestubtypes[besti] < 0);
3091 boundtype[besti] = bestubtypes[besti];
3092 varsign[besti] = -1;
3097 assert(bestlbtypes[besti] < 0);
3098 boundtype[besti] = bestlbtypes[besti];
3099 varsign[besti] = +1;
3101 *localbdsused = *localbdsused || (boundtype[besti] == -2);
3173 int*RESTRICT cutinds,
3175 int*RESTRICT varsign,
3176 int*RESTRICT boundtype,
3187 assert(
QUAD_HI(cutrhs) != NULL);
3188 assert(cutcoefs != NULL);
3189 assert(cutinds != NULL);
3190 assert(nnz != NULL);
3191 assert(boundtype != NULL);
3192 assert(varsign != NULL);
3208 while( i < *nnz && cutinds[i] >= firstcontvar )
3213 assert(cutinds[i] < firstcontvar);
3218 for( i = *nnz - 1; i >= 0 && cutinds[i] < firstcontvar; --i )
3228 assert(var != NULL);
3230 assert(varsign[i] == +1 || varsign[i] == -1);
3265 cutinds[i] = cutinds[*nnz];
3272 assert(boundtype[i] < 0);
3275 if( varsign[i] == +1 )
3278 if( boundtype[i] == -1 )
3294 if( boundtype[i] == -1 )
3311 while( i >= ndelcontvars )
3321 assert(var != NULL);
3323 assert(varsign[i] == +1 || varsign[i] == -1);
3324 assert( v >= firstcontvar );
3346 cutinds[i] = cutinds[ndelcontvars];
3347 varsign[i] = varsign[ndelcontvars];
3348 boundtype[i] = boundtype[ndelcontvars];
3356 if( boundtype[i] < 0 )
3361 if( varsign[i] == +1 )
3364 if( boundtype[i] == -1 )
3380 if( boundtype[i] == -1 )
3404 vbidx = boundtype[i];
3407 if( varsign[i] == +1 )
3425 assert(0 <= zidx && zidx < firstcontvar);
3435 cutinds[(*nnz)++] = zidx;
3440 assert(
QUAD_HI(zcoef) != 0.0);
3448 if( ndelcontvars > 0 )
3450 assert(ndelcontvars <= *nnz);
3451 *nnz -= ndelcontvars;
3452 if( *nnz < ndelcontvars )
3501 assert(scip != NULL);
3502 assert(weights != NULL || nrowinds == 0);
3503 assert(slacksign != NULL || nrowinds == 0);
3504 assert(rowinds != NULL || nrowinds == 0);
3505 assert(scale > 0.0);
3506 assert(cutcoefs != NULL);
3507 assert(
QUAD_HI(cutrhs) != NULL);
3508 assert(cutinds != NULL);
3509 assert(nnz != NULL);
3516 for( i = 0; i < nrowinds; i++ )
3529 assert(slacksign[i] == -1 || slacksign[i] == +1);
3533 assert(row != NULL);
3534 assert(row->
len == 0 || row->
cols != NULL);
3536 assert(row->
len == 0 || row->
vals != NULL);
3539 ar = slacksign[i] * scale * weights[i];
3587 if( slacksign[i] == +1 )
3645 int* boundsfortrans,
3676 assert(aggrrow != NULL);
3678 assert(success != NULL);
3691 *cutnnz = aggrrow->
nnz;
3692 *cutislocal = aggrrow->
local;
3700 for( i = 0; i < *cutnnz; ++i )
3704 int k = aggrrow->
inds[i];
3730 boundsfortrans, boundtypesfortrans, minfrac, maxfrac, tmpcoefs,
QUAD(&rhs), cutinds, cutnnz, varsign, boundtype, &freevariable, &localbdsused) );
3731 assert(allowlocal || !localbdsused);
3732 *cutislocal = *cutislocal || localbdsused;
3805 aggrrow->
nrows, scale, tmpcoefs, QUAD(&rhs), cutinds, cutnnz,
QUAD(f0)) );
3827 for( i = 0; i < *cutnnz; ++i )
3839 if( cutefficacy != NULL )
3840 *cutefficacy =
calcEfficacy(scip, sol, cutcoefs, *cutrhs, cutinds, *cutnnz);
3842 if( cutrank != NULL )
3843 *cutrank = aggrrow->
rank + 1;
3852 for( i = 0; i < *cutnnz; ++i )
3891 scale = 1.0 / delta;
3899 if( f0 < minfrac || f0 > maxfrac )
3902 onedivoneminusf0 = 1.0 / (1.0 - f0);
3904 contscale = scale * onedivoneminusf0;
3913 rhs -= contscale * contactivity;
3914 norm = SQR(contscale) * contsqrnorm;
3921 for( i = 0; i < nvars; ++i )
3923 SCIP_Real floorai = floor(scale * coefs[i]);
3924 SCIP_Real fi = (scale * coefs[i]) - floorai;
3926 if( fi > f0pluseps )
3927 floorai += (fi - f0) * onedivoneminusf0;
3929 rhs -= solvals[i] * floorai;
3930 norm += SQR(floorai);
3935 return - rhs /
MAX(norm, 1e-6);
3962 int* boundsfortrans,
4008 assert(aggrrow != NULL);
4009 assert(aggrrow->
nrows + aggrrow->
nnz >= 1);
4010 assert(success != NULL);
4035 mksetnnz = aggrrow->
nnz;
4040 for( i = 0; i < mksetnnz; ++i )
4042 int j = mksetinds[i];
4049 *cutislocal = aggrrow->
local;
4067 boundsfortrans, boundtypesfortrans, minfrac, maxfrac, mksetcoefs,
QUAD(&mksetrhs), mksetinds, &mksetnnz, varsign, boundtype, &freevariable, &localbdsused) );
4069 assert(allowlocal || !localbdsused);
4078 maxabsmksetcoef = -1.0;
4081 for( i = mksetnnz - 1; i >= 0 && mksetinds[i] < firstcontvar; --i )
4083 SCIP_VAR* var = vars[mksetinds[i]];
4094 maxabsmksetcoef =
MAX(absmksetcoef, maxabsmksetcoef);
4099 bounddist[nbounddist] = MIN(ub - primsol, primsol - lb);
4100 bounddistpos[nbounddist] = i;
4101 deltacands[nbounddist] = absmksetcoef;
4106 if( nbounddist == 0 )
4110 ndeltacands = nbounddist;
4115 if( maxabsmksetcoef != -1.0 )
4117 deltacands[ndeltacands++] = maxabsmksetcoef + 1.0;
4120 deltacands[ndeltacands++] = 1.0;
4122 maxtestdelta = MIN(ndeltacands, maxtestdelta);
4154 for( i = intstart; i < mksetnnz; ++i )
4160 var = vars[mksetinds[i]];
4166 if( boundtype[i] == -1 )
4169 if( varsign[i] == -1 )
4176 assert(boundtype[i] == -2);
4179 if( varsign[i] == -1 )
4185 tmpvalues[ntmpcoefs] = solval;
4187 tmpcoefs[ntmpcoefs] = varsign[i] *
QUAD_TO_DBL(coef);
4191 assert(ntmpcoefs == mksetnnz - intstart);
4195 for( i = 0; i < intstart; ++i )
4209 switch( boundtype[i] )
4213 if( varsign[i] == -1 )
4220 if( varsign[i] == -1 )
4227 if( varsign[i] == -1 )
4237 solval = (coef * vbdsolval + constant) - solval;
4249 solval = solval - (coef * vbdsolval + constant);
4253 contactivity += solval * (
QUAD_TO_DBL(mksetcoef) * varsign[i]);
4262 for( i = 0; i < aggrrow->
nrows; ++i )
4280 slackval = row->
rhs - slackval;
4288 slackval = slackval - row->
lhs;
4294 tmpvalues[ntmpcoefs] = slackval;
4303 contactivity += slackval * slackcoeff;
4304 contsqrnorm += SQR(slackcoeff);
4313 for( i = 0; i < maxtestdelta; ++i )
4320 for( j = 0; j < i; ++j )
4322 if(
SCIPisEQ(scip, deltacands[i], deltacands[j]) )
4324 deltaseenbefore =
TRUE;
4330 if( deltaseenbefore )
4332 maxtestdelta = MIN(maxtestdelta + 1, ndeltacands);
4336 efficacy =
computeMIREfficacy(scip, tmpcoefs, tmpvalues,
QUAD_TO_DBL(mksetrhs), contactivity, contsqrnorm, deltacands[i], ntmpcoefs, minfrac, maxfrac);
4338 if( efficacy > bestefficacy )
4340 bestefficacy = efficacy;
4341 bestdelta = deltacands[i];
4350 for( i = 2; i <= 8 ; i *= 2 )
4355 delta = bestdelta / i;
4357 efficacy =
computeMIREfficacy(scip, tmpcoefs, tmpvalues,
QUAD_TO_DBL(mksetrhs), contactivity, contsqrnorm, delta, ntmpcoefs, minfrac, maxfrac);
4359 if( efficacy >= bestefficacy )
4361 bestefficacy = efficacy;
4369 for( i = 0; i < nbounddist; ++i )
4380 k = bounddistpos[i];
4402 SCIPquadprecSumQD(newrhs, mksetrhs, tmpcoefs[k - intstart] * (bestlb - bestub));
4403 tmpcoefs[k - intstart] = -tmpcoefs[k - intstart];
4405 oldsolval = tmpvalues[k - intstart];
4406 tmpvalues[k - intstart] = varsign[k] == +1 ? bestub -
SCIPgetSolVal(scip, sol, vars[mksetinds[k]]) :
SCIPgetSolVal(scip, sol, vars[mksetinds[k]]) - bestlb;
4409 newefficacy =
computeMIREfficacy(scip, tmpcoefs, tmpvalues,
QUAD_TO_DBL(newrhs), contactivity, contsqrnorm, bestdelta, ntmpcoefs, minfrac, maxfrac);
4412 if( newefficacy > bestefficacy )
4415 bestefficacy = newefficacy;
4418 if( varsign[k] == +1 )
4421 assert(bestubtype < 0);
4422 boundtype[k] = bestubtype;
4428 assert(bestlbtype < 0);
4429 boundtype[k] = bestlbtype;
4433 localbdsused = localbdsused || (boundtype[k] == -2);
4438 tmpcoefs[k - intstart] = -tmpcoefs[k - intstart];
4439 tmpvalues[k - intstart] = oldsolval;
4443 if( bestefficacy > 0.0 )
4450 scale = 1.0 / bestdelta;
4459 for( i = 0; i < mksetnnz; ++i )
4492 aggrrow->
nrows, scale, mksetcoefs, QUAD(&mksetrhs), mksetinds, &mksetnnz,
QUAD(f0)) );
4500 for( i = 0; i < mksetnnz; ++i )
4509 SCIPdebugMessage(
"efficacy of cmir cut is different than expected efficacy: %f != %f\n", efficacy, bestefficacy);
4514 *cutislocal = *cutislocal || localbdsused;
4528 SCIPdebugMessage(
"post-processed cut (success = %s):\n", *success ?
"TRUE" :
"FALSE");
4538 for( i = 0; i < mksetnnz; ++i )
4551 *cutefficacy = mirefficacy;
4552 if( cutrank != NULL )
4553 *cutrank = aggrrow->
rank + 1;
4554 *cutislocal = *cutislocal || localbdsused;
4570 for( i = 0; i < mksetnnz; ++i )
4592 #define NO_EXACT_KNAPSACK 4594 #ifndef NO_EXACT_KNAPSACK 4595 #define MAXDNOM 1000LL 4596 #define MINDELTA 1e-03 4597 #define MAXDELTA 1e-09 4598 #define MAXSCALE 1000.0 4599 #define MAXDYNPROGSPACE 1000000 4602 #define MAXABSVBCOEF 1e+5 4603 #define MAXBOUND 1e+10 4668 assert(scip != NULL);
4669 assert(var != NULL);
4673 assert(rowcoefs != NULL);
4674 assert(binvarused != NULL);
4675 assert(closestvlb != NULL);
4676 assert(closestvlbidx != NULL);
4681 *closestvlbidx = -1;
4694 for( i = 0; i < nvlbs; i++ )
4703 if( bestsub > vlbconsts[i] )
4718 if( (
unsigned int)probidxbinvar >= (
unsigned int)nbinvars )
4739 if( binvarused[probidxbinvar] == 1 )
4748 rowcoefsign = COPYSIGN(1.0, rowcoef);
4750 val2 = rowcoefsign * ((rowcoef * vlbcoefs[i]) + rowcoefbinvar);
4756 val1 = rowcoefsign * ((rowcoef * (bestsub - vlbconsts[i])) + rowcoefbinvar);
4762 vlbsol = vlbcoefs[i] *
SCIPgetSolVal(scip, sol, vlbvars[i]) + vlbconsts[i];
4763 if( vlbsol > *closestvlb )
4765 *closestvlb = vlbsol;
4768 assert(*closestvlbidx >= 0);
4799 assert(scip != NULL);
4800 assert(var != NULL);
4804 assert(rowcoefs != NULL);
4805 assert(binvarused != NULL);
4806 assert(closestvub != NULL);
4807 assert(closestvubidx != NULL);
4812 *closestvubidx = -1;
4825 for( i = 0; i < nvubs; i++ )
4834 if( bestslb < vubconsts[i] )
4849 if( (
unsigned int)probidxbinvar >= (
unsigned int)nbinvars )
4871 if( binvarused[probidxbinvar] == 1 )
4880 rowcoefsign = COPYSIGN(1.0, rowcoef);
4882 val2 = rowcoefsign * ((rowcoef * vubcoefs[i]) + rowcoefbinvar);
4888 val1 = rowcoefsign * ((rowcoef * (bestslb - vubconsts[i])) + rowcoefbinvar);
4894 vubsol = vubcoefs[i] *
SCIPgetSolVal(scip, sol, vubvars[i]) + vubconsts[i];
4895 if( vubsol < *closestvub )
4897 *closestvub = vubsol;
4900 assert(*closestvubidx >= 0);
4944 bestlbtype[varposinrow] = -3;
4945 bestubtype[varposinrow] = -3;
4947 probidx = rowinds[varposinrow];
4948 var = vars[probidx];
4962 if( bestslb[varposinrow] <= -
MAXBOUND )
4965 if( bestsub[varposinrow] >=
MAXBOUND )
4970 SCIPdebugMsg(scip,
" %d: %g <%s, idx=%d, lp=%g, [%g(%d),%g(%d)]>:\n", varposinrow, rowcoef,
SCIPvarGetName(var), probidx,
4971 solval, bestslb[varposinrow], bestslbtype[varposinrow], bestsub[varposinrow], bestsubtype[varposinrow]);
4978 *freevariable =
TRUE;
4987 bestlb[varposinrow] = bestslb[varposinrow];
4988 bestlbtype[varposinrow] = bestslbtype[varposinrow];
4995 SCIP_CALL(
getClosestVlb(scip, var, sol, rowcoefs, binvarused, bestsub[varposinrow], rowcoef, &bestvlb, &bestvlbidx) );
4996 if(
SCIPisGT(scip, bestvlb, bestlb[varposinrow]) )
4998 bestlb[varposinrow] = bestvlb;
4999 bestlbtype[varposinrow] = bestvlbidx;
5009 bestub[varposinrow] = bestsub[varposinrow];
5010 bestubtype[varposinrow] = bestsubtype[varposinrow];
5017 SCIP_CALL(
getClosestVub(scip, var, sol, rowcoefs, binvarused, bestslb[varposinrow], rowcoef, &bestvub, &bestvubidx) );
5018 if(
SCIPisLT(scip, bestvub, bestub[varposinrow]) )
5020 bestub[varposinrow] = bestvub;
5021 bestubtype[varposinrow] = bestvubidx;
5025 SCIPdebugMsg(scip,
" bestlb=%g(%d), bestub=%g(%d)\n", bestlb[varposinrow], bestlbtype[varposinrow], bestub[varposinrow], bestubtype[varposinrow]);
5032 *freevariable =
TRUE;
5036 *freevariable =
FALSE;
5042 if(
SCIPisEQ(scip, solval, (1.0 - boundswitch) * bestlb[varposinrow] + boundswitch * bestub[varposinrow]) && bestlbtype[varposinrow] >= 0 )
5046 else if(
SCIPisEQ(scip, solval, (1.0 - boundswitch) * bestlb[varposinrow] + boundswitch * bestub[varposinrow])
5047 && bestubtype[varposinrow] >= 0 )
5051 else if(
SCIPisLE(scip, solval, (1.0 - boundswitch) * bestlb[varposinrow] + boundswitch * bestub[varposinrow]) )
5057 assert(
SCIPisGT(scip, solval, (1.0 - boundswitch) * bestlb[varposinrow] + boundswitch * bestub[varposinrow]));
5070 binvarused[vlbvarprobidx] = 1;
5072 else if ( selectedbounds[varposinrow] ==
SCIP_BOUNDTYPE_UPPER && bestubtype[varposinrow] >= 0 )
5081 binvarused[vubvarprobidx] = 1;
5125 SCIPdebugMsg(scip,
"--------------------- construction of SNF relaxation ------------------------------------\n");
5146 for( i = nnz - 1; i >= 0 && rowinds[i] < nbinvars; --i )
5152 nnonbinvarsrow = i + 1;
5154 for( i = 0; i < nnonbinvarsrow; ++i )
5158 assert(rowinds[i] >= nbinvars);
5161 bestlb, bestub, bestslb, bestsub, bestlbtype, bestubtype, bestslbtype, bestsubtype, selectedbounds, &freevariable) );
5168 for( j = nnz - 1; j >= nnonbinvarsrow; --j )
5169 binvarused[rowinds[j]] = 0;
5172 for( j = 0; j < i; ++j )
5191 *localbdsused =
FALSE;
5196 for( i = 0; i < nnonbinvarsrow; ++i )
5203 probidx = rowinds[i];
5204 var = vars[probidx];
5208 assert(probidx >= nbinvars);
5216 assert(bestsubtype[i] == -1 || bestsubtype[i] == -2);
5224 if( bestlbtype[i] < 0 )
5244 if( bestlbtype[i] == -2 || bestsubtype[i] == -2 )
5245 *localbdsused =
TRUE;
5278 SCIPdebugMsg(scip,
" --> bestlb used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=1), rhs=%g-(%g*%g)=%g\n",
5306 assert(binvarused[vlbvarprobidx] == 1);
5307 assert(vlbvarprobidx < nbinvars);
5310 varsolvalbinary =
SCIPgetSolVal(scip, sol, vlbvars[bestlbtype[i]]);
5326 binvarused[vlbvarprobidx] = 0;
5358 SCIPdebugMsg(scip,
" --> bestlb used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=%s), rhs=%g-(%g*%g)=%g\n",
5361 vlbconsts[bestlbtype[i]], snf->
transrhs );
5370 assert(bestslbtype[i] == -1 || bestslbtype[i] == -2);
5378 if( bestubtype[i] < 0 )
5398 if( bestubtype[i] == -2 || bestslbtype[i] == -2 )
5399 *localbdsused =
TRUE;
5432 SCIPdebugMsg(scip,
" --> bestub used for trans: ... %s y'_%d + ..., Y'_%d <= %g x_%d (=1), rhs=%g-(%g*%g)=%g\n",
5460 assert(binvarused[vubvarprobidx] == 1);
5461 assert(vubvarprobidx < nbinvars);
5464 varsolvalbinary =
SCIPgetSolVal(scip, sol, vubvars[bestubtype[i]]);
5467 binvarused[vubvarprobidx] = 0;
5512 SCIPdebugMsg(scip,
" --> bestub used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=%s), rhs=%g-(%g*%g)=%g\n",
5529 for( i = nnonbinvarsrow; i < nnz; ++i )
5538 probidx = rowinds[i];
5540 assert(probidx < nbinvars);
5543 if( binvarused[probidx] == 0 )
5547 assert(binvarused[probidx] == -1);
5550 binvarused[probidx] = 0;
5552 var = vars[probidx];
5558 SCIPdebugMsg(scip,
" %d: %g <%s, idx=%d, lp=%g, [%g, %g]>:\n", i,
QUAD_TO_DBL(rowcoef),
SCIPvarGetName(var), probidx, varsolval,
5616 SCIPdebugMsg(scip,
"constraint in constructed 0-1 single node flow relaxation: ");
5704 assert(weights != NULL);
5705 assert(profits != NULL);
5708 assert(items != NULL);
5709 assert(nitems >= 0);
5711 if( solitems != NULL )
5716 if( solval != NULL )
5723 for( i = nitems - 1; i >= 0; --i )
5724 tempsort[i] = profits[i] / weights[i];
5727 mediancapacity = capacity * (1 -
SCIPfeastol(scip));
5736 solitemsweight = 0.0;
5737 for( j = 0; j < nitems &&
SCIPisFeasLT(scip, solitemsweight + weights[j], capacity); j++ )
5739 if( solitems != NULL )
5741 solitems[*nsolitems] = items[j];
5744 if( solval != NULL )
5745 (*solval) += profits[j];
5746 solitemsweight += weights[j];
5751 for( ; j < nitems; j++ )
5753 if(
SCIPisFeasLT(scip, solitemsweight + weights[j], capacity) )
5755 if( solitems != NULL )
5757 solitems[*nsolitems] = items[j];
5760 if( solval != NULL )
5761 (*solval) += profits[j];
5762 solitemsweight += weights[j];
5764 else if( solitems != NULL )
5766 nonsolitems[*nnonsolitems] = items[j];
5788 int* nflowcovervars,
5789 int* nnonflowcovervars,
5790 int* flowcoverstatus,
5798 assert(scip != NULL);
5799 assert(coefs != NULL);
5800 assert(vubcoefs != NULL);
5801 assert(solitems != NULL);
5802 assert(nonsolitems != NULL);
5803 assert(nsolitems >= 0);
5804 assert(nnonsolitems >= 0);
5805 assert(nflowcovervars != NULL && *nflowcovervars >= 0);
5806 assert(nnonflowcovervars != NULL && *nnonflowcovervars >= 0);
5807 assert(flowcoverstatus != NULL);
5808 assert(
QUAD_HI(flowcoverweight) != NULL);
5809 assert(lambda != NULL);
5812 for( j = 0; j < nsolitems; j++ )
5815 if( coefs[solitems[j]] == 1 )
5817 flowcoverstatus[solitems[j]] = -1;
5818 (*nnonflowcovervars)++;
5823 assert(coefs[solitems[j]] == -1);
5824 flowcoverstatus[solitems[j]] = 1;
5825 (*nflowcovervars)++;
5829 for( j = 0; j < nnonsolitems; j++ )
5832 if( coefs[nonsolitems[j]] == 1 )
5834 flowcoverstatus[nonsolitems[j]] = 1;
5835 (*nflowcovervars)++;
5836 SCIPquadprecSumQD(*flowcoverweight, *flowcoverweight, vubcoefs[nonsolitems[j]]);
5841 assert(coefs[nonsolitems[j]] == -1);
5842 flowcoverstatus[nonsolitems[j]] = -1;
5843 (*nnonflowcovervars)++;
5852 #ifndef NO_EXACT_KNAPSACK 5867 assert(mindelta <= 0.0);
5868 assert(maxdelta >= 0.0);
5870 sval = val * scalar;
5871 downval = floor(sval);
5892 assert(mindelta <= 0.0);
5893 assert(maxdelta >= 0.0);
5895 sval = val * scalar;
5914 int* nflowcovervars,
5915 int* nnonflowcovervars,
5916 int* flowcoverstatus,
5935 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 5941 int nflowcovervarsafterfix;
5944 int nnonflowcovervarsafterfix;
5949 assert(scip != NULL);
5954 assert(nflowcovervars != NULL);
5955 assert(nnonflowcovervars != NULL);
5956 assert(flowcoverstatus != NULL);
5957 assert(lambda != NULL);
5958 assert(found != NULL);
5960 SCIPdebugMsg(scip,
"--------------------- get flow cover ----------------------------------------------------\n");
5974 *nflowcovervars = 0;
5975 *nnonflowcovervars = 0;
5978 nflowcovervarsafterfix = 0;
5979 nnonflowcovervarsafterfix = 0;
5981 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 5992 SCIPdebugMsg(scip,
"0. Fix some variables in advance:\n");
5995 n1itemsweight = 0.0;
6006 flowcoverstatus[j] = -1;
6007 (*nnonflowcovervars)++;
6027 flowcoverstatus[j] = -1;
6028 (*nnonflowcovervars)++;
6034 flowcoverstatus[j] = 1;
6035 (*nflowcovervars)++;
6042 flowcoverstatus[j] = 1;
6043 (*nflowcovervars)++;
6051 flowcoverstatus[j] = -1;
6052 (*nnonflowcovervars)++;
6056 assert((*nflowcovervars) + (*nnonflowcovervars) + nitems == snf->
ntransvars);
6057 assert(nn1items >= 0);
6087 SCIPdebugMsg(scip,
"1. Transform KP^SNF to KP^SNF_rat:\n");
6090 transweightsrealintegral =
TRUE;
6091 for( j = 0; j < nitems; j++ )
6096 transweightsrealintegral =
FALSE;
6101 SCIPdebugMsg(scip,
" <%d>: j in N1: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
6102 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
6107 SCIPdebugMsg(scip,
" <%d>: j in N2: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
6108 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
6113 SCIPdebugMsg(scip,
" transcapacity = -rhs(%g) + flowcoverweight(%g) + n1itemsweight(%g) = %g\n",
6126 assert(nitems >= 0);
6142 if( transweightsrealintegral )
6146 scalesuccess =
TRUE;
6150 scalesuccess =
FALSE;
6166 for( j = 0; j < nitems; ++j )
6168 transweightsint[j] = getIntegralVal(transweightsreal[j], scalar, -MINDELTA, MAXDELTA);
6169 transprofitsint[j] = transprofitsreal[j];
6170 itemsint[j] = items[j];
6174 transcapacityint = getIntegralVal(transcapacityreal, scalar, -MINDELTA, MAXDELTA);
6175 transcapacityint -= 1;
6178 transcapacityint = (
SCIP_Longint) (transcapacityreal * scalar);
6179 nflowcovervarsafterfix = *nflowcovervars;
6180 nnonflowcovervarsafterfix = *nnonflowcovervars;
6184 tmp2 = (
SCIP_Real) ((transcapacityint) + 1);
6185 if( transcapacityint * nitems <= MAXDYNPROGSPACE && tmp1 * tmp2 <= INT_MAX / 8.0)
6191 itemsint, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL, &success));
6197 transcapacityreal, items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6199 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 6208 items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6216 items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6220 assert(nsolitems != -1);
6221 assert(nnonsolitems != -1);
6224 assert(*nflowcovervars + *nnonflowcovervars + nsolitems + nnonsolitems == snf->
ntransvars);
6226 nnonflowcovervars, flowcoverstatus, QUAD(&flowcoverweight), lambda);
6227 assert(*nflowcovervars + *nnonflowcovervars == snf->
ntransvars);
6236 items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6242 *nflowcovervars = nflowcovervarsafterfix;
6243 *nnonflowcovervars = nnonflowcovervarsafterfix;
6246 assert(*nflowcovervars + *nnonflowcovervars + nsolitems + nnonsolitems == snf->
ntransvars);
6248 nnonflowcovervars, flowcoverstatus, QUAD(&flowcoverweight), lambda);
6249 assert(*nflowcovervars + *nnonflowcovervars == snf->
ntransvars);
6258 SCIPdebugMsg(scip,
"2. %s solution:\n", kpexact ?
"exact" :
"approximate");
6265 else if( snf->
transvarcoefs[j] == -1 && flowcoverstatus[j] == 1 )
6298 int* nflowcovervars,
6299 int* nnonflowcovervars,
6300 int* flowcoverstatus,
6322 assert(scip != NULL);
6327 assert(nflowcovervars != NULL);
6328 assert(nnonflowcovervars != NULL);
6329 assert(flowcoverstatus != NULL);
6330 assert(lambda != NULL);
6331 assert(found != NULL);
6333 SCIPdebugMsg(scip,
"--------------------- get flow cover ----------------------------------------------------\n");
6346 *nflowcovervars = 0;
6347 *nnonflowcovervars = 0;
6358 SCIPdebugMsg(scip,
"0. Fix some variables in advance:\n");
6361 n1itemsweight = 0.0;
6372 flowcoverstatus[j] = -1;
6373 (*nnonflowcovervars)++;
6393 flowcoverstatus[j] = -1;
6394 (*nnonflowcovervars)++;
6400 flowcoverstatus[j] = 1;
6401 (*nflowcovervars)++;
6408 flowcoverstatus[j] = 1;
6409 (*nflowcovervars)++;
6417 flowcoverstatus[j] = -1;
6418 (*nnonflowcovervars)++;
6422 assert((*nflowcovervars) + (*nnonflowcovervars) + nitems == snf->
ntransvars);
6423 assert(nn1items >= 0);
6453 SCIPdebugMsg(scip,
"1. Transform KP^SNF to KP^SNF_rat:\n");
6456 for( j = 0; j < nitems; j++ )
6463 SCIPdebugMsg(scip,
" <%d>: j in N1: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
6464 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
6469 SCIPdebugMsg(scip,
" <%d>: j in N2: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
6470 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
6475 SCIPdebugMsg(scip,
" transcapacity = -rhs(%g) + flowcoverweight(%g) + n1itemsweight(%g) = %g\n",
6488 assert(nitems >= 0);
6507 items, solitems, nonsolitems, &nsolitems, &nnonsolitems, NULL));
6509 assert(nsolitems != -1);
6510 assert(nnonsolitems != -1);
6513 assert(*nflowcovervars + *nnonflowcovervars + nsolitems + nnonsolitems == snf->
ntransvars);
6515 nnonflowcovervars, flowcoverstatus, QUAD(&flowcoverweight), lambda);
6516 assert(*nflowcovervars + *nnonflowcovervars == snf->
ntransvars);
6532 else if( snf->
transvarcoefs[j] == -1 && flowcoverstatus[j] == 1 )
6569 xpluslambda = x + liftingdata->
lambda;
6572 while( i < liftingdata->
r &&
SCIPisGT(scip, xpluslambda, liftingdata->
M[i+1]) )
6575 if( i < liftingdata->
t )
6577 if(
SCIPisLE(scip, liftingdata->
M[i], x) )
6579 assert(
SCIPisLE(scip, xpluslambda, liftingdata->
M[i+1]));
6580 return i * liftingdata->
lambda;
6583 assert(i > 0 &&
SCIPisLE(scip, liftingdata->
M[i], xpluslambda) && x <= liftingdata->
M[i]);
6592 if( i < liftingdata->
r )
6611 return i * liftingdata->
lambda;
6613 assert(
SCIPisFeasLE(scip, liftingdata->
M[i], xpluslambda) &&
6615 MAX(0.0, liftingdata->
m[i] - (liftingdata->
mp - liftingdata->
lambda) - liftingdata->
ml)));
6623 assert(i == liftingdata->
r &&
SCIPisLE(scip, liftingdata->
M[liftingdata->
r], xpluslambda));
6652 vubcoefpluslambda = vubcoef + liftingdata->
lambda;
6655 while( i < liftingdata->
r &&
SCIPisGT(scip, vubcoefpluslambda, liftingdata->
M[i+1]) )
6658 if(
SCIPisLT(scip, vubcoef, liftingdata->
M[i]) )
6661 assert(liftingdata->
M[i] < vubcoefpluslambda);
6670 assert(i == liftingdata->
r ||
SCIPisLE(scip, vubcoefpluslambda, liftingdata->
M[i+1]));
6681 int* transvarflowcoverstatus,
6708 int s = (snf->
transvarcoefs[i] + 1) + (transvarflowcoverstatus[i] + 1)/2;
6714 assert(snf->
transvarcoefs[i] == -1 && transvarflowcoverstatus[i] == -1);
6728 assert(snf->
transvarcoefs[i] == -1 && transvarflowcoverstatus[i] == 1);
6733 assert(snf->
transvarcoefs[i] == 1 && transvarflowcoverstatus[i] == 1);
6774 for( i = 0; i < liftingdata->
r; ++i)
6783 assert(liftingdata->
m[liftingdata->
t] == liftingdata->
mp ||
SCIPisInfinity(scip, liftingdata->
mp));
6789 while( liftingdata->
t < liftingdata->
r && liftingdata->
m[liftingdata->
t] == liftingdata->
mp )
6816 int* flowcoverstatus,
6839 int s = (snf->
transvarcoefs[i] + 1) + (flowcoverstatus[i] + 1)/2;
6884 assert(snf->
transvarcoefs[i] == -1 && flowcoverstatus[i] == 1);
6890 if( liftedbincoef != 0.0 )
6905 assert(snf->
transvarcoefs[i] == 1 && flowcoverstatus[i] == -1);
6908 assert(alpha == 0 || alpha == 1);
6995 for( i = 0; i < aggrrow->
nrows; ++i )
7004 assert(slackcoef != 0.0);
7007 if( slackcoef > 0.0 )
7025 slackub = rowrhs - rowlhs;
7038 slackub = -aggrrow->
rowweights[i] * MIN(rhsslack, slackub);
7040 if(
SCIPisGE(scip, slackub, lambda) )
7052 slackub = aggrrow->
rowweights[i] * MIN(lhsslack, slackub);
7054 if(
SCIPisGE(scip, slackub, lambda) )
7065 if( *cutrhs < 0.0 && *cutrhs >=
SCIPepsilon(scip) )
7110 int *transvarflowcoverstatus;
7112 int nnonflowcovervars;
7124 SCIP_CALL(
constructSNFRelaxation(scip, sol, boundswitch, allowlocal, aggrrow->
vals,
QUAD(aggrrow->rhs), aggrrow->
inds, aggrrow->
nnz, &snf, success, &localbdsused) );
7131 *cutislocal = aggrrow->
local || localbdsused;
7135 SCIP_CALL(
getFlowCover(scip, &snf, &nflowcovervars, &nnonflowcovervars, transvarflowcoverstatus, &lambda, success) );
7166 for( i = 0; i < *cutnnz; ++i )
7169 assert(tmpcoefs[j] != 0.0);
7170 cutcoefs[i] = tmpcoefs[j];
7174 if( cutefficacy != NULL )
7175 *cutefficacy =
calcEfficacy(scip, sol, cutcoefs, *cutrhs, cutinds, *cutnnz);
7177 if( cutrank != NULL )
7178 *cutrank = aggrrow->
rank + 1;
7183 for( i = 0; i < *cutnnz; ++i )
7186 assert(tmpcoefs[j] != 0.0);
7251 int aggrrowintstart;
7256 assert(varsign != NULL);
7257 assert(boundtype != NULL);
7258 assert(freevariable != NULL);
7259 assert(localbdsused != NULL);
7261 *freevariable =
FALSE;
7262 *localbdsused =
FALSE;
7278 for( i = 0; i < *nnz && cutinds[i] >= firstcontvar; ++i )
7288 SCIP_CALL(
findBestLb(scip, vars[v], sol, usevbds, allowlocal, bestbds + i, boundtype + i) );
7293 *freevariable =
TRUE;
7302 SCIP_CALL(
findBestUb(scip, vars[cutinds[i]], sol, usevbds, allowlocal, bestbds + i, boundtype + i) );
7307 *freevariable =
TRUE;
7316 aggrrowintstart = i;
7319 for( i = 0; i < aggrrowintstart; ++i )
7330 if( boundtype[i] < 0 )
7334 *localbdsused = *localbdsused || (boundtype[i] == -2);
7344 if( varsign[i] == +1 )
7359 assert(vbdvars != NULL);
7360 assert(vbdcoefs != NULL);
7361 assert(vbdconsts != NULL);
7365 assert(0 <= zidx && zidx < firstcontvar);
7374 cutinds[(*nnz)++] = zidx;
7380 assert(
QUAD_HI(zcoef) != 0.0);
7386 assert(i == aggrrowintstart);
7402 assert(v < firstcontvar);
7411 cutinds[i] = cutinds[*nnz];
7418 SCIP_CALL(
determineBestBounds(scip, vars[v], sol, boundswitch,
FALSE, allowlocal,
FALSE,
FALSE, NULL, NULL,
7419 &bestlb, &bestub, &bestlbtype, &bestubtype, &selectedbound, freevariable) );
7430 boundtype[i] = bestlbtype;
7438 boundtype[i] = bestubtype;
7444 assert(boundtype[i] == -1 || boundtype[i] == -2);
7445 *localbdsused = *localbdsused || (boundtype[i] == -2);
7532 int aggrrowintstart;
7534 assert(
QUAD_HI(cutrhs) != NULL);
7535 assert(cutcoefs != NULL);
7536 assert(cutinds != NULL);
7537 assert(nnz != NULL);
7538 assert(boundtype != NULL);
7539 assert(varsign != NULL);
7555 while( i < *nnz && cutinds[i] >= firstcontvar )
7560 assert(cutinds[i] < firstcontvar);
7566 for( i = *nnz - 1; i >= 0 && cutinds[i] < firstcontvar; --i )
7579 assert(var != NULL);
7581 assert(boundtype[i] == -1 || boundtype[i] == -2);
7582 assert(varsign[i] == +1 || varsign[i] == -1);
7615 cutinds[i] = cutinds[*nnz];
7622 assert(boundtype[i] < 0);
7625 if( varsign[i] == +1 )
7630 if( boundtype[i] == -1 )
7648 if( boundtype[i] == -1 )
7664 aggrrowintstart = i + 1;
7668 for( i = 0; i < aggrrowintstart; ++i )
7680 assert(var != NULL);
7683 assert(varsign[i] == +1 || varsign[i] == -1);
7695 if( aggrrowintstart > 0 )
7698 assert(aggrrowintstart <= *nnz);
7702 for( i = 0; i < aggrrowintstart; ++i )
7707 *nnz -= aggrrowintstart;
7708 if( *nnz < aggrrowintstart )
7758 assert(scip != NULL);
7759 assert(weights != NULL);
7760 assert(slacksign != NULL);
7761 assert(rowinds != NULL);
7763 assert(cutcoefs != NULL);
7764 assert(
QUAD_HI(cutrhs) != NULL);
7765 assert(cutinds != NULL);
7766 assert(nnz != NULL);
7773 for( i = 0; i < nrowinds; i++ )
7786 assert(slacksign[i] == -1 || slacksign[i] == +1);
7790 assert(row != NULL);
7791 assert(row->
len == 0 || row->
cols != NULL);
7793 assert(row->
len == 0 || row->
vals != NULL);
7840 if( slacksign[i] == +1 )
7928 assert(scip != NULL);
7929 assert(aggrrow != NULL);
7931 assert(cutcoefs != NULL);
7932 assert(cutrhs != NULL);
7933 assert(cutinds != NULL);
7934 assert(success != NULL);
7935 assert(cutislocal != NULL);
7948 *cutnnz = aggrrow->
nnz;
7949 *cutislocal = aggrrow->
local;
7956 for( i = 0; i < *cutnnz; ++i )
7986 tmpcoefs,
QUAD(&rhs), cutinds, cutnnz, varsign, boundtype, &freevariable, &localbdsused) );
7988 assert(allowlocal || !localbdsused);
7989 *cutislocal = *cutislocal || localbdsused;
8065 aggrrow->
nrows, scale, tmpcoefs, QUAD(&rhs), cutinds, cutnnz,
QUAD(f0), k) );
8086 for( i = 0; i < *cutnnz; ++i )
8099 if( cutefficacy != NULL )
8100 *cutefficacy =
calcEfficacy(scip, sol, cutcoefs, *cutrhs, cutinds, *cutnnz);
8102 if( cutrank != NULL )
8103 *cutrank = aggrrow->
rank + 1;
8113 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)