32 #define SEPA_NAME "flowcover" 33 #define SEPA_DESC "flow cover cuts separator (c-MIR approach)" 34 #define SEPA_PRIORITY -4000 36 #define SEPA_MAXBOUNDDIST 0.0 37 #define SEPA_USESSUBSCIP FALSE 38 #define SEPA_DELAY FALSE 40 #define DEFAULT_MAXROUNDS 5 41 #define DEFAULT_MAXROUNDSROOT 15 42 #define DEFAULT_MAXTRIES 100 44 #define DEFAULT_MAXTRIESROOT -1 46 #define DEFAULT_MAXFAILS 50 48 #define DEFAULT_MAXFAILSROOT 100 50 #define DEFAULT_MAXSEPACUTS 100 51 #define DEFAULT_MAXSEPACUTSROOT 200 52 #define DEFAULT_MAXSLACK SCIP_REAL_MAX 53 #define DEFAULT_MAXSLACKROOT SCIP_REAL_MAX 54 #define DEFAULT_SLACKSCORE 1e-03 55 #define DEFAULT_MAXROWDENSITY 1.0 56 #define DEFAULT_DYNAMICCUTS TRUE 57 #define DEFAULT_MAXTESTDELTA 10 58 #define DEFAULT_MULTBYMINUSONE TRUE 60 #define BOUNDSWITCH 0.5 61 #define ALLOWLOCAL TRUE 62 #define DENSSCORE 1e-04 66 #define FIXINTEGRALRHS FALSE 67 #define MAXDNOM 1000LL 68 #define MINDELTA 1e-03 69 #define MAXDELTA 1e-09 70 #define MAXSCALE 1000.0 71 #define MAXDYNPROGSPACE 1000000 73 #define MAXAGGRLEN(nvars) (0.1*(nvars)+1000) 74 #define MAXABSVBCOEF 1e+5 75 #define MAXBOUND 1e+10 131 assert(scip !=
NULL);
136 assert(rowcoefsbinary !=
NULL);
137 assert(varsolvals !=
NULL);
138 assert(assoctransvars !=
NULL);
139 assert(closestvlb !=
NULL);
140 assert(closestvlbidx !=
NULL);
157 for( i = 0; i < nvlbs; i++ )
185 rowcoefbinvar = rowcoefsbinary[probidxbinvar];
187 val1 = ( rowcoef * ( bestsub - vlbconsts[i] ) ) + rowcoefbinvar;
188 val2 = ( rowcoef * vlbcoefs[i] ) + rowcoefbinvar;
190 meetscriteria =
FALSE;
193 if( assoctransvars[probidxbinvar] == -1 &&
SCIPisFeasLE(scip, bestsub, vlbconsts[i])
195 meetscriteria =
TRUE;
200 if( assoctransvars[probidxbinvar] == -1 &&
SCIPisFeasLE(scip, bestsub, vlbconsts[i])
202 meetscriteria =
TRUE;
215 vlbsol = (vlbcoefs[i] * varsolvals[probidxbinvar]) + vlbconsts[i];
216 if(
SCIPisGT(scip, vlbsol, *closestvlb) )
218 *closestvlb = vlbsol;
221 assert(*closestvlbidx >= 0);
249 assert(scip !=
NULL);
254 assert(rowcoefsbinary !=
NULL);
255 assert(varsolvals !=
NULL);
256 assert(assoctransvars !=
NULL);
257 assert(closestvub !=
NULL);
258 assert(closestvubidx !=
NULL);
275 for( i = 0; i < nvubs; i++ )
303 rowcoefbinvar = rowcoefsbinary[probidxbinvar];
305 val1 = ( rowcoef * ( bestslb - vubconsts[i] ) ) + rowcoefbinvar;
306 val2 = ( rowcoef * vubcoefs[i] ) + rowcoefbinvar;
308 meetscriteria =
FALSE;
311 if( assoctransvars[probidxbinvar] == -1 &&
SCIPisFeasGE(scip, bestslb, vubconsts[i])
313 meetscriteria =
TRUE;
318 if( assoctransvars[probidxbinvar] == -1 &&
SCIPisFeasGE(scip, bestslb, vubconsts[i])
320 meetscriteria =
TRUE;
333 vubsol = vubcoefs[i] * varsolvals[probidxbinvar] + vubconsts[i];
334 if(
SCIPisLT(scip, vubsol, *closestvub) )
336 *closestvub = vubsol;
339 assert(*closestvubidx >= 0);
356 assert(closestlb !=
NULL);
357 assert(closestlbtype !=
NULL);
365 if(
SCIPisGT(scip, loclb, *closestlb) )
389 assert(closestub !=
NULL);
390 assert(closestubtype !=
NULL);
398 if(
SCIPisLT(scip, locub, *closestub) )
445 int* nonzcolsnonbinary;
448 int nnonzcolsnonbinary;
451 assert(scip !=
NULL);
454 assert(varsolvals !=
NULL);
456 assert(rowweight == 1.0 || rowweight == -1.0);
459 assert(scale == 1.0 || scale == -1.0);
460 assert(boundsfortrans !=
NULL);
461 assert(boundtypesfortrans !=
NULL);
462 assert(assoctransvars !=
NULL);
463 assert(transvarcoefs !=
NULL);
464 assert(transbinvarsolvals !=
NULL);
465 assert(transcontvarsolvals !=
NULL);
466 assert(transvarvubcoefs !=
NULL);
467 assert(ntransvars !=
NULL);
468 assert(transrhs !=
NULL);
469 assert(success !=
NULL);
473 SCIPdebugMsg(scip,
"--------------------- construction of SNF relaxation ------------------------------------\n");
490 nnonzcolsnonbinary = 0;
492 for( c = 0; c < nnonzcols; c++ )
505 nonzcolsbinary[nnonzcolsbinary] = c;
515 nonzcolsnonbinary[nnonzcolsnonbinary] = c;
516 nnonzcolsnonbinary++;
519 assert(nnonzcolsbinary + nnonzcolsnonbinary == nnonzcols);
522 for( c = 0; c < nvars; c++ )
524 assoctransvars[c] = -1;
525 boundsfortrans[c] = -3;
534 assert(rowweight == -1.0 && scale == -1.0);
559 SCIPdebugMsg(scip,
"transformation for NONBINARY variables (nnonbinvars=%d):\n", nnonzcolsnonbinary);
562 for( c = 0; c < nnonzcolsnonbinary; c++ )
584 rowcoef = rowweight * scale * nonzcoefs[nonzcolsnonbinary[c]];
586 assert(assoctransvars[probidx] == -1);
587 assert(boundsfortrans[probidx] == -3);
594 SCIPdebugMsg(scip,
" %d: %g <%s, idx=%d, lp=%g, [%g(%d),%g(%d)]>:\n", c, rowcoef,
SCIPvarGetName(var), probidx,
595 varsolvals[probidx], bestslb, bestslbtype, bestsub, bestsubtype);
612 bestlbtype = bestslbtype;
619 SCIP_CALL(
getClosestVlb(scip, var, bestsub, rowcoef, rowcoefsbinary, varsolvals, assoctransvars, &bestvlb, &bestvlbidx) );
620 if(
SCIPisGT(scip, bestvlb, bestlb) )
623 bestlbtype = bestvlbidx;
633 bestubtype = bestsubtype;
640 SCIP_CALL(
getClosestVub(scip, var, bestslb, rowcoef, rowcoefsbinary, varsolvals, assoctransvars, &bestvub, &bestvubidx) );
641 if(
SCIPisLT(scip, bestvub, bestub) )
644 bestubtype = bestvubidx;
648 SCIPdebugMsg(scip,
" bestlb=%g(%d), bestub=%g(%d)\n", bestlb, bestlbtype, bestub, bestubtype);
681 assert(bestsubtype == -1 || bestsubtype == -2);
687 boundsfortrans[probidx] = bestlbtype;
689 assoctransvars[probidx] = *ntransvars;
705 val = rowcoef * ( bestsub - bestlb );
706 contsolval = rowcoef * ( varsolvals[probidx] - bestsub );
709 transvarcoefs[*ntransvars] = - 1;
710 transvarvubcoefs[*ntransvars] = val;
711 transbinvarsolvals[*ntransvars] = 1.0;
712 transcontvarsolvals[*ntransvars] = - contsolval;
717 transvarcoefs[*ntransvars] = 1;
718 transvarvubcoefs[*ntransvars] = - val;
719 transbinvarsolvals[*ntransvars] = 1.0;
720 transcontvarsolvals[*ntransvars] = contsolval;
722 (*transrhs) -= (rowcoef * bestsub);
724 SCIPdebugMsg(scip,
" --> bestlb used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=1), rhs=%g-(%g*%g)=%g\n",
725 transvarcoefs[*ntransvars] == 1 ?
"+" :
"-", *ntransvars, *ntransvars, transvarvubcoefs[*ntransvars],
726 *ntransvars, *transrhs + (rowcoef * bestsub), rowcoef, bestsub, *transrhs);
752 val = (rowcoef * vlbcoefs[bestlbtype]) + rowcoefbinary;
753 contsolval = (rowcoef * (varsolvals[probidx] - vlbconsts[bestlbtype])) + (rowcoefbinary * varsolvalbinary);
757 transvarcoefs[*ntransvars] = - 1;
758 transvarvubcoefs[*ntransvars] = - val;
759 transbinvarsolvals[*ntransvars] = varsolvalbinary;
760 transcontvarsolvals[*ntransvars] = - contsolval;
765 transvarcoefs[*ntransvars] = 1;
766 transvarvubcoefs[*ntransvars] = val;
767 transbinvarsolvals[*ntransvars] = varsolvalbinary;
768 transcontvarsolvals[*ntransvars] = contsolval;
770 (*transrhs) -= (rowcoef * vlbconsts[bestlbtype]);
775 SCIPdebugMsg(scip,
" --> bestlb used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=%s), rhs=%g-(%g*%g)=%g\n",
776 transvarcoefs[*ntransvars] == 1 ?
"+" :
"-", *ntransvars, *ntransvars, transvarvubcoefs[*ntransvars],
777 *ntransvars,
SCIPvarGetName(vlbvars[bestlbtype]), *transrhs + (rowcoef * vlbconsts[bestlbtype]), rowcoef,
778 vlbconsts[bestlbtype], *transrhs );
787 assert(bestslbtype == -1 || bestslbtype == -2);
793 boundsfortrans[probidx] = bestubtype;
795 assoctransvars[probidx] = *ntransvars;
811 val = rowcoef * ( bestub - bestslb );
812 contsolval = rowcoef * ( varsolvals[probidx] - bestslb );
815 transvarcoefs[*ntransvars] = 1;
816 transvarvubcoefs[*ntransvars] = val;
817 transbinvarsolvals[*ntransvars] = 1.0;
818 transcontvarsolvals[*ntransvars] = contsolval;
823 transvarcoefs[*ntransvars] = - 1;
824 transvarvubcoefs[*ntransvars] = - val;
825 transbinvarsolvals[*ntransvars] = 1.0;
826 transcontvarsolvals[*ntransvars] = - contsolval;
828 (*transrhs) -= (rowcoef * bestslb);
830 SCIPdebugMsg(scip,
" --> bestub used for trans: ... %s y'_%d + ..., Y'_%d <= %g x_%d (=1), rhs=%g-(%g*%g)=%g\n",
831 transvarcoefs[*ntransvars] == 1 ?
"+" :
"-", *ntransvars, *ntransvars, transvarvubcoefs[*ntransvars],
832 *ntransvars, *transrhs + (rowcoef * bestslb), rowcoef, bestslb, *transrhs);
859 val = ( rowcoef * vubcoefs[bestubtype] ) + rowcoefbinary;
860 contsolval = (rowcoef * (varsolvals[probidx] - vubconsts[bestubtype])) + (rowcoefbinary * varsolvalbinary);
864 transvarcoefs[*ntransvars] = 1;
865 transvarvubcoefs[*ntransvars] = val;
866 transbinvarsolvals[*ntransvars] = varsolvalbinary;
867 transcontvarsolvals[*ntransvars] = contsolval;
872 transvarcoefs[*ntransvars] = - 1;
873 transvarvubcoefs[*ntransvars] = - val;
874 transbinvarsolvals[*ntransvars] = varsolvalbinary;
875 transcontvarsolvals[*ntransvars] = - contsolval;
877 (*transrhs) -= (rowcoef * vubconsts[bestubtype]);
882 SCIPdebugMsg(scip,
" --> bestub used for trans: ... %s y'_%d + ..., y'_%d <= %g x_%d (=%s), rhs=%g-(%g*%g)=%g\n",
883 transvarcoefs[*ntransvars] == 1 ?
"+" :
"-", *ntransvars, *ntransvars, transvarvubcoefs[*ntransvars],
884 *ntransvars,
SCIPvarGetName(vubvars[bestubtype]), *transrhs + (rowcoef * vubconsts[bestubtype]), rowcoef,
885 vubconsts[bestubtype], *transrhs);
899 assert(boundsfortrans[probidx] > -3);
900 assert(assoctransvars[probidx] >= 0 && assoctransvars[probidx] == (*ntransvars));
901 assert(transvarcoefs[*ntransvars] == 1 || transvarcoefs[*ntransvars] == - 1 );
902 assert(
SCIPisFeasGE(scip, transbinvarsolvals[*ntransvars], 0.0)
903 &&
SCIPisFeasLE(scip, transbinvarsolvals[*ntransvars], 1.0));
904 assert(
SCIPisFeasGE(scip, transvarvubcoefs[*ntransvars], 0.0)
910 assert(*ntransvars == nnonzcolsnonbinary);
912 SCIPdebugMsg(scip,
"transformation for BINARY variables (nbinvars=%d):\n", nnonzcolsbinary);
915 for( c = 0; c < nnonzcolsbinary; c++ )
925 rowcoef = rowweight * scale * nonzcoefs[nonzcolsbinary[c]];
927 assert(rowcoefsbinary[probidx] == rowcoef);
930 SCIPdebugMsg(scip,
" %d: %g <%s, idx=%d, lp=%g, [%g, %g]>:\n", c, rowcoef,
SCIPvarGetName(var), probidx, varsolvals[probidx],
934 if( assoctransvars[probidx] > -1 )
936 assert(assoctransvars[probidx] >= 0 && assoctransvars[probidx] <= nnonzcolsnonbinary);
937 assert(boundsfortrans[probidx] == -3);
942 assert(assoctransvars[probidx] == -1);
943 assert(boundsfortrans[probidx] == -3);
946 assoctransvars[probidx] = *ntransvars;
956 contsolval = rowcoef * varsolvals[probidx];
959 transvarcoefs[*ntransvars] = 1;
960 transvarvubcoefs[*ntransvars] = val;
961 transbinvarsolvals[*ntransvars] = varsolvals[probidx];
962 transcontvarsolvals[*ntransvars] = contsolval;
967 transvarcoefs[*ntransvars] = - 1;
968 transvarvubcoefs[*ntransvars] = - val;
969 transbinvarsolvals[*ntransvars] = varsolvals[probidx];
970 transcontvarsolvals[*ntransvars] = - contsolval;
972 assert(assoctransvars[probidx] >= 0 && assoctransvars[probidx] == (*ntransvars));
973 assert(transvarcoefs[*ntransvars] == 1 || transvarcoefs[*ntransvars] == - 1 );
974 assert(
SCIPisFeasGE(scip, transbinvarsolvals[*ntransvars], 0.0)
975 &&
SCIPisFeasLE(scip, transbinvarsolvals[*ntransvars], 1.0));
976 assert(
SCIPisFeasGE(scip, transvarvubcoefs[*ntransvars], 0.0)
979 SCIPdebugMsg(scip,
" --> ... %s y'_%d + ..., y'_%d <= %g x_%d (=%s))\n", transvarcoefs[*ntransvars] == 1 ?
"+" :
"-", *ntransvars, *ntransvars,
980 transvarvubcoefs[*ntransvars], *ntransvars,
SCIPvarGetName(var) );
985 assert(*ntransvars >= nnonzcolsnonbinary && *ntransvars <= nnonzcols);
991 SCIPdebugMsg(scip,
"constraint in constructed 0-1 single node flow relaxation: ");
992 for( c = 0; c < *ntransvars; c++ )
1033 assert(weights !=
NULL);
1034 assert(profits !=
NULL);
1037 assert(items !=
NULL);
1038 assert(nitems >= 0);
1040 if( solitems !=
NULL )
1045 if( solval !=
NULL )
1052 for( i = nitems - 1; i >= 0; --i )
1053 tempsort[i] = profits[i] / weights[i];
1056 mediancapacity = capacity * (1 -
SCIPfeastol(scip));
1065 solitemsweight = 0.0;
1066 for( j = 0; j < nitems &&
SCIPisFeasLT(scip, solitemsweight + weights[j], capacity); j++ )
1068 if( solitems !=
NULL )
1070 solitems[*nsolitems] = items[j];
1073 if( solval !=
NULL )
1074 (*solval) += profits[j];
1075 solitemsweight += weights[j];
1080 for( ; j < nitems; j++ )
1082 if(
SCIPisFeasLT(scip, solitemsweight + weights[j], capacity) )
1084 if( solitems !=
NULL )
1086 solitems[*nsolitems] = items[j];
1089 if( solval !=
NULL )
1090 (*solval) += profits[j];
1091 solitemsweight += weights[j];
1093 else if( solitems !=
NULL )
1095 nonsolitems[*nnonsolitems] = items[j];
1116 assert(mindelta <= 0.0);
1117 assert(maxdelta >= 0.0);
1119 sval = val * scalar;
1120 downval = floor(sval);
1141 assert(mindelta <= 0.0);
1142 assert(maxdelta >= 0.0);
1144 sval = val * scalar;
1168 int* nflowcovervars,
1169 int* nnonflowcovervars,
1170 int* flowcoverstatus,
1177 assert(scip !=
NULL);
1178 assert(coefs !=
NULL);
1179 assert(vubcoefs !=
NULL);
1180 assert(solitems !=
NULL);
1181 assert(nonsolitems !=
NULL);
1182 assert(nsolitems >= 0);
1183 assert(nnonsolitems >= 0);
1184 assert(nflowcovervars !=
NULL && *nflowcovervars >= 0);
1185 assert(nnonflowcovervars !=
NULL && *nnonflowcovervars >= 0);
1186 assert(flowcoverstatus !=
NULL);
1187 assert(flowcoverweight !=
NULL);
1188 assert(lambda !=
NULL);
1191 for( j = 0; j < nsolitems; j++ )
1194 if( coefs[solitems[j]] == 1 )
1196 flowcoverstatus[solitems[j]] = -1;
1197 (*nnonflowcovervars)++;
1202 assert(coefs[solitems[j]] == -1);
1203 flowcoverstatus[solitems[j]] = 1;
1204 (*nflowcovervars)++;
1205 (*flowcoverweight) -= vubcoefs[solitems[j]];
1208 for( j = 0; j < nnonsolitems; j++ )
1211 if( coefs[nonsolitems[j]] == 1 )
1213 flowcoverstatus[nonsolitems[j]] = 1;
1214 (*nflowcovervars)++;
1215 (*flowcoverweight) += vubcoefs[nonsolitems[j]];
1220 assert(coefs[nonsolitems[j]] == -1);
1221 flowcoverstatus[nonsolitems[j]] = -1;
1222 (*nnonflowcovervars)++;
1227 *lambda = (*flowcoverweight) - rhs;
1242 int* nflowcovervars,
1243 int* nnonflowcovervars,
1244 int* flowcoverstatus,
1263 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 1269 int nflowcovervarsafterfix;
1272 int nnonflowcovervarsafterfix;
1277 assert(scip !=
NULL);
1278 assert(coefs !=
NULL);
1279 assert(solvals !=
NULL);
1280 assert(vubcoefs !=
NULL);
1282 assert(nflowcovervars !=
NULL);
1283 assert(nnonflowcovervars !=
NULL);
1284 assert(flowcoverstatus !=
NULL);
1285 assert(lambda !=
NULL);
1286 assert(found !=
NULL);
1288 SCIPdebugMsg(scip,
"--------------------- get flow cover ----------------------------------------------------\n");
1302 *nflowcovervars = 0;
1303 *nnonflowcovervars = 0;
1304 flowcoverweight = 0.0;
1305 nflowcovervarsafterfix = 0;
1306 nnonflowcovervarsafterfix = 0;
1307 flowcoverweightafterfix = 0.0;
1308 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 1319 SCIPdebugMsg(scip,
"0. Fix some variables in advance:\n");
1322 n1itemsweight = 0.0;
1324 for( j = 0; j < nvars; j++ )
1326 assert(coefs[j] == 1 || coefs[j] == -1);
1333 flowcoverstatus[j] = -1;
1334 (*nnonflowcovervars)++;
1345 n1itemsweight += vubcoefs[j];
1349 n2itemsminweight =
MIN(n2itemsminweight, vubcoefs[j]);
1352 else if( coefs[j] == 1 && solvals[j] < 0.5 )
1354 flowcoverstatus[j] = -1;
1355 (*nnonflowcovervars)++;
1359 else if( coefs[j] == 1 && solvals[j] > 0.5 )
1361 flowcoverstatus[j] = 1;
1362 (*nflowcovervars)++;
1363 flowcoverweight += vubcoefs[j];
1367 else if( coefs[j] == -1 && solvals[j] > 0.5 )
1369 flowcoverstatus[j] = 1;
1370 (*nflowcovervars)++;
1371 flowcoverweight -= vubcoefs[j];
1377 assert(coefs[j] == -1 && solvals[j] < 0.5);
1378 flowcoverstatus[j] = -1;
1379 (*nnonflowcovervars)++;
1383 assert((*nflowcovervars) + (*nnonflowcovervars) + nitems == nvars);
1384 assert(nn1items >= 0);
1414 SCIPdebugMsg(scip,
"1. Transform KP^SNF to KP^SNF_rat:\n");
1417 transweightsrealintegral =
TRUE;
1418 for( j = 0; j < nitems; j++ )
1420 transweightsreal[j] = vubcoefs[items[j]];
1423 transweightsrealintegral =
FALSE;
1425 if( coefs[items[j]] == 1 )
1427 transprofitsreal[j] = 1.0 - solvals[items[j]];
1428 SCIPdebugMsg(scip,
" <%d>: j in N1: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
1429 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
1433 transprofitsreal[j] = solvals[items[j]];
1434 SCIPdebugMsg(scip,
" <%d>: j in N2: w_%d = %g, p_%d = %g %s\n", items[j], items[j], transweightsreal[j],
1435 items[j], transprofitsreal[j],
SCIPisIntegral(scip, transweightsreal[j]) ?
"" :
" ----> NOT integral");
1439 transcapacityreal = - rhs + flowcoverweight + n1itemsweight;
1440 SCIPdebugMsg(scip,
" transcapacity = -rhs(%g) + flowcoverweight(%g) + n1itemsweight(%g) = %g\n",
1441 rhs, flowcoverweight, n1itemsweight, transcapacityreal);
1453 assert(nitems >= 0);
1457 *lambda = flowcoverweight - rhs;
1468 if( transweightsrealintegral )
1472 scalesuccess =
TRUE;
1476 scalesuccess =
FALSE;
1492 for( j = 0; j < nitems; ++j )
1495 transprofitsint[j] = transprofitsreal[j];
1496 itemsint[j] = items[j];
1501 transcapacityint -= 1;
1504 transcapacityint = (
SCIP_Longint) (transcapacityreal * scalar);
1505 nflowcovervarsafterfix = *nflowcovervars;
1506 nnonflowcovervarsafterfix = *nnonflowcovervars;
1507 flowcoverweightafterfix = flowcoverweight;
1510 tmp2 = (
SCIP_Real) ((transcapacityint) + 1);
1511 if( transcapacityint * nitems <=
MAXDYNPROGSPACE && tmp1 * tmp2 <= INT_MAX / 8.0)
1517 itemsint, solitems, nonsolitems, &nsolitems, &nnonsolitems,
NULL, &success));
1523 transcapacityreal, items, solitems, nonsolitems, &nsolitems, &nnonsolitems,
NULL));
1525 #if !defined(NDEBUG) || defined(SCIP_DEBUG) 1534 items, solitems, nonsolitems, &nsolitems, &nnonsolitems,
NULL));
1542 items, solitems, nonsolitems, &nsolitems, &nnonsolitems,
NULL));
1546 assert(nsolitems != -1);
1547 assert(nnonsolitems != -1);
1550 assert(*nflowcovervars + *nnonflowcovervars + nsolitems + nnonsolitems == nvars);
1551 buildFlowCover(scip, coefs, vubcoefs, rhs, solitems, nonsolitems, nsolitems, nnonsolitems, nflowcovervars,
1552 nnonflowcovervars, flowcoverstatus, &flowcoverweight, lambda);
1553 assert(*nflowcovervars + *nnonflowcovervars == nvars);
1562 items, solitems, nonsolitems, &nsolitems, &nnonsolitems,
NULL));
1568 *nflowcovervars = nflowcovervarsafterfix;
1569 *nnonflowcovervars = nnonflowcovervarsafterfix;
1570 flowcoverweight = flowcoverweightafterfix;
1572 assert(*nflowcovervars + *nnonflowcovervars + nsolitems + nnonsolitems == nvars);
1573 buildFlowCover(scip, coefs, vubcoefs, rhs, solitems, nonsolitems, nsolitems, nnonsolitems, nflowcovervars,
1574 nnonflowcovervars, flowcoverstatus, &flowcoverweight, lambda);
1575 assert(*nflowcovervars + *nnonflowcovervars == nvars);
1584 SCIPdebugMsg(scip,
"2. %s solution:\n", kpexact ?
"exact" :
"approximate");
1585 for( j = 0; j < nvars; j++ )
1587 if( coefs[j] == 1 && flowcoverstatus[j] == 1 )
1589 SCIPdebugMsg(scip,
" C1: + y_%d [u_%d = %g]\n", j, j, vubcoefs[j]);
1591 else if( coefs[j] == -1 && flowcoverstatus[j] == 1 )
1593 SCIPdebugMsg(scip,
" C2: - y_%d [u_%d = %g]\n", j, j, vubcoefs[j]);
1596 SCIPdebugMsg(scip,
" flowcoverweight(%g) = rhs(%g) + lambda(%g)\n", flowcoverweight, rhs, *lambda);
1624 int* transvarflowcoverstatus,
1633 assert(scip !=
NULL);
1634 assert(ntransvars >= 0);
1635 assert(transvarcoefs !=
NULL);
1636 assert(transbinvarsolvals !=
NULL);
1637 assert(transcontvarsolvals !=
NULL);
1638 assert(transvarvubcoefs !=
NULL);
1639 assert(transvarflowcoverstatus !=
NULL);
1640 assert(
SCIPisGT(scip, delta, lambda));
1647 fbeta = 1.0 - (lambda / delta);
1648 onedivoneminusfbeta = delta / lambda;
1650 SCIPdebugMsg(scip,
" --------------------- get L1 and L2 -----------------------------------------------------\n");
1651 SCIPdebugMsg(scip,
" L1 = { j in N1-C1 : y*_j >= ( u_j - lambda F_{f_beta}( u_j/delta) ) x*_j }\n");
1652 SCIPdebugMsg(scip,
" L2 = { j in N2-C2 : y*_j >= - lambda F_{f_beta}(- u_j/delta) x*_j }\n");
1658 for( j = 0; j < ntransvars; j++ )
1665 assert(transvarcoefs[j] == 1 || transvarcoefs[j] == -1);
1666 assert(
SCIPisGE(scip, transvarvubcoefs[j], 0.0));
1670 if( transvarcoefs[j] == 1 && transvarflowcoverstatus[j] == -1 )
1676 d = transvarvubcoefs[j] / delta;
1682 mirval = downd + ((fd - fbeta) * onedivoneminusfbeta);
1685 if(
SCIPisFeasGE(scip, transcontvarsolvals[j], ( transvarvubcoefs[j] - ( lambda * mirval ) ) * transbinvarsolvals[j]) )
1686 transvarflowcoverstatus[j] = 2;
1688 SCIPdebugMsg(scip,
" <%d>: in N1-C1: %g ?>=? ( %g - %g F_{f_beta}(%g)(%g) ) %g = %g ---> fcstatus = %d\n",
1689 j, transcontvarsolvals[j], transvarvubcoefs[j], lambda, d, mirval, transbinvarsolvals[j],
1690 ( transvarvubcoefs[j] - ( lambda * mirval ) ) * transbinvarsolvals[j], transvarflowcoverstatus[j]);
1694 if( transvarcoefs[j] == -1 && transvarflowcoverstatus[j] == -1 )
1700 d = - transvarvubcoefs[j] / delta;
1706 mirval = downd + ((fd - fbeta) * onedivoneminusfbeta);
1709 if(
SCIPisFeasGE(scip, transcontvarsolvals[j], - ( lambda * mirval ) * transbinvarsolvals[j]) )
1710 transvarflowcoverstatus[j] = 2;
1712 SCIPdebugMsg(scip,
" <%d>: in N2-C2: %g ?>=? - %g F_{f_beta}(-%g)(%g) %g = %g ---> fcstatus = %d\n",
1713 j, transcontvarsolvals[j], lambda, d, mirval, transbinvarsolvals[j],
1714 - ( lambda * mirval ) * transbinvarsolvals[j], transvarflowcoverstatus[j]);
1728 int* boundsfortrans,
1730 int* assoctransvars,
1732 int* flowcoverstatus,
1735 int* boundsforsubst,
1741 assert(scip !=
NULL);
1742 assert(vars !=
NULL);
1744 assert(boundsfortrans !=
NULL);
1745 assert(boundtypesfortrans !=
NULL);
1746 assert(assoctransvars !=
NULL);
1747 assert(transvarcoefs !=
NULL);
1748 assert(flowcoverstatus !=
NULL);
1749 assert(ntransvars >= 0 && ntransvars <= nvars);
1750 assert(boundsforsubst !=
NULL);
1751 assert(boundtypesforsubst !=
NULL);
1753 for( j = 0; j < nvars; j++ )
1756 assert(assoctransvars[j] == -1 || ( flowcoverstatus[assoctransvars[j]] == -1
1757 || flowcoverstatus[assoctransvars[j]] == 1 || flowcoverstatus[assoctransvars[j]] == 2 ));
1760 if( assoctransvars[j] == -1 )
1762 assert(boundsfortrans[j] == -3);
1763 boundsforsubst[j] = -3;
1771 if( flowcoverstatus[assoctransvars[j]] == 1 )
1773 boundsforsubst[j] = -1;
1779 boundsforsubst[j] = -1;
1787 if( flowcoverstatus[assoctransvars[j]] >= 1 )
1789 boundsforsubst[j] = boundsfortrans[j];
1790 boundtypesforsubst[j] = boundtypesfortrans[j];
1802 assert(closestlbtype == -1 || closestlbtype == -2);
1804 boundsforsubst[j] = closestlbtype;
1814 assert(closestubtype == -1 || closestubtype == -2);
1816 boundsforsubst[j] = closestubtype;
1850 assert(nvars == 0 || cutcoefs !=
NULL);
1851 assert(nvars == 0 || varsolvals !=
NULL);
1852 assert(cutvars !=
NULL);
1853 assert(cutvals !=
NULL);
1854 assert(cutlen !=
NULL);
1855 assert(cutact !=
NULL);
1856 assert(cutnorm !=
NULL);
1865 for( v = 0; v < nvars; ++v )
1870 act += val * varsolvals[v];
1871 cutsqrnorm += SQR(val);
1872 cutvars[len] = vars[v];
1877 norm = SQRT(cutsqrnorm);
1880 for( v = 0; v < nvars; ++v )
1885 act += val * varsolvals[v];
1887 norm =
MAX(norm, absval);
1888 cutvars[len] = vars[v];
1895 for( v = 0; v < nvars; ++v )
1900 act += val * varsolvals[v];
1902 cutvars[len] = vars[v];
1909 for( v = 0; v < nvars; ++v )
1914 act += val * varsolvals[v];
1916 cutvars[len] = vars[v];
1960 assert(scip !=
NULL);
1961 assert(varsolvals !=
NULL);
1962 assert(cutcoefs !=
NULL);
1963 assert(ncuts !=
NULL);
1964 assert(cutoff !=
NULL);
1965 assert(nvars == 0 || vars !=
NULL);
1969 SCIPdebugMsg(scip,
"--------------------- found cut ---------------------------------------------------------\n");
1977 cutvars, cutvals, &cutlen, &cutact, &cutnorm) );
1987 cutislocal,
FALSE, sepadata->dynamiccuts) );
1993 SCIPdebugMsg(scip,
" -> found potential flowcover cut <%s>: activity=%f, rhs=%f, norm=%f, eff=%f\n",
2002 SCIPdebugMsg(scip,
" -> flowcover cut <%s> no longer efficacious: act=%f, rhs=%f, norm=%f, eff=%f\n",
2014 SCIPdebugMsg(scip,
" -> found flowcover cut <%s>: act=%f, rhs=%f, norm=%f, eff=%f, rank=%d, min=%f, max=%f (range=%g)\n",
2020 if( !(*cutoff) && !cutislocal )
2050 assert(cutcoefs !=
NULL);
2053 for( i = 0; i < nvars; ++i )
2054 sqrnorm += SQR(cutcoefs[i]);
2055 sqrnorm =
MAX(sqrnorm, 1e-06);
2056 return (cutact - cutrhs)/SQRT(sqrnorm);
2071 int* boundsfortrans,
2073 int* assoctransvars,
2079 int* transvarflowcoverstatus,
2090 int* boundsforsubst;
2091 int* transvarflowcoverstatustmp;
2107 assert(scip !=
NULL);
2108 assert(sepadata !=
NULL);
2109 assert(vars !=
NULL);
2110 assert(varsolvals !=
NULL);
2111 assert(rowweights !=
NULL);
2112 assert(boundsfortrans !=
NULL);
2113 assert(boundtypesfortrans !=
NULL);
2114 assert(assoctransvars !=
NULL);
2115 assert(ntransvars >=0);
2116 assert(transvarcoefs !=
NULL);
2117 assert(transbinvarsolvals !=
NULL);
2118 assert(transcontvarsolvals !=
NULL);
2119 assert(transvarvubcoefs !=
NULL);
2120 assert(transvarflowcoverstatus !=
NULL);
2122 assert(ncuts !=
NULL);
2124 SCIPdebugMsg(scip,
"--------------------- cut generation heuristic ------------------------------------------\n");
2134 SCIPdebugMsg(scip,
"1. get candidate set for the value of delta:\n");
2153 for( j = 0; j < ntransvars; j++ )
2158 if( transvarcoefs[j] == 1 && transvarflowcoverstatus[j] == 1
2160 c1vubcoefsmax =
MAX(c1vubcoefsmax, transvarvubcoefs[j]);
2163 val =
MIN(transvarvubcoefs[j], lambda) * transbinvarsolvals[j];
2164 if( transvarcoefs[j] == -1 && transvarflowcoverstatus[j] == -1 &&
SCIPisFeasLE(scip, val, transcontvarsolvals[j])
2166 l2tmpvubcoefsmax =
MAX(l2tmpvubcoefsmax, transvarvubcoefs[j]);
2169 if(
SCIPisFeasGT(scip, transvarvubcoefs[j] + 1.0, lambda) )
2170 nvubcoefsmax =
MAX(nvubcoefsmax, transvarvubcoefs[j]);
2175 candsetdelta[startidx + ncandsetdelta] = transvarvubcoefs[j];
2177 SCIPdebugMsg(scip,
" u_j = %g\n", transvarvubcoefs[j]);
2184 assert(
SCIPisFeasGT(scip, nvubcoefsmax + 1.0, lambda));
2186 candsetdelta[startidx] = nvubcoefsmax + 1.0;
2188 SCIPdebugMsg(scip,
" max u_j+1 = %g\n", nvubcoefsmax + 1.0);
2193 candsetdelta[startidx] = lambda + 1.0;
2195 SCIPdebugMsg(scip,
" lambda + 1 = %g\n", lambda + 1.0);
2202 candsetdelta[startidx] = l2tmpvubcoefsmax;
2204 SCIPdebugMsg(scip,
" l2tmpvubcoefsmax = %g\n", l2tmpvubcoefsmax);
2210 candsetdelta[startidx] = c1vubcoefsmax;
2212 SCIPdebugMsg(scip,
" c1vubcoefsmax = %g\n", c1vubcoefsmax);
2215 assert(startidx >= 0 && startidx <= 3);
2216 assert(startidx + ncandsetdelta >= 4);
2217 assert(ncandsetdelta >= 1 && ncandsetdelta <= ntransvars + 4);
2219 SCIPdebugMsg(scip,
"2. generate c-MIRFCIs for different values of delta:\n");
2227 for( j = startidx; j < startidx + ncandsetdelta && ntesteddeltas < sepadata->maxtestdelta; j++ )
2235 delta = candsetdelta[j];
2236 onedivdelta = 1.0 / delta;
2246 for( i = 0; i < ntesteddeltas && !tested; i++ )
2247 tested =
SCIPisEQ(scip, testeddeltas[i], delta);
2250 testeddeltas[ntesteddeltas] = delta;
2261 getL1L2(scip, ntransvars, transvarcoefs, transbinvarsolvals, transcontvarsolvals, transvarvubcoefs,
2262 transvarflowcoverstatustmp, delta, lambda);
2268 transvarcoefs, transvarflowcoverstatustmp, ntransvars, boundsforsubst, boundtypesforsubst ) );
2272 boundtypesforsubst, (
int)
MAXAGGRLEN(nvars), 1.0,
MINFRAC,
MAXFRAC, rowweights, -1.0,
NULL, -1, -1,
NULL,
2273 scalar * onedivdelta,
NULL,
NULL, cutcoefs, &cutrhs, &cutact, &success, &cutislocal,
NULL) );
2281 for(i = 0; i < nvars; i++)
2282 cutcoefs[i] = lambda * cutcoefs[i];
2283 cutrhs = lambda * cutrhs;
2284 cutact = lambda * cutact;
2286 efficacy =
calcEfficacy(nvars, cutcoefs, cutrhs, cutact);
2288 SCIPdebugMsg(scip,
" ---> act = %g rhs = %g eff = %g (old besteff = %g, old bestdelta=%g)\n", cutact, cutrhs, efficacy, bestefficacy, bestdelta);
2290 if( efficacy > bestefficacy )
2293 bestefficacy = efficacy;
2304 assert(bestdelta != 0.0);
2305 onedivbestdelta = 1.0 / bestdelta;
2308 getL1L2(scip, ntransvars, transvarcoefs, transbinvarsolvals, transcontvarsolvals, transvarvubcoefs,
2309 transvarflowcoverstatus, bestdelta, lambda);
2315 transvarcoefs, transvarflowcoverstatus, ntransvars, boundsforsubst, boundtypesforsubst ) );
2319 boundtypesforsubst, (
int)
MAXAGGRLEN(nvars), 1.0,
MINFRAC,
MAXFRAC, rowweights, -1.0,
NULL, -1, -1,
NULL,
2320 scalar * onedivbestdelta,
NULL,
NULL, cutcoefs, &cutrhs, &cutact, &success, &cutislocal, &cutrank) );
2324 for(i = 0; i < nvars; i++)
2325 cutcoefs[i] = lambda * cutcoefs[i];
2326 cutrhs = lambda * cutrhs;
2327 cutact = lambda * cutact;
2330 SCIP_CALL(
addCut(scip, sepa, sepadata, vars, nvars, sol, varsolvals, cutcoefs, cutrhs, cutislocal, cutrank, normtype, cutoff, ncuts) );
2351 assert(rowscores !=
NULL);
2352 assert(0 <= ind1 && 0 <= ind2);
2354 tmp = rowscores[ind1] - rowscores[ind2];
2385 int* assoctransvars;
2386 int* boundsfortrans;
2391 int* transvarflowcoverstatus;
2415 assert(scip !=
NULL);
2416 assert(sepa !=
NULL);
2417 assert(result !=
NULL);
2421 assert(sepadata !=
NULL);
2427 if( (depth == 0 && sepadata->maxroundsroot >= 0 && ncalls >= sepadata->maxroundsroot)
2428 || (depth > 0 && sepadata->maxrounds >= 0 && ncalls >= sepadata->maxrounds) )
2433 assert(nrows == 0 || rows !=
NULL);
2442 assert(nvars == 0 || vars !=
NULL);
2481 maxtries = sepadata->maxtriesroot;
2482 maxfails = sepadata->maxfailsroot;
2483 maxsepacuts = sepadata->maxsepacutsroot;
2484 maxslack = sepadata->maxslackroot;
2488 maxtries = sepadata->maxtries;
2489 maxfails = sepadata->maxfails;
2490 maxsepacuts = sepadata->maxsepacuts;
2491 maxslack = sepadata->maxslack;
2496 objnorm =
MAX(objnorm, 1.0);
2497 for( r = 0; r < nrows; r++ )
2507 rowlhsscores[r] = 0.0;
2508 rowrhsscores[r] = 0.0;
2526 rownorm =
MAX(rownorm, 0.1);
2530 slack = (activity - lhs)/rownorm;
2531 dualscore =
MAX(dualsol/objnorm, 0.0001);
2534 && rowdensity <= sepadata->maxrowdensity )
2536 rowlhsscores[r] = dualscore +
DENSSCORE * rowdensity + sepadata->slackscore *
MAX(1.0 - slack, 0.0);
2537 assert(rowlhsscores[r] > 0.0);
2540 rowlhsscores[r] = 0.0;
2542 slack = (rhs - activity)/rownorm;
2543 dualscore =
MAX(-dualsol/objnorm, 0.0001);
2546 && rowdensity <= sepadata->maxrowdensity )
2548 rowrhsscores[r] = dualscore +
DENSSCORE * rowdensity + sepadata->slackscore *
MAX(1.0 - slack, 0.0);
2549 assert(rowrhsscores[r] > 0.0);
2552 rowrhsscores[r] = 0.0;
2554 rowscores[r] =
MAX(rowlhsscores[r], rowrhsscores[r]);
2559 SCIPsortInd(roworder, rowScoreComp, (
void*) rowscores, nrows);
2561 for( r = nrows - 1; r > 0; --r )
2562 assert(rowscores[roworder[r]] <= rowscores[roworder[r - 1]]);
2578 for( r = 0; r < nrows && ntries < maxtries && ncuts < maxsepacuts && rowscores[roworder[r]] > 0.0
2592 assert(rowweights[roworder[r-1]] == 1.0 || rowweights[roworder[r-1]] == -1.0 || rowweights[roworder[r-1]] == 0.0);
2593 rowweights[roworder[r-1]] = 0.0;
2600 rowweights[roworder[r]] = -1.0;
2602 rowweights[roworder[r]] = 1.0;
2606 rowweights[roworder[r]] = 0.0;
2610 SCIPdebugMsg(scip,
"===================== flow cover separation for row <%s> (%d of %d) ===================== \n",
2613 SCIPdebugMsg(scip,
"rowact=%g is closer to %s --> rowweight=%g\n", rowact, rowweights[roworder[r]] == 1 ?
"rhs" :
"lhs", rowweights[roworder[r]]);
2618 assert(mult == 1.0 || (mult == -1.0 && sepadata->multbyminusone));
2627 mult, boundsfortrans, boundtypesfortrans, assoctransvars, transvarcoefs, transbinvarsolvals,
2628 transcontvarsolvals, transvarvubcoefs, &ntransvars, &transcapacity, &transsuccess) );
2632 SCIPdebugMsg(scip,
"mult=%g: no 0-1 single node flow relaxation found\n", mult);
2636 flowcoverfound =
FALSE;
2639 SCIP_CALL(
getFlowCover(scip, transvarcoefs, transbinvarsolvals, transvarvubcoefs, ntransvars, transcapacity,
2640 &ncovervars, &nnoncovervars, transvarflowcoverstatus, &lambda, &flowcoverfound) );
2641 if( !flowcoverfound )
2643 SCIPdebugMsg(scip,
"mult=%g: no flow cover found\n", mult);
2650 SCIP_CALL(
cutGenerationHeuristic(scip, sepa, sepadata, vars, nvars, sol, varsolvals, rowweights, mult, boundsfortrans,
2651 boundtypesfortrans, assoctransvars, ntransvars, transvarcoefs, transbinvarsolvals, transcontvarsolvals,
2652 transvarvubcoefs, transvarflowcoverstatus, lambda, normtype, &cutoff, &ncuts) );
2660 while( sepadata->multbyminusone && mult < 0.0 );
2669 if( ncuts == oldncuts )
2672 if( nfails >= maxfails )
2699 else if ( ncuts > 0 )
2714 assert(scip !=
NULL);
2715 assert(sepa !=
NULL);
2732 assert(sepadata !=
NULL);
2798 sepaExeclpFlowcover, sepaExecsolFlowcover,
2801 assert(sepa !=
NULL);
2809 "separating/flowcover/maxrounds",
2810 "maximal number of separation rounds per node (-1: unlimited)",
2813 "separating/flowcover/maxroundsroot",
2814 "maximal number of separation rounds in the root node (-1: unlimited)",
2817 "separating/flowcover/maxtries",
2818 "maximal number of rows to separate flow cover cuts for per separation round (-1: unlimited)",
2821 "separating/flowcover/maxtriesroot",
2822 "maximal number of rows to separate flow cover cuts for per separation round in the root (-1: unlimited)",
2825 "separating/flowcover/maxfails",
2826 "maximal number of consecutive fails to generate a cut per separation round (-1: unlimited)",
2829 "separating/flowcover/maxfailsroot",
2830 "maximal number of consecutive fails to generate a cut per separation round in the root (-1: unlimited)",
2833 "separating/flowcover/maxsepacuts",
2834 "maximal number of flow cover cuts separated per separation round",
2837 "separating/flowcover/maxsepacutsroot",
2838 "maximal number of flow cover cuts separated per separation round in the root",
2841 "separating/flowcover/maxslack",
2842 "maximal slack of rows to separate flow cover cuts for",
2845 "separating/flowcover/maxslackroot",
2846 "maximal slack of rows to separate flow cover cuts for in the root",
2849 "separating/flowcover/slackscore",
2850 "weight of slack in the scoring of the rows",
2853 "separating/flowcover/maxrowdensity",
2854 "maximal density of row to separate flow cover cuts for",
2857 "separating/flowcover/dynamiccuts",
2858 "should generated cuts be removed from the LP if they are no longer tight?",
2861 "separating/flowcover/multbyminusone",
2862 "should flow cover cuts be separated for 0-1 single node flow set with reversed arcs in addition?",
2865 "separating/flowcover/maxtestdelta",
2866 "cut generation heuristic: maximal number of different deltas to try",
enum SCIP_Result SCIP_RESULT
#define DEFAULT_MAXROWDENSITY
static SCIP_Bool isIntegralScalar(SCIP_Real val, SCIP_Real scalar, SCIP_Real mindelta, SCIP_Real maxdelta)
enum SCIP_BoundType SCIP_BOUNDTYPE
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPgetCharParam(SCIP *scip, const char *name, char *value)
SCIP_Real * SCIPvarGetVlbCoefs(SCIP_VAR *var)
SCIP_Real SCIPfeastol(SCIP *scip)
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 SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE addCut(SCIP *scip, SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata, SCIP_VAR **vars, int nvars, SCIP_SOL *sol, SCIP_Real *varsolvals, SCIP_Real *cutcoefs, SCIP_Real cutrhs, SCIP_Bool cutislocal, int cutrank, char normtype, SCIP_Bool *cutoff, int *ncuts)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPsortInd(int *indarray, SCIP_DECL_SORTINDCOMP((*indcomp)), void *dataptr, int len)
int SCIPvarGetNVlbs(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
const char * SCIProwGetName(SCIP_ROW *row)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
int SCIProwGetNLPNonz(SCIP_ROW *row)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE getClosestVlb(SCIP *scip, SCIP_VAR *var, SCIP_Real bestsub, SCIP_Real rowcoef, SCIP_Real *rowcoefsbinary, SCIP_Real *varsolvals, int *assoctransvars, SCIP_Real *closestvlb, int *closestvlbidx)
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
#define DEFAULT_DYNAMICCUTS
const char * SCIPsepaGetName(SCIP_SEPA *sepa)
enum SCIP_Retcode SCIP_RETCODE
int SCIPvarGetNVubs(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
SCIP_RETCODE SCIPcalcMIR(SCIP *scip, SCIP_SOL *sol, SCIP_Real boundswitch, SCIP_Bool usevbds, SCIP_Bool allowlocal, SCIP_Bool fixintegralrhs, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, int maxmksetcoefs, SCIP_Real maxweightrange, SCIP_Real minfrac, SCIP_Real maxfrac, SCIP_Real *weights, SCIP_Real maxweight, int *weightinds, int nweightinds, int rowlensum, int *sidetypes, SCIP_Real scale, SCIP_Real *mksetcoefs, SCIP_Bool *mksetcoefsvalid, SCIP_Real *mircoef, SCIP_Real *mirrhs, SCIP_Real *cutactivity, SCIP_Bool *success, SCIP_Bool *cutislocal, int *cutrank)
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_VAR ** SCIPvarGetVlbVars(SCIP_VAR *var)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
int SCIPgetNLPBranchCands(SCIP *scip)
SCIP_RETCODE SCIPsetSepaCopy(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPACOPY((*sepacopy)))
SCIP_Real SCIProwGetDualsol(SCIP_ROW *row)
#define SCIPdebugMsgPrint
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPincludeSepaFlowcover(SCIP *scip)
SCIP_Real SCIPgetObjNorm(SCIP *scip)
SCIP_Real SCIPepsilon(SCIP *scip)
SCIP_Real SCIPgetRowMaxCoef(SCIP *scip, SCIP_ROW *row)
SCIP_SEPADATA * SCIPsepaGetData(SCIP_SEPA *sepa)
#define DEFAULT_MAXROUNDS
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
#define DEFAULT_MAXROUNDSROOT
SCIP_Bool SCIPisCutEfficacious(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut)
Constraint handler for knapsack constraints of the form , x binary and .
static SCIP_RETCODE getClosestVub(SCIP *scip, SCIP_VAR *var, SCIP_Real bestslb, SCIP_Real rowcoef, SCIP_Real *rowcoefsbinary, SCIP_Real *varsolvals, int *assoctransvars, SCIP_Real *closestvub, int *closestvubidx)
static SCIP_Real calcEfficacy(int nvars, SCIP_Real *cutcoefs, SCIP_Real cutrhs, SCIP_Real cutact)
#define DEFAULT_MAXSEPACUTS
SCIP_Real SCIPgetRowMinCoef(SCIP *scip, SCIP_ROW *row)
static SCIP_DECL_SEPAEXECLP(sepaExeclpFlowcover)
#define DEFAULT_MAXSEPACUTSROOT
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
#define DEFAULT_MULTBYMINUSONE
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
int SCIPsepaGetNCallsAtNode(SCIP_SEPA *sepa)
SCIP_Bool SCIPisEfficacious(SCIP *scip, SCIP_Real efficacy)
static SCIP_RETCODE getBoundsForSubstitution(SCIP *scip, SCIP_VAR **vars, int nvars, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, int *assoctransvars, int *transvarcoefs, int *flowcoverstatus, int ntransvars, int *boundsforsubst, SCIP_BOUNDTYPE *boundtypesforsubst)
static SCIP_DECL_SEPAEXECSOL(sepaExecsolFlowcover)
static SCIP_RETCODE storeCutInArrays(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_Real *cutcoefs, SCIP_Real *varsolvals, char normtype, SCIP_VAR **cutvars, SCIP_Real *cutvals, int *cutlen, SCIP_Real *cutact, SCIP_Real *cutnorm)
SCIP_Real * SCIPvarGetVubConstants(SCIP_VAR *var)
static SCIP_RETCODE cutGenerationHeuristic(SCIP *scip, SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata, SCIP_VAR **vars, int nvars, SCIP_SOL *sol, SCIP_Real *varsolvals, SCIP_Real *rowweights, SCIP_Real scalar, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, int *assoctransvars, int ntransvars, int *transvarcoefs, SCIP_Real *transbinvarsolvals, SCIP_Real *transcontvarsolvals, SCIP_Real *transvarvubcoefs, int *transvarflowcoverstatus, SCIP_Real lambda, char normtype, SCIP_Bool *cutoff, int *ncuts)
const char * SCIPvarGetName(SCIP_VAR *var)
static void getClosestLb(SCIP *scip, SCIP_VAR *var, SCIP_Bool allowlocal, SCIP_Real *closestlb, int *closestlbtype)
void SCIPsepaSetData(SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata)
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, SCIP_Real *flowcoverweight, SCIP_Real *lambda)
static SCIP_Longint getIntegralVal(SCIP_Real val, SCIP_Real scalar, SCIP_Real mindelta, SCIP_Real maxdelta)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real * SCIPvarGetVlbConstants(SCIP_VAR *var)
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 SCIPaddCut(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut, SCIP_Bool forcecut, SCIP_Bool *infeasible)
static SCIP_DECL_SEPAFREE(sepaFreeFlowcover)
static SCIP_RETCODE getFlowCover(SCIP *scip, int *coefs, SCIP_Real *solvals, SCIP_Real *vubcoefs, int nvars, SCIP_Real rhs, int *nflowcovervars, int *nnonflowcovervars, int *flowcoverstatus, SCIP_Real *lambda, SCIP_Bool *found)
static void getClosestUb(SCIP *scip, SCIP_VAR *var, SCIP_Bool allowlocal, SCIP_Real *closestub, int *closestubtype)
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
SCIP_RETCODE SCIPincludeSepaBasic(SCIP *scip, SCIP_SEPA **sepa, const char *name, const char *desc, int priority, int freq, SCIP_Real maxbounddist, SCIP_Bool usessubscip, SCIP_Bool delay, SCIP_DECL_SEPAEXECLP((*sepaexeclp)), SCIP_DECL_SEPAEXECSOL((*sepaexecsol)), SCIP_SEPADATA *sepadata)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
public data structures and miscellaneous methods
static SCIP_DECL_SEPACOPY(sepaCopyFlowcover)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
static void getL1L2(SCIP *scip, int ntransvars, int *transvarcoefs, SCIP_Real *transbinvarsolvals, SCIP_Real *transcontvarsolvals, SCIP_Real *transvarvubcoefs, int *transvarflowcoverstatus, SCIP_Real delta, SCIP_Real lambda)
SCIP_Bool SCIPisSumLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int SCIPgetDepth(SCIP *scip)
#define DEFAULT_MAXSLACKROOT
SCIP_RETCODE SCIPaddPoolCut(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPcreateEmptyRowSepa(SCIP *scip, SCIP_ROW **row, SCIP_SEPA *sepa, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
SCIP_Real SCIPgetCutEfficacy(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut)
static SCIP_RETCODE separateCuts(SCIP *scip, SCIP_SEPA *sepa, SCIP_SOL *sol, SCIP_RESULT *result)
#define BMScopyMemoryArray(ptr, source, num)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPgetRowSolActivity(SCIP *scip, SCIP_ROW *row, SCIP_SOL *sol)
static SCIP_DECL_SORTINDCOMP(rowScoreComp)
int SCIProwGetRank(SCIP_ROW *row)
int SCIPgetNVars(SCIP *scip)
SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
SCIP_RETCODE SCIPsetSepaFree(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAFREE((*sepafree)))
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
#define SEPA_MAXBOUNDDIST
void SCIPselectWeightedDownRealRealInt(SCIP_Real *realarray1, SCIP_Real *realarray2, int *intarray, SCIP_Real *weights, SCIP_Real capacity, int len, int *medianpos)
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
void SCIProwChgRank(SCIP_ROW *row, int rank)
static SCIP_RETCODE constructSNFRelaxation(SCIP *scip, SCIP_VAR **vars, int nvars, SCIP_Real *varsolvals, SCIP_ROW *row, SCIP_Real rowweight, SCIP_Real scale, int *boundsfortrans, SCIP_BOUNDTYPE *boundtypesfortrans, int *assoctransvars, int *transvarcoefs, SCIP_Real *transbinvarsolvals, SCIP_Real *transcontvarsolvals, SCIP_Real *transvarvubcoefs, int *ntransvars, SCIP_Real *transrhs, SCIP_Bool *success)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
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)
int SCIProwGetLPPos(SCIP_ROW *row)
SCIP_RETCODE SCIPaddVarsToRow(SCIP *scip, SCIP_ROW *row, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
SCIP_Bool SCIPisStopped(SCIP *scip)
#define DEFAULT_MAXTESTDELTA
SCIP_RETCODE SCIPprintRow(SCIP *scip, SCIP_ROW *row, FILE *file)
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_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)
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)
SCIP_Longint SCIPgetNLPs(SCIP *scip)
#define DEFAULT_MAXTRIESROOT
#define MAXAGGRLEN(nvars)
SCIP_RETCODE SCIPmakeRowIntegral(SCIP *scip, SCIP_ROW *row, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Real maxscale, SCIP_Bool usecontvars, SCIP_Bool *success)
SCIP_Real SCIProwGetNorm(SCIP_ROW *row)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
struct SCIP_SepaData SCIP_SEPADATA
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
int SCIPgetNSepaRounds(SCIP *scip)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
#define DEFAULT_MAXFAILSROOT
#define DEFAULT_SLACKSCORE