Skip to content

Commit

Permalink
Merge branch 'concurrent-check-gap' into 'v9-minor'
Browse files Browse the repository at this point in the history
add gap limit checks to syncstoreFinishSync

See merge request integer/scip!3515
  • Loading branch information
svigerske committed Sep 24, 2024
2 parents 75eeedc + b5bd65a commit 831aeb9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Features
--------

- added check for absolute and relative gap limits at end of synchronization in concurrent solving mode, in order to terminate earlier;
note that if the concurrent solve is stopped due to a gap limit, the "winner" solver will have an interrupted solution status and
its primal and dual bounds may not be the best possible ones (use SCIPgetConcurrentPrimalbound() and SCIPgetConcurrentDualbound() instead)

Performance improvements
------------------------

Expand Down
2 changes: 2 additions & 0 deletions src/scip/struct_syncstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ struct SCIP_SyncStore
* by all threads */

SCIP* mainscip; /**< the SCIP instance that was used for initializing the syncstore */
SCIP_Real limit_gap; /**< relative gap limit in main SCIP */
SCIP_Real limit_absgap; /**< absolute gap limit in main SCIP */
SCIP_Bool stopped; /**< flag to indicate if the solving is stopped */
SCIP_LOCK* lock; /**< lock to protect the syncstore data structure from data races */

Expand Down
6 changes: 5 additions & 1 deletion src/scip/syncstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ SCIP_RETCODE SCIPsyncstoreInit(
syncstore = SCIPgetSyncstore(scip);
assert(syncstore != NULL);
syncstore->mainscip = scip;
SCIP_CALL( SCIPgetRealParam(scip, "limits/gap", &syncstore->limit_gap) );
SCIP_CALL( SCIPgetRealParam(scip, "limits/absgap", &syncstore->limit_absgap) );
syncstore->lastsync = NULL;
syncstore->nsolvers = SCIPgetNConcurrentSolvers(scip);

Expand Down Expand Up @@ -492,7 +494,9 @@ SCIP_RETCODE SCIPsyncstoreFinishSync(

if( (*syncdata)->syncedcount == syncstore->nsolvers )
{
if( (*syncdata)->status != SCIP_STATUS_UNKNOWN )
if( (*syncdata)->status != SCIP_STATUS_UNKNOWN ||
(SCIPgetConcurrentGap(syncstore->mainscip) <= syncstore->limit_gap) ||
(SCIPgetConcurrentPrimalbound(syncstore->mainscip) - SCIPgetConcurrentDualbound(syncstore->mainscip) <= syncstore->limit_absgap) )
SCIPsyncstoreSetSolveIsStopped(syncstore, TRUE);

syncstore->lastsync = *syncdata;
Expand Down

0 comments on commit 831aeb9

Please sign in to comment.