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 Oct 2, 2024
2 parents d78e72e + a95b258 commit 1ba27b5
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 155 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ Features
Performance improvements
------------------------

- reoptimization now also stores propagations from propagators if reoptimization/saveconsprop is enabled;
the parameter will be renamed to reoptimization/saveprop in a next major release

Fixed bugs
----------

Expand Down
60 changes: 30 additions & 30 deletions src/scip/reopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,11 +1380,11 @@ SCIP_RETCODE cleanActiveConss(
return SCIP_OKAY;
}

/** update the bound changes made by constraint propagations during current iteration; stop saving the bound changes if
* we reach a branching decision based on a dual information.
/** update the bound changes made by propagations during current iteration; stop saving the bound changes if
* we reach a branching decision based on a dual information
*/
static
SCIP_RETCODE updateConstraintPropagation(
SCIP_RETCODE updatePropagation(
SCIP_REOPT* reopt, /**< reoptimization data structure */
SCIP_SET* set, /**< global SCIP settings */
BMS_BLKMEM* blkmem, /**< block memory */
Expand All @@ -1395,6 +1395,7 @@ SCIP_RETCODE updateConstraintPropagation(
{
int nvars;
int nconsprops;
int npropprops;
int naddedbndchgs;

assert(reopt != NULL);
Expand All @@ -1403,16 +1404,16 @@ SCIP_RETCODE updateConstraintPropagation(
assert(0 < id && id < reopt->reopttree->reoptnodessize);
assert(reopt->reopttree->reoptnodes[id] != NULL );

/* get the number of all stored constraint propagations */
SCIPnodeGetNDomchg(node, NULL, &nconsprops, NULL);
/* get the number of all stored constraint and propagator propagations */
SCIPnodeGetNDomchg(node, NULL, &nconsprops, &npropprops);
nvars = reopt->reopttree->reoptnodes[id]->nvars;

if( nconsprops > 0 )
if( nconsprops > 0 || npropprops > 0 )
{
/* check the memory */
SCIP_CALL( reoptnodeCheckMemory(reopt->reopttree->reoptnodes[id], set, blkmem, nvars + nconsprops, 0, 0) );
SCIP_CALL( reoptnodeCheckMemory(reopt->reopttree->reoptnodes[id], set, blkmem, nvars + nconsprops + npropprops, 0, 0) );

SCIPnodeGetConsProps(node,
SCIPnodeGetPropsBeforeDual(node,
&reopt->reopttree->reoptnodes[id]->vars[nvars],
&reopt->reopttree->reoptnodes[id]->varbounds[nvars],
&reopt->reopttree->reoptnodes[id]->varboundtypes[nvars],
Expand Down Expand Up @@ -1479,17 +1480,16 @@ SCIP_RETCODE saveAfterDualBranchings(
assert(reopt->reopttree->reoptnodes[id]->afterdualvarssize > 0);
assert(reopt->reopttree->reoptnodes[id]->nafterdualvars >= 0);

SCIPnodeGetBdChgsAfterDual(node,
reopt->reopttree->reoptnodes[id]->afterdualvars,
reopt->reopttree->reoptnodes[id]->afterdualvarbounds,
reopt->reopttree->reoptnodes[id]->afterdualvarboundtypes,
reopt->reopttree->reoptnodes[id]->nafterdualvars,
SCIPnodeGetPropsAfterDual(node,
reopt->reopttree->reoptnodes[id]->afterdualvars + reopt->reopttree->reoptnodes[id]->nafterdualvars,
reopt->reopttree->reoptnodes[id]->afterdualvarbounds + reopt->reopttree->reoptnodes[id]->nafterdualvars,
reopt->reopttree->reoptnodes[id]->afterdualvarboundtypes + reopt->reopttree->reoptnodes[id]->nafterdualvars,
&nbranchvars,
reopt->reopttree->reoptnodes[id]->afterdualvarssize);
reopt->reopttree->reoptnodes[id]->afterdualvarssize - reopt->reopttree->reoptnodes[id]->nafterdualvars);

if( nbranchvars > reopt->reopttree->reoptnodes[id]->afterdualvarssize )
if( nbranchvars > reopt->reopttree->reoptnodes[id]->afterdualvarssize - reopt->reopttree->reoptnodes[id]->nafterdualvars )
{
int newsize = SCIPsetCalcMemGrowSize(set, nbranchvars+1);
int newsize = SCIPsetCalcMemGrowSize(set, reopt->reopttree->reoptnodes[id]->nafterdualvars + nbranchvars);
SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &(reopt->reopttree->reoptnodes[id]->afterdualvars), \
reopt->reopttree->reoptnodes[id]->afterdualvarssize, newsize) );
SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &(reopt->reopttree->reoptnodes[id]->afterdualvarbounds), \
Expand All @@ -1498,13 +1498,12 @@ SCIP_RETCODE saveAfterDualBranchings(
reopt->reopttree->reoptnodes[id]->afterdualvarssize, newsize) );
reopt->reopttree->reoptnodes[id]->afterdualvarssize = newsize;

SCIPnodeGetBdChgsAfterDual(node,
reopt->reopttree->reoptnodes[id]->afterdualvars,
reopt->reopttree->reoptnodes[id]->afterdualvarbounds,
reopt->reopttree->reoptnodes[id]->afterdualvarboundtypes,
reopt->reopttree->reoptnodes[id]->nafterdualvars,
SCIPnodeGetPropsAfterDual(node,
reopt->reopttree->reoptnodes[id]->afterdualvars + reopt->reopttree->reoptnodes[id]->nafterdualvars,
reopt->reopttree->reoptnodes[id]->afterdualvarbounds + reopt->reopttree->reoptnodes[id]->nafterdualvars,
reopt->reopttree->reoptnodes[id]->afterdualvarboundtypes + reopt->reopttree->reoptnodes[id]->nafterdualvars,
&nbranchvars,
reopt->reopttree->reoptnodes[id]->afterdualvarssize);
reopt->reopttree->reoptnodes[id]->afterdualvarssize - reopt->reopttree->reoptnodes[id]->nafterdualvars);
}

/* the stored variables of this node need to be transformed into the original space */
Expand All @@ -1513,9 +1512,9 @@ SCIP_RETCODE saveAfterDualBranchings(

SCIPsetDebugMsg(set, " -> save %d bound changes after dual reductions\n", nbranchvars);

assert(nbranchvars <= reopt->reopttree->reoptnodes[id]->afterdualvarssize); /* this should be the case */
assert(reopt->reopttree->reoptnodes[id]->nafterdualvars + nbranchvars <= reopt->reopttree->reoptnodes[id]->afterdualvarssize); /* this should be the case */

reopt->reopttree->reoptnodes[id]->nafterdualvars = nbranchvars;
reopt->reopttree->reoptnodes[id]->nafterdualvars += nbranchvars;

return SCIP_OKAY;
}
Expand Down Expand Up @@ -1686,13 +1685,14 @@ SCIP_RETCODE getLastSavedNode(
{
int nbranchings = 0;
int nconsprop = 0;
int npropprops = 0;

if( set->reopt_saveconsprop )
SCIPnodeGetNDomchg((*parent), &nbranchings, &nconsprop, NULL);
if( set->reopt_saveprop )
SCIPnodeGetNDomchg((*parent), &nbranchings, &nconsprop, &npropprops);
else
SCIPnodeGetNDomchg((*parent), &nbranchings, NULL, NULL);

(*nbndchgs) = (*nbndchgs) + nbranchings + nconsprop;
(*nbndchgs) = (*nbndchgs) + nbranchings + nconsprop + npropprops;
(*parent) = SCIPnodeGetParent(*parent);
(*parentid) = SCIPnodeGetReoptID(*parent);

Expand Down Expand Up @@ -2710,10 +2710,10 @@ SCIP_RETCODE addNode(
SCIP_CALL( saveAfterDualBranchings(reopt, set, blkmem, node, id, &transintoorig) );
}

/* update constraint propagations */
if( set->reopt_saveconsprop )
/* update propagations */
if( set->reopt_saveprop )
{
SCIP_CALL( updateConstraintPropagation(reopt, set, blkmem, node, id, &transintoorig) );
SCIP_CALL( updatePropagation(reopt, set, blkmem, node, id, &transintoorig) );
}

/* ensure that all variables describing the branching path are original */
Expand Down
6 changes: 3 additions & 3 deletions src/scip/set.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
* branching
*/
#define SCIP_DEFAULT_REOPT_REDUCETOFRONTIER TRUE/**< delete stored nodes which were not reoptimized */
#define SCIP_DEFAULT_REOPT_SAVECONSPROP FALSE/**< save constraint propagation */
#define SCIP_DEFAULT_REOPT_SAVEPROP FALSE /**< save constraint and propagator propagation */
#define SCIP_DEFAULT_REOPT_USESPLITCONS TRUE /**< use constraints to reconstruct the subtree pruned be dual reduction
* when reactivating the node
*/
Expand Down Expand Up @@ -2416,8 +2416,8 @@ SCIP_RETCODE SCIPsetCreate(
NULL, NULL) );
SCIP_CALL( SCIPsetAddBoolParam(*set, messagehdlr, blkmem,
"reoptimization/saveconsprop",
"save constraint propagations",
&(*set)->reopt_saveconsprop, TRUE, SCIP_DEFAULT_REOPT_SAVECONSPROP,
"save constraint and propagator propagations",
&(*set)->reopt_saveprop, TRUE, SCIP_DEFAULT_REOPT_SAVEPROP,
NULL, NULL) );
SCIP_CALL( SCIPsetAddBoolParam(*set, messagehdlr, blkmem,
"reoptimization/usesplitcons", "use constraints to reconstruct the subtree pruned be dual reduction when reactivating the node",
Expand Down
2 changes: 1 addition & 1 deletion src/scip/struct_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ struct SCIP_Set
SCIP_Bool reopt_commontimelimit;/**< time limit over all reoptimization rounds? */
SCIP_Bool reopt_enable; /**< enable reoptimization */
SCIP_Bool reopt_reducetofrontier; /**< delete stored nodes which were not reoptimized */
SCIP_Bool reopt_saveconsprop; /**< save constraint propagations */
SCIP_Bool reopt_saveprop; /**< save constraint and propagator propagations */
SCIP_Bool reopt_sbinit; /**< try to fix variables before reoptimizing by probing like strong
* branching
*/
Expand Down
Loading

0 comments on commit 1ba27b5

Please sign in to comment.