Scippy

SCIP

Solving Constraint Integer Programs

heur.c File Reference

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/struct_heur.h"

Go to the source code of this file.

Functions

 SCIP_DECL_SORTPTRCOMP (SCIPheurComp)
 
 SCIP_DECL_SORTPTRCOMP (SCIPheurCompName)
 
static SCIP_DECL_PARAMCHGD (paramChgdHeurPriority)
 
void SCIPdivesetReset (SCIP_DIVESET *diveset)
 
void SCIPdivesetUpdateStats (SCIP_DIVESET *diveset, SCIP_STAT *stat, int depth, int nprobingnodes, int nbacktracks, SCIP_Longint nsolsfound, SCIP_Longint nbestsolsfound, SCIP_Bool leavesol)
 
static SCIP_RETCODE heurAddDiveset (SCIP_HEUR *heur, SCIP_DIVESET *diveset)
 
SCIP_RETCODE SCIPdivesetCreate (SCIP_DIVESET **diveset, 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, SCIP_Bool backtrack, SCIP_Bool onlylpbranchcands, SCIP_DIVETYPE divetypemask, SCIP_DECL_DIVESETGETSCORE((*divesetgetscore)))
 
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)
 
int SCIPdivesetGetNCalls (SCIP_DIVESET *diveset)
 
int SCIPdivesetGetNSolutionCalls (SCIP_DIVESET *diveset)
 
int SCIPdivesetGetMinDepth (SCIP_DIVESET *diveset)
 
int SCIPdivesetGetMaxDepth (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetAvgDepth (SCIP_DIVESET *diveset)
 
int SCIPdivesetGetMinSolutionDepth (SCIP_DIVESET *diveset)
 
int SCIPdivesetGetMaxSolutionDepth (SCIP_DIVESET *diveset)
 
SCIP_Real SCIPdivesetGetAvgSolutionDepth (SCIP_DIVESET *diveset)
 
SCIP_Longint SCIPdivesetGetNLPIterations (SCIP_DIVESET *diveset)
 
SCIP_Longint SCIPdivesetGetNProbingNodes (SCIP_DIVESET *diveset)
 
SCIP_Longint SCIPdivesetGetNBacktracks (SCIP_DIVESET *diveset)
 
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_Real SCIPdivesetGetLPResolveDomChgQuot (SCIP_DIVESET *diveset)
 
SCIP_Bool SCIPdivesetUseOnlyLPBranchcands (SCIP_DIVESET *diveset)
 
SCIP_Bool SCIPdivesetSupportsType (SCIP_DIVESET *diveset, SCIP_DIVETYPE divetype)
 
void SCIPdivesetUpdateLPStats (SCIP_DIVESET *diveset, SCIP_STAT *stat, SCIP_Longint niterstoadd)
 
static void divesetFree (SCIP_DIVESET **diveset)
 
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 SCIPheurCopyInclude (SCIP_HEUR *heur, SCIP_SET *set)
 
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, unsigned int 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)
 
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)
 

Function Documentation

SCIP_DECL_SORTPTRCOMP ( SCIPheurComp  )

compares two heuristics w. r. to their delay positions and their priority

Definition at line 40 of file heur.c.

References SCIP_Heur::delaypos, SCIP_Heur::freq, SCIP_Heur::ncalls, NULL, and SCIP_Heur::priority.

SCIP_DECL_SORTPTRCOMP ( SCIPheurCompName  )

comparison method for sorting heuristics w.r.t. to their name

Definition at line 64 of file heur.c.

References SCIPheurGetName().

static SCIP_DECL_PARAMCHGD ( paramChgdHeurPriority  )
static

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

Definition at line 71 of file heur.c.

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

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

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
leavesolhas the diving heuristic reached a feasible leaf

Definition at line 108 of file heur.c.

References MAX, SCIP_Diveset::maxdepth, SCIP_Diveset::maxsoldepth, MIN, SCIP_Diveset::mindepth, SCIP_Diveset::minsoldepth, SCIP_Diveset::nbestsolsfound, SCIP_Diveset::ncalls, SCIP_Stat::ndivesetcalls, SCIP_Diveset::nsolcalls, SCIP_Diveset::nsolsfound, NULL, SCIP_Diveset::totaldepth, SCIP_Stat::totaldivesetdepth, SCIP_Diveset::totalnbacktracks, SCIP_Diveset::totalnnodes, and SCIP_Diveset::totalsoldepth.

Referenced by SCIPupdateDivesetStats().

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 146 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().

SCIP_RETCODE SCIPdivesetCreate ( SCIP_DIVESET **  diveset,
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,
SCIP_Bool  backtrack,
SCIP_Bool  onlylpbranchcands,
SCIP_DIVETYPE  divetypemask,
SCIP_DECL_DIVESETGETSCORE((*divesetgetscore))   
)

create a set of diving heuristic settings

Parameters
divesetpointer 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
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?
divetypemaskbit mask that represents the supported dive types by this dive set

Definition at line 176 of file heur.c.

References BMSallocMemory, BMSduplicateMemoryArray, FALSE, heurAddDiveset(), NULL, paramname, SCIP_ALLOC, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_REAL_MAX, SCIPdivesetReset(), SCIPheurGetName(), SCIPsetAddBoolParam(), SCIPsetAddIntParam(), SCIPsetAddRealParam(), SCIPsnprintf(), and TRUE.

Referenced by SCIPcreateDiveset().

SCIP_HEUR* SCIPdivesetGetHeur ( SCIP_DIVESET diveset)

get the heuristic to which this diving setting belongs

Parameters
divesetdiving settings

Definition at line 302 of file heur.c.

References SCIP_Diveset::heur.

SCIP_SOL* SCIPdivesetGetWorkSolution ( SCIP_DIVESET diveset)

get the working solution of this dive set

Parameters
divesetdiving settings

Definition at line 310 of file heur.c.

References NULL, and SCIP_Diveset::sol.

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 320 of file heur.c.

References NULL, and SCIP_Diveset::sol.

Referenced by SCIPperformGenericDivingAlgorithm().

const char* SCIPdivesetGetName ( SCIP_DIVESET diveset)

get the name of the dive set

Parameters
divesetdiving settings

Definition at line 331 of file heur.c.

References SCIP_Diveset::name, and NULL.

Referenced by printHeuristicStatistics(), SCIPperformGenericDivingAlgorithm(), and solveLP().

SCIP_Real SCIPdivesetGetMinRelDepth ( SCIP_DIVESET diveset)

get the minimum relative depth of the diving settings

Parameters
divesetdiving settings

Definition at line 341 of file heur.c.

References SCIP_Diveset::minreldepth.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Real SCIPdivesetGetMaxRelDepth ( SCIP_DIVESET diveset)

get the maximum relative depth of the diving settings

Parameters
divesetdiving settings

Definition at line 349 of file heur.c.

References SCIP_Diveset::maxreldepth.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Longint SCIPdivesetGetSolSuccess ( SCIP_DIVESET diveset)

get the number of successful runs of the diving settings

Parameters
divesetdiving settings

Definition at line 357 of file heur.c.

References SCIP_Diveset::nbestsolsfound, and SCIP_Diveset::nsolsfound.

Referenced by SCIPperformGenericDivingAlgorithm().

int SCIPdivesetGetNCalls ( SCIP_DIVESET diveset)

get the number of calls to this dive set

Parameters
divesetdiving settings

Definition at line 365 of file heur.c.

References SCIP_Diveset::ncalls, and NULL.

Referenced by printHeuristicStatistics(), and SCIPperformGenericDivingAlgorithm().

int SCIPdivesetGetNSolutionCalls ( SCIP_DIVESET diveset)

get the number of calls successfully terminated at a feasible leaf node

Parameters
divesetdiving settings

Definition at line 375 of file heur.c.

References SCIP_Diveset::nsolcalls, and NULL.

Referenced by printHeuristicStatistics().

int SCIPdivesetGetMinDepth ( SCIP_DIVESET diveset)

get the minimum depth reached by this dive set

Parameters
divesetdiving settings

Definition at line 385 of file heur.c.

References SCIP_Diveset::mindepth, and NULL.

Referenced by printHeuristicStatistics().

int SCIPdivesetGetMaxDepth ( SCIP_DIVESET diveset)

get the maximum depth reached by this dive set

Parameters
divesetdiving settings

Definition at line 395 of file heur.c.

References SCIP_Diveset::maxdepth, and NULL.

Referenced by printHeuristicStatistics().

SCIP_Real SCIPdivesetGetAvgDepth ( SCIP_DIVESET diveset)

get the average depth this dive set reached during execution

Parameters
divesetdiving settings

Definition at line 405 of file heur.c.

References SCIP_Diveset::ncalls, NULL, SCIP_Real, and SCIP_Diveset::totaldepth.

Referenced by printHeuristicStatistics().

int SCIPdivesetGetMinSolutionDepth ( SCIP_DIVESET diveset)

get the minimum depth at which this dive set found a solution

Parameters
divesetdiving settings

Definition at line 415 of file heur.c.

References SCIP_Diveset::minsoldepth, and NULL.

Referenced by printHeuristicStatistics().

int SCIPdivesetGetMaxSolutionDepth ( SCIP_DIVESET diveset)

get the maximum depth at which this dive set found a solution

Parameters
divesetdiving settings

Definition at line 425 of file heur.c.

References SCIP_Diveset::maxsoldepth, and NULL.

Referenced by printHeuristicStatistics().

SCIP_Real SCIPdivesetGetAvgSolutionDepth ( SCIP_DIVESET diveset)

get the average depth at which this dive set found a solution

Parameters
divesetdiving settings

Definition at line 435 of file heur.c.

References SCIP_Diveset::nsolcalls, NULL, SCIP_Real, and SCIP_Diveset::totalsoldepth.

Referenced by printHeuristicStatistics().

SCIP_Longint SCIPdivesetGetNLPIterations ( SCIP_DIVESET diveset)

get the total number of LP iterations used by this dive set

Parameters
divesetdiving settings

Definition at line 445 of file heur.c.

References SCIP_Diveset::nlpiterations, and NULL.

Referenced by printHeuristicStatistics(), SCIPperformGenericDivingAlgorithm(), and solveLP().

SCIP_Longint SCIPdivesetGetNProbingNodes ( SCIP_DIVESET diveset)

get the total number of probing nodes used by this dive set

Parameters
divesetdiving settings

Definition at line 455 of file heur.c.

References NULL, and SCIP_Diveset::totalnnodes.

Referenced by printHeuristicStatistics().

SCIP_Longint SCIPdivesetGetNBacktracks ( SCIP_DIVESET diveset)

get the total number of backtracks performed by this dive set

Parameters
divesetdiving settings

Definition at line 465 of file heur.c.

References NULL, and SCIP_Diveset::totalnbacktracks.

Referenced by printHeuristicStatistics().

SCIP_Real SCIPdivesetGetMaxLPIterQuot ( SCIP_DIVESET diveset)

get the maximum LP iterations quotient of the diving settings

Parameters
divesetdiving settings

Definition at line 475 of file heur.c.

References SCIP_Diveset::maxlpiterquot.

Referenced by SCIPperformGenericDivingAlgorithm().

int SCIPdivesetGetMaxLPIterOffset ( SCIP_DIVESET diveset)

get the maximum LP iterations offset of the diving settings

Parameters
divesetdiving settings

Definition at line 483 of file heur.c.

References SCIP_Diveset::maxlpiterofs.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Real SCIPdivesetGetUbQuotNoSol ( SCIP_DIVESET diveset)

get the maximum upper bound quotient parameter of the diving settings if no solution is available

Parameters
divesetdiving settings

Definition at line 491 of file heur.c.

References SCIP_Diveset::maxdiveubquotnosol.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Real SCIPdivesetGetAvgQuotNoSol ( SCIP_DIVESET diveset)

get the average quotient parameter of the diving settings if no solution is available

Parameters
divesetdiving settings

Definition at line 499 of file heur.c.

References SCIP_Diveset::maxdiveavgquotnosol.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Real SCIPdivesetGetUbQuot ( SCIP_DIVESET diveset)

get the maximum upper bound quotient parameter of the diving settings if an incumbent solution exists

Parameters
divesetdiving settings

Definition at line 506 of file heur.c.

References SCIP_Diveset::maxdiveubquot.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Real SCIPdivesetGetAvgQuot ( SCIP_DIVESET diveset)

get the average upper bound quotient parameter of the diving settings if an incumbent solution exists

Parameters
divesetdiving settings

Definition at line 514 of file heur.c.

References SCIP_Diveset::maxdiveavgquot.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Bool SCIPdivesetUseBacktrack ( SCIP_DIVESET diveset)

should backtracking be applied?

Parameters
divesetdiving settings

Definition at line 522 of file heur.c.

References SCIP_Diveset::backtrack.

Referenced by SCIPperformGenericDivingAlgorithm().

int SCIPdivesetGetLPSolveFreq ( SCIP_DIVESET diveset)

returns the LP solve frequency for diving LPs (0: dynamically based on number of intermediate domain reductions)

Parameters
divesetdiving settings

Definition at line 530 of file heur.c.

References SCIP_Diveset::lpsolvefreq, and NULL.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Real SCIPdivesetGetLPResolveDomChgQuot ( SCIP_DIVESET diveset)

returns the domain reduction quotient for triggering an immediate resolve of the diving LP (0.0: always resolve)

Parameters
divesetdiving settings

Definition at line 540 of file heur.c.

References SCIP_Diveset::lpresolvedomchgquot, and NULL.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Bool SCIPdivesetUseOnlyLPBranchcands ( SCIP_DIVESET diveset)

should only LP branching candidates be considered instead of the slower but more general constraint handler diving variable selection?

Parameters
divesetdiving settings

Definition at line 552 of file heur.c.

References NULL, and SCIP_Diveset::onlylpbranchcands.

Referenced by SCIPperformGenericDivingAlgorithm().

SCIP_Bool SCIPdivesetSupportsType ( SCIP_DIVESET diveset,
SCIP_DIVETYPE  divetype 
)

returns TRUE if dive set supports diving of the specified type

Parameters
divesetdiving settings
divetypebit mask that represents the supported dive types by this dive set

Definition at line 562 of file heur.c.

References SCIP_Diveset::divetypemask, and NULL.

Referenced by getDiveBdChgsSOS1conflictgraph(), and getDiveBdChgsSOS1constraints().

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

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

Definition at line 573 of file heur.c.

References SCIP_Stat::ndivesetlpiterations, SCIP_Stat::ndivesetlps, SCIP_Diveset::nlpiterations, and SCIP_Diveset::nlps.

Referenced by SCIPupdateDivesetLPStats().

static void divesetFree ( SCIP_DIVESET **  diveset)
static

frees memory of a diveset

Parameters
divesetgeneral diving settings

Definition at line 587 of file heur.c.

References BMSfreeMemory, BMSfreeMemoryArray, and NULL.

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

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 599 of file heur.c.

References SCIP_Diveset::divetypemask, NULL, 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

Parameters
heurprimal heuristic
setSCIP_SET of SCIP to copy to

Definition at line 624 of file heur.c.

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

Referenced by SCIPsetCopyPlugins().

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,
unsigned int  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 643 of file heur.c.

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

Referenced by SCIPincludeHeur(), and SCIPincludeHeurBasic().

SCIP_RETCODE SCIPheurFree ( SCIP_HEUR **  heur,
SCIP_SET set 
)

calls destructor and frees memory of primal heuristic

Parameters
heurpointer to primal heuristic data structure
setglobal SCIP settings

Definition at line 728 of file heur.c.

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

SCIP_RETCODE SCIPheurExit ( SCIP_HEUR heur,
SCIP_SET set 
)

calls exit method of primal heuristic

Parameters
heurprimal heuristic
setglobal SCIP settings

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

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 842 of file heur.c.

References SCIP_Heur::delaypos, FALSE, NULL, 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

Parameters
heurprimal heuristic
setglobal SCIP settings

Definition at line 872 of file heur.c.

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

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 896 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

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 958 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, SCIPclockStart(), SCIPclockStop(), SCIPdebugMessage, SCIPerrorMessage, and SCIPheurShouldBeExecuted().

Referenced by SCIPprimalHeuristics().

void SCIPheurSetData ( SCIP_HEUR heur,
SCIP_HEURDATA heurdata 
)

sets user data of primal heuristic; user has to free old data in advance!

Parameters
heurprimal heuristic
heurdatanew primal heuristic user data

Definition at line 1068 of file heur.c.

References SCIP_Heur::heurdata, and NULL.

Referenced by presolveTwoOpt(), SCIP_DECL_HEUREXIT(), SCIP_DECL_HEUREXITSOL(), SCIP_DECL_HEURFREE(), SCIP_DECL_HEURINIT(), and SCIP_DECL_HEURINITSOL().

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

sets copy callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1081 of file heur.c.

References NULL.

Referenced by SCIPsetHeurCopy().

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

sets destructor callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1092 of file heur.c.

References NULL.

Referenced by SCIPsetHeurFree().

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

sets initialization callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1103 of file heur.c.

References NULL.

Referenced by SCIPsetHeurInit().

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

sets deinitialization callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1114 of file heur.c.

References NULL.

Referenced by SCIPsetHeurExit().

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

sets solving process initialization callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1125 of file heur.c.

References NULL.

Referenced by SCIPsetHeurInitsol().

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

sets solving process deinitialization callback of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1136 of file heur.c.

References NULL.

Referenced by SCIPsetHeurExitsol().

const char* SCIPheurGetDesc ( SCIP_HEUR heur)

gets description of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1157 of file heur.c.

References SCIP_Heur::desc, and NULL.

Referenced by SCIP_DECL_DIALOGEXEC(), SCIPincludeDialogDefaultFix(), and SCIPincludeDialogDefaultSet().

char SCIPheurGetDispchar ( SCIP_HEUR heur)

gets display character of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1167 of file heur.c.

References SCIP_Heur::dispchar, and NULL.

Referenced by SCIP_DECL_DIALOGEXEC(), and SCIP_DECL_DISPOUTPUT().

SCIP_HEURTIMING SCIPheurGetTimingmask ( SCIP_HEUR heur)

returns the timing mask of the heuristic

Parameters
heurprimal heuristic

Definition at line 1177 of file heur.c.

References NULL, and SCIP_Heur::timingmask.

void SCIPheurSetTimingmask ( SCIP_HEUR heur,
SCIP_HEURTIMING  timingmask 
)

sets new timing mask for heuristic

Parameters
heurprimal heuristic
timingmasknew timing mask of heuristic

Definition at line 1187 of file heur.c.

References NULL, and SCIP_Heur::timingmask.

Referenced by SCIP_DECL_HEUREXEC(), SCIP_DECL_HEUREXITSOL(), SCIP_DECL_HEURINIT(), and SCIP_DECL_HEURINITSOL().

SCIP_Bool SCIPheurUsesSubscip ( SCIP_HEUR heur)

does the heuristic use a secondary SCIP instance?

Parameters
heurprimal heuristic

Definition at line 1198 of file heur.c.

References NULL, and SCIP_Heur::usessubscip.

Referenced by SCIPparamsetSetToSubscipsOff().

int SCIPheurGetPriority ( SCIP_HEUR heur)

gets priority of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1208 of file heur.c.

References NULL, and SCIP_Heur::priority.

Referenced by SCIP_DECL_DIALOGEXEC(), and SCIPprimalHeuristics().

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 1218 of file heur.c.

References FALSE, NULL, and SCIP_Heur::priority.

Referenced by SCIPsetHeurPriority().

int SCIPheurGetFreq ( SCIP_HEUR heur)

gets frequency of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1232 of file heur.c.

References SCIP_Heur::freq, and NULL.

Referenced by checkParameters(), SCIP_DECL_DIALOGEXEC(), SCIP_DECL_HEURINIT(), and SCIP_DECL_HEURINITSOL().

void SCIPheurSetFreq ( SCIP_HEUR heur,
int  freq 
)

sets frequency of primal heuristic

Parameters
heurprimal heuristic
freqnew frequency of heuristic

Definition at line 1242 of file heur.c.

References SCIP_Heur::freq, and NULL.

Referenced by storeSolution().

int SCIPheurGetFreqofs ( SCIP_HEUR heur)

gets frequency offset of primal heuristic

Parameters
heurprimal heuristic

Definition at line 1253 of file heur.c.

References SCIP_Heur::freqofs, and NULL.

Referenced by SCIP_DECL_DIALOGEXEC(), SCIP_DECL_HEURINIT(), and SCIP_DECL_HEURINITSOL().

int SCIPheurGetMaxdepth ( SCIP_HEUR heur)

gets maximal depth level for calling primal heuristic (returns -1, if no depth limit exists)

Parameters
heurprimal heuristic

Definition at line 1263 of file heur.c.

References SCIP_Heur::maxdepth, and NULL.

SCIP_Longint SCIPheurGetNCalls ( SCIP_HEUR heur)

gets the number of times, the heuristic was called and tried to find a solution

Parameters
heurprimal heuristic

Definition at line 1273 of file heur.c.

References SCIP_Heur::ncalls, and NULL.

Referenced by applyVbounds(), printHeuristicStatistics(), SCIP_DECL_HEUREXEC(), and SCIPapplyZeroobj().

SCIP_Longint SCIPheurGetNSolsFound ( SCIP_HEUR heur)

gets the number of primal feasible solutions found by this heuristic

Parameters
heurprimal heuristic

Definition at line 1283 of file heur.c.

References SCIP_Heur::nsolsfound, and NULL.

Referenced by printHeuristicStatistics(), and SCIP_DECL_HEUREXEC().

SCIP_Longint SCIPheurGetNBestSolsFound ( SCIP_HEUR heur)

gets the number of new best primal feasible solutions found by this heuristic

Parameters
heurprimal heuristic

Definition at line 1293 of file heur.c.

References SCIP_Heur::nbestsolsfound, and NULL.

Referenced by applyVbounds(), and SCIP_DECL_HEUREXEC().

SCIP_Bool SCIPheurIsInitialized ( SCIP_HEUR heur)

is primal heuristic initialized?

Parameters
heurprimal heuristic

Definition at line 1303 of file heur.c.

References SCIP_Heur::initialized, and NULL.

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 1313 of file heur.c.

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

Referenced by SCIPsetSetReoptimizationParams().

SCIP_Real SCIPheurGetSetupTime ( SCIP_HEUR heur)

gets time in seconds used in this heuristic for setting up for next stages

Parameters
heurprimal heuristic

Definition at line 1325 of file heur.c.

References NULL, SCIPclockGetTime(), and SCIP_Heur::setuptime.

Referenced by printHeuristicStatistics().

SCIP_Real SCIPheurGetTime ( SCIP_HEUR heur)

gets time in seconds used in this heuristic

Parameters
heurprimal heuristic

Definition at line 1335 of file heur.c.

References SCIP_Heur::heurclock, NULL, and SCIPclockGetTime().

Referenced by printHeuristicStatistics().

SCIP_DIVESET** SCIPheurGetDivesets ( SCIP_HEUR heur)

returns array of divesets of this primal heuristic, or NULL if it has no divesets

Parameters
heurprimal heuristic

Definition at line 1345 of file heur.c.

References SCIP_Heur::divesets, and NULL.

Referenced by printHeuristicStatistics().

int SCIPheurGetNDivesets ( SCIP_HEUR heur)

returns the number of divesets of this primal heuristic

Parameters
heurprimal heuristic

Definition at line 1355 of file heur.c.

References SCIP_Heur::ndivesets, and NULL.

Referenced by printHeuristicStatistics().