Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v9-minor'
Browse files Browse the repository at this point in the history
  • Loading branch information
scip-ci committed Mar 20, 2024
2 parents 582aa38 + 1421b87 commit eed8bc8
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 42 deletions.
3 changes: 2 additions & 1 deletion .gitlab/merge_request_templates/Code_Review.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
### Does this merge request introduce an API change? :warning:

* [ ] No, **or** as far as possible, the code ensures backwards compatibility.
* [ ] No, **or** the `SCIP_APIVERSION` is updated (use label 'public SCIP API'; in particular if new `SCIP_EXPORT` methods have been added).
* [ ] No, **or** the `SCIP_APIVERSION` will be updated (use label 'public SCIP API'; in particular if new `SCIP_EXPORT` methods have been added).
To update `SCIP_APIVERSION`, run `scripts/updateversion.py -a` on branch **master** after the changes of this MR have arrived in the master branch (if this is a merge into vX-minor, then first merge vX-minor into master or wait for the Jenkins job that does that).
* [ ] No parameter was added/deleted/changed **or** the MR is tagged with the label 'default parameter'. (This includes the addition of parameters by adding/deleting a plugin.)
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ Fixed bugs
- in count mode respect empty solution when problem is solved in presolving
- fixed that SCIP may have tried to pass a negative random seed to an LP solver
- fixed bug where conflict analysis in strong branching tried to analyze an unsuccessful LP solve
- enable parameter limits/restarts by allowing to reach the restart limit in restartAllowed()
- handle normalizing linear constraints in presolving with more caution to avoid numerical difficulties for integer variables with large coefficients
- use quad precision to calculate residual activity bounds to reduce numerical errors for large variable bounds in cons_linear.c

Miscellaneous
-------------
Expand Down
2 changes: 2 additions & 0 deletions check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ set(pairs_Issue
# "instances/Issue/3629.cip\;-infinity\;only_dualinfer"
"instances/Issue/3632.cip\;0\;default"
"instances/Issue/3633.lp\;0\;default"
"instances/Issue/3662_1.cip\;0\;default"
"instances/Issue/3662_2.cip\;0\;default"
)

#
Expand Down
13 changes: 13 additions & 0 deletions check/instances/Issue/3662_1.cip
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
STATISTICS
Problem name : Issue 3662
Variables : 2 (1 binary, 0 integer, 0 implicit integer, 1 continuous)
Constraints : 0 initial, 2 maximal
OBJECTIVE
Sense : minimize
VARIABLES
[binary] <x465>: obj=0, original bounds=[0,1]
[continuous] <x5>: obj=1, original bounds=[0,+inf]
CONSTRAINTS
[linear] <c_u_x1227_>: +5<x465>[B] <= 5;
[linear] <c_u_x1229_>: -10000048<x465>[B] <= -10;
END
26 changes: 26 additions & 0 deletions check/instances/Issue/3662_2.cip
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
STATISTICS
Problem name : Issue 3662
Variables : 9 (3 binary, 0 integer, 0 implicit integer, 6 continuous)
Constraints : 0 initial, 8 maximal
OBJECTIVE
Sense : minimize
VARIABLES
[binary] <x154>: obj=0, original bounds=[0,1]
[binary] <x350>: obj=0, original bounds=[0,1]
[binary] <x380>: obj=0, original bounds=[0,1]
[continuous] <x351>: obj=0, original bounds=[0,+inf]
[continuous] <x382>: obj=0, original bounds=[0,+inf]
[continuous] <x385>: obj=0, original bounds=[0,+inf]
[continuous] <x386>: obj=0, original bounds=[0,+inf]
[continuous] <x155>: obj=0, original bounds=[0,+inf]
[continuous] <x156>: obj=0, original bounds=[0,+inf]
CONSTRAINTS
[linear] <c_e_x909_>: -47.1233787589408<x154>[B] +<x155>[C] == 0;
[linear] <c_e_x911_>: -<x155>[C] +<x156>[C] == 0;
[linear] <c_e_x1101_>: -1.64216813092803e-08<x350>[B] +<x351>[C] == 0;
[linear] <c_e_x1137_>: -1.71191717005204<x380>[B] +<x382>[C] == 0;
[linear] <c_u_x1142_>: <x385>[C] +<x386>[C] <= 20000000;
[linear] <c_e_x1143_>: -<x385>[C] +<x386>[C] == -6.88914620404344;
[linear] <c_e_x1328_>: -<x382>[C] +<x386>[C] -<x156>[C] == -48.2362670341181;
[linear] <c_e_x1480_>: <x351>[C] -<x385>[C] == -7.48817509891815;
END
4 changes: 2 additions & 2 deletions scripts/updateversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
if newapiversion != oldapiversion:
print("\nAPI versions before the change:")
print(commands.getoutput('grep -e "APIVERSION" -e "SCIP_VERSION_API" make/make.project CMakeLists.txt'))
if newsubversion == "0":
print "\nWarning: API version increased for what seems to be a bugfix version (%s)" %(newversionstring)
if newminor != "0" or newpatch != "0":
print "\nWarning: API version increased for what does not seem to be the master branch (version %s)" %(newversionstring)
commands.getoutput('sed -i "s/^SCIP_VERSION_API.*/SCIP_VERSION_API = %-s/" make/make.project' % newapiversion)
commands.getoutput('sed -i "s/set(SCIP_VERSION_API [0-9]*)/set(SCIP_VERSION_API %s)/" CMakeLists.txt' \
%(newapiversion))
Expand Down
68 changes: 34 additions & 34 deletions src/scip/cons_linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -2456,7 +2456,7 @@ void getMinActivity(
}
else
{
SCIP_Real tmpactivity;
SCIP_Real QUAD(tmpactivity);

/* recompute minactivity if it is not valid */
if( global )
Expand All @@ -2465,34 +2465,35 @@ void getMinActivity(
consdataRecomputeGlbMinactivity(scip, consdata);
assert(consdata->validglbminact);

tmpactivity = QUAD_TO_DBL(consdata->glbminactivity);
QUAD_ASSIGN_Q(tmpactivity, consdata->glbminactivity);
}
else
{
if( !consdata->validminact )
consdataRecomputeMinactivity(scip, consdata);
assert(consdata->validminact);

tmpactivity = QUAD_TO_DBL(consdata->minactivity);
QUAD_ASSIGN_Q(tmpactivity, consdata->minactivity);
}

/* we have no infinite and no neg. huge contributions, but pos. huge contributions;
* a feasible relaxation of the minactivity is the number of positive huge contributions
* times the minimum value counting as "huge" plus finite (and non-huge) part of minactivity - delta
/* calculate residual minactivity */
SCIPquadprecSumQD(tmpactivity, tmpactivity, -delta);

/* we have no infinite and no neg. huge contributions, but pos. huge contributions; a feasible relaxation of the
* minactivity is given by adding the number of positive huge contributions times the huge value
*/
if( poshuge > 0 )
{
*minactivity = 1.0 * poshuge * SCIPgetHugeValue(scip) + (tmpactivity - delta);
*issettoinfinity = FALSE;
SCIPquadprecSumQD(tmpactivity, tmpactivity, poshuge * SCIPgetHugeValue(scip));
*isrelax = TRUE;
}
/* all counters are zero, so the minactivity is just stored and we subtract the delta */
/* all counters are zero, so the minactivity is complete */
else
{
*minactivity = tmpactivity - delta;
*issettoinfinity = FALSE;
*isrelax = FALSE;
}

/* round residual minactivity */
*minactivity = QUAD_TO_DBL(tmpactivity);
*issettoinfinity = FALSE;
}
}

Expand Down Expand Up @@ -2557,7 +2558,7 @@ void getMaxActivity(
}
else
{
SCIP_Real tmpactivity;
SCIP_Real QUAD(tmpactivity);

/* recompute maxactivity if it is not valid */
if( global )
Expand All @@ -2566,34 +2567,35 @@ void getMaxActivity(
consdataRecomputeGlbMaxactivity(scip, consdata);
assert(consdata->validglbmaxact);

tmpactivity = QUAD_TO_DBL(consdata->glbmaxactivity);
QUAD_ASSIGN_Q(tmpactivity, consdata->glbmaxactivity);
}
else
{
if( !consdata->validmaxact )
consdataRecomputeMaxactivity(scip, consdata);
assert(consdata->validmaxact);

tmpactivity = QUAD_TO_DBL(consdata->maxactivity);
QUAD_ASSIGN_Q(tmpactivity, consdata->maxactivity);
}

/* we have no infinite, and no pos. huge contributions, but neg. huge contributions;
* a feasible relaxation of the maxactivity is minus the number of negative huge contributions
* times the minimum value counting as "huge" plus the finite (and non-huge) part of maxactivity minus delta
/* calculate residual maxactivity */
SCIPquadprecSumQD(tmpactivity, tmpactivity, -delta);

/* we have no infinite and no pos. huge contributions, but neg. huge contributions; a feasible relaxation of the
* maxactivity is given by subtracting the number of negative huge contributions times the huge value
*/
if( neghuge > 0 )
{
*maxactivity = -1.0 * neghuge * SCIPgetHugeValue(scip) + tmpactivity - delta;
*issettoinfinity = FALSE;
SCIPquadprecSumQD(tmpactivity, tmpactivity, -neghuge * SCIPgetHugeValue(scip));
*isrelax = TRUE;
}
/* all counters are zero, so the maxactivity is just stored and we subtract the delta */
/* all counters are zero, so the maxactivity is complete */
else
{
*maxactivity = tmpactivity - delta;
*issettoinfinity = FALSE;
*isrelax = FALSE;
}

/* round residual maxactivity */
*maxactivity = QUAD_TO_DBL(tmpactivity);
*issettoinfinity = FALSE;
}
}

Expand Down Expand Up @@ -4315,6 +4317,12 @@ SCIP_RETCODE normalizeCons(
if( SCIPisZero(scip, minabsval/maxabsval) )
return SCIP_OKAY;

/* return if scaling by maxval will eliminate or generate non-zero sides */
if( !SCIPisInfinity(scip, consdata->lhs) && SCIPisFeasZero(scip, consdata->lhs) != SCIPisFeasZero(scip, consdata->lhs/maxabsval) )
return SCIP_OKAY;
if( !SCIPisInfinity(scip, consdata->rhs) && SCIPisFeasZero(scip, consdata->rhs) != SCIPisFeasZero(scip, consdata->rhs/maxabsval) )
return SCIP_OKAY;

/* check if not all absolute coefficients are near 1.0 but scaling could do */
if( SCIPisLT(scip, minabsval, 1.0) != SCIPisGT(scip, maxabsval, 1.0) )
{
Expand Down Expand Up @@ -11351,7 +11359,6 @@ SCIP_RETCODE aggregateVariables(
return SCIP_OKAY;
}

/* normalize constraint */
SCIP_CALL( normalizeCons(scip, cons, &infeasible) );

if( infeasible )
Expand Down Expand Up @@ -11615,7 +11622,6 @@ SCIP_RETCODE simplifyInequalities(
*/
consdata->normalized = FALSE;

/* normalize constraint */
SCIP_CALL( normalizeCons(scip, cons, infeasible) );
assert(nvars == consdata->nvars);

Expand Down Expand Up @@ -11992,7 +11998,6 @@ SCIP_RETCODE simplifyInequalities(

oldcoef = vals[w];

/* normalize constraint */
SCIP_CALL( normalizeCons(scip, cons, infeasible) );
assert(vars == consdata->vars);
assert(vals == consdata->vals);
Expand Down Expand Up @@ -12223,7 +12228,6 @@ SCIP_RETCODE simplifyInequalities(

if( !notchangable )
{
/* normalize constraint */
SCIP_CALL( normalizeCons(scip, cons, infeasible) );
assert(vars == consdata->vars);
assert(vals == consdata->vals);
Expand Down Expand Up @@ -12469,7 +12473,6 @@ SCIP_RETCODE simplifyInequalities(
}
}

/* normalize constraint */
SCIP_CALL( normalizeCons(scip, cons, infeasible) );
assert(vars == consdata->vars);
assert(vals == consdata->vals);
Expand Down Expand Up @@ -13047,7 +13050,6 @@ SCIP_RETCODE aggregateConstraints(
/* copy the upgraded flag from the old cons0 to the new constraint */
newconsdata->upgraded = consdata0->upgraded;

/* normalize the new constraint */
SCIP_CALL( normalizeCons(scip, newcons, infeasible) );

if( *infeasible )
Expand Down Expand Up @@ -16498,7 +16500,6 @@ SCIP_DECL_CONSPRESOL(consPresolLinear)
consdata->presolved = TRUE;
SCIP_CALL( SCIPunmarkConsPropagate(scip, cons) );

/* normalize constraint */
SCIP_CALL( normalizeCons(scip, cons, &infeasible) );

if( infeasible )
Expand Down Expand Up @@ -18899,7 +18900,6 @@ SCIP_RETCODE SCIPupgradeConsLinear(
}
}

/* normalize constraint */
SCIP_CALL( normalizeCons(scip, cons, &infeasible) );

/* normalizeCons() can only detect infeasibility when scaling with the gcd. in that case, the scaling was
Expand Down
8 changes: 3 additions & 5 deletions src/scip/solve.c
Original file line number Diff line number Diff line change
Expand Up @@ -4130,13 +4130,11 @@ SCIP_Bool restartAllowed(
assert(set != NULL);
assert(stat != NULL);

return (set->nactivepricers == 0 && !set->reopt_enable
&& (set->presol_maxrestarts == -1 || stat->nruns <= set->presol_maxrestarts)
&& (set->limit_restarts == -1 || stat->nruns <= set->limit_restarts));
return set->nactivepricers == 0 && !set->reopt_enable
&& ( set->presol_maxrestarts == -1 || stat->nruns <= set->presol_maxrestarts );
}
#else
#define restartAllowed(set,stat) ((set)->nactivepricers == 0 && !set->reopt_enable && ((set)->presol_maxrestarts == -1 || (stat)->nruns <= (set)->presol_maxrestarts) \
&& (set->limit_restarts == -1 || stat->nruns <= set->limit_restarts))
#define restartAllowed(set,stat) ((set)->nactivepricers == 0 && !set->reopt_enable && ((set)->presol_maxrestarts == -1 || (stat)->nruns <= (set)->presol_maxrestarts))
#endif

/** solves the focus node */
Expand Down

0 comments on commit eed8bc8

Please sign in to comment.