methods for concurrent solvers
Definition in file concsolver.c.
#include <assert.h>
#include <string.h>
#include "scip/concsolver.h"
#include "scip/set.h"
#include "scip/scip.h"
#include "scip/concurrent.h"
#include "scip/struct_concsolver.h"
#include "scip/struct_stat.h"
#include "scip/struct_scip.h"
#include "blockmemshell/memory.h"
#include "scip/syncstore.h"
#include "scip/boundstore.h"
#include "scip/clock.h"
Go to the source code of this file.
SCIP_RETCODE SCIPconcsolverTypeCreate | ( | SCIP_CONCSOLVERTYPE ** | concsolvertype, |
SCIP_SET * | set, | ||
SCIP_MESSAGEHDLR * | messagehdlr, | ||
BMS_BLKMEM * | blkmem, | ||
const char * | name, | ||
SCIP_Real | prefpriodefault, | ||
SCIP_DECL_CONCSOLVERCREATEINST((*concsolvercreateinst)) | , | ||
SCIP_DECL_CONCSOLVERDESTROYINST((*concsolverdestroyinst)) | , | ||
SCIP_DECL_CONCSOLVERINITSEEDS((*concsolverinitseeds)) | , | ||
SCIP_DECL_CONCSOLVEREXEC((*concsolverexec)) | , | ||
SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA((*concsolvercopysolvdata)) | , | ||
SCIP_DECL_CONCSOLVERSTOP((*concsolverstop)) | , | ||
SCIP_DECL_CONCSOLVERSYNCWRITE((*concsolversyncwrite)) | , | ||
SCIP_DECL_CONCSOLVERSYNCREAD((*concsolversyncread)) | , | ||
SCIP_DECL_CONCSOLVERTYPEFREEDATA((*concsolvertypefreedata)) | , | ||
SCIP_CONCSOLVERTYPEDATA * | data | ||
) |
creates a concurrent solver type
concsolvertype | pointer to concurrent solver data structure |
set | global SCIP settings |
messagehdlr | message handler |
blkmem | block memory for parameter settings |
name | name of concurrent solver |
prefpriodefault | the default preferred priority of this concurrent solver type |
data | the concurent solver type's data |
Definition at line 41 of file concsolver.c.
References BMSallocMemory, BMSduplicateMemoryArray, FALSE, SCIP_ALLOC, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPsetAddRealParam(), and SCIPsnprintf().
Referenced by SCIPincludeConcsolverType().
void SCIPconcsolverTypeFree | ( | SCIP_CONCSOLVERTYPE ** | concsolvertype | ) |
frees all memory of a concurrent solver type
concsolvertype | pointer to concurrent solver data structure |
Definition at line 100 of file concsolver.c.
References BMSfreeMemory, and BMSfreeMemoryArray.
Referenced by SCIPsetFree().
SCIP_CONCSOLVERTYPEDATA* SCIPconcsolverTypeGetData | ( | SCIP_CONCSOLVERTYPE * | concsolvertype | ) |
gets the data of a concurrent solver type
concsolvertype | concurrent solver type |
Definition at line 115 of file concsolver.c.
References SCIP_ConcSolverType::data.
Referenced by SCIP_DECL_CONCSOLVERCREATEINST().
void SCIPconcsolverTypeSetData | ( | SCIP_CONCSOLVERTYPE * | concsolvertype, |
SCIP_CONCSOLVERTYPEDATA * | data | ||
) |
sets the data of a concurrent solver type
concsolvertype | concurrent solver type |
data | the concurrent solver's data |
Definition at line 125 of file concsolver.c.
References SCIP_ConcSolverType::data.
char* SCIPconcsolverTypeGetName | ( | SCIP_CONCSOLVERTYPE * | concsolvertype | ) |
gets the name of a concurrent solver type
concsolvertype | concurrent solver type |
Definition at line 136 of file concsolver.c.
References SCIP_ConcSolverType::name.
Referenced by SCIPsetIncludeBanditvtable().
SCIP_Real SCIPconcsolverTypeGetPrefPrio | ( | SCIP_CONCSOLVERTYPE * | concsolvertype | ) |
gets the preferred priority from a concurrent solver type
concsolvertype | concurrent solver type |
Definition at line 146 of file concsolver.c.
References SCIP_ConcSolverType::prefprio.
Referenced by SCIPsolveConcurrent().
SCIP_RETCODE SCIPconcsolverCreateInstance | ( | SCIP_SET * | set, |
SCIP_CONCSOLVERTYPE * | concsolvertype, | ||
SCIP_CONCSOLVER ** | concsolver | ||
) |
creates an instance of the given concurrent solver type
set | global SCIP settings |
concsolvertype | concurrent solver type to create |
concsolver | pointer to return concurrent solver instance |
Definition at line 156 of file concsolver.c.
References BMSallocMemory, BMSduplicateMemoryArray, SCIP_ConcSolverType::name, SCIP_ConcSolverType::ninstances, SCIP_ALLOC, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_PARA_DETERMINISTIC, SCIPaddConcurrentSolver(), SCIPcreateWallClock(), SCIPdebugMessage, SCIPgetNConcurrentSolvers(), SCIPgetNVars(), and SCIPsnprintf().
Referenced by SCIPsolveConcurrent().
SCIP_RETCODE SCIPconcsolverDestroyInstance | ( | SCIP_SET * | set, |
SCIP_CONCSOLVER ** | concsolver | ||
) |
destroys an instance of the given concurrent solver
set | global SCIP settings |
concsolver | concurrent solver |
Definition at line 203 of file concsolver.c.
References BMSfreeMemory, BMSfreeMemoryArray, SCIP_CALL, SCIP_OKAY, and SCIPfreeClock().
SCIP_CONCSOLVERDATA* SCIPconcsolverGetData | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the data of a concurrent solver
concsolver | concurrent solver |
Definition at line 225 of file concsolver.c.
References SCIP_ConcSolver::data.
Referenced by initConcsolver(), SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA(), SCIP_DECL_CONCSOLVERDESTROYINST(), SCIP_DECL_CONCSOLVEREXEC(), SCIP_DECL_CONCSOLVERINITSEEDS(), SCIP_DECL_CONCSOLVERSTOP(), SCIP_DECL_CONCSOLVERSYNCREAD(), SCIP_DECL_CONCSOLVERSYNCWRITE(), and setChildSelRule().
void SCIPconcsolverSetData | ( | SCIP_CONCSOLVER * | concsolver, |
SCIP_CONCSOLVERDATA * | data | ||
) |
sets the data of a concurrent solver
concsolver | concurrent solver |
data | the concurrent solver's data |
Definition at line 235 of file concsolver.c.
References SCIP_ConcSolver::data.
Referenced by SCIP_DECL_CONCSOLVERCREATEINST(), and SCIP_DECL_CONCSOLVERDESTROYINST().
char* SCIPconcsolverGetName | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the name of a concurrent solver
concsolver | concurrent solver |
Definition at line 246 of file concsolver.c.
References SCIP_ConcSolver::name.
Referenced by initConcsolver(), SCIP_DECL_CONCSOLVERCREATEINST(), SCIP_DECL_CONCSOLVEREXEC(), SCIP_DECL_CONCSOLVERINITSEEDS(), SCIP_DECL_CONCSOLVERSYNCREAD(), SCIP_DECL_CONCSOLVERSYNCWRITE(), and SCIPprintConcsolverStatistics().
SCIP_RETCODE SCIPconcsolverInitSeeds | ( | SCIP_CONCSOLVER * | concsolver, |
unsigned int | seed | ||
) |
initializes the random seeds of a concurrent solver
concsolver | concurrent solver |
seed | seed for initializing the solver's internal random seeds |
Definition at line 256 of file concsolver.c.
References SCIP_CALL, SCIP_OKAY, and SCIP_ConcSolver::type.
Referenced by SCIPsolveConcurrent().
SCIP_RETCODE SCIPconcsolverExec | ( | SCIP_CONCSOLVER * | concsolver | ) |
start the solving process of a concurrent solver
concsolver | concurrent solver |
Definition at line 271 of file concsolver.c.
References FALSE, SCIP_ConcSolver::nlpiterations, SCIP_ConcSolver::nnodes, SCIP_CALL, SCIP_OKAY, SCIP_ConcSolver::solvingtime, SCIP_ConcSolver::stopped, and SCIP_ConcSolver::type.
Referenced by execConcsolver().
SCIP_RETCODE SCIPconcsolverGetSolvingData | ( | SCIP_CONCSOLVER * | concsolver, |
SCIP * | scip | ||
) |
gets solving data of concurrent solver and stores it in the given SCIP instance
concsolver | concurrent solver |
scip | SCIP datastructure |
Definition at line 289 of file concsolver.c.
References SCIP_ConcSolver::type.
Referenced by SCIPconcurrentSolve().
SCIP_RETCODE SCIPconcsolverStop | ( | SCIP_CONCSOLVER * | concsolver | ) |
interrupt solving in a concurrent solver
concsolver | concurrent solver |
Definition at line 302 of file concsolver.c.
References SCIP_CALL, SCIP_OKAY, SCIP_ConcSolver::stopped, TRUE, and SCIP_ConcSolver::type.
Referenced by SCIPconcsolverSync().
SCIP_RETCODE SCIPconcsolverSync | ( | SCIP_CONCSOLVER * | concsolver, |
SCIP_SET * | set | ||
) |
let the given concurrent solver synchronize, i.e. pass its own solutions and bounds to the SPI.
concsolver | concurrent solver |
set | global SCIP settings |
Definition at line 321 of file concsolver.c.
References SCIP_ConcSolver::name, SCIP_ConcSolver::nsolsrecvd, SCIP_ConcSolver::nsolsshared, SCIP_ConcSolver::nsyncs, SCIP_ConcSolver::ntighterbnds, SCIP_ConcSolver::ntighterintbnds, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_STATUS_UNKNOWN, SCIPboundstoreGetNChgs(), SCIPconcsolverStop(), SCIPdebugMessage, SCIPgetSyncstore(), SCIPrelDiff(), SCIPsetInfinity(), SCIPsetIsGE(), SCIPsetIsInfinity(), SCIPstartClock(), SCIPstopClock(), SCIPsyncdataGetBoundChgs(), SCIPsyncdataGetLowerbound(), SCIPsyncdataGetNSynced(), SCIPsyncdataGetStatus(), SCIPsyncdataGetSyncFreq(), SCIPsyncdataGetUpperbound(), SCIPsyncdataSetSyncFreq(), SCIPsyncstoreEnsureAllSynced(), SCIPsyncstoreFinishSync(), SCIPsyncstoreGetNextSyncdata(), SCIPsyncstoreGetNSolvers(), SCIPsyncstoreGetSyncdata(), SCIPsyncstoreStartSync(), SCIP_ConcSolver::stopped, SCIP_ConcSolver::syncdata, SCIP_ConcSolver::syncdelay, SCIP_ConcSolver::syncfreq, SCIP_ConcSolver::timesincelastsync, SCIP_ConcSolver::totalsynctime, and SCIP_ConcSolver::type.
Referenced by execConcsolver(), and SCIPsynchronize().
SCIP_Real SCIPconcsolverGetSyncFreq | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the current synchronization frequency of the concurent solver
concsolver | concurrent solver |
Definition at line 455 of file concsolver.c.
References SCIP_ConcSolver::syncfreq.
Referenced by SCIPincrementConcurrentTime().
SCIP_Longint SCIPconcsolverGetMemTotal | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the total memory used by the concurent solver
concsolver | concurrent solver |
Definition at line 465 of file concsolver.c.
References SCIPsyncdataGetMemTotal(), and SCIP_ConcSolver::syncdata.
Referenced by SCIPgetConcurrentMemTotal().
void SCIPconcsolverSetTimeSinceLastSync | ( | SCIP_CONCSOLVER * | concsolver, |
SCIP_Real | time | ||
) |
sets the time elapsed since the last synchronization. Must be set before the synchronization is started.
concsolver | concurrent solver |
time | the time passed since the last synchronization |
Definition at line 477 of file concsolver.c.
References SCIP_ConcSolver::timesincelastsync.
Referenced by SCIPincrementConcurrentTime().
SCIP_Real SCIPconcsolverGetSolvingTime | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the solving time of the concurrent solver
concsolver | concurrent solver |
Definition at line 488 of file concsolver.c.
References SCIP_ConcSolver::solvingtime.
Referenced by SCIPprintConcsolverStatistics().
SCIP_Real SCIPconcsolverGetSyncTime | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the time spent for synchronization for the concurrent solver
concsolver | concurrent solver |
Definition at line 498 of file concsolver.c.
References SCIPclockGetTime(), and SCIP_ConcSolver::totalsynctime.
Referenced by SCIPprintConcsolverStatistics().
SCIP_Longint SCIPconcsolverGetNLPIterations | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the number of lp iterations the concurrent solver used
concsolver | concurrent solver |
Definition at line 508 of file concsolver.c.
References SCIP_ConcSolver::nlpiterations.
Referenced by SCIPprintConcsolverStatistics().
SCIP_Longint SCIPconcsolverGetNNodes | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the number of branch and bound nodes the concurrent solver used
concsolver | concurrent solver |
Definition at line 518 of file concsolver.c.
References SCIP_ConcSolver::nnodes.
Referenced by SCIPprintConcsolverStatistics().
SCIP_Longint SCIPconcsolverGetNSolsRecvd | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the number of solutions the concurrent solver received during synchronization
concsolver | concurrent solver |
Definition at line 528 of file concsolver.c.
References SCIP_ConcSolver::nsolsrecvd.
Referenced by SCIPprintConcsolverStatistics().
SCIP_Longint SCIPconcsolverGetNSolsShared | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the number of solutions the concurrent solver shared during synchronization
concsolver | concurrent solver |
Definition at line 538 of file concsolver.c.
References SCIP_ConcSolver::nsolsshared.
Referenced by SCIPprintConcsolverStatistics().
SCIP_Longint SCIPconcsolverGetNTighterBnds | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the number of tighter global variable bounds the solver received
concsolver | concurrent solver |
Definition at line 548 of file concsolver.c.
References SCIP_ConcSolver::ntighterbnds.
Referenced by SCIPprintConcsolverStatistics().
SCIP_Longint SCIPconcsolverGetNTighterIntBnds | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets the number of tighter global variable bounds of integer variables the solver received
concsolver | concurrent solver |
Definition at line 558 of file concsolver.c.
References SCIP_ConcSolver::ntighterintbnds.
Referenced by SCIPprintConcsolverStatistics().
int SCIPconcsolverGetIdx | ( | SCIP_CONCSOLVER * | concsolver | ) |
gets index of concurrent solver
concsolver | concurrent solver |
Definition at line 568 of file concsolver.c.
References SCIP_ConcSolver::idx.
Referenced by SCIP_DECL_CONCSOLVERCREATEINST(), SCIP_DECL_CONCSOLVERSYNCREAD(), SCIP_DECL_CONCSOLVERSYNCWRITE(), and setChildSelRule().