From 64a75c572903407cd7a7178e2964d79ad45adda1 Mon Sep 17 00:00:00 2001 From: Dominik Kamp Date: Mon, 25 Mar 2024 19:41:15 +0100 Subject: [PATCH] Correct infinite linear activity bounds --- CHANGELOG | 3 + src/scip/cons_linear.c | 298 +++++++++++++++++++---------------------- 2 files changed, 141 insertions(+), 160 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 66bf83df97..61caa66d2a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,10 +16,13 @@ Fixed bugs - use quad precision to calculate residual activity bounds to reduce numerical errors for large variable bounds in cons_linear.c - in SCIPsolveProbingLP() when objective has been changed do not return cutoff due to exceeding the cutoff bound - set probing LP to be a relaxation only when objective has not been changed +- declare contradicting infinities in getMinActivity() and getMaxActivity() as non-tight Miscellaneous ------------- +- redefine isrelax to istight in cons_linear.c + Build system ------------ diff --git a/src/scip/cons_linear.c b/src/scip/cons_linear.c index c233a38cf2..51186e4a87 100644 --- a/src/scip/cons_linear.c +++ b/src/scip/cons_linear.c @@ -2411,8 +2411,8 @@ void getMinActivity( SCIP_Bool global, /**< should the global or local minimal activity be returned? */ SCIP_Bool goodrelax, /**< should a good relaxation be computed or are relaxed acticities ignored, anyway? */ SCIP_Real* minactivity, /**< pointer to store the minimal activity */ - SCIP_Bool* isrelax, /**< pointer to store whether the activity is a relaxation, - * i.e. is <= the exact minactivity (in case of huge contributing values) */ + SCIP_Bool* istight, /**< pointer to store whether activity bound is tight to variable bounds + * i.e. is the actual minactivity (otherwise a lower bound is provided) */ SCIP_Bool* issettoinfinity /**< pointer to store whether minactivity was set to infinity or calculated */ ) { @@ -2423,36 +2423,29 @@ void getMinActivity( assert(poshuge >= 0); assert(neghuge >= 0); assert(minactivity != NULL); - assert(isrelax != NULL); + assert(istight != NULL); assert(issettoinfinity != NULL); - /* if we have pos. infinite contributions, the minactivity is +infty */ - if( posinf > 0 ) - { - *minactivity = SCIPinfinity(scip); - *issettoinfinity = TRUE; - *isrelax = FALSE; - } - /* if we have neg. (and no pos.) infinite contributions, the minactivity is -infty */ - else if( neginf > 0 ) + /* if we have neg. infinite contributions, the minactivity is -infty */ + if( neginf > 0 ) { *minactivity = -SCIPinfinity(scip); *issettoinfinity = TRUE; - *isrelax = FALSE; + *istight = posinf == 0; } - /* if we have neg. huge contributions, we only know that -infty is a relaxation of the minactivity */ - else if( neghuge > 0 ) + /* if we have pos. (and no neg.) infinite contributions, the minactivity is +infty */ + else if( posinf > 0 ) { - *minactivity = -SCIPinfinity(scip); + *minactivity = SCIPinfinity(scip); *issettoinfinity = TRUE; - *isrelax = TRUE; + *istight = TRUE; } - /* we do not need a good relaxation and we have positive huge contributions, so we just return -infty as activity */ - else if( !goodrelax && poshuge > 0 ) + /* if we have neg. huge contributions or do not need a good relaxation, we just return -infty as minactivity */ + else if( neghuge > 0 || ( poshuge > 0 && !goodrelax ) ) { *minactivity = -SCIPinfinity(scip); *issettoinfinity = TRUE; - *isrelax = TRUE; + *istight = FALSE; } else { @@ -2485,11 +2478,11 @@ void getMinActivity( if( poshuge > 0 ) { SCIPquadprecSumQD(tmpactivity, tmpactivity, poshuge * SCIPgetHugeValue(scip)); - *isrelax = TRUE; + *istight = FALSE; } - /* all counters are zero, so the minactivity is complete */ + /* all counters are zero, so the minactivity is tight */ else - *isrelax = FALSE; + *istight = TRUE; /* round residual minactivity */ *minactivity = QUAD_TO_DBL(tmpactivity); @@ -2513,8 +2506,8 @@ void getMaxActivity( SCIP_Bool global, /**< should the global or local maximal activity be returned? */ SCIP_Bool goodrelax, /**< should a good relaxation be computed or are relaxed acticities ignored, anyway? */ SCIP_Real* maxactivity, /**< pointer to store the maximal activity */ - SCIP_Bool* isrelax, /**< pointer to store whether the activity is a relaxation, - * i.e. is >= the exact maxactivity (in case of huge contributing values) */ + SCIP_Bool* istight, /**< pointer to store whether activity bound is tight to variable bounds + * i.e. is the actual maxactivity (otherwise an upper bound is provided) */ SCIP_Bool* issettoinfinity /**< pointer to store whether maxactivity was set to infinity or calculated */ ) { @@ -2525,36 +2518,29 @@ void getMaxActivity( assert(poshuge >= 0); assert(neghuge >= 0); assert(maxactivity != NULL); - assert(isrelax != NULL); + assert(istight != NULL); assert(issettoinfinity != NULL); - /* if we have neg. infinite contributions, the maxactivity is -infty */ - if( neginf > 0 ) - { - *maxactivity = -SCIPinfinity(scip); - *issettoinfinity = TRUE; - *isrelax = FALSE; - } - /* if we have pos. (and no neg.) infinite contributions, the maxactivity is +infty */ - else if( posinf > 0 ) + /* if we have pos. infinite contributions, the maxactivity is +infty */ + if( posinf > 0 ) { *maxactivity = SCIPinfinity(scip); *issettoinfinity = TRUE; - *isrelax = FALSE; + *istight = neginf == 0; } - /* if we have pos. huge contributions, we only know that +infty is a relaxation of the maxactivity */ - else if( poshuge > 0 ) + /* if we have neg. (and no pos.) infinite contributions, the maxactivity is -infty */ + else if( neginf > 0 ) { - *maxactivity = SCIPinfinity(scip); + *maxactivity = -SCIPinfinity(scip); *issettoinfinity = TRUE; - *isrelax = TRUE; + *istight = TRUE; } - /* we do not need a good relaxation and we have positve huge contributions, so we just return +infty as activity */ - else if( !goodrelax && neghuge > 0 ) + /* if we have pos. huge contributions or do not need a good relaxation, we just return +infty as maxactivity */ + else if( poshuge > 0 || ( neghuge > 0 && !goodrelax ) ) { *maxactivity = SCIPinfinity(scip); *issettoinfinity = TRUE; - *isrelax = TRUE; + *istight = FALSE; } else { @@ -2587,11 +2573,11 @@ void getMaxActivity( if( neghuge > 0 ) { SCIPquadprecSumQD(tmpactivity, tmpactivity, -neghuge * SCIPgetHugeValue(scip)); - *isrelax = TRUE; + *istight = FALSE; } - /* all counters are zero, so the maxactivity is complete */ + /* all counters are zero, so the maxactivity is tight */ else - *isrelax = FALSE; + *istight = TRUE; /* round residual maxactivity */ *maxactivity = QUAD_TO_DBL(tmpactivity); @@ -2608,12 +2594,10 @@ void consdataGetActivityBounds( * relaxed activities ignored, anyway? */ SCIP_Real* minactivity, /**< pointer to store the minimal activity */ SCIP_Real* maxactivity, /**< pointer to store the maximal activity */ - SCIP_Bool* minisrelax, /**< pointer to store whether the returned minactivity is just a relaxation, - * i.e. <= the exact minactivity (in case of huge contributions), - * or equal to the exact minimal activity */ - SCIP_Bool* maxisrelax, /**< pointer to store whether the returned maxactivity is just a relaxation, - * i.e. >= the exact maxactivity (in case of huge contributions), - * or equal to the exact maximal activity */ + SCIP_Bool* ismintight, /**< pointer to store whether the minactivity bound is tight + * i.e. is the actual minactivity (otherwise a lower bound is provided) */ + SCIP_Bool* ismaxtight, /**< pointer to store whether the maxactivity bound is tight + * i.e. is the actual maxactivity (otherwise an upper bound is provided) */ SCIP_Bool* isminsettoinfinity, /**< pointer to store whether minactivity was set to infinity or calculated */ SCIP_Bool* ismaxsettoinfinity /**< pointer to store whether maxactivity was set to infinity or calculated */ @@ -2641,11 +2625,11 @@ void consdataGetActivityBounds( getMinActivity(scip, consdata, consdata->minactivityposinf, consdata->minactivityneginf, consdata->minactivityposhuge, consdata->minactivityneghuge, 0.0, FALSE, goodrelax, - minactivity, minisrelax, isminsettoinfinity); + minactivity, ismintight, isminsettoinfinity); getMaxActivity(scip, consdata, consdata->maxactivityposinf, consdata->maxactivityneginf, consdata->maxactivityposhuge, consdata->maxactivityneghuge, 0.0, FALSE, goodrelax, - maxactivity, maxisrelax, ismaxsettoinfinity); + maxactivity, ismaxtight, ismaxsettoinfinity); } /** calculates activity bounds for constraint after setting variable to zero */ @@ -2740,12 +2724,10 @@ void consdataGetActivityResiduals( * relaxed acticities ignored, anyway? */ SCIP_Real* minresactivity, /**< pointer to store the minimal residual activity */ SCIP_Real* maxresactivity, /**< pointer to store the maximal residual activity */ - SCIP_Bool* minisrelax, /**< pointer to store whether the returned residual minactivity is just a - * relaxation, i.e. <= the exact residual minactivity (in case of huge - * contributions), or equal to the exact residual minactivity */ - SCIP_Bool* maxisrelax, /**< pointer to store whether the returned residual maxactivity is just a - * relaxation, i.e. <= the exact residual maxactivity (in case of huge - * contributions), or equal to the exact residual minactivity */ + SCIP_Bool* ismintight, /**< pointer to store whether the residual minactivity bound is tight + * i.e. is the actual residual minactivity (otherwise a lower bound is provided) */ + SCIP_Bool* ismaxtight, /**< pointer to store whether the residual maxactivity bound is tight + * i.e. is the actual residual maxactivity (otherwise an upper bound is provided) */ SCIP_Bool* isminsettoinfinity, /**< pointer to store whether minresactivity was set to infinity or calculated */ SCIP_Bool* ismaxsettoinfinity /**< pointer to store whether maxresactivity was set to infinity or calculated */ ) @@ -2759,8 +2741,8 @@ void consdataGetActivityResiduals( assert(var != NULL); assert(minresactivity != NULL); assert(maxresactivity != NULL); - assert(minisrelax != NULL); - assert(maxisrelax != NULL); + assert(ismintight != NULL); + assert(ismaxtight != NULL); assert(isminsettoinfinity != NULL); assert(ismaxsettoinfinity != NULL); @@ -2804,7 +2786,7 @@ void consdataGetActivityResiduals( getMinActivity(scip, consdata, consdata->minactivityposinf - 1, consdata->minactivityneginf, consdata->minactivityposhuge, consdata->minactivityneghuge, 0.0, FALSE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } else if( SCIPisInfinity(scip, -minactbound) ) { @@ -2812,7 +2794,7 @@ void consdataGetActivityResiduals( getMinActivity(scip, consdata, consdata->minactivityposinf, consdata->minactivityneginf - 1, consdata->minactivityposhuge, consdata->minactivityneghuge, 0.0, FALSE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } else if( SCIPisHugeValue(scip, minactbound * absval) ) { @@ -2820,7 +2802,7 @@ void consdataGetActivityResiduals( getMinActivity(scip, consdata, consdata->minactivityposinf, consdata->minactivityneginf, consdata->minactivityposhuge - 1, consdata->minactivityneghuge, 0.0, FALSE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } else if( SCIPisHugeValue(scip, -minactbound * absval) ) { @@ -2828,13 +2810,13 @@ void consdataGetActivityResiduals( getMinActivity(scip, consdata, consdata->minactivityposinf, consdata->minactivityneginf, consdata->minactivityposhuge, consdata->minactivityneghuge - 1, 0.0, FALSE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } else { getMinActivity(scip, consdata, consdata->minactivityposinf, consdata->minactivityneginf, consdata->minactivityposhuge, consdata->minactivityneghuge, absval * minactbound, FALSE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } /* get/compute maxactivity by calling getMaxActivity() with updated counters for infinite and huge values @@ -2846,7 +2828,7 @@ void consdataGetActivityResiduals( getMaxActivity(scip, consdata, consdata->maxactivityposinf, consdata->maxactivityneginf - 1, consdata->maxactivityposhuge, consdata->maxactivityneghuge, 0.0, FALSE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } else if( SCIPisInfinity(scip, maxactbound) ) { @@ -2854,7 +2836,7 @@ void consdataGetActivityResiduals( getMaxActivity(scip, consdata, consdata->maxactivityposinf - 1, consdata->maxactivityneginf, consdata->maxactivityposhuge, consdata->maxactivityneghuge, 0.0, FALSE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } else if( SCIPisHugeValue(scip, absval * maxactbound) ) { @@ -2862,7 +2844,7 @@ void consdataGetActivityResiduals( getMaxActivity(scip, consdata, consdata->maxactivityposinf, consdata->maxactivityneginf, consdata->maxactivityposhuge - 1, consdata->maxactivityneghuge, 0.0, FALSE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } else if( SCIPisHugeValue(scip, -absval * maxactbound) ) { @@ -2870,13 +2852,13 @@ void consdataGetActivityResiduals( getMaxActivity(scip, consdata, consdata->maxactivityposinf, consdata->maxactivityneginf, consdata->maxactivityposhuge, consdata->maxactivityneghuge - 1, 0.0, FALSE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } else { getMaxActivity(scip, consdata, consdata->maxactivityposinf, consdata->maxactivityneginf, consdata->maxactivityposhuge, consdata->maxactivityneghuge, absval * maxactbound, FALSE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } } @@ -2889,20 +2871,18 @@ void consdataGetGlbActivityBounds( * relaxed acticities ignored, anyway? */ SCIP_Real* glbminactivity, /**< pointer to store the minimal activity, or NULL, if not needed */ SCIP_Real* glbmaxactivity, /**< pointer to store the maximal activity, or NULL, if not needed */ - SCIP_Bool* minisrelax, /**< pointer to store whether the returned minactivity is just a relaxation, - * i.e. <= the exact minactivity (in case of huge contributions), - * or equal to the exact minimal activity */ - SCIP_Bool* maxisrelax, /**< pointer to store whether the returned maxactivity is just a relaxation, - * i.e. >= the exact maxactivity (in case of huge contributions), - * or equal to the exact maximal activity */ + SCIP_Bool* ismintight, /**< pointer to store whether the minactivity bound is tight + * i.e. is the actual minactivity (otherwise a lower bound is provided) */ + SCIP_Bool* ismaxtight, /**< pointer to store whether the maxactivity bound is tight + * i.e. is the actual maxactivity (otherwise an upper bound is provided) */ SCIP_Bool* isminsettoinfinity, /**< pointer to store whether minresactivity was set to infinity or calculated */ SCIP_Bool* ismaxsettoinfinity /**< pointer to store whether maxresactivity was set to infinity or calculated */ ) { assert(scip != NULL); assert(consdata != NULL); - assert((glbminactivity != NULL && minisrelax != NULL && isminsettoinfinity != NULL) - || (glbmaxactivity != NULL && maxisrelax != NULL && ismaxsettoinfinity != NULL)); + assert((glbminactivity != NULL && ismintight != NULL && isminsettoinfinity != NULL) + || (glbmaxactivity != NULL && ismaxtight != NULL && ismaxsettoinfinity != NULL)); if( !consdata->validactivities ) { @@ -2924,21 +2904,21 @@ void consdataGetGlbActivityBounds( if( glbminactivity != NULL ) { assert(isminsettoinfinity != NULL); - assert(minisrelax != NULL); + assert(ismintight != NULL); getMinActivity(scip, consdata, consdata->glbminactivityposinf, consdata->glbminactivityneginf, consdata->glbminactivityposhuge, consdata->glbminactivityneghuge, 0.0, TRUE, goodrelax, - glbminactivity, minisrelax, isminsettoinfinity); + glbminactivity, ismintight, isminsettoinfinity); } if( glbmaxactivity != NULL ) { assert(ismaxsettoinfinity != NULL); - assert(maxisrelax != NULL); + assert(ismaxtight != NULL); getMaxActivity(scip, consdata, consdata->glbmaxactivityposinf, consdata->glbmaxactivityneginf, consdata->glbmaxactivityposhuge, consdata->glbmaxactivityneghuge, 0.0, TRUE, goodrelax, - glbmaxactivity, maxisrelax, ismaxsettoinfinity); + glbmaxactivity, ismaxtight, ismaxsettoinfinity); } } @@ -2953,12 +2933,10 @@ void consdataGetGlbActivityResiduals( * relaxed acticities ignored, anyway? */ SCIP_Real* minresactivity, /**< pointer to store the minimal residual activity, or NULL, if not needed */ SCIP_Real* maxresactivity, /**< pointer to store the maximal residual activity, or NULL, if not needed */ - SCIP_Bool* minisrelax, /**< pointer to store whether the returned residual minactivity is just a - * relaxation, i.e. <= the exact residual minactivity (in case of huge - * contributions), or equal to the exact residual minactivity */ - SCIP_Bool* maxisrelax, /**< pointer to store whether the returned residual maxactivity is just a - * relaxation, i.e. <= the exact residual maxactivity (in case of huge - * contributions), or equal to the exact residual minactivity */ + SCIP_Bool* ismintight, /**< pointer to store whether the residual minactivity bound is tight + * i.e. is the actual residual minactivity (otherwise a lower bound is provided) */ + SCIP_Bool* ismaxtight, /**< pointer to store whether the residual maxactivity bound is tight + * i.e. is the actual residual maxactivity (otherwise an upper bound is provided) */ SCIP_Bool* isminsettoinfinity, /**< pointer to store whether minresactivity was set to infinity or calculated */ SCIP_Bool* ismaxsettoinfinity /**< pointer to store whether maxresactivity was set to infinity or calculated */ ) @@ -2970,8 +2948,8 @@ void consdataGetGlbActivityResiduals( assert(scip != NULL); assert(consdata != NULL); assert(var != NULL); - assert((minresactivity != NULL && minisrelax != NULL && isminsettoinfinity != NULL ) - || (maxresactivity != NULL && maxisrelax != NULL && ismaxsettoinfinity != NULL)); + assert((minresactivity != NULL && ismintight != NULL && isminsettoinfinity != NULL ) + || (maxresactivity != NULL && ismaxtight != NULL && ismaxsettoinfinity != NULL)); /* get activity bounds of linear constraint */ if( !consdata->validactivities ) @@ -3000,7 +2978,7 @@ void consdataGetGlbActivityResiduals( if( minresactivity != NULL ) { assert(isminsettoinfinity != NULL); - assert(minisrelax != NULL); + assert(ismintight != NULL); /* get/compute minactivity by calling getMinActivity() with updated counters for infinite and huge values * and contribution of variable set to zero that has to be subtracted from finite part of activity @@ -3011,7 +2989,7 @@ void consdataGetGlbActivityResiduals( getMinActivity(scip, consdata, consdata->glbminactivityposinf - 1, consdata->glbminactivityneginf, consdata->glbminactivityposhuge, consdata->glbminactivityneghuge, 0.0, TRUE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } else if( SCIPisInfinity(scip, -minactbound) ) { @@ -3019,7 +2997,7 @@ void consdataGetGlbActivityResiduals( getMinActivity(scip, consdata, consdata->glbminactivityposinf, consdata->glbminactivityneginf - 1, consdata->glbminactivityposhuge, consdata->glbminactivityneghuge, 0.0, TRUE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } else if( SCIPisHugeValue(scip, minactbound * absval) ) { @@ -3027,7 +3005,7 @@ void consdataGetGlbActivityResiduals( getMinActivity(scip, consdata, consdata->glbminactivityposinf, consdata->glbminactivityneginf, consdata->glbminactivityposhuge - 1, consdata->glbminactivityneghuge, 0.0, TRUE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } else if( SCIPisHugeValue(scip, -minactbound * absval) ) { @@ -3035,20 +3013,20 @@ void consdataGetGlbActivityResiduals( getMinActivity(scip, consdata, consdata->glbminactivityposinf, consdata->glbminactivityneginf, consdata->glbminactivityposhuge, consdata->glbminactivityneghuge - 1, 0.0, TRUE, goodrelax, - minresactivity, minisrelax, isminsettoinfinity); + minresactivity, ismintight, isminsettoinfinity); } else { getMinActivity(scip, consdata, consdata->glbminactivityposinf, consdata->glbminactivityneginf, consdata->glbminactivityposhuge, consdata->glbminactivityneghuge, absval * minactbound, TRUE, - goodrelax, minresactivity, minisrelax, isminsettoinfinity); + goodrelax, minresactivity, ismintight, isminsettoinfinity); } } if( maxresactivity != NULL ) { assert(ismaxsettoinfinity != NULL); - assert(maxisrelax != NULL); + assert(ismaxtight != NULL); /* get/compute maxactivity by calling getMaxActivity() with updated counters for infinite and huge values * and contribution of variable set to zero that has to be subtracted from finite part of activity @@ -3059,7 +3037,7 @@ void consdataGetGlbActivityResiduals( getMaxActivity(scip, consdata, consdata->glbmaxactivityposinf, consdata->glbmaxactivityneginf - 1, consdata->glbmaxactivityposhuge, consdata->glbmaxactivityneghuge, 0.0, TRUE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } else if( SCIPisInfinity(scip, maxactbound) ) { @@ -3067,7 +3045,7 @@ void consdataGetGlbActivityResiduals( getMaxActivity(scip, consdata, consdata->glbmaxactivityposinf - 1, consdata->glbmaxactivityneginf, consdata->glbmaxactivityposhuge, consdata->glbmaxactivityneghuge, 0.0, TRUE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } else if( SCIPisHugeValue(scip, absval * maxactbound) ) { @@ -3075,7 +3053,7 @@ void consdataGetGlbActivityResiduals( getMaxActivity(scip, consdata, consdata->glbmaxactivityposinf, consdata->glbmaxactivityneginf, consdata->glbmaxactivityposhuge - 1, consdata->glbmaxactivityneghuge, 0.0, TRUE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } else if( SCIPisHugeValue(scip, -absval * maxactbound) ) { @@ -3083,13 +3061,13 @@ void consdataGetGlbActivityResiduals( getMaxActivity(scip, consdata, consdata->glbmaxactivityposinf, consdata->glbmaxactivityneginf, consdata->glbmaxactivityposhuge, consdata->glbmaxactivityneghuge - 1, 0.0, TRUE, goodrelax, - maxresactivity, maxisrelax, ismaxsettoinfinity); + maxresactivity, ismaxtight, ismaxsettoinfinity); } else { getMaxActivity(scip, consdata, consdata->glbmaxactivityposinf, consdata->glbmaxactivityneginf, consdata->glbmaxactivityposhuge, consdata->glbmaxactivityneghuge, absval * maxactbound, TRUE, - goodrelax, maxresactivity, maxisrelax, ismaxsettoinfinity); + goodrelax, maxresactivity, ismaxtight, ismaxsettoinfinity); } } } @@ -4948,8 +4926,8 @@ SCIP_RETCODE addConflictBounds( { SCIP_Real minresactivity; SCIP_Real maxresactivity; - SCIP_Bool minisrelax; - SCIP_Bool maxisrelax; + SCIP_Bool ismintight; + SCIP_Bool ismaxtight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; @@ -4962,23 +4940,23 @@ SCIP_RETCODE addConflictBounds( assert(vals != NULL); /* for flexelint */ if( reasonisrhs ) consdataGetGlbActivityResiduals(scip, consdata, infervar, vals[inferpos], FALSE, &minresactivity, NULL, - &minisrelax, NULL, &isminsettoinfinity, NULL); + &ismintight, NULL, &isminsettoinfinity, NULL); else consdataGetGlbActivityResiduals(scip, consdata, infervar, vals[inferpos], FALSE, NULL, &maxresactivity, - NULL, &maxisrelax, NULL, &ismaxsettoinfinity); + NULL, &ismaxtight, NULL, &ismaxsettoinfinity); } else { if( reasonisrhs ) consdataGetGlbActivityBounds(scip, consdata, FALSE, &minresactivity, NULL, - &minisrelax, NULL, &isminsettoinfinity, NULL); + &ismintight, NULL, &isminsettoinfinity, NULL); else consdataGetGlbActivityBounds(scip, consdata, FALSE, NULL, &maxresactivity, - NULL, &maxisrelax, NULL, &ismaxsettoinfinity); + NULL, &ismaxtight, NULL, &ismaxsettoinfinity); } /* we can only do something clever, if the residual activity is finite and not relaxed */ - if( (reasonisrhs && !isminsettoinfinity && !minisrelax) || (!reasonisrhs && !ismaxsettoinfinity && !maxisrelax) ) /*lint !e644*/ + if( (reasonisrhs && !isminsettoinfinity && ismintight) || (!reasonisrhs && !ismaxsettoinfinity && ismaxtight) ) /*lint !e644*/ { SCIP_Real rescap; SCIP_Bool resactisinf; @@ -6827,8 +6805,8 @@ SCIP_RETCODE tightenVarBounds( SCIP_Real rhs; SCIP_Bool infeasible; SCIP_Bool tightened; - SCIP_Bool minisrelax; - SCIP_Bool maxisrelax; + SCIP_Bool ismintight; + SCIP_Bool ismaxtight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; @@ -6857,7 +6835,7 @@ SCIP_RETCODE tightenVarBounds( lhs = consdata->lhs; rhs = consdata->rhs; consdataGetActivityResiduals(scip, consdata, var, val, FALSE, &minresactivity, &maxresactivity, - &minisrelax, &maxisrelax, &isminsettoinfinity, &ismaxsettoinfinity); + &ismintight, &ismaxtight, &isminsettoinfinity, &ismaxsettoinfinity); assert(var != NULL); assert(!SCIPisZero(scip, val)); assert(!SCIPisInfinity(scip, lhs)); @@ -6870,7 +6848,7 @@ SCIP_RETCODE tightenVarBounds( if( val > 0.0 ) { /* check, if we can tighten the variable's bounds */ - if( !isminsettoinfinity && !SCIPisInfinity(scip, rhs) && !minisrelax ) + if( !isminsettoinfinity && !SCIPisInfinity(scip, rhs) && ismintight ) { SCIP_Real newub; @@ -6923,7 +6901,7 @@ SCIP_RETCODE tightenVarBounds( } } - if( !ismaxsettoinfinity && !SCIPisInfinity(scip, -lhs) && !maxisrelax ) + if( !ismaxsettoinfinity && !SCIPisInfinity(scip, -lhs) && ismaxtight ) { SCIP_Real newlb; @@ -6973,7 +6951,7 @@ SCIP_RETCODE tightenVarBounds( else { /* check, if we can tighten the variable's bounds */ - if( !isminsettoinfinity && !SCIPisInfinity(scip, rhs) && !minisrelax ) + if( !isminsettoinfinity && !SCIPisInfinity(scip, rhs) && ismintight ) { SCIP_Real newlb; @@ -7024,7 +7002,7 @@ SCIP_RETCODE tightenVarBounds( } } - if( !ismaxsettoinfinity && !SCIPisInfinity(scip, -lhs) && !maxisrelax ) + if( !ismaxsettoinfinity && !SCIPisInfinity(scip, -lhs) && ismaxtight ) { SCIP_Real newub; @@ -7165,13 +7143,13 @@ SCIP_RETCODE tightenBounds( SCIP_Real surplus; SCIP_Real minactivity; SCIP_Real maxactivity; - SCIP_Bool minisrelax; - SCIP_Bool maxisrelax; + SCIP_Bool ismintight; + SCIP_Bool ismaxtight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; /* use maximal activity delta to skip propagation (cannot deduce anything) */ - consdataGetActivityBounds(scip, consdata, FALSE, &minactivity, &maxactivity, &minisrelax, &maxisrelax, + consdataGetActivityBounds(scip, consdata, FALSE, &minactivity, &maxactivity, &ismintight, &ismaxtight, &isminsettoinfinity, &ismaxsettoinfinity); assert(!SCIPisInfinity(scip, minactivity)); assert(!SCIPisInfinity(scip, -maxactivity)); @@ -7744,8 +7722,8 @@ SCIP_RETCODE propagateCons( SCIP_CONSDATA* consdata; SCIP_Real minactivity; SCIP_Real maxactivity; - SCIP_Bool minactisrelax; - SCIP_Bool maxactisrelax; + SCIP_Bool isminacttight; + SCIP_Bool ismaxacttight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; @@ -7829,7 +7807,7 @@ SCIP_RETCODE propagateCons( /* check constraint for infeasibility and redundancy */ if( !(*cutoff) ) { - consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &minactisrelax, &maxactisrelax, + consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &isminacttight, &ismaxacttight, &isminsettoinfinity, &ismaxsettoinfinity); if( SCIPisFeasGT(scip, minactivity, consdata->rhs) ) @@ -9118,8 +9096,8 @@ SCIP_RETCODE consdataTightenCoefs( * activity, ignoring the coefficients contributing with infinite value */ SCIP_Real maxactivity; /* maximal value w.r.t. the variable's local bounds for the constraint's * activity, ignoring the coefficients contributing with infinite value */ - SCIP_Bool minactisrelax; /* do huge finite values contribute to the minactivity? */ - SCIP_Bool maxactisrelax; /* do huge finite values contribute to the maxactivity? */ + SCIP_Bool isminacttight; /* are all contributions to the minactivity non-huge or non-contradicting? */ + SCIP_Bool ismaxacttight; /* are all contributions to the maxactivity non-huge or non-contradicting? */ SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; SCIP_Real minleftactivity; /* minimal activity without surely non-redundant variables. */ @@ -9154,7 +9132,7 @@ SCIP_RETCODE consdataTightenCoefs( } /* get the minimal and maximal activity of the constraint */ - consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &minactisrelax, &maxactisrelax, + consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &isminacttight, &ismaxacttight, &isminsettoinfinity, &ismaxsettoinfinity); minleftactivity = 0.0; @@ -9235,7 +9213,7 @@ SCIP_RETCODE consdataTightenCoefs( (*nchgcoefs)++; /* get the new minimal and maximal activity of the constraint */ - consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &minactisrelax, &maxactisrelax, + consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &isminacttight, &ismaxacttight, &isminsettoinfinity, &ismaxsettoinfinity); if( !SCIPisInfinity(scip, -consdata->lhs) && !SCIPisEQ(scip, newlhs, consdata->lhs) ) @@ -9342,7 +9320,7 @@ SCIP_RETCODE consdataTightenCoefs( (*nchgcoefs)++; /* get the new minimal and maximal activity of the constraint */ - consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &minactisrelax, &maxactisrelax, + consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &isminacttight, &ismaxacttight, &isminsettoinfinity, &ismaxsettoinfinity); if( !SCIPisInfinity(scip, -consdata->lhs) && !SCIPisEQ(scip, newlhs, consdata->lhs) ) @@ -9405,7 +9383,7 @@ SCIP_RETCODE consdataTightenCoefs( * (<= the exact minactivity), and we might falsely claim variables to be redundant in the following */ assert(!SCIPisInfinity(scip, minactivity)); - if( !SCIPisInfinity(scip, -consdata->lhs) && (SCIPisInfinity(scip, -minactivity) || minactisrelax) ) + if( !SCIPisInfinity(scip, -consdata->lhs) && (SCIPisInfinity(scip, -minactivity) || !isminacttight) ) return SCIP_OKAY; /* if the rhs is finite, we will check in the following whether the not non-redundant variables can make rhs feasible; @@ -9414,7 +9392,7 @@ SCIP_RETCODE consdataTightenCoefs( * (>= the exact maxactivity), and we might falsely claim variables to be redundant in the following */ assert(!SCIPisInfinity(scip, -maxactivity)); - if( !SCIPisInfinity(scip, consdata->rhs) && (SCIPisInfinity(scip, maxactivity) || maxactisrelax) ) + if( !SCIPisInfinity(scip, consdata->rhs) && (SCIPisInfinity(scip, maxactivity) || !ismaxacttight) ) return SCIP_OKAY; /* correct lhs and rhs by min/max activity of surely non-redundant variables @@ -9470,14 +9448,14 @@ SCIP_RETCODE consdataTightenCoefs( i--; /* get the new minimal and maximal activity of the constraint */ - consdataGetActivityBounds(scip, consdata, FALSE, &minactivity, &maxactivity, &minactisrelax, &maxactisrelax, + consdataGetActivityBounds(scip, consdata, FALSE, &minactivity, &maxactivity, &isminacttight, &ismaxacttight, &isminsettoinfinity, &ismaxsettoinfinity); /* we return above if the condition does not hold and deleting a variable cannot increase the number of * huge contributions */ - assert(!minactisrelax || SCIPisInfinity(scip, -consdata->lhs)); - assert(!maxactisrelax || SCIPisInfinity(scip, consdata->rhs)); + assert(isminacttight || SCIPisInfinity(scip, -consdata->lhs)); + assert(ismaxacttight || SCIPisInfinity(scip, consdata->rhs)); } } else @@ -9496,14 +9474,14 @@ SCIP_RETCODE consdataTightenCoefs( i--; /* get the new minimal and maximal activity of the constraint */ - consdataGetActivityBounds(scip, consdata, FALSE, &minactivity, &maxactivity, &minactisrelax, &maxactisrelax, + consdataGetActivityBounds(scip, consdata, FALSE, &minactivity, &maxactivity, &isminacttight, &ismaxacttight, &isminsettoinfinity, &ismaxsettoinfinity); /* we return above if the condition does not hold and deleting a variable cannot increase the number of * huge contributions */ - assert(!minactisrelax || SCIPisInfinity(scip, -consdata->lhs)); - assert(!maxactisrelax || SCIPisInfinity(scip, consdata->rhs)); + assert(isminacttight || SCIPisInfinity(scip, -consdata->lhs)); + assert(ismaxacttight || SCIPisInfinity(scip, consdata->rhs)); } } @@ -9924,19 +9902,19 @@ SCIP_RETCODE convertLongEquality( SCIP_Real newlhs; SCIP_Real newrhs; SCIP_Bool removescons; - SCIP_Bool minisrelax; - SCIP_Bool maxisrelax; + SCIP_Bool ismintight; + SCIP_Bool ismaxtight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; /* check if the constraint becomes redundant after multi-aggregation */ consdataGetActivityResiduals(scip, consdata, var, val, FALSE, &minresactivity, &maxresactivity, - &minisrelax, &maxisrelax, &isminsettoinfinity, &ismaxsettoinfinity); + &ismintight, &ismaxtight, &isminsettoinfinity, &ismaxsettoinfinity); /* do not perform the multi-aggregation due to numerics, if we have huge contributions in the residual * activity */ - if( minisrelax || maxisrelax ) + if( !ismintight || !ismaxtight ) continue; getNewSidesAfterAggregation(scip, consdata, var, val, &newlhs, &newrhs); @@ -10854,21 +10832,21 @@ SCIP_RETCODE dualPresolve( SCIP_Real maxresactivity; SCIP_Real minval; SCIP_Real maxval; - SCIP_Bool minisrelax; - SCIP_Bool maxisrelax; + SCIP_Bool ismintight; + SCIP_Bool ismaxtight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; /* calculate bounds for \sum_{j \neq i} a_j * x_j */ consdataGetActivityResiduals(scip, consdata, var, val, FALSE, &minresactivity, &maxresactivity, - &minisrelax, &maxisrelax, &isminsettoinfinity, &ismaxsettoinfinity); + &ismintight, &ismaxtight, &isminsettoinfinity, &ismaxsettoinfinity); assert(SCIPisLE(scip, minresactivity, maxresactivity)); /* We called consdataGetActivityResiduals() saying that we do not need a good relaxation, * so whenever we have a relaxed activity, it should be relaxed to +/- infinity. * This is needed, because we do not want to rely on relaxed finite resactivities. */ - assert((!minisrelax || isminsettoinfinity) && (!maxisrelax || ismaxsettoinfinity)); + assert((ismintight || isminsettoinfinity) && (ismaxtight || ismaxsettoinfinity)); if( agglhs ) { @@ -11563,8 +11541,8 @@ SCIP_RETCODE simplifyInequalities( SCIP_Longint gcd; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; - SCIP_Bool isminrelax; - SCIP_Bool ismaxrelax; + SCIP_Bool ismintight; + SCIP_Bool ismaxtight; SCIP_Bool allcoefintegral; SCIP_Bool onlybin; SCIP_Bool hasrhs; @@ -11699,14 +11677,14 @@ SCIP_RETCODE simplifyInequalities( /* get global activities */ consdataGetGlbActivityBounds(scip, consdata, FALSE, &minact, &maxact, - &isminrelax, &ismaxrelax, &isminsettoinfinity, &ismaxsettoinfinity); + &ismintight, &ismaxtight, &isminsettoinfinity, &ismaxsettoinfinity); /* cannot work with infinite activities */ if( isminsettoinfinity || ismaxsettoinfinity ) return SCIP_OKAY; - assert(!isminrelax); - assert(!ismaxrelax); + assert(ismintight); + assert(ismaxtight); assert(maxact > minact); assert(!SCIPisInfinity(scip, -minact)); assert(!SCIPisInfinity(scip, maxact)); @@ -14108,8 +14086,8 @@ SCIP_RETCODE presolStuffing( SCIP_Real val; SCIP_Real obj; SCIP_Real factor; - SCIP_Bool minactisrelax; - SCIP_Bool maxactisrelax; + SCIP_Bool isminacttight; + SCIP_Bool ismaxacttight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; SCIP_Bool tryfixing; @@ -14130,7 +14108,7 @@ SCIP_RETCODE presolStuffing( if( singlevarstuffing ) { - consdataGetActivityBounds(scip, consdata, FALSE, &minactivity, &maxactivity, &minactisrelax, &maxactisrelax, + consdataGetActivityBounds(scip, consdata, FALSE, &minactivity, &maxactivity, &isminacttight, &ismaxacttight, &isminsettoinfinity, &ismaxsettoinfinity); } else @@ -14844,8 +14822,8 @@ SCIP_RETCODE fullDualPresolve( SCIP_Real maxresactivity; SCIP_Real newredlb; SCIP_Real newredub; - SCIP_Bool minisrelax; - SCIP_Bool maxisrelax; + SCIP_Bool ismintight; + SCIP_Bool ismaxtight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; int arrayindex; @@ -14872,13 +14850,13 @@ SCIP_RETCODE fullDualPresolve( { /* calculate residual activity bounds if variable would be fixed to zero */ consdataGetGlbActivityResiduals(scip, consdata, var, val, FALSE, &minresactivity, &maxresactivity, - &minisrelax, &maxisrelax, &isminsettoinfinity, &ismaxsettoinfinity); + &ismintight, &ismaxtight, &isminsettoinfinity, &ismaxsettoinfinity); /* We called consdataGetGlbActivityResiduals() saying that we do not need a good relaxation, * so whenever we have a relaxed activity, it should be relaxed to +/- infinity. * This is needed, because we do not want to rely on relaxed finite resactivities. */ - assert((!minisrelax || isminsettoinfinity) && (!maxisrelax || ismaxsettoinfinity)); + assert((ismintight || isminsettoinfinity) && (ismaxtight || ismaxsettoinfinity)); /* check minresactivity for reliability */ if( !isminsettoinfinity && SCIPisUpdateUnreliable(scip, minresactivity, consdata->lastglbminactivity) ) @@ -16382,8 +16360,8 @@ SCIP_DECL_CONSPRESOL(consPresolLinear) SCIP_CONSDATA* consdata; SCIP_Real minactivity; SCIP_Real maxactivity; - SCIP_Bool minactisrelax; - SCIP_Bool maxactisrelax; + SCIP_Bool isminacttight; + SCIP_Bool ismaxacttight; SCIP_Bool isminsettoinfinity; SCIP_Bool ismaxsettoinfinity; SCIP_Bool cutoff; @@ -16539,7 +16517,7 @@ SCIP_DECL_CONSPRESOL(consPresolLinear) break; /* check constraint for infeasibility and redundancy */ - consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &minactisrelax, &maxactisrelax, + consdataGetActivityBounds(scip, consdata, TRUE, &minactivity, &maxactivity, &isminacttight, &ismaxacttight, &isminsettoinfinity, &ismaxsettoinfinity); if( SCIPisFeasGT(scip, minactivity, consdata->rhs) || SCIPisFeasLT(scip, maxactivity, consdata->lhs) ) {