methods for primal heuristics
Definition in file heur.c.
#include <assert.h>
#include <string.h>
#include "scip/def.h"
#include "scip/set.h"
#include "scip/clock.h"
#include "scip/paramset.h"
#include "scip/primal.h"
#include "scip/scip.h"
#include "scip/heur.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/misc.h"
#include "scip/struct_heur.h"
Go to the source code of this file.
|
static |
method to call, when the priority of a heuristic was changed
Definition at line 72 of file heur.c.
References SCIP_CALL, SCIP_OKAY, SCIPparamGetData(), SCIPparamGetInt(), and SCIPsetHeurPriority().
SCIP_RETCODE SCIPdivesetReset | ( | SCIP_DIVESET * | diveset, |
SCIP_SET * | set | ||
) |
resets diving settings counters
diveset | diveset to be reset |
set | global SCIP settings |
Definition at line 86 of file heur.c.
References SCIP_Diveset::initialseed, SCIP_Diveset::maxdepth, SCIP_Diveset::maxsoldepth, SCIP_Diveset::mindepth, SCIP_Diveset::minsoldepth, SCIP_Diveset::nbestsolsfound, SCIP_Diveset::ncalls, SCIP_Diveset::nlpiterations, SCIP_Diveset::nlps, SCIP_Diveset::nsolcalls, SCIP_Diveset::nsolsfound, SCIP_Diveset::randnumgen, SCIP_OKAY, SCIPrandomSetSeed(), SCIPsetInitializeRandomSeed(), SCIP_Diveset::totaldepth, SCIP_Diveset::totalnbacktracks, SCIP_Diveset::totalnnodes, and SCIP_Diveset::totalsoldepth.
Referenced by SCIPdivesetCreate(), and SCIPheurInit().
void SCIPdivesetUpdateStats | ( | SCIP_DIVESET * | diveset, |
SCIP_STAT * | stat, | ||
int | depth, | ||
int | nprobingnodes, | ||
int | nbacktracks, | ||
SCIP_Longint | nsolsfound, | ||
SCIP_Longint | nbestsolsfound, | ||
SCIP_Bool | leavesol | ||
) |
update diveset statistics and global diveset statistics
diveset | diveset to be reset |
stat | global SCIP statistics |
depth | the depth reached this time |
nprobingnodes | the number of probing nodes explored this time |
nbacktracks | the number of backtracks during probing this time |
nsolsfound | number of new solutions found this time |
nbestsolsfound | number of new best solutions found this time |
leavesol | has the diving heuristic reached a feasible leaf |
Definition at line 116 of file heur.c.
References MAX, SCIP_Diveset::maxdepth, SCIP_Diveset::maxsoldepth, SCIP_Diveset::mindepth, SCIP_Diveset::minsoldepth, SCIP_Diveset::nbestsolsfound, SCIP_Diveset::ncalls, SCIP_Stat::ndivesetcalls, SCIP_Diveset::nsolcalls, SCIP_Diveset::nsolsfound, SCIP_Diveset::totaldepth, SCIP_Stat::totaldivesetdepth, SCIP_Diveset::totalnbacktracks, SCIP_Diveset::totalnnodes, and SCIP_Diveset::totalsoldepth.
Referenced by SCIPupdateDivesetStats().
|
static |
append diveset to heuristic array of divesets
heur | the heuristic to which this dive setting belongs |
diveset | pointer to the freshly created diveset |
Definition at line 154 of file heur.c.
References BMSallocMemoryArray, BMSreallocMemoryArray, SCIP_Heur::divesets, SCIP_Diveset::heur, SCIP_Heur::ndivesets, SCIP_ALLOC, and SCIP_OKAY.
Referenced by SCIPdivesetCreate().
SCIP_RETCODE SCIPdivesetCreate | ( | SCIP_DIVESET ** | divesetptr, |
SCIP_HEUR * | heur, | ||
const char * | name, | ||
SCIP_SET * | set, | ||
SCIP_MESSAGEHDLR * | messagehdlr, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_Real | minreldepth, | ||
SCIP_Real | maxreldepth, | ||
SCIP_Real | maxlpiterquot, | ||
SCIP_Real | maxdiveubquot, | ||
SCIP_Real | maxdiveavgquot, | ||
SCIP_Real | maxdiveubquotnosol, | ||
SCIP_Real | maxdiveavgquotnosol, | ||
SCIP_Real | lpresolvedomchgquot, | ||
int | lpsolvefreq, | ||
int | maxlpiterofs, | ||
unsigned int | initialseed, | ||
SCIP_Bool | backtrack, | ||
SCIP_Bool | onlylpbranchcands, | ||
SCIP_DIVETYPE | divetypemask, | ||
SCIP_DECL_DIVESETGETSCORE((*divesetgetscore)) | |||
) |
create a set of diving heuristic settings
divesetptr | pointer to the freshly created diveset |
heur | the heuristic to which this dive setting belongs |
name | name for the diveset, or NULL if the name of the heuristic should be used |
set | global SCIP settings |
messagehdlr | message handler |
blkmem | block memory for parameter settings |
minreldepth | minimal relative depth to start diving |
maxreldepth | maximal relative depth to start diving |
maxlpiterquot | maximal fraction of diving LP iterations compared to node LP iterations |
maxdiveubquot | maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound) where diving is performed (0.0: no limit) |
maxdiveavgquot | maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound) where diving is performed (0.0: no limit) |
maxdiveubquotnosol | maximal UBQUOT when no solution was found yet (0.0: no limit) |
maxdiveavgquotnosol | maximal AVGQUOT when no solution was found yet (0.0: no limit) |
lpresolvedomchgquot | percentage of immediate domain changes during probing to trigger LP resolve |
lpsolvefreq | LP solve frequency for (0: only if enough domain reductions are found by propagation) |
maxlpiterofs | additional number of allowed LP iterations |
initialseed | initial seed for random number generation |
backtrack | use one level of backtracking if infeasibility is encountered? |
onlylpbranchcands | should only LP branching candidates be considered instead of the slower but more general constraint handler diving variable selection? |
divetypemask | bit mask that represents the supported dive types by this dive set |
Definition at line 184 of file heur.c.
References SCIP_Diveset::backtrack, BMSallocBlockMemory, BMSduplicateMemoryArray, SCIP_Diveset::divetypemask, FALSE, SCIP_Diveset::heur, heurAddDiveset(), SCIP_Diveset::initialseed, SCIP_Diveset::lpresolvedomchgquot, SCIP_Diveset::lpsolvefreq, SCIP_Diveset::maxdiveavgquot, SCIP_Diveset::maxdiveavgquotnosol, SCIP_Diveset::maxdiveubquot, SCIP_Diveset::maxdiveubquotnosol, SCIP_Diveset::maxlpiterofs, SCIP_Diveset::maxlpiterquot, SCIP_Diveset::maxreldepth, SCIP_Diveset::minreldepth, SCIP_Diveset::name, SCIP_Diveset::onlylpbranchcands, SCIP_Diveset::randnumgen, SCIP_ALLOC, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_REAL_MAX, SCIPdivesetReset(), SCIPheurGetName(), SCIPrandomCreate(), SCIPsetAddBoolParam(), SCIPsetAddIntParam(), SCIPsetAddRealParam(), SCIPsnprintf(), SCIP_Diveset::sol, and TRUE.
Referenced by SCIPcreateDiveset().
SCIP_HEUR* SCIPdivesetGetHeur | ( | SCIP_DIVESET * | diveset | ) |
get the heuristic to which this diving setting belongs
diveset | diving settings |
Definition at line 322 of file heur.c.
References SCIP_Diveset::heur.
SCIP_SOL* SCIPdivesetGetWorkSolution | ( | SCIP_DIVESET * | diveset | ) |
get the working solution of this dive set
diveset | diving settings |
Definition at line 330 of file heur.c.
References SCIP_Diveset::sol.
void SCIPdivesetSetWorkSolution | ( | SCIP_DIVESET * | diveset, |
SCIP_SOL * | sol | ||
) |
set the working solution for this dive set
diveset | diving settings |
sol | new working solution for this dive set, or NULL |
Definition at line 340 of file heur.c.
References SCIP_Diveset::sol.
Referenced by SCIPperformGenericDivingAlgorithm().
void SCIPdivesetUpdateLPStats | ( | SCIP_DIVESET * | diveset, |
SCIP_STAT * | stat, | ||
SCIP_Longint | niterstoadd | ||
) |
update diveset LP statistics, should be called after every LP solved by this diving heuristic
diveset | diving settings |
stat | global SCIP statistics |
niterstoadd | additional number of LP iterations to be added |
Definition at line 615 of file heur.c.
References SCIP_Stat::ndivesetlpiterations, SCIP_Stat::ndivesetlps, SCIP_Diveset::nlpiterations, and SCIP_Diveset::nlps.
Referenced by SCIPupdateDivesetLPStats().
|
static |
frees memory of a diveset
divesetptr | general diving settings |
blkmem | block memory for parameter settings |
Definition at line 629 of file heur.c.
References BMSfreeBlockMemory, BMSfreeMemoryArray, SCIP_Diveset::name, SCIP_Diveset::randnumgen, and SCIPrandomFree().
Referenced by SCIPheurFree().
SCIP_RETCODE SCIPdivesetGetScore | ( | SCIP_DIVESET * | diveset, |
SCIP_SET * | set, | ||
SCIP_DIVETYPE | divetype, | ||
SCIP_VAR * | divecand, | ||
SCIP_Real | divecandsol, | ||
SCIP_Real | divecandfrac, | ||
SCIP_Real * | candscore, | ||
SCIP_Bool * | roundup | ||
) |
get the candidate score and preferred rounding direction for a candidate variable
diveset | general diving settings |
set | SCIP settings |
divetype | the type of diving that should be applied |
divecand | the candidate for which the branching direction is requested |
divecandsol | LP solution value of the candidate |
divecandfrac | fractionality of the candidate |
candscore | pointer to store the candidate score |
roundup | pointer to store whether preferred direction for diving is upwards |
Definition at line 647 of file heur.c.
References SCIP_Diveset::divetypemask, SCIP_CALL, and SCIP_OKAY.
Referenced by SCIPgetDivesetScore().
SCIP_RETCODE SCIPheurCopyInclude | ( | SCIP_HEUR * | heur, |
SCIP_SET * | set | ||
) |
copies the given primal heuristic to a new scip
heur | primal heuristic |
set | SCIP_SET of SCIP to copy to |
Definition at line 673 of file heur.c.
References SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPsetDebugMsg.
SCIP_RETCODE SCIPheurCreate | ( | SCIP_HEUR ** | heur, |
SCIP_SET * | set, | ||
SCIP_MESSAGEHDLR * | messagehdlr, | ||
BMS_BLKMEM * | blkmem, | ||
const char * | name, | ||
const char * | desc, | ||
char | dispchar, | ||
int | priority, | ||
int | freq, | ||
int | freqofs, | ||
int | maxdepth, | ||
SCIP_HEURTIMING | timingmask, | ||
SCIP_Bool | usessubscip, | ||
SCIP_DECL_HEURCOPY((*heurcopy)) | , | ||
SCIP_DECL_HEURFREE((*heurfree)) | , | ||
SCIP_DECL_HEURINIT((*heurinit)) | , | ||
SCIP_DECL_HEUREXIT((*heurexit)) | , | ||
SCIP_DECL_HEURINITSOL((*heurinitsol)) | , | ||
SCIP_DECL_HEUREXITSOL((*heurexitsol)) | , | ||
SCIP_DECL_HEUREXEC((*heurexec)) | , | ||
SCIP_HEURDATA * | heurdata | ||
) |
creates a primal heuristic
heur | pointer to primal heuristic data structure |
set | global SCIP settings |
messagehdlr | message handler |
blkmem | block memory for parameter settings |
name | name of primal heuristic |
desc | description of primal heuristic |
dispchar | display character of primal heuristic |
priority | priority of the primal heuristic |
freq | frequency for calling primal heuristic |
freqofs | frequency offset for calling primal heuristic |
maxdepth | maximal depth level to call heuristic at (-1: no limit) |
timingmask | positions in the node solving loop where heuristic should be executed |
usessubscip | does the heuristic use a secondary SCIP instance? |
heurdata | primal heuristic data |
Definition at line 692 of file heur.c.
References BMSallocMemory, BMSduplicateMemoryArray, FALSE, SCIP_ALLOC, SCIP_CALL, SCIP_CLOCKTYPE_DEFAULT, SCIP_MAXSTRLEN, SCIP_MAXTREEDEPTH, SCIP_OKAY, SCIPclockCreate(), SCIPsetAddIntParam(), SCIPsnprintf(), and TRUE.
Referenced by SCIPincludeHeur(), and SCIPincludeHeurBasic().
SCIP_RETCODE SCIPheurFree | ( | SCIP_HEUR ** | heur, |
SCIP_SET * | set, | ||
BMS_BLKMEM * | blkmem | ||
) |
calls destructor and frees memory of primal heuristic
heur | pointer to primal heuristic data structure |
set | global SCIP settings |
blkmem | block memory |
Definition at line 777 of file heur.c.
References BMSfreeMemory, BMSfreeMemoryArray, BMSfreeMemoryArrayNull, divesetFree(), SCIP_CALL, SCIP_OKAY, and SCIPclockFree().
Referenced by SCIPsetFree().
SCIP_RETCODE SCIPheurInit | ( | SCIP_HEUR * | heur, |
SCIP_SET * | set | ||
) |
initializes primal heuristic
heur | primal heuristic |
set | global SCIP settings |
Definition at line 812 of file heur.c.
References SCIP_Heur::delaypos, SCIP_Heur::divesets, SCIP_Heur::heurclock, SCIP_Heur::initialized, SCIP_Heur::name, SCIP_Heur::nbestsolsfound, SCIP_Heur::ncalls, SCIP_Heur::ndivesets, SCIP_Heur::nsolsfound, SCIP_CALL, SCIP_INVALIDCALL, SCIP_OKAY, SCIPclockReset(), SCIPclockStart(), SCIPclockStop(), SCIPdivesetReset(), SCIPerrorMessage, SCIP_Heur::setuptime, and TRUE.
SCIP_RETCODE SCIPheurExit | ( | SCIP_HEUR * | heur, |
SCIP_SET * | set | ||
) |
calls exit method of primal heuristic
heur | primal heuristic |
set | global SCIP settings |
Definition at line 862 of file heur.c.
References FALSE, SCIP_Heur::initialized, SCIP_Heur::name, SCIP_CALL, SCIP_INVALIDCALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), SCIPerrorMessage, and SCIP_Heur::setuptime.
Referenced by SCIPsetInitPlugins().
SCIP_RETCODE SCIPheurInitsol | ( | SCIP_HEUR * | heur, |
SCIP_SET * | set | ||
) |
informs primal heuristic that the branch and bound process is being started
heur | primal heuristic |
set | global SCIP settings |
Definition at line 892 of file heur.c.
References SCIP_Heur::delaypos, FALSE, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), and SCIP_Heur::setuptime.
Referenced by SCIPsetExitprePlugins().
SCIP_RETCODE SCIPheurExitsol | ( | SCIP_HEUR * | heur, |
SCIP_SET * | set | ||
) |
informs primal heuristic that the branch and bound process data is being freed
heur | primal heuristic |
set | global SCIP settings |
Definition at line 922 of file heur.c.
References SCIP_CALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), and SCIP_Heur::setuptime.
Referenced by SCIPsetInitsolPlugins().
SCIP_Bool SCIPheurShouldBeExecuted | ( | SCIP_HEUR * | heur, |
int | depth, | ||
int | lpstateforkdepth, | ||
SCIP_HEURTIMING | heurtiming, | ||
SCIP_Bool * | delayed | ||
) |
should the heuristic be executed at the given depth, frequency, timing, ...
heur | primal heuristic |
depth | depth of current node |
lpstateforkdepth | depth of the last node with solved LP |
heurtiming | current point in the node solving process |
delayed | pointer to store whether the heuristic should be delayed |
Definition at line 946 of file heur.c.
References SCIP_Heur::delaypos, FALSE, SCIP_Heur::freq, SCIP_Heur::freqofs, SCIP_Heur::maxdepth, SCIP_Bool, SCIP_HEURTIMING_AFTERLPNODE, SCIP_HEURTIMING_AFTERLPPLUNGE, SCIP_HEURTIMING_AFTERPSEUDONODE, SCIP_HEURTIMING_AFTERPSEUDOPLUNGE, SCIP_HEURTIMING_BEFOREPRESOL, SCIP_HEURTIMING_DURINGPRESOLLOOP, SCIP_Heur::timingmask, and TRUE.
Referenced by SCIPheurExec(), and SCIPprimalHeuristics().
SCIP_RETCODE SCIPheurExec | ( | SCIP_HEUR * | heur, |
SCIP_SET * | set, | ||
SCIP_PRIMAL * | primal, | ||
int | depth, | ||
int | lpstateforkdepth, | ||
SCIP_HEURTIMING | heurtiming, | ||
SCIP_Bool | nodeinfeasible, | ||
int * | ndelayedheurs, | ||
SCIP_RESULT * | result | ||
) |
calls execution method of primal heuristic
heur | primal heuristic |
set | global SCIP settings |
primal | primal data |
depth | depth of current node |
lpstateforkdepth | depth of the last node with solved LP |
heurtiming | current point in the node solving process |
nodeinfeasible | was the current node already detected to be infeasible? |
ndelayedheurs | pointer to count the number of delayed heuristics |
result | pointer to store the result of the callback method |
Definition at line 1008 of file heur.c.
References SCIP_Heur::delaypos, FALSE, SCIP_Heur::freq, SCIP_Heur::freqofs, SCIP_Heur::heurclock, SCIP_Heur::maxdepth, SCIP_Heur::name, SCIP_Primal::nbestsolsfound, SCIP_Heur::nbestsolsfound, SCIP_Heur::ncalls, SCIP_Primal::nsolsfound, SCIP_Heur::nsolsfound, SCIP_Bool, SCIP_CALL, SCIP_DELAYED, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_FOUNDSOL, SCIP_HEURTIMING_BEFOREPRESOL, SCIP_HEURTIMING_DURINGPRESOLLOOP, SCIP_INVALIDRESULT, SCIP_Longint, SCIP_OKAY, SCIP_UNBOUNDED, SCIPclockStart(), SCIPclockStop(), SCIPerrorMessage, SCIPheurShouldBeExecuted(), and SCIPsetDebugMsg.
Referenced by SCIPprimalHeuristics().
void SCIPheurSetCopy | ( | SCIP_HEUR * | heur, |
SCIP_DECL_HEURCOPY((*heurcopy)) | |||
) |
sets copy callback of primal heuristic
heur | primal heuristic |
Definition at line 1132 of file heur.c.
Referenced by SCIPsetHeurCopy().
void SCIPheurSetFree | ( | SCIP_HEUR * | heur, |
SCIP_DECL_HEURFREE((*heurfree)) | |||
) |
sets destructor callback of primal heuristic
heur | primal heuristic |
Definition at line 1143 of file heur.c.
Referenced by SCIPsetHeurFree().
void SCIPheurSetInit | ( | SCIP_HEUR * | heur, |
SCIP_DECL_HEURINIT((*heurinit)) | |||
) |
sets initialization callback of primal heuristic
heur | primal heuristic |
Definition at line 1154 of file heur.c.
Referenced by SCIPsetHeurInit().
void SCIPheurSetExit | ( | SCIP_HEUR * | heur, |
SCIP_DECL_HEUREXIT((*heurexit)) | |||
) |
sets deinitialization callback of primal heuristic
heur | primal heuristic |
Definition at line 1165 of file heur.c.
Referenced by SCIPsetHeurExit().
void SCIPheurSetInitsol | ( | SCIP_HEUR * | heur, |
SCIP_DECL_HEURINITSOL((*heurinitsol)) | |||
) |
sets solving process initialization callback of primal heuristic
heur | primal heuristic |
Definition at line 1176 of file heur.c.
Referenced by SCIPsetHeurInitsol().
void SCIPheurSetExitsol | ( | SCIP_HEUR * | heur, |
SCIP_DECL_HEUREXITSOL((*heurexitsol)) | |||
) |
sets solving process deinitialization callback of primal heuristic
heur | primal heuristic |
Definition at line 1187 of file heur.c.
Referenced by SCIPsetHeurExitsol().
sets priority of primal heuristic
heur | primal heuristic |
set | global SCIP settings |
priority | new priority of the primal heuristic |
Definition at line 1269 of file heur.c.
References FALSE, and SCIP_Heur::priority.
Referenced by SCIPsetHeurPriority().
enables or disables all clocks of heur
, depending on the value of the flag
heur | the heuristic for which all clocks should be enabled or disabled |
enable | should the clocks of the heuristic be enabled? |
Definition at line 1364 of file heur.c.
References SCIP_Heur::heurclock, SCIPclockEnableOrDisable(), and SCIP_Heur::setuptime.
|
static |
scip | SCIP data structure |
vargraph | variable graph data structure for breadth-first-search neighborhoods |
relaxdenseconss | should dense constraints (at least as dense as density ) be ignored by connectivity graph? |
relaxdensity | density (with respect to number of variables) to relax constraint from graph |
nrelaxedconstraints | pointer to store the number of constraints that were relaxed, or NULL if not needed |
Definition at line 1634 of file heur.c.
References SCIP_VGraph::nvarconss, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPallocBufferArray, SCIPcalcMemGrowSize(), SCIPconsIsChecked(), SCIPfreeBufferArray, SCIPgetConsNVars(), SCIPgetConss(), SCIPgetConsVars(), SCIPgetNConss(), SCIPgetNVars(), SCIPreallocBlockMemoryArray, SCIPvarGetProbindex(), SCIP_VGraph::varconss, and SCIP_VGraph::varconssize.
Referenced by SCIPvariableGraphCreate().