Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

methods for primal heuristics

Author
Tobias Achterberg
Timo Berthold

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.

Functions

 SCIP_DECL_SORTPTRCOMP (SCIPheurComp)
 
 SCIP_DECL_SORTPTRCOMP (SCIPheurCompPriority)
 
 SCIP_DECL_SORTPTRCOMP (SCIPheurCompName)
 
static SCIP_DECL_PARAMCHGD (paramChgdHeurPriority)
 
static void resetDivesetStats (SCIP_DIVESETSTATS *divesetstats)
 
SCIP_RETCODE SCIPdivesetReset (SCIP_DIVESET *diveset, SCIP_SET *set)
 
static void updateDivesetstats (SCIP_DIVESETSTATS *divesetstats, int depth, int nprobingnodes, int nbacktracks, SCIP_Longint nsolsfound, SCIP_Longint nbestsolsfound, SCIP_Longint nconflictsfound, SCIP_Bool leavesol)
 
static SCIP_DIVESETSTATSdivesetGetStats (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
void SCIPdivesetUpdateStats (SCIP_DIVESET *diveset, SCIP_STAT *stat, int depth, int nprobingnodes, int nbacktracks, SCIP_Longint nsolsfound, SCIP_Longint nbestsolsfound, SCIP_Longint nconflictsfound, SCIP_Bool leavesol, SCIP_DIVECONTEXT divecontext)
 
static SCIP_RETCODE heurAddDiveset (SCIP_HEUR *heur, SCIP_DIVESET *diveset)
 
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_Bool ispublic, SCIP_DIVETYPE divetypemask, SCIP_DECL_DIVESETGETSCORE((*divesetgetscore)), SCIP_DECL_DIVESETAVAILABLE((*divesetavailable)))
 
SCIP_HEURSCIPdivesetGetHeur (SCIP_DIVESET *diveset)
 
SCIP_SOLSCIPdivesetGetWorkSolution (SCIP_DIVESET *diveset)
 
void SCIPdivesetSetWorkSolution (SCIP_DIVESET *diveset, SCIP_SOL *sol)
 
const char * SCIPdivesetGetName (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetMinRelDepth (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetMaxRelDepth (SCIP_DIVESET *diveset)
 
SCIP_Longint SCIPdivesetGetSolSuccess (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
int SCIPdivesetGetNCalls (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
int SCIPdivesetGetNSolutionCalls (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
int SCIPdivesetGetMinDepth (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
int SCIPdivesetGetMaxDepth (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
SCIP_Real SCIPdivesetGetAvgDepth (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
int SCIPdivesetGetMinSolutionDepth (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
int SCIPdivesetGetMaxSolutionDepth (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
SCIP_Real SCIPdivesetGetAvgSolutionDepth (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
SCIP_Longint SCIPdivesetGetNLPIterations (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
SCIP_Longint SCIPdivesetGetNProbingNodes (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
SCIP_Longint SCIPdivesetGetNBacktracks (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
SCIP_Longint SCIPdivesetGetNConflicts (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
SCIP_Longint SCIPdivesetGetNSols (SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
 
SCIP_Real SCIPdivesetGetMaxLPIterQuot (SCIP_DIVESET *diveset)
 
int SCIPdivesetGetMaxLPIterOffset (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetUbQuotNoSol (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetAvgQuotNoSol (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetUbQuot (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetAvgQuot (SCIP_DIVESET *diveset)
 
SCIP_Bool SCIPdivesetUseBacktrack (SCIP_DIVESET *diveset)
 
int SCIPdivesetGetLPSolveFreq (SCIP_DIVESET *diveset)
 
SCIP_RANDNUMGENSCIPdivesetGetRandnumgen (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetLPResolveDomChgQuot (SCIP_DIVESET *diveset)
 
SCIP_Bool SCIPdivesetUseOnlyLPBranchcands (SCIP_DIVESET *diveset)
 
SCIP_Bool SCIPdivesetSupportsType (SCIP_DIVESET *diveset, SCIP_DIVETYPE divetype)
 
SCIP_Bool SCIPdivesetIsPublic (SCIP_DIVESET *diveset)
 
static void updateDivesetstatsLP (SCIP_DIVESETSTATS *divesetstats, SCIP_Longint niterstoadd)
 
void SCIPdivesetUpdateLPStats (SCIP_DIVESET *diveset, SCIP_STAT *stat, SCIP_Longint niterstoadd, SCIP_DIVECONTEXT divecontext)
 
static void divesetFree (SCIP_DIVESET **divesetptr, BMS_BLKMEM *blkmem)
 
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)
 
SCIP_RETCODE SCIPdivesetIsAvailable (SCIP_DIVESET *diveset, SCIP_SET *set, SCIP_Bool *available)
 
SCIP_RETCODE SCIPheurCopyInclude (SCIP_HEUR *heur, SCIP_SET *set)
 
static SCIP_RETCODE doHeurCreate (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)
 
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)
 
SCIP_RETCODE SCIPheurFree (SCIP_HEUR **heur, SCIP_SET *set, BMS_BLKMEM *blkmem)
 
SCIP_RETCODE SCIPheurInit (SCIP_HEUR *heur, SCIP_SET *set)
 
SCIP_RETCODE SCIPheurExit (SCIP_HEUR *heur, SCIP_SET *set)
 
SCIP_RETCODE SCIPheurInitsol (SCIP_HEUR *heur, SCIP_SET *set)
 
SCIP_RETCODE SCIPheurExitsol (SCIP_HEUR *heur, SCIP_SET *set)
 
SCIP_Bool SCIPheurShouldBeExecuted (SCIP_HEUR *heur, int depth, int lpstateforkdepth, SCIP_HEURTIMING heurtiming, SCIP_Bool *delayed)
 
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)
 
SCIP_HEURDATASCIPheurGetData (SCIP_HEUR *heur)
 
void SCIPheurSetData (SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
 
void SCIPheurSetCopy (SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
 
void SCIPheurSetFree (SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
 
void SCIPheurSetInit (SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
 
void SCIPheurSetExit (SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit)))
 
void SCIPheurSetInitsol (SCIP_HEUR *heur, SCIP_DECL_HEURINITSOL((*heurinitsol)))
 
void SCIPheurSetExitsol (SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
 
const char * SCIPheurGetName (SCIP_HEUR *heur)
 
const char * SCIPheurGetDesc (SCIP_HEUR *heur)
 
char SCIPheurGetDispchar (SCIP_HEUR *heur)
 
SCIP_HEURTIMING SCIPheurGetTimingmask (SCIP_HEUR *heur)
 
void SCIPheurSetTimingmask (SCIP_HEUR *heur, SCIP_HEURTIMING timingmask)
 
SCIP_Bool SCIPheurUsesSubscip (SCIP_HEUR *heur)
 
int SCIPheurGetPriority (SCIP_HEUR *heur)
 
void SCIPheurSetPriority (SCIP_HEUR *heur, SCIP_SET *set, int priority)
 
int SCIPheurGetFreq (SCIP_HEUR *heur)
 
void SCIPheurSetFreq (SCIP_HEUR *heur, int freq)
 
int SCIPheurGetFreqofs (SCIP_HEUR *heur)
 
int SCIPheurGetMaxdepth (SCIP_HEUR *heur)
 
SCIP_Longint SCIPheurGetNCalls (SCIP_HEUR *heur)
 
SCIP_Longint SCIPheurGetNSolsFound (SCIP_HEUR *heur)
 
SCIP_Longint SCIPheurGetNBestSolsFound (SCIP_HEUR *heur)
 
SCIP_Bool SCIPheurIsInitialized (SCIP_HEUR *heur)
 
void SCIPheurEnableOrDisableClocks (SCIP_HEUR *heur, SCIP_Bool enable)
 
SCIP_Real SCIPheurGetSetupTime (SCIP_HEUR *heur)
 
SCIP_Real SCIPheurGetTime (SCIP_HEUR *heur)
 
SCIP_DIVESET ** SCIPheurGetDivesets (SCIP_HEUR *heur)
 
int SCIPheurGetNDivesets (SCIP_HEUR *heur)
 
SCIP_RETCODE SCIPvariablegraphBreadthFirst (SCIP *scip, SCIP_VGRAPH *vargraph, SCIP_VAR **startvars, int nstartvars, int *distances, int maxdistance, int maxvars, int maxbinintvars)
 
static SCIP_RETCODE fillVariableGraph (SCIP *scip, SCIP_VGRAPH *vargraph, SCIP_Bool relaxdenseconss, SCIP_Real relaxdensity, int *nrelaxedconstraints)
 
SCIP_RETCODE SCIPvariableGraphCreate (SCIP *scip, SCIP_VGRAPH **vargraph, SCIP_Bool relaxdenseconss, SCIP_Real relaxdensity, int *nrelaxedconstraints)
 
void SCIPvariableGraphFree (SCIP *scip, SCIP_VGRAPH **vargraph)
 

Function Documentation

◆ SCIP_DECL_PARAMCHGD()

static SCIP_DECL_PARAMCHGD ( paramChgdHeurPriority  )
static

method to call, when the priority of a heuristic was changed

Definition at line 91 of file heur.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPparamGetData(), SCIPparamGetInt(), and SCIPsetHeurPriority().

◆ resetDivesetStats()

◆ SCIPdivesetReset()

SCIP_RETCODE SCIPdivesetReset ( SCIP_DIVESET diveset,
SCIP_SET set 
)

resets diving settings counters

Parameters
divesetdiveset to be reset
setglobal SCIP settings

Definition at line 130 of file heur.c.

References SCIP_Diveset::divesetstats, SCIP_Diveset::initialseed, NULL, SCIP_Diveset::randnumgen, resetDivesetStats(), SCIP_OKAY, SCIPrandomSetSeed(), and SCIPsetInitializeRandomSeed().

Referenced by SCIPdivesetCreate(), and SCIPheurInit().

◆ updateDivesetstats()

static void updateDivesetstats ( SCIP_DIVESETSTATS divesetstats,
int  depth,
int  nprobingnodes,
int  nbacktracks,
SCIP_Longint  nsolsfound,
SCIP_Longint  nbestsolsfound,
SCIP_Longint  nconflictsfound,
SCIP_Bool  leavesol 
)
static

update dive set statistics

Parameters
divesetstatsdive set statistics
depththe depth reached this time
nprobingnodesthe number of probing nodes explored this time
nbacktracksthe number of backtracks during probing this time
nsolsfoundnumber of new solutions found this time
nbestsolsfoundnumber of new best solutions found this time
nconflictsfoundnumber of new conflicts found this time
leavesolhas the diving heuristic reached a feasible leaf

Definition at line 154 of file heur.c.

References MAX, SCIP_DivesetStats::maxdepth, SCIP_DivesetStats::maxsoldepth, MIN, SCIP_DivesetStats::mindepth, SCIP_DivesetStats::minsoldepth, SCIP_DivesetStats::nbestsolsfound, SCIP_DivesetStats::ncalls, SCIP_DivesetStats::nconflictsfound, SCIP_DivesetStats::nsolcalls, SCIP_DivesetStats::nsolsfound, SCIP_DivesetStats::totaldepth, SCIP_DivesetStats::totalnbacktracks, SCIP_DivesetStats::totalnnodes, and SCIP_DivesetStats::totalsoldepth.

Referenced by SCIPdivesetUpdateStats().

◆ divesetGetStats()

◆ SCIPdivesetUpdateStats()

void SCIPdivesetUpdateStats ( SCIP_DIVESET diveset,
SCIP_STAT stat,
int  depth,
int  nprobingnodes,
int  nbacktracks,
SCIP_Longint  nsolsfound,
SCIP_Longint  nbestsolsfound,
SCIP_Longint  nconflictsfound,
SCIP_Bool  leavesol,
SCIP_DIVECONTEXT  divecontext 
)

update diveset statistics and global diveset statistics

Parameters
divesetdiveset to be reset
statglobal SCIP statistics
depththe depth reached this time
nprobingnodesthe number of probing nodes explored this time
nbacktracksthe number of backtracks during probing this time
nsolsfoundnumber of new solutions found this time
nbestsolsfoundnumber of new best solutions found this time
nconflictsfoundnumber of new conflicts found this time
leavesolhas the diving heuristic reached a feasible leaf
divecontextcontext for diving statistics

Definition at line 203 of file heur.c.

References divesetGetStats(), SCIP_Stat::ndivesetcalls, NULL, SCIP_DIVECONTEXT_ADAPTIVE, SCIP_DIVECONTEXT_SCHEDULER, SCIP_DIVECONTEXT_SINGLE, SCIP_DIVECONTEXT_TOTAL, SCIP_Stat::totaldivesetdepth, and updateDivesetstats().

Referenced by SCIPupdateDivesetStats().

◆ heurAddDiveset()

static SCIP_RETCODE heurAddDiveset ( SCIP_HEUR heur,
SCIP_DIVESET diveset 
)
static

append diveset to heuristic array of divesets

Parameters
heurthe heuristic to which this dive setting belongs
divesetpointer to the freshly created diveset

Definition at line 236 of file heur.c.

References BMSallocMemoryArray, BMSreallocMemoryArray, SCIP_Heur::divesets, SCIP_Diveset::heur, SCIP_Heur::ndivesets, NULL, SCIP_ALLOC, and SCIP_OKAY.

Referenced by SCIPdivesetCreate().

◆ 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_Bool  ispublic,
SCIP_DIVETYPE  divetypemask,
SCIP_DECL_DIVESETGETSCORE((*divesetgetscore))  ,
SCIP_DECL_DIVESETAVAILABLE((*divesetavailable))   
)

create a set of diving heuristic settings

Parameters
divesetptrpointer to the freshly created diveset
heurthe heuristic to which this dive setting belongs
namename for the diveset, or NULL if the name of the heuristic should be used
setglobal SCIP settings
messagehdlrmessage handler
blkmemblock memory for parameter settings
minreldepthminimal relative depth to start diving
maxreldepthmaximal relative depth to start diving
maxlpiterquotmaximal fraction of diving LP iterations compared to node LP iterations
maxdiveubquotmaximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound) where diving is performed (0.0: no limit)
maxdiveavgquotmaximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound) where diving is performed (0.0: no limit)
maxdiveubquotnosolmaximal UBQUOT when no solution was found yet (0.0: no limit)
maxdiveavgquotnosolmaximal AVGQUOT when no solution was found yet (0.0: no limit)
lpresolvedomchgquotpercentage of immediate domain changes during probing to trigger LP resolve
lpsolvefreqLP solve frequency for (0: only if enough domain reductions are found by propagation)
maxlpiterofsadditional number of allowed LP iterations
initialseedinitial seed for random number generation
backtrackuse one level of backtracking if infeasibility is encountered?
onlylpbranchcandsshould only LP branching candidates be considered instead of the slower but more general constraint handler diving variable selection?
ispublicis this dive set publicly available (ie., can be used by other primal heuristics?)
divetypemaskbit mask that represents the supported dive types by this dive set

Definition at line 266 of file heur.c.

References SCIP_Diveset::backtrack, BMSallocBlockMemory, BMSduplicateMemoryArray, SCIP_Diveset::divesetstats, SCIP_Diveset::divetypemask, FALSE, SCIP_Diveset::heur, heurAddDiveset(), SCIP_Diveset::initialseed, SCIP_Diveset::ispublic, 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, NULL, SCIP_Diveset::onlylpbranchcands, paramname, 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().

◆ SCIPdivesetGetHeur()

SCIP_HEUR* SCIPdivesetGetHeur ( SCIP_DIVESET diveset)

get the heuristic to which this diving setting belongs

Parameters
divesetdiving settings

Definition at line 416 of file heur.c.

References SCIP_Diveset::heur.

Referenced by SCIP_DECL_DIVESETAVAILABLE().

◆ SCIPdivesetGetWorkSolution()

SCIP_SOL* SCIPdivesetGetWorkSolution ( SCIP_DIVESET diveset)

get the working solution of this dive set

Parameters
divesetdiving settings

Definition at line 424 of file heur.c.

References NULL, and SCIP_Diveset::sol.

◆ SCIPdivesetSetWorkSolution()

void SCIPdivesetSetWorkSolution ( SCIP_DIVESET diveset,
SCIP_SOL sol 
)

set the working solution for this dive set

Parameters
divesetdiving settings
solnew working solution for this dive set, or NULL

Definition at line 434 of file heur.c.

References NULL, and SCIP_Diveset::sol.

Referenced by SCIPperformGenericDivingAlgorithm().

◆ updateDivesetstatsLP()

static void updateDivesetstatsLP ( SCIP_DIVESETSTATS divesetstats,
SCIP_Longint  niterstoadd 
)
static

updates LP related diveset statistics

Parameters
divesetstatsdiving settings
niterstoaddadditional number of LP iterations to be added

Definition at line 775 of file heur.c.

References SCIP_DivesetStats::nlpiterations, SCIP_DivesetStats::nlps, and NULL.

Referenced by SCIPdivesetUpdateLPStats().

◆ SCIPdivesetUpdateLPStats()

void SCIPdivesetUpdateLPStats ( SCIP_DIVESET diveset,
SCIP_STAT stat,
SCIP_Longint  niterstoadd,
SCIP_DIVECONTEXT  divecontext 
)

update diveset LP statistics, should be called after every LP solved by this diving heuristic

Parameters
divesetdiving settings
statglobal SCIP statistics
niterstoaddadditional number of LP iterations to be added
divecontextcontext for diving statistics

Definition at line 787 of file heur.c.

References divesetGetStats(), SCIP_Stat::ndivesetlpiterations, SCIP_Stat::ndivesetlps, NULL, SCIP_DIVECONTEXT_ADAPTIVE, SCIP_DIVECONTEXT_SCHEDULER, SCIP_DIVECONTEXT_SINGLE, SCIP_DIVECONTEXT_TOTAL, and updateDivesetstatsLP().

Referenced by SCIPupdateDivesetLPStats().

◆ divesetFree()

static void divesetFree ( SCIP_DIVESET **  divesetptr,
BMS_BLKMEM blkmem 
)
static

frees memory of a diveset

Parameters
divesetptrgeneral diving settings
blkmemblock memory for parameter settings

Definition at line 808 of file heur.c.

References BMSfreeBlockMemory, BMSfreeMemoryArray, SCIP_Diveset::divesetstats, SCIP_Diveset::name, NULL, SCIP_Diveset::randnumgen, and SCIPrandomFree().

Referenced by SCIPheurFree().

◆ SCIPdivesetGetScore()

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

Parameters
divesetgeneral diving settings
setSCIP settings
divetypethe type of diving that should be applied
divecandthe candidate for which the branching direction is requested
divecandsolLP solution value of the candidate
divecandfracfractionality of the candidate
candscorepointer to store the candidate score
rounduppointer to store whether preferred direction for diving is upwards

Definition at line 834 of file heur.c.

References SCIP_Diveset::divetypemask, NULL, SCIP_CALL, and SCIP_OKAY.

Referenced by SCIPgetDivesetScore().

◆ SCIPdivesetIsAvailable()

SCIP_RETCODE SCIPdivesetIsAvailable ( SCIP_DIVESET diveset,
SCIP_SET set,
SCIP_Bool available 
)

check specific preconditions for diving, e.g., if an incumbent solution is available

Parameters
divesetdiving heuristic settings
setSCIP settings
availablepointer to store if the diving can run at the current solving stage

Definition at line 858 of file heur.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, and TRUE.

Referenced by SCIPisDivesetAvailable().

◆ SCIPheurCopyInclude()

SCIP_RETCODE SCIPheurCopyInclude ( SCIP_HEUR heur,
SCIP_SET set 
)

copies the given primal heuristic to a new scip

Parameters
heurprimal heuristic
setSCIP_SET of SCIP to copy to

Definition at line 882 of file heur.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPsetDebugMsg.

Referenced by SCIPsetCopyPlugins().

◆ doHeurCreate()

static SCIP_RETCODE doHeurCreate ( 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 
)
static

internal method for creating a primal heuristic

Parameters
heurpointer to primal heuristic data structure
setglobal SCIP settings
messagehdlrmessage handler
blkmemblock memory for parameter settings
namename of primal heuristic
descdescription of primal heuristic
dispchardisplay character of primal heuristic
prioritypriority of the primal heuristic
freqfrequency for calling primal heuristic
freqofsfrequency offset for calling primal heuristic
maxdepthmaximal depth level to call heuristic at (-1: no limit)
timingmaskpositions in the node solving loop where heuristic should be executed
usessubscipdoes the heuristic use a secondary SCIP instance?
heurdataprimal heuristic data

Definition at line 902 of file heur.c.

References BMSallocMemory, BMSclearMemory, BMSduplicateMemoryArray, FALSE, NULL, paramname, SCIP_ALLOC, SCIP_CALL, SCIP_CLOCKTYPE_DEFAULT, SCIP_MAXSTRLEN, SCIP_MAXTREEDEPTH, SCIP_OKAY, SCIPclockCreate(), SCIPsetAddIntParam(), SCIPsnprintf(), and TRUE.

Referenced by SCIPheurCreate().

◆ SCIPheurCreate()

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

Parameters
heurpointer to primal heuristic data structure
setglobal SCIP settings
messagehdlrmessage handler
blkmemblock memory for parameter settings
namename of primal heuristic
descdescription of primal heuristic
dispchardisplay character of primal heuristic
prioritypriority of the primal heuristic
freqfrequency for calling primal heuristic
freqofsfrequency offset for calling primal heuristic
maxdepthmaximal depth level to call heuristic at (-1: no limit)
timingmaskpositions in the node solving loop where heuristic should be executed
usessubscipdoes the heuristic use a secondary SCIP instance?
heurdataprimal heuristic data

Definition at line 989 of file heur.c.

References doHeurCreate(), NULL, SCIP_CALL_FINALLY, SCIP_OKAY, and SCIPheurFree().

Referenced by SCIPincludeHeur(), and SCIPincludeHeurBasic().

◆ SCIPheurFree()

SCIP_RETCODE SCIPheurFree ( SCIP_HEUR **  heur,
SCIP_SET set,
BMS_BLKMEM blkmem 
)

calls destructor and frees memory of primal heuristic

Parameters
heurpointer to primal heuristic data structure
setglobal SCIP settings
blkmemblock memory

Definition at line 1028 of file heur.c.

References BMSfreeMemory, BMSfreeMemoryArrayNull, divesetFree(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPclockFree().

Referenced by SCIPheurCreate().

◆ SCIPheurInit()

◆ SCIPheurExit()

SCIP_RETCODE SCIPheurExit ( SCIP_HEUR heur,
SCIP_SET set 
)

calls exit method of primal heuristic

Parameters
heurprimal heuristic
setglobal SCIP settings

Definition at line 1117 of file heur.c.

References FALSE, SCIP_Heur::initialized, SCIP_Heur::name, NULL, SCIP_CALL, SCIP_INVALIDCALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), SCIPerrorMessage, and SCIP_Heur::setuptime.

Referenced by SCIPsetInitPlugins().

◆ SCIPheurInitsol()

SCIP_RETCODE SCIPheurInitsol ( SCIP_HEUR heur,
SCIP_SET set 
)

informs primal heuristic that the branch and bound process is being started

Parameters
heurprimal heuristic
setglobal SCIP settings

Definition at line 1147 of file heur.c.

References SCIP_Heur::delaypos, FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), and SCIP_Heur::setuptime.

Referenced by SCIPsetExitprePlugins().

◆ SCIPheurExitsol()

SCIP_RETCODE SCIPheurExitsol ( SCIP_HEUR heur,
SCIP_SET set 
)

informs primal heuristic that the branch and bound process data is being freed

Parameters
heurprimal heuristic
setglobal SCIP settings

Definition at line 1177 of file heur.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), and SCIP_Heur::setuptime.

Referenced by SCIPsetInitsolPlugins().

◆ SCIPheurShouldBeExecuted()

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, ...

Parameters
heurprimal heuristic
depthdepth of current node
lpstateforkdepthdepth of the last node with solved LP
heurtimingcurrent point in the node solving process
delayedpointer to store whether the heuristic should be delayed

Definition at line 1201 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().

◆ SCIPheurExec()

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

Parameters
heurprimal heuristic
setglobal SCIP settings
primalprimal data
depthdepth of current node
lpstateforkdepthdepth of the last node with solved LP
heurtimingcurrent point in the node solving process
nodeinfeasiblewas the current node already detected to be infeasible?
ndelayedheurspointer to count the number of delayed heuristics
resultpointer to store the result of the callback method

Definition at line 1263 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, NULL, 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().

◆ SCIPheurSetCopy()

void SCIPheurSetCopy ( SCIP_HEUR heur,
SCIP_DECL_HEURCOPY((*heurcopy))   
)

sets copy callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1387 of file heur.c.

References NULL.

Referenced by SCIPsetHeurCopy().

◆ SCIPheurSetFree()

void SCIPheurSetFree ( SCIP_HEUR heur,
SCIP_DECL_HEURFREE((*heurfree))   
)

sets destructor callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1398 of file heur.c.

References NULL.

Referenced by SCIPsetHeurFree().

◆ SCIPheurSetInit()

void SCIPheurSetInit ( SCIP_HEUR heur,
SCIP_DECL_HEURINIT((*heurinit))   
)

sets initialization callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1409 of file heur.c.

References NULL.

Referenced by SCIPsetHeurInit().

◆ SCIPheurSetExit()

void SCIPheurSetExit ( SCIP_HEUR heur,
SCIP_DECL_HEUREXIT((*heurexit))   
)

sets deinitialization callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1420 of file heur.c.

References NULL.

Referenced by SCIPsetHeurExit().

◆ SCIPheurSetInitsol()

void SCIPheurSetInitsol ( SCIP_HEUR heur,
SCIP_DECL_HEURINITSOL((*heurinitsol))   
)

sets solving process initialization callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1431 of file heur.c.

References NULL.

Referenced by SCIPsetHeurInitsol().

◆ SCIPheurSetExitsol()

void SCIPheurSetExitsol ( SCIP_HEUR heur,
SCIP_DECL_HEUREXITSOL((*heurexitsol))   
)

sets solving process deinitialization callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1442 of file heur.c.

References NULL.

Referenced by SCIPsetHeurExitsol().

◆ SCIPheurSetPriority()

void SCIPheurSetPriority ( SCIP_HEUR heur,
SCIP_SET set,
int  priority 
)

sets priority of primal heuristic

Parameters
heurprimal heuristic
setglobal SCIP settings
prioritynew priority of the primal heuristic

Definition at line 1524 of file heur.c.

References FALSE, NULL, and SCIP_Heur::priority.

Referenced by SCIPsetHeurPriority().

◆ SCIPheurEnableOrDisableClocks()

void SCIPheurEnableOrDisableClocks ( SCIP_HEUR heur,
SCIP_Bool  enable 
)

enables or disables all clocks of heur, depending on the value of the flag

Parameters
heurthe heuristic for which all clocks should be enabled or disabled
enableshould the clocks of the heuristic be enabled?

Definition at line 1619 of file heur.c.

References SCIP_Heur::heurclock, NULL, SCIPclockEnableOrDisable(), and SCIP_Heur::setuptime.

◆ fillVariableGraph()

static SCIP_RETCODE fillVariableGraph ( SCIP scip,
SCIP_VGRAPH vargraph,
SCIP_Bool  relaxdenseconss,
SCIP_Real  relaxdensity,
int *  nrelaxedconstraints 
)
static
Parameters
scipSCIP data structure
vargraphvariable graph data structure for breadth-first-search neighborhoods
relaxdenseconssshould dense constraints (at least as dense as density) be ignored by connectivity graph?
relaxdensitydensity (with respect to number of variables) to relax constraint from graph
nrelaxedconstraintspointer to store the number of constraints that were relaxed, or NULL if not needed

Definition at line 1892 of file heur.c.

References NULL, 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().