Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v91-bugfix' into v9-minor
Browse files Browse the repository at this point in the history
  • Loading branch information
scip-ci committed Oct 9, 2024
2 parents b80f688 + 0415927 commit 6d9f30f
Show file tree
Hide file tree
Showing 19 changed files with 941 additions and 409 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Fixed bugs

- skip constraint propagation if the residual activity bound cancels the side precision in tightenVarBounds() of cons_linear.c
- use indices of negation counterparts and accept fixings when ordering and-resultants of pseudoboolean constraints
- correct bound tracking to make the evaluation of primal-dual-integrals work

Unit tests
----------
Expand Down
1 change: 1 addition & 0 deletions check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ set(pairs_Issue
"instances/Issue/3675_2.cip\;0\;presolving_heuristics_off"
"instances/Issue/3681.cip\;0\;default"
"instances/Issue/3688.cip\;131882\;reduced_presolving"
"instances/Issue/3691.cip\;1.862908\;presolvingnolinear"
"instances/Issue/3693.cip\;7812672.2316\;default"
"instances/Issue/3719.cip\;0\;presolving_off"
"instances/Issue/3722.cip\;1200008400.00755\;default"
Expand Down
1 change: 1 addition & 0 deletions check/coverage/settings/presolvingnolinear.set
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
constraints/linear/maxprerounds = 0
319 changes: 319 additions & 0 deletions check/instances/Issue/3691.cip

Large diffs are not rendered by default.

80 changes: 44 additions & 36 deletions src/scip/branch_allfullstrong.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,46 +147,51 @@ SCIP_RETCODE branch(
SCIP_CALL( SCIPselectVarPseudoStrongBranching(scip, pseudocandscopy, branchruledata->skipdown, branchruledata->skipup, npseudocands,
npriopseudocands, &bestpseudocand, &bestdown, &bestup, &bestscore, &bestdownvalid, &bestupvalid, &provedbound, result) );

if( *result != SCIP_CUTOFF && *result != SCIP_REDUCEDDOM && *result != SCIP_CONSADDED )
if( *result != SCIP_CUTOFF )
{
SCIP_NODE* downchild;
SCIP_NODE* eqchild;
SCIP_NODE* upchild;
SCIP_VAR* var;
/* update lower bound of current node */
if( allcolsinlp && !exactsolve )
{
SCIP_CALL( SCIPupdateLocalLowerbound(scip, provedbound) );
SCIPdebugMsg(scip, " -> current focus' lowerbound: %g\n", SCIPgetLocalLowerbound(scip));
}

assert(*result == SCIP_DIDNOTRUN);
assert(0 <= bestpseudocand && bestpseudocand < npseudocands);
assert(SCIPisLT(scip, provedbound, cutoffbound));
if( *result != SCIP_REDUCEDDOM && *result != SCIP_CONSADDED )
{
SCIP_NODE* downchild;
SCIP_NODE* eqchild;
SCIP_NODE* upchild;
SCIP_VAR* var;

var = pseudocandscopy[bestpseudocand];
assert(*result == SCIP_DIDNOTRUN);
assert(0 <= bestpseudocand && bestpseudocand < npseudocands);
assert(SCIPisLT(scip, provedbound, cutoffbound));

/* perform the branching */
SCIPdebugMsg(scip, " -> %d candidates, selected candidate %d: variable <%s>[%g,%g] (solval=%g, down=%g, up=%g, score=%g)\n",
npseudocands, bestpseudocand, SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), SCIPvarGetLPSol(var),
bestdown, bestup, bestscore);
SCIP_CALL( SCIPbranchVarVal(scip, var, SCIPvarGetLPSol(var), &downchild, &eqchild, &upchild) );
var = pseudocandscopy[bestpseudocand];

/* update the lower bounds in the children */
if( allcolsinlp && !exactsolve )
{
if( downchild != NULL )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, downchild, bestdownvalid ? MAX(bestdown, provedbound) : provedbound) );
SCIPdebugMsg(scip, " -> down child's lowerbound: %g\n", SCIPnodeGetLowerbound(downchild));
}
if( eqchild != NULL )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, eqchild, provedbound) );
SCIPdebugMsg(scip, " -> eq child's lowerbound: %g\n", SCIPnodeGetLowerbound(eqchild));
}
if( upchild != NULL )
/* perform the branching */
SCIPdebugMsg(scip, " -> %d candidates, selected candidate %d: variable <%s>[%g,%g] (solval=%g, down=%g, up=%g, score=%g)\n",
npseudocands, bestpseudocand, SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), SCIPvarGetLPSol(var),
bestdown, bestup, bestscore);
SCIP_CALL( SCIPbranchVarVal(scip, var, SCIPvarGetLPSol(var), &downchild, &eqchild, &upchild) );

/* update the lower bounds in the children */
if( allcolsinlp && !exactsolve )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, upchild, bestupvalid ? MAX(bestup, provedbound) : provedbound) );
SCIPdebugMsg(scip, " -> up child's lowerbound: %g\n", SCIPnodeGetLowerbound(upchild));
if( bestdownvalid )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, downchild, bestdown) );
SCIPdebugMsg(scip, " -> down child's lowerbound: %g\n", SCIPnodeGetLowerbound(downchild));
}
if( bestupvalid )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, upchild, bestup) );
SCIPdebugMsg(scip, " -> up child's lowerbound: %g\n", SCIPnodeGetLowerbound(upchild));
}
}
}

*result = SCIP_BRANCHED;
*result = SCIP_BRANCHED;
}
}

SCIPfreeBufferArray(scip, &pseudocandscopy);
Expand Down Expand Up @@ -345,8 +350,8 @@ SCIP_RETCODE SCIPselectVarPseudoStrongBranching(
*bestpseudocand = 0;
*bestdown = lpobjval;
*bestup = lpobjval;
*bestdownvalid = TRUE;
*bestupvalid = TRUE;
*bestdownvalid = FALSE;
*bestupvalid = FALSE;
*bestscore = -SCIPinfinity(scip);
*provedbound = lpobjval;
if( npseudocands > 1 )
Expand Down Expand Up @@ -486,13 +491,14 @@ SCIP_RETCODE SCIPselectVarPseudoStrongBranching(
SCIPdebugMsg(scip, " -> variable <%s> is infeasible in downward branch\n", SCIPvarGetName(pseudocands[c]));
break; /* terminate initialization loop, because LP was changed */
}
else
downvalid = FALSE;
}
else
{
SCIP_Real newub;

/* upwards rounding is infeasible -> change upper bound of variable to downward rounding */
assert(upinf);
newub = SCIPfeasFloor(scip, solval);
if( SCIPvarGetUbLocal(pseudocands[c]) > newub + 0.5 )
{
Expand All @@ -501,9 +507,11 @@ SCIP_RETCODE SCIPselectVarPseudoStrongBranching(
SCIPdebugMsg(scip, " -> variable <%s> is infeasible in upward branch\n", SCIPvarGetName(pseudocands[c]));
break; /* terminate initialization loop, because LP was changed */
}
else
upvalid = FALSE;
}
}
else if( allcolsinlp && !exactsolve && downvalid && upvalid )
else if( allcolsinlp && !exactsolve && !integral && downvalid && upvalid )
{
SCIP_Real minbound;

Expand Down
71 changes: 44 additions & 27 deletions src/scip/branch_fullstrong.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ SCIP_RETCODE SCIPselectVarStrongBranching(
*bestcand = 0;
*bestdown = lpobjval;
*bestup = lpobjval;
*bestdownvalid = TRUE;
*bestupvalid = TRUE;
*bestdownvalid = FALSE;
*bestupvalid = FALSE;
*bestscore = -SCIPinfinity(scip);

/* if only one candidate exists, choose this one without applying strong branching; also, when SCIP is about to be
Expand Down Expand Up @@ -600,29 +600,11 @@ SCIP_DECL_BRANCHEXECLP(branchExeclpFullstrong)
branchruledata->maxproprounds, branchruledata->probingbounds, branchruledata->forcestrongbranch, &bestcand,
&bestdown, &bestup, &bestscore, &bestdownvalid, &bestupvalid, &provedbound, result) );

if( *result != SCIP_CUTOFF && *result != SCIP_REDUCEDDOM && *result != SCIP_CONSADDED )
if( *result != SCIP_CUTOFF )
{
SCIP_NODE* downchild;
SCIP_NODE* upchild;
SCIP_VAR* var;
SCIP_Real val;
SCIP_Bool allcolsinlp;
SCIP_Bool exactsolve;

assert(*result == SCIP_DIDNOTRUN);
assert(0 <= bestcand && bestcand < nlpcands);
assert(SCIPisLT(scip, provedbound, SCIPgetCutoffbound(scip)));

var = lpcands[bestcand];
val = lpcandssol[bestcand];

/* perform the branching */
SCIPdebugMsg(scip, " -> %d candidates, selected candidate %d: variable <%s> (solval=%g, down=%g, up=%g, score=%g)\n",
nlpcands, bestcand, SCIPvarGetName(var), lpcandssol[bestcand], bestdown, bestup, bestscore);
SCIP_CALL( SCIPbranchVarVal(scip, var, val, &downchild, NULL, &upchild) );
assert(downchild != NULL);
assert(upchild != NULL);

/* check, if we want to solve the problem exactly, meaning that strong branching information is not useful
* for cutting off sub problems and improving lower bounds of children
*/
Expand All @@ -631,16 +613,51 @@ SCIP_DECL_BRANCHEXECLP(branchExeclpFullstrong)
/* check, if all existing columns are in LP, and thus the strong branching results give lower bounds */
allcolsinlp = SCIPallColsInLP(scip);

/* update the lower bounds in the children */
/* update lower bound of current node */
if( allcolsinlp && !exactsolve )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, downchild, bestdownvalid ? MAX(bestdown, provedbound) : provedbound) );
SCIP_CALL( SCIPupdateNodeLowerbound(scip, upchild, bestupvalid ? MAX(bestup, provedbound) : provedbound) );
SCIP_CALL( SCIPupdateLocalLowerbound(scip, provedbound) );
}
SCIPdebugMsg(scip, " -> down child's lowerbound: %g\n", SCIPnodeGetLowerbound(downchild));
SCIPdebugMsg(scip, " -> up child's lowerbound: %g\n", SCIPnodeGetLowerbound(upchild));

*result = SCIP_BRANCHED;
if( *result != SCIP_REDUCEDDOM && *result != SCIP_CONSADDED )
{
SCIP_NODE* downchild;
SCIP_NODE* upchild;
SCIP_VAR* var;
SCIP_Real val;

assert(*result == SCIP_DIDNOTRUN);
assert(0 <= bestcand && bestcand < nlpcands);
assert(SCIPisLT(scip, provedbound, SCIPgetCutoffbound(scip)));

var = lpcands[bestcand];
val = lpcandssol[bestcand];

/* perform the branching */
SCIPdebugMsg(scip, " -> %d candidates, selected candidate %d: variable <%s> (solval=%g, down=%g, up=%g, score=%g)\n",
nlpcands, bestcand, SCIPvarGetName(var), lpcandssol[bestcand], bestdown, bestup, bestscore);
SCIP_CALL( SCIPbranchVarVal(scip, var, val, &downchild, NULL, &upchild) );
assert(downchild != NULL);
assert(upchild != NULL);

/* update the lower bounds in the children */
if( allcolsinlp && !exactsolve )
{
if( bestdownvalid )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, downchild, bestdown) );
}
if( bestupvalid )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, upchild, bestup) );
}
}

SCIPdebugMsg(scip, " -> down child's lowerbound: %g\n", SCIPnodeGetLowerbound(downchild));
SCIPdebugMsg(scip, " -> up child's lowerbound: %g\n", SCIPnodeGetLowerbound(upchild));

*result = SCIP_BRANCHED;
}
}

SCIPfreeBufferArray(scip, &lpcandsfrac);
Expand Down
92 changes: 50 additions & 42 deletions src/scip/branch_lookahead.c
Original file line number Diff line number Diff line change
Expand Up @@ -2583,15 +2583,15 @@ SCIP_RETCODE branchOnVar(
* (e.g., because we are doing branch-and-price) or the problem should be solved exactly */
if( SCIPallColsInLP(scip) && !SCIPisExactSolve(scip) )
{
SCIP_Real bestdown = decision->downdb;
SCIP_Bool bestdownvalid = decision->downdbvalid;
SCIP_Real bestup = decision->updb;
SCIP_Bool bestupvalid = decision->updbvalid;
SCIP_Real provedbound = decision->proveddb;

/* update the lower bound for the LPs for further children of both created nodes */
SCIP_CALL( SCIPupdateNodeLowerbound(scip, downchild, bestdownvalid ? MAX(bestdown, provedbound) : provedbound) );
SCIP_CALL( SCIPupdateNodeLowerbound(scip, upchild, bestupvalid ? MAX(bestup, provedbound) : provedbound) );
if( decision->downdbvalid )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, downchild, decision->downdb) );
}
if( decision->updbvalid )
{
SCIP_CALL( SCIPupdateNodeLowerbound(scip, upchild, decision->updb) );
}

if( decision->boundsvalid && config->applychildbounds )
{
Expand Down Expand Up @@ -4779,9 +4779,9 @@ SCIP_RETCODE selectVarRecursive(
decision->branchvar = candidatelist->candidates[0]->branchvar;
decision->branchval = candidatelist->candidates[0]->branchval;
decision->downdb = lpobjval;
decision->downdbvalid = TRUE;
decision->downdbvalid = FALSE;
decision->updb = lpobjval;
decision->updbvalid = TRUE;
decision->updbvalid = FALSE;
decision->proveddb = lpobjval;
decision->score = 0.0;

Expand Down Expand Up @@ -5373,9 +5373,9 @@ SCIP_RETCODE selectVarStart(
decision->branchvar = candidatelist->candidates[0]->branchvar;
decision->branchval = candidatelist->candidates[0]->branchval;
decision->downdb = lpobjval;
decision->downdbvalid = TRUE;
decision->downdbvalid = FALSE;
decision->updb = lpobjval;
decision->updbvalid = TRUE;
decision->updbvalid = FALSE;
decision->proveddb = lpobjval;

LABdebugMessage(scip, SCIP_VERBLEVEL_HIGH, "Only one candidate (<%s>) is given. This one is chosen without "
Expand Down Expand Up @@ -5428,9 +5428,9 @@ SCIP_RETCODE selectVarStart(
decision->branchvar = candidatelist->candidates[0]->branchvar;
decision->branchval = candidatelist->candidates[0]->branchval;
decision->downdb = lpobjval;
decision->downdbvalid = TRUE;
decision->downdbvalid = FALSE;
decision->updb = lpobjval;
decision->updbvalid = TRUE;
decision->updbvalid = FALSE;
decision->proveddb = lpobjval;

LABdebugMessage(scip, SCIP_VERBLEVEL_HIGH, "Only one candidate (<%s>) is given. This one is chosen without "
Expand Down Expand Up @@ -6046,41 +6046,49 @@ SCIP_DECL_BRANCHEXECLP(branchExeclpLookahead)
branchruledata->statistics->ncutoffproofnodes += localstats->ncutoffproofnodes;
#endif
}
else if( status->addedbinconss )
{
*result = SCIP_CONSADDED;
}
else if( status->domred )
{
*result = SCIP_REDUCEDDOM;
}
else if( status->lperror )
else
{
if( status->addedbinconss )
{
*result = SCIP_CONSADDED;
}
else if( status->domred )
{
*result = SCIP_REDUCEDDOM;
}
else if( status->lperror )
{
#ifdef SCIP_STATISTIC
++branchruledata->statistics->nlperrorcalls;
++branchruledata->statistics->nlperrorcalls;
#endif
if( !branchingDecisionIsValid(decision) )
{
LABdebugMessage(scip, SCIP_VERBLEVEL_FULL, "LP error with no valid candidate: select first candidate variable\n");
if( !branchingDecisionIsValid(decision) )
{
LABdebugMessage(scip, SCIP_VERBLEVEL_FULL, "LP error with no valid candidate: select first candidate variable\n");

assert(candidatelist->ncandidates > 0);
decision->branchvar = candidatelist->candidates[0]->branchvar;
decision->branchval = candidatelist->candidates[0]->branchval;
assert(candidatelist->ncandidates > 0);
decision->branchvar = candidatelist->candidates[0]->branchvar;
decision->branchval = candidatelist->candidates[0]->branchval;
}
}
else if( status->maxnconsreached )
{
/* this case may occure if the domain reductions that reached the limit were already applied via domain
* propagation
*/
*result = SCIP_REDUCEDDOM;
}
}
else if( status->maxnconsreached )
{
/* this case may occure if the domain reductions that reached the limit were already applied via domain
* propagation
*/
*result = SCIP_REDUCEDDOM;
}
#ifdef SCIP_STATISTIC
else if( status->limitreached )
{
++branchruledata->statistics->nlimitcalls;
}
else if( status->limitreached )
{
++branchruledata->statistics->nlimitcalls;
}
#endif
/* update lower bound of current node */
if( SCIPallColsInLP(scip) && !SCIPisExactSolve(scip) )
{
SCIP_CALL( SCIPupdateLocalLowerbound(scip, decision->proveddb) );
}
}

LABdebugMessage(scip, SCIP_VERBLEVEL_FULL, "Result before branching is %s\n", getStatusString(*result));

Expand Down
Loading

0 comments on commit 6d9f30f

Please sign in to comment.