37 #define PROP_NAME "genvbounds" 38 #define PROP_DESC "generalized variable bounds propagator" 39 #define PROP_TIMING SCIP_PROPTIMING_ALWAYS 40 #define PROP_PRIORITY 3000000 42 #define PROP_DELAY FALSE 44 #define PROP_PRESOL_PRIORITY -2000000 46 #define PROP_PRESOLTIMING SCIP_PRESOLTIMING_FAST 47 #define PROP_PRESOL_MAXROUNDS -1 49 #define DEFAULT_GLOBAL_PROPAGATION TRUE 50 #define DEFAULT_PROPAGATE_IN_ROOT_NODE TRUE 51 #define DEFAULT_SORT TRUE 53 #define DEFAULT_PROPASCONSS FALSE 55 #define EVENTHDLR_NAME "genvbounds" 56 #define EVENTHDLR_DESC "event handler for generalized variable bounds propagator" 110 int* componentsstart;
113 int componentsstartsize;
115 int* startcomponents;
116 int startindicessize;
119 int* gstartcomponents;
120 int gstartindicessize;
122 int genvboundstoresize;
148 assert(scip != NULL);
150 SCIPdebugMsg(scip,
"cutoff = %.9g (%.9g + %.9g * %.9g)\n",
174 assert(scip != NULL);
175 assert(propdata != NULL);
194 assert(genvbound != NULL);
204 for( i = 0; i < genvbound->
ncoefs; i++ )
243 assert(scip != NULL);
244 assert(vars != NULL);
245 assert(coefs != NULL);
250 for( i = 0; i < nvars; i++ )
265 minval += coefs[i] *
bound;
284 assert(scip != NULL);
285 assert(vars != NULL);
286 assert(coefs != NULL);
291 for( i = 0; i < nvars; i++ )
325 minval += coefs[i] *
bound;
341 assert(scip != NULL);
342 assert(genvbound != NULL);
360 #ifdef WITH_DEBUG_SOLUTION 373 assert(scip != NULL);
374 assert(genvbound != NULL);
376 if( !SCIPdebugIsMainscip(scip) )
380 SCIP_CALL( SCIPdebugGetSol(scip, &debugsol) );
383 if( debugsol == NULL )
387 for( i = 0; i < genvbound->
ncoefs; i++ )
391 activity += genvbound->
coefs[i] * solval;
393 printf(
"***** debug: ignoring variable with %s value in debug solution\n",
425 assert(scip != NULL);
426 assert(propdata != NULL);
428 assert(propdata->startcomponents == NULL);
429 assert(propdata->startindices == NULL);
430 assert(propdata->startmap == NULL);
431 assert(propdata->nindices == -1);
433 assert(propdata->gstartindices == NULL);
434 assert(propdata->gstartcomponents == NULL);
435 assert(propdata->ngindices == -1);
437 assert(propdata->ngenvbounds >= 1);
438 assert(propdata->ncomponents >= 1);
447 propdata->startindicessize = propdata->ncomponents;
448 propdata->gstartindicessize = propdata->ncomponents;
453 propdata->nindices = 0;
454 propdata->ngindices = 0;
466 assert(scip != NULL);
467 assert(propdata != NULL);
471 if( propdata->startcomponents != NULL )
473 assert(propdata->startindices != NULL);
474 assert(propdata->startmap != NULL);
475 assert(propdata->nindices >= 0);
479 propdata->startindicessize = 0;
481 propdata->nindices = -1;
483 assert(propdata->gstartindices != NULL);
484 assert(propdata->gstartcomponents != NULL);
485 assert(propdata->ngindices >= 0);
489 propdata->gstartindicessize = 0;
490 propdata->ngindices = -1;
493 assert(propdata->startcomponents == NULL);
494 assert(propdata->startindices == NULL);
495 assert(propdata->startmap == NULL);
496 assert(propdata->nindices == -1);
498 assert(propdata->gstartindices == NULL);
499 assert(propdata->gstartcomponents == NULL);
500 assert(propdata->ngindices == -1);
513 assert(scip != NULL);
514 assert(propdata != NULL);
516 assert(propdata->gstartindices != NULL);
517 assert(propdata->gstartcomponents != NULL);
518 assert(propdata->ngindices == 0);
522 for( i = 0; i < propdata->ncomponents; i++ )
526 for( j = propdata->componentsstart[i]; j < propdata->componentsstart[i+1]; j++ )
528 assert(j < propdata->ngenvbounds);
530 if( !
SCIPisZero(scip, propdata->genvboundstore[j]->cutoffcoef) )
532 assert(
SCIPisNegative(scip, propdata->genvboundstore[j]->cutoffcoef));
534 propdata->gstartcomponents[propdata->ngindices] = i;
535 propdata->gstartindices[propdata->ngindices] = j;
538 propdata->ngindices++;
545 if( propdata->gstartindicessize != propdata->ngindices )
548 propdata->ngindices) );
550 propdata->ngindices) );
551 propdata->gstartindicessize = propdata->ngindices;
565 assert(scip != NULL);
566 assert(propdata != NULL);
567 assert(propdata->startcomponents != NULL);
568 assert(propdata->startindices != NULL);
569 assert(propdata->startmap != NULL);
570 assert(propdata->nindices >= 0);
573 propdata->nindices = 0;
585 assert(scip != NULL);
586 assert(propdata != NULL);
590 if( propdata->componentsstart != NULL )
592 assert(propdata->ncomponents > 0);
595 propdata->componentsstartsize = 0;
596 propdata->ncomponents = -1;
599 assert(propdata->componentsstart == NULL);
600 assert(propdata->ncomponents == -1);
614 assert(scip != NULL);
615 assert(genvbound != NULL);
616 assert(genvbound->
coefs != NULL);
617 assert(genvbound->
vars != NULL);
618 assert(genvbound->
var != NULL);
621 for( i = 0; i < genvbound->
ncoefs; ++i )
623 assert(genvbound->
vars[i] != NULL);
645 assert(scip != NULL);
646 assert(propdata != NULL);
648 if( propdata->genvboundstore != NULL )
651 for( i = propdata->ngenvbounds - 1; i >= 0; i-- )
664 propdata->ngenvbounds = 0;
673 if( propdata->cutoffboundvar != NULL )
677 propdata->cutoffboundvar = NULL;
703 assert(scip != NULL);
704 assert(genvbound != NULL);
705 assert(boundval != NULL);
706 assert(success != NULL);
711 lhsvar = genvbound->
var;
712 assert(lhsvar != NULL);
715 vars = genvbound->
vars;
716 nvars = genvbound->
ncoefs;
717 assert(vars != NULL);
738 SCIPdebugMsg(scip,
"resolving genvbound propagation: lhs=%s<%s> >= boundval=%.15g\n",
742 tmpboundval = *boundval;
746 SCIPdebugMsg(scip,
"subtracting constant terms gives boundval=%.15g\n", tmpboundval);
751 SCIPdebugMsg(scip,
"minactivity of right-hand side is minactivity=%.15g\n", minactivity);
757 if(
SCIPisLT(scip, minactivity, tmpboundval) )
759 SCIPdebugMsg(scip,
"minactivity is too small to explain propagation; was genvbound replaced?\n");
764 assert(
SCIPisGE(scip, minactivity, tmpboundval));
766 slack =
MAX(minactivity - tmpboundval, 0.0);
771 for( i = 0; i < nvars; i++ )
773 assert(vars[i] != NULL);
778 if( genvbound->
coefs[i] > 0.0 )
790 SCIPdebugMsg(scip,
"lower bound of variable <%s> (genvbound->vars[%d]) in conflict set / at index is %.15g / %.15g\n",
796 if(
SCIPisLE(scip, lbatindex, conflictlb) )
798 SCIPdebugMsg(scip,
"skipping lower bound of variable <%s> (genvbound->vars[%d]) already enforced in conflict set\n",
806 relaxedlb = lbatindex - (slack / genvbound->
coefs[i]);
807 assert(relaxedlb <= lbatindex);
816 assert(
SCIPisGE(scip, relaxedlb, conflictlb));
817 assert(
SCIPisLE(scip, relaxedlb, lbatindex));
820 slack -= genvbound->
coefs[i] * (lbatindex - relaxedlb);
821 slack =
MAX(slack, 0.0);
823 SCIPdebugMsg(scip,
"added lower bound of variable <%s> (genvbound->vars[%d]); new slack=%.15g\n",
840 SCIPdebugMsg(scip,
"upper bound of variable <%s> (genvbound->vars[%d]) in conflict set / at index is %.15g / %.15g\n",
846 if(
SCIPisGE(scip, ubatindex, conflictub) )
848 SCIPdebugMsg(scip,
"skipping upper bound of variable <%s> (genvbound->vars[%d]) already enforced in conflict set\n",
856 relaxedub = ubatindex - (slack / genvbound->
coefs[i]);
857 assert(relaxedub >= ubatindex);
866 assert(
SCIPisLE(scip, relaxedub, conflictub));
867 assert(
SCIPisGE(scip, relaxedub, ubatindex));
870 slack -= genvbound->
coefs[i] * (ubatindex - relaxedub);
871 slack =
MAX(slack, 0.0);
873 SCIPdebugMsg(scip,
"added upper bound of variable <%s> (genvbound->vars[%d]); new slack=%.15g\n",
881 tmpboundval += slack;
890 if(
SCIPisLT(scip, tmpboundval, *boundval) )
892 SCIPdebugMsg(scip,
"boundval was reduced from %.15g to %.15g; propagation not resolved\n", *boundval, tmpboundval);
897 *boundval = tmpboundval;
912 assert(scip != NULL);
913 assert(genvbound != NULL);
951 bound -= infeasthreshold;
957 SCIPdebugMsg(scip,
"strange: could not create initial reason to start conflict analysis\n");
964 SCIPdebugMsg(scip,
"skipping upper bound of left-hand side variable <%s> already enforced in conflict set\n",
1003 bound = -bound + infeasthreshold;
1009 SCIPdebugMsg(scip,
"strange: could not create initial reason to start conflict analysis\n");
1016 SCIPdebugMsg(scip,
"skipping lower bound of left-hand side variable <%s> already enforced in conflict set\n",
1050 assert(scip != NULL);
1051 assert(genvbound != NULL);
1052 assert(genvbound->
var != NULL);
1054 assert(result != NULL);
1075 SCIPdebugMsg(scip,
" %s genvbound propagation for <%s>\n", global ?
1078 printGenVBound(scip, genvbound);
1079 SCIPdebugMsg(scip,
" [%.15g,%.15g] -> [%.15g,%.15g]\n", lb, ub, new_lb, new_ub);
1084 if( global || genvbound->
ncoefs <= 0 )
1107 SCIPdebugMsg(scip,
" -> lower bound tightening on variable <%s> led to infeasibility\n",
1120 SCIPdebugMsg(scip,
" -> upper bound tightening on variable <%s> led to infeasibility\n",
1134 else if( tightened )
1137 if( nchgbds != NULL )
1148 void printEventData(
1155 SCIPdebugMessage(
"event data: %s bound of <%s> tightened ==> start propagating at ",
1159 assert(eventdata->nstarts > 0);
1161 for( i = 0; i < eventdata->nstarts; i++ )
1163 SCIPdebugPrintf(
"(component %d, index %d) ", eventdata->startcomponents[i], eventdata->startindices[i]);
1176 assert(scip != NULL);
1177 assert(eventdata != NULL);
1178 assert(*eventdata != NULL);
1183 (*eventdata)->startindicessize = 0;
1184 (*eventdata)->nstarts = -1;
1185 (*eventdata)->var = NULL;
1186 (*eventdata)->prop = NULL;
1202 assert(scip != NULL);
1203 assert(propdata != NULL);
1205 if( propdata->lbevents != NULL )
1207 assert(propdata->ubevents != NULL);
1208 assert(propdata->lbeventsmap != NULL);
1209 assert(propdata->ubeventsmap != NULL);
1214 for( i = propdata->nlbevents - 1; i >= 0; i-- )
1219 for( i = propdata->nubevents - 1; i >= 0; i-- )
1226 propdata->nlbevents = -1;
1227 propdata->nubevents = -1;
1230 assert(propdata->lbevents == NULL);
1231 assert(propdata->ubevents == NULL);
1232 assert(propdata->lbeventsmap == NULL);
1233 assert(propdata->ubeventsmap == NULL);
1234 assert(propdata->nlbevents == -1);
1235 assert(propdata->nubevents == -1);
1251 assert(scip != NULL);
1252 assert(propdata != NULL);
1253 assert(propdata->eventhdlr != NULL);
1255 if( propdata->lbevents != NULL )
1257 assert(propdata->ubevents != NULL);
1258 assert(propdata->nlbevents >= 0);
1259 assert(propdata->nubevents >= 0);
1261 for( i = propdata->nlbevents - 1; i >= 0; i-- )
1265 propdata->lbevents[i], -1) );
1268 for( i = propdata->nubevents - 1; i >= 0; i-- )
1272 propdata->ubevents[i], -1) );
1279 assert(propdata->lbevents == NULL);
1280 assert(propdata->ubevents == NULL);
1281 assert(propdata->nlbevents == -1);
1282 assert(propdata->nubevents == -1);
1301 assert(scip != NULL);
1302 assert(propdata != NULL);
1303 assert(var != NULL);
1315 (*eventdata)->startindicessize = propdata->ncomponents;
1316 (*eventdata)->nstarts = 0;
1317 (*eventdata)->var =
var;
1318 (*eventdata)->prop = propdata->prop;
1323 propdata->lbevents[propdata->nlbevents] = *eventdata;
1324 propdata->nlbevents++;
1328 propdata->ubevents[propdata->nubevents] = *eventdata;
1329 propdata->nubevents++;
1354 assert(scip != NULL);
1355 assert(propdata != NULL);
1356 assert(var != NULL);
1357 assert(startindex >= 0);
1358 assert(startcomponent >= 0);
1362 assert(eventdata != NULL);
1364 if( eventdata->nstarts > 0 && eventdata->startcomponents[eventdata->nstarts - 1] == startcomponent )
1370 assert(eventdata->startindices[eventdata->nstarts - 1] < startindex);
1375 eventdata->startcomponents[eventdata->nstarts] = startcomponent;
1376 eventdata->startindices[eventdata->nstarts] = startindex;
1379 eventdata->nstarts++;
1394 assert(scip != NULL);
1395 assert(propdata != NULL);
1396 assert(propdata->eventhdlr != NULL);
1397 assert(propdata->lbevents == NULL);
1398 assert(propdata->ubevents == NULL);
1399 assert(propdata->issorted);
1400 assert(propdata->nlbevents == -1);
1401 assert(propdata->nubevents == -1);
1411 propdata->nlbevents = 0;
1412 propdata->nubevents = 0;
1415 for( i = 0; i < propdata->ncomponents; i++ )
1420 for( j = propdata->componentsstart[i]; j < propdata->componentsstart[i+1]; j++ )
1425 assert(j < propdata->ngenvbounds);
1427 genvbound = propdata->genvboundstore[j];
1428 assert(genvbound != NULL);
1431 for( k = 0; k < genvbound->
ncoefs; k++ )
1446 assert(propdata->nlbevents <= nprobvars);
1447 assert(propdata->nubevents <= nprobvars);
1448 if( propdata->nlbevents < nprobvars )
1452 if( propdata->nubevents < nprobvars )
1458 for( i = 0; i < propdata->nlbevents; i++ )
1462 assert(eventdata != NULL);
1463 assert(eventdata->nstarts > 0);
1464 assert(eventdata->startcomponents != NULL);
1465 assert(eventdata->startindices != NULL);
1468 if( eventdata->startindicessize != eventdata->nstarts )
1471 eventdata->nstarts) );
1473 eventdata->nstarts) );
1474 eventdata->startindicessize = eventdata->nstarts;
1483 for( i = 0; i < propdata->nubevents; i++ )
1487 assert(eventdata != NULL);
1488 assert(eventdata->nstarts > 0);
1489 assert(eventdata->startcomponents != NULL);
1490 assert(eventdata->startindices != NULL);
1493 if( eventdata->startindicessize != eventdata->nstarts )
1496 eventdata->nstarts) );
1498 eventdata->nstarts) );
1499 eventdata->startindicessize = eventdata->nstarts;
1534 int* strongcomponents;
1535 int* strongcompstartidx;
1539 assert(scip != NULL);
1540 assert(propdata != NULL);
1541 assert(propdata->componentsstart == NULL);
1543 SCIPdebugMsg(scip,
"(re-)sort genvbounds topologically\n");
1549 for( i = 0; i < propdata->ngenvbounds; i++ )
1554 assert(i < propdata->ngenvbounds);
1556 genvbound = propdata->genvboundstore[i];
1558 for( j = 0; j < genvbound->
ncoefs; j++ )
1583 propdata->componentsstartsize = propdata->ncomponents + 1;
1591 propdata->componentsstart[propdata->ncomponents] = propdata->ngenvbounds;
1592 for( i = 0; i < propdata->ncomponents; i++ )
1597 int nstrongcomponents;
1600 propdata->componentsstart[i] = sortedindex;
1606 &nstrongcomponents) );
1608 for( j = 0; j <
nnodes; ++j )
1615 node = strongcomponents[nnodes - j - 1];
1617 assert(node < propdata->ngenvbounds);
1618 genvboundssorted[sortedindex] = propdata->genvboundstore[node];
1624 for( j = 0; j <
nnodes; j++ )
1626 assert(nodes[j] < propdata->ngenvbounds);
1627 genvboundssorted[sortedindex] = propdata->genvboundstore[nodes[j]];
1632 assert(sortedindex == propdata->ngenvbounds);
1635 for( i = 0; i < propdata->ngenvbounds; i++ )
1637 assert(genvboundssorted[i] != NULL);
1639 propdata->genvboundstore[i] = genvboundssorted[i];
1640 propdata->genvboundstore[i]->
index = i;
1652 propdata->issorted =
TRUE;
1655 SCIPdebugMsg(scip,
"genvbounds got: %d\n", propdata->ngenvbounds);
1656 for( i = 0; i < propdata->ncomponents; i++ )
1662 for( j = propdata->componentsstart[i]; j < propdata->componentsstart[i+1]; j++ )
1665 printGenVBound(scip, propdata->genvboundstore[j]);
1686 int* startingcomponents;
1687 int* startingindices;
1691 SCIPdebugMsg(scip,
"applying %s genvbound propagation in depth %d\n", global ?
1694 assert(scip != NULL);
1695 assert(prop != NULL);
1696 assert(result != NULL);
1699 assert(propdata != NULL);
1700 assert(propdata->genvboundstore != NULL);
1708 if( !propdata->issorted )
1714 for( j = 0; j < propdata->ngenvbounds && *result !=
SCIP_CUTOFF; j++ )
1722 SCIPdebugMsg(scip,
"applying genvbound with index %d (unsorted mode)\n", j);
1731 startingcomponents = global ? propdata->gstartcomponents : propdata->startcomponents;
1732 startingindices = global ? propdata->gstartindices : propdata->startindices;
1733 nindices = global ? propdata->ngindices : propdata->nindices;
1735 for( i = 0; i < nindices && *result !=
SCIP_CUTOFF; i++ )
1739 SCIPdebugMsg(scip,
"starting in component %d at index %d\n", startingcomponents[i], startingindices[i]);
1740 for( j = startingindices[i]; j < propdata->componentsstart[startingcomponents[i] + 1] &&
1743 assert(j < propdata->ngenvbounds);
1751 SCIPdebugMsg(scip,
"applying genvbound with index %d, component %d\n", j, startingcomponents[i]);
1775 assert(scip != NULL);
1776 assert(propdata != NULL);
1777 assert(propdata->eventhdlr != NULL);
1784 propdata->genvboundstoresize = 2 * nprobvars;
1787 propdata->ngenvbounds = 0;
1806 assert(scip != NULL);
1807 assert(propdata != NULL);
1808 assert(genvbound != NULL);
1809 assert(
getGenVBound(scip, propdata, genvbound->var, genvbound->boundtype) == NULL);
1811 hashmap = genvbound->boundtype ==
SCIP_BOUNDTYPE_LOWER ? propdata->lbgenvbounds : propdata->ubgenvbounds;
1817 assert(propdata->ngenvbounds <= propdata->genvboundstoresize);
1818 if( propdata->ngenvbounds == propdata->genvboundstoresize )
1820 int oldsize = propdata->genvboundstoresize;
1821 propdata->genvboundstoresize = 2*propdata->genvboundstoresize + 1;
1827 propdata->genvboundstore[propdata->ngenvbounds] = genvbound;
1828 genvbound->index = propdata->ngenvbounds;
1829 propdata->ngenvbounds++;
1831 assert(propdata->ngenvbounds <= propdata->genvboundstoresize);
1846 assert(scip != NULL);
1847 assert(propdata != NULL);
1848 assert(propdata->prop != NULL);
1849 assert(result != NULL);
1856 if( !propdata->issorted )
1882 if( propdata->lbevents == NULL )
1891 if( propdata->ngindices > 0 )
1907 if(
SCIPgetDepth(scip) > 0 || propdata->propinrootnode )
1910 if( !propdata->issorted || (
SCIPgetCurrentNode(scip) == propdata->lastnodecaught && propdata->nindices > 0 ) )
1930 assert(scip != NULL);
1931 assert(propdata != NULL);
1932 assert(propdata->propasconss);
1935 if( propdata->cutoffboundvar == NULL )
1943 SCIPdebugMsg(scip,
"initialize cutoffboundvar with UB = %e\n", ub);
1958 assert(propdata->cutoffboundvar != NULL);
1961 for( i = 0; i < propdata->ngenvbounds; ++i )
1971 genvbound = propdata->genvboundstore[i];
1972 assert(genvbound != NULL);
1974 nvars = genvbound->
ncoefs + 2;
1981 for( j = 0; j < genvbound->
ncoefs; j++ )
1983 vars[j] = genvbound->
vars[j];
1984 vals[j] = genvbound->
coefs[j];
1989 vars[genvbound->
ncoefs] = genvbound->
var;
1995 vars[genvbound->
ncoefs + 1] = propdata->cutoffboundvar;
2015 if( propdata->ngenvbounds > 0 )
2017 assert(propdata->genvboundstore != NULL);
2019 for( i = propdata->ngenvbounds - 1; i >= 0; i-- )
2038 propdata->genvboundstore = NULL;
2039 propdata->genvboundstoresize = 0;
2040 propdata->ngenvbounds = 0;
2074 assert(scip != NULL);
2075 assert(genvboundprop != NULL);
2077 assert(vars != NULL);
2078 assert(var != NULL);
2079 assert(
coefs != NULL);
2081 assert(coefcutoffbound <= 0.0);
2086 SCIPerrorMessage(
"cannot create generalized variable bound from invalid data\n");
2091 assert(propdata != NULL);
2094 if( propdata->genvboundstore == NULL )
2100 newgenvbound = (genvbound == NULL);
2105 for( i = 0; i < genvbound->
ncoefs; ++i )
2107 assert(genvbound->
vars[i] != NULL);
2124 else if( !newgenvbound && genvbound->
ncoefs ==
ncoefs )
2127 for( i = 0; i <
ncoefs; i++ )
2130 genvbound->
vars[i] = vars[i];
2144 for( i = 0; i <
ncoefs; i++ )
2147 genvbound->
vars[i] = vars[i];
2150 else if( newgenvbound )
2168 for( i = 0; i < genvbound->
ncoefs; ++i )
2170 assert(genvbound->
vars[i] != NULL);
2175 assert(genvbound->
var != NULL);
2210 propdata->issorted =
FALSE;
2214 SCIPdebug( printGenVBound(scip, genvbound) );
2215 #ifdef WITH_DEBUG_SOLUTION 2216 SCIP_CALL( checkDebugSolutionGenVBound(scip, genvbound) );
2234 assert(scip != NULL);
2235 assert(prop != NULL);
2250 assert(scip != NULL);
2251 assert(prop != NULL);
2256 assert(propdata != NULL);
2258 propdata->genvboundstore = NULL;
2259 propdata->genvboundstoresize = 0;
2260 propdata->lbevents = NULL;
2261 propdata->ubevents = NULL;
2262 propdata->lbgenvbounds = NULL;
2263 propdata->ubgenvbounds = NULL;
2264 propdata->lbeventsmap = NULL;
2265 propdata->ubeventsmap = NULL;
2266 propdata->startmap = NULL;
2267 propdata->componentsstart = NULL;
2268 propdata->startindices = NULL;
2269 propdata->startcomponents = NULL;
2270 propdata->gstartindices = NULL;
2271 propdata->gstartcomponents = NULL;
2273 propdata->lastnodecaught = NULL;
2274 propdata->cutoffboundvar = NULL;
2275 propdata->ngenvbounds = -1;
2276 propdata->ncomponents = -1;
2277 propdata->nindices = -1;
2278 propdata->ngindices = -1;
2279 propdata->nlbevents = -1;
2280 propdata->nubevents = -1;
2281 propdata->issorted =
FALSE;
2283 propdata->prop = prop;
2295 assert(scip != NULL);
2296 assert(prop != NULL);
2306 assert(propdata != NULL);
2311 if( propdata->ngenvbounds < 1 )
2330 assert(scip != NULL);
2331 assert(prop != NULL);
2336 assert(propdata != NULL);
2339 if( propdata->cutoffboundvar != NULL )
2341 SCIPdebugMsg(scip,
"propinitpre in problem <%s>: locking cutoffboundvar (current downlocks=%d, uplocks=%d)\n",
2360 assert(scip != NULL);
2361 assert(prop != NULL);
2364 SCIPdebugMsg(scip,
"propexitpre in problem <%s>: removing fixed, aggregated, negated, and multi-aggregated variables from right-hand side\n",
2369 assert(propdata != NULL);
2372 assert(propdata->lbevents == NULL);
2373 assert(propdata->ubevents == NULL);
2378 for( i = 0; i < propdata->ngenvbounds; )
2385 genvbound = propdata->genvboundstore[i];
2386 assert(genvbound != NULL);
2391 nvars = genvbound->
ncoefs;
2399 if( requiredsize > genvbound->
ncoefs )
2402 if( genvbound->
coefssize < requiredsize )
2410 assert(requiredsize <= genvbound->
ncoefs);
2414 for( j = 0; j < genvbound->
ncoefs; ++j )
2416 assert(genvbound->
vars[j] != NULL);
2419 for( j = 0; j < nvars; ++j )
2421 assert(vars[j] != NULL);
2445 --(propdata->ngenvbounds);
2448 if( i < propdata->ngenvbounds )
2450 propdata->genvboundstore[i] = propdata->genvboundstore[propdata->ngenvbounds];
2451 propdata->genvboundstore[i]->index = i;
2454 propdata->issorted =
FALSE;
2472 assert(scip != NULL);
2473 assert(prop != NULL);
2478 assert(propdata != NULL);
2492 assert(scip != NULL);
2493 assert(prop != NULL);
2504 assert(propdata != NULL);
2507 if( propdata->cutoffboundvar != NULL )
2514 assert(propdata->propasconss);
2526 SCIPdebugMsg(scip,
"tightened UB of cutoffboundvar to %e (old: %e, infeas: %u, tightened: %u)\n",
2527 newub, oldub, infeasible, tightened);
2530 assert(infeasible ==
FALSE);
2538 if( propdata->ngenvbounds < 1 )
2546 if( propdata->propasconss )
2575 SCIPdebugMsg(scip,
"explain %s bound change of variable <%s>\n",
2580 assert(propdata != NULL);
2581 assert(propdata->genvboundstore != NULL);
2586 assert(inferinfo >= 0);
2587 assert(inferinfo < propdata->ngenvbounds);
2592 if( inferinfo >= propdata->ngenvbounds)
2594 SCIPerrorMessage(
"generalized variable bounds propagator received inferinfo out of range; propagation not resolved, safe to continue\n");
2599 genvbound = propdata->genvboundstore[inferinfo];
2600 assert(genvbound != NULL);
2601 assert(genvbound->
var == infervar);
2604 if( genvbound->
var != infervar )
2606 SCIPerrorMessage(
"generalized variable bounds propagator received incorrect inferinfo; propagation not resolved, but it's safe to continue\n");
2623 boundval = MIN(boundval, roundedboundval);
2641 assert(scip != NULL);
2642 assert(prop != NULL);
2649 assert(propdata != NULL);
2673 assert(propdata != NULL);
2693 assert(scip != NULL);
2694 assert(eventdata != NULL);
2699 assert(eventdata->startcomponents != NULL);
2700 assert(eventdata->startindices != NULL);
2701 assert(eventdata->nstarts > 0);
2702 assert(eventdata->prop != NULL);
2705 assert(propdata != NULL);
2707 assert(propdata->startcomponents != NULL);
2708 assert(propdata->startmap != NULL);
2709 assert(propdata->startindices != NULL);
2722 for( i = 0; i < eventdata->nstarts; i++ )
2727 component = eventdata->startcomponents[i];
2728 assert(component >= 0);
2729 startidx = eventdata->startindices[i];
2737 componentidx = ((int)(
size_t)
SCIPhashmapGetImage(propdata->startmap, (
void*)(
size_t) (component + 1))) - 1;
2738 assert(componentidx >= 0);
2739 assert(propdata->startcomponents[componentidx] == component);
2741 if( propdata->startindices[componentidx] > startidx )
2742 propdata->startindices[componentidx] = startidx;
2748 componentidx = propdata->nindices;
2751 propdata->startcomponents[componentidx] = component;
2752 propdata->startindices[componentidx] = startidx;
2756 (
void*)(
size_t) (componentidx + 1)) );
2759 propdata->nindices++;
2783 propExecGenvbounds, propdata) );
2797 "apply global propagation?",
2801 "apply genvbounds in root node if no new incumbent was found?",
2805 "sort genvbounds and wait for bound change events?",
2809 "should genvbounds be transformed to (linear) constraints?",
enum SCIP_Result SCIP_RESULT
SCIP_RETCODE SCIPsetPropPresol(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPPRESOL((*proppresol)), int presolpriority, int presolmaxrounds, SCIP_PRESOLTIMING presoltiming)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
enum SCIP_BoundType SCIP_BOUNDTYPE
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
static SCIP_RETCODE applyGenVBound(SCIP *scip, SCIP_PROP *prop, GENVBOUND *genvbound, SCIP_Bool global, SCIP_RESULT *result, int *nchgbds)
SCIP_Real SCIPfeastol(SCIP *scip)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_Real SCIPgetVarUbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
static SCIP_RETCODE freeComponentsData(SCIP *scip, SCIP_PROPDATA *propdata)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPgetVarLbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
static SCIP_RETCODE freeGenVBound(SCIP *scip, GENVBOUND *genvbound)
static SCIP_RETCODE execGenVBounds(SCIP *scip, SCIP_PROPDATA *propdata, SCIP_RESULT *result, SCIP_Bool local, int *nchgbds)
SCIP_RETCODE SCIPcatchVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
static SCIP_RETCODE initPropdata(SCIP *scip, SCIP_PROPDATA *propdata)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
static SCIP_RETCODE applyGenVBounds(SCIP *scip, SCIP_PROP *prop, SCIP_Bool global, SCIP_RESULT *result, int *nchgbds)
static SCIP_RETCODE dropAndFreeEvents(SCIP *scip, SCIP_PROPDATA *propdata)
SCIP_RETCODE SCIPdigraphComputeUndirectedComponents(SCIP_DIGRAPH *digraph, int minsize, int *components, int *ncomponents)
#define PROP_PRESOL_MAXROUNDS
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)
SCIP_RETCODE SCIPinferVarLbProp(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_PROP *inferprop, int inferinfo, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
static SCIP_DECL_PROPEXEC(propExecGenvbounds)
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
static SCIP_RETCODE freeAllEventData(SCIP *scip, SCIP_PROPDATA *propdata)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
static SCIP_RETCODE analyzeGenVBoundConflict(SCIP *scip, GENVBOUND *genvbound)
static SCIP_RETCODE freeEventData(SCIP *scip, SCIP_EVENTDATA **eventdata)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPgetConflictVarUb(SCIP *scip, SCIP_VAR *var)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup)
static SCIP_DECL_PROPEXITSOL(propExitsolGenvbounds)
static GENVBOUND * getGenVBound(SCIP *scip, SCIP_PROPDATA *propdata, SCIP_VAR *var, SCIP_BOUNDTYPE boundtype)
SCIP_RETCODE SCIPcreateVarBasic(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype)
SCIP_RETCODE SCIPaddConflictRelaxedLb(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Real relaxedlb)
SCIP_RETCODE SCIPinitConflictAnalysis(SCIP *scip, SCIP_CONFTYPE conftype, SCIP_Bool iscutoffinvolved)
int SCIPdigraphGetNComponents(SCIP_DIGRAPH *digraph)
#define SCIPfreeBlockMemory(scip, ptr)
static SCIP_RETCODE resetLocalStartingData(SCIP *scip, SCIP_PROPDATA *propdata)
#define PROP_PRESOLTIMING
void SCIPdigraphGetComponent(SCIP_DIGRAPH *digraph, int compidx, int **nodes, int *nnodes)
static SCIP_Real getGenVBoundsMinActivity(SCIP *scip, SCIP_VAR **vars, SCIP_Real *coefs, int nvars, SCIP_Bool global)
#define DEFAULT_PROPASCONSS
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
static SCIP_RETCODE fillGlobalStartingData(SCIP *scip, SCIP_PROPDATA *propdata)
#define SCIPdebugMsgPrint
SCIP_RETCODE SCIPdigraphTopoSortComponents(SCIP_DIGRAPH *digraph)
SCIP_RETCODE SCIPcreateDigraph(SCIP *scip, SCIP_DIGRAPH **digraph, int nnodes)
static SCIP_DECL_PROPEXITPRE(propExitpreGenvbounds)
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE addEventData(SCIP *scip, SCIP_PROPDATA *propdata, SCIP_VAR *var, int startindex, int startcomponent, SCIP_BOUNDTYPE boundtype)
const char * SCIPgetProbName(SCIP *scip)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisConflictAnalysisApplicable(SCIP *scip)
int SCIPdigraphGetNNodes(SCIP_DIGRAPH *digraph)
int SCIPgetNFixedVars(SCIP *scip)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_RETCODE SCIPsetPropExitpre(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPEXITPRE((*propexitpre)))
static SCIP_RETCODE addNewGenVBound(SCIP *scip, SCIP_PROPDATA *propdata, GENVBOUND *genvbound)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_Real getGenVBoundsBound(SCIP *scip, GENVBOUND *genvbound, SCIP_Bool global)
static SCIP_RETCODE resolveGenVBoundPropagation(SCIP *scip, GENVBOUND *genvbound, SCIP_BDCHGIDX *bdchgidx, SCIP_Real *boundval, SCIP_Bool *success)
static SCIP_DECL_EVENTEXEC(eventExecGenvbounds)
SCIP_RETCODE SCIPgenVBoundAdd(SCIP *scip, SCIP_PROP *genvboundprop, SCIP_VAR **vars, SCIP_VAR *var, SCIP_Real *coefs, int ncoefs, SCIP_Real coefcutoffbound, SCIP_Real constant, SCIP_BOUNDTYPE boundtype)
#define DEFAULT_PROPAGATE_IN_ROOT_NODE
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
SCIP_Real SCIPgetConflictVarLb(SCIP *scip, SCIP_VAR *var)
static SCIP_DECL_PROPEXIT(propExitGenvbounds)
SCIP_RETCODE SCIPmarkDoNotMultaggrVar(SCIP *scip, SCIP_VAR *var)
static SCIP_Real getGenVBoundsMinActivityConflict(SCIP *scip, SCIP_VAR **vars, SCIP_Real *coefs, int nvars, SCIP_BDCHGIDX *bdchgidx)
struct SCIP_EventData SCIP_EVENTDATA
const char * SCIPvarGetName(SCIP_VAR *var)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
SCIP_RETCODE SCIPtightenVarLbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
#define SCIP_EVENTTYPE_LBTIGHTENED
int SCIPgetNTotalVars(SCIP *scip)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPinferVarUbProp(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_PROP *inferprop, int inferinfo, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
SCIP_RETCODE SCIPdigraphAddArc(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
#define SCIPdebugCheckLbGlobal(scip, var, lb)
#define SCIPdebugGetSolVal(scip, var, val)
static SCIP_RETCODE freeGenVBounds(SCIP *scip, SCIP_PROPDATA *propdata)
#define SCIPdebugCheckUbGlobal(scip, var, ub)
#define PROP_PRESOL_PRIORITY
static SCIP_RETCODE createConstraints(SCIP *scip, SCIP_PROPDATA *propdata)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_RETCODE SCIPsetPropInit(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPINIT((*propinit)))
static SCIP_RETCODE setUpEvents(SCIP *scip, SCIP_PROPDATA *propdata)
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
int SCIPgetDepth(SCIP *scip)
int SCIPvarGetNLocksUp(SCIP_VAR *var)
SCIP_RETCODE SCIPaddConflictRelaxedUb(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Real relaxedub)
static SCIP_Real getCutoffboundGenVBound(SCIP *scip)
SCIP_RETCODE SCIPsetPropCopy(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPCOPY((*propcopy)))
SCIP_RETCODE SCIPdropVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
SCIP_RETCODE SCIPdigraphComputeDirectedComponents(SCIP_DIGRAPH *digraph, int compidx, int *strongcomponents, int *strongcompstartidx, int *nstrongcomponents)
#define BMScopyMemoryArray(ptr, source, num)
static SCIP_DECL_PROPFREE(propFreeGenvbounds)
static SCIP_DECL_PROPINITPRE(propInitpreGenvbounds)
#define SCIP_EVENTTYPE_UBTIGHTENED
Constraint handler for linear constraints in their most general form, .
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPgetTransObjscale(SCIP *scip)
SCIP_RETCODE SCIPsetPropExitsol(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPEXITSOL((*propexitsol)))
SCIP_Bool SCIPinProbing(SCIP *scip)
const char * SCIPpropGetName(SCIP_PROP *prop)
int SCIPgetNVars(SCIP *scip)
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_Real SCIPgetTransObjoffset(SCIP *scip)
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
int SCIPvarGetNLocksDown(SCIP_VAR *var)
SCIP_RETCODE SCIPsetPropResprop(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPRESPROP((*propresprop)))
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_Bool SCIPallowDualReds(SCIP *scip)
static SCIP_RETCODE createStartingData(SCIP *scip, SCIP_PROPDATA *propdata)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
static SCIP_RETCODE getEventData(SCIP *scip, SCIP_PROPDATA *propdata, SCIP_VAR *var, SCIP_BOUNDTYPE boundtype, SCIP_EVENTDATA **eventdata)
struct SCIP_PropData SCIP_PROPDATA
static SCIP_RETCODE sortGenVBounds(SCIP *scip, SCIP_PROPDATA *propdata)
SCIP_RETCODE SCIPsetPropFree(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPFREE((*propfree)))
SCIP_PROPDATA * SCIPpropGetData(SCIP_PROP *prop)
void SCIPpropSetData(SCIP_PROP *prop, SCIP_PROPDATA *propdata)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define DEFAULT_GLOBAL_PROPAGATION
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
static SCIP_DECL_PROPCOPY(propCopyGenvbounds)
SCIP_RETCODE SCIPtightenVarUbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_RETCODE SCIPincludePropGenvbounds(SCIP *scip)
static SCIP_DECL_PROPRESPROP(propRespropGenvbounds)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
#define BMSclearMemoryArray(ptr, num)
SCIP_RETCODE SCIPsetPropInitpre(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPINITPRE((*propinitpre)))
void SCIPdigraphFree(SCIP_DIGRAPH **digraph)
SCIP_RETCODE SCIPsetPropExit(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPEXIT((*propexit)))
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
static SCIP_RETCODE freeStartingData(SCIP *scip, SCIP_PROPDATA *propdata)
SCIP_Bool SCIPisInRestart(SCIP *scip)
static SCIP_DECL_PROPPRESOL(propPresolGenvbounds)
SCIP_RETCODE SCIPanalyzeConflict(SCIP *scip, int validdepth, SCIP_Bool *success)
SCIP_Bool SCIPallowObjProp(SCIP *scip)
static SCIP_DECL_PROPINIT(propInitGenvbounds)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
generalized variable bounds propagator
SCIP_RETCODE SCIPincludePropBasic(SCIP *scip, SCIP_PROP **propptr, const char *name, const char *desc, int priority, int freq, SCIP_Bool delay, SCIP_PROPTIMING timingmask, SCIP_DECL_PROPEXEC((*propexec)), SCIP_PROPDATA *propdata)