Scippy

SCIP

Solving Constraint Integer Programs

heur_dins.c File Reference

Detailed Description

DINS primal heuristic (according to Ghosh)

Author
Timo Berthold
Robert Waniek

Definition in file heur_dins.c.

#include <assert.h>
#include <string.h>
#include "scip/scip.h"
#include "scip/scipdefplugins.h"
#include "scip/cons_linear.h"
#include "scip/heur_dins.h"

Go to the source code of this file.

Macros

#define HEUR_NAME   "dins"
 
#define HEUR_DESC   "distance induced neighborhood search by Ghosh"
 
#define HEUR_DISPCHAR   'D'
 
#define HEUR_PRIORITY   -1105000
 
#define HEUR_FREQ   -1
 
#define HEUR_FREQOFS   0
 
#define HEUR_MAXDEPTH   -1
 
#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPNODE
 
#define HEUR_USESSUBSCIP   TRUE
 
#define DEFAULT_NODESOFS   5000LL /* number of nodes added to the contingent of the total nodes */
 
#define DEFAULT_MAXNODES   5000LL /* maximum number of nodes to regard in the subproblem */
 
#define DEFAULT_MINNODES   50LL /* minimum number of nodes to regard in the subproblem */
 
#define DEFAULT_MINIMPROVE   0.01 /* factor by which DINS should at least improve the incumbent */
 
#define DEFAULT_NODESQUOT   0.05 /* subproblem nodes in relation to nodes of the original problem */
 
#define DEFAULT_LPLIMFAC   1.5 /* factor by which the limit on the number of LP depends on the node limit */
 
#define DEFAULT_MINFIXINGRATE   0.3 /* minimum percentage of integer variables that have to be fixed */
 
#define DEFAULT_NWAITINGNODES   0LL /* number of nodes without incumbent change that heuristic should wait */
 
#define DEFAULT_NEIGHBORHOODSIZE   18 /* radius of the incumbents neighborhood to be searched */
 
#define DEFAULT_SOLNUM   5 /* number of pool-solutions to be checked for flag array update */
 
#define DEFAULT_USELPROWS
 
#define DEFAULT_COPYCUTS
 
#define EVENTHDLR_NAME   "Dins"
 
#define EVENTHDLR_DESC   "LP event handler for "HEUR_NAME" heuristic"
 

Functions

static SCIP_RETCODE createSubproblem (SCIP *scip, SCIP *subscip, SCIP_VAR **vars, SCIP_VAR **subvars, int nbinvars, int nintvars, int *fixingcounter, SCIP_Bool uselprows)
 
static SCIP_RETCODE addLocalBranchingConstraint (SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEURDATA *heurdata, SCIP_Bool *fixed)
 
static SCIP_RETCODE createNewSol (SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
 
static SCIP_DECL_EVENTEXEC (eventExecRins)
 
static SCIP_DECL_HEURCOPY (heurCopyDins)
 
static SCIP_DECL_HEURFREE (heurFreeDins)
 
static SCIP_DECL_HEURINITSOL (heurInitsolDins)
 
static SCIP_DECL_HEUREXITSOL (heurExitsolDins)
 
static SCIP_DECL_HEUREXEC (heurExecDins)
 
SCIP_RETCODE SCIPincludeHeurDins (SCIP *scip)
 

Macro Definition Documentation

#define HEUR_NAME   "dins"

Definition at line 31 of file heur_dins.c.

Referenced by SCIP_DECL_HEURCOPY(), SCIP_DECL_HEUREXEC(), and SCIPincludeHeurDins().

#define HEUR_DESC   "distance induced neighborhood search by Ghosh"

Definition at line 32 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define HEUR_DISPCHAR   'D'

Definition at line 33 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define HEUR_PRIORITY   -1105000

Definition at line 34 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define HEUR_FREQ   -1

Definition at line 35 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define HEUR_FREQOFS   0

Definition at line 36 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define HEUR_MAXDEPTH   -1

Definition at line 37 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPNODE

Definition at line 38 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define HEUR_USESSUBSCIP   TRUE

does the heuristic use a secondary SCIP instance?

Definition at line 39 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_NODESOFS   5000LL /* number of nodes added to the contingent of the total nodes */

Definition at line 41 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_MAXNODES   5000LL /* maximum number of nodes to regard in the subproblem */

Definition at line 42 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_MINNODES   50LL /* minimum number of nodes to regard in the subproblem */

Definition at line 43 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_MINIMPROVE   0.01 /* factor by which DINS should at least improve the incumbent */

Definition at line 44 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_NODESQUOT   0.05 /* subproblem nodes in relation to nodes of the original problem */

Definition at line 45 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_LPLIMFAC   1.5 /* factor by which the limit on the number of LP depends on the node limit */

Definition at line 46 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_MINFIXINGRATE   0.3 /* minimum percentage of integer variables that have to be fixed */

Definition at line 47 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_NWAITINGNODES   0LL /* number of nodes without incumbent change that heuristic should wait */

Definition at line 48 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_NEIGHBORHOODSIZE   18 /* radius of the incumbents neighborhood to be searched */

Definition at line 49 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_SOLNUM   5 /* number of pool-solutions to be checked for flag array update */

Definition at line 50 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_USELPROWS
Value:
FALSE /* should subproblem be created out of the rows in the LP rows,
* otherwise, the copy constructors of the constraints handlers are used */

Definition at line 51 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define DEFAULT_COPYCUTS
Value:
TRUE /* if DEFAULT_USELPROWS is FALSE, then should all active cuts from the cutpool
* of the original scip be copied to constraints of the subscip */

Definition at line 52 of file heur_dins.c.

Referenced by SCIPincludeHeurDins().

#define EVENTHDLR_NAME   "Dins"

Definition at line 55 of file heur_dins.c.

Referenced by SCIP_DECL_EVENTEXEC(), and SCIP_DECL_HEUREXEC().

#define EVENTHDLR_DESC   "LP event handler for "HEUR_NAME" heuristic"

Definition at line 56 of file heur_dins.c.

Referenced by SCIP_DECL_HEUREXEC().

Function Documentation

static SCIP_RETCODE createSubproblem ( SCIP scip,
SCIP subscip,
SCIP_VAR **  vars,
SCIP_VAR **  subvars,
int  nbinvars,
int  nintvars,
int *  fixingcounter,
SCIP_Bool  uselprows 
)
static

creates a subproblem for subscip by fixing a number of variables

Parameters
scipSCIP data structure of the original problem
subscipSCIP data structure of the subproblem
varsvariables of the original problem
subvarsvariables of the subproblem
nbinvarsnumber of binary variables of problem and subproblem
nintvarsnumber of general integer variables of problem and subproblem
fixingcounternumber of integer variables that get fixed
uselprowsshould subproblem be created out of the rows in the LP rows?

Definition at line 93 of file heur_dins.c.

References FALSE, MAX, MIN, NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_INTEGER, SCIPaddCons(), SCIPallocBufferArray, SCIPchgVarLbGlobal(), SCIPchgVarUbGlobal(), SCIPcolGetVar(), SCIPcreateConsLinear(), SCIPfeasCeil(), SCIPfeasFloor(), SCIPfreeBufferArray, SCIPgetBestSol(), SCIPgetLPRowsData(), SCIPgetSolVal(), SCIPisFeasEQ(), SCIPreleaseCons(), SCIProwGetCols(), SCIProwGetConstant(), SCIProwGetLhs(), SCIProwGetName(), SCIProwGetNNonz(), SCIProwGetRhs(), SCIProwGetVals(), SCIProwIsLocal(), SCIPvarGetLbGlobal(), SCIPvarGetLPSol(), SCIPvarGetProbindex(), SCIPvarGetType(), SCIPvarGetUbGlobal(), and TRUE.

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_RETCODE addLocalBranchingConstraint ( SCIP scip,
SCIP subscip,
SCIP_VAR **  subvars,
SCIP_HEURDATA heurdata,
SCIP_Bool fixed 
)
static

create the extra constraint of local branching and add it to subscip

Parameters
scipSCIP data structure of the original problem
subscipSCIP data structure of the subproblem
subvarsvariables of the subproblem
heurdataheuristic's data structure
fixedTRUE –> include variable in LB constraint

Definition at line 252 of file heur_dins.c.

References FALSE, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsLinear(), SCIPfreeBufferArray, SCIPgetBestSol(), SCIPgetProbName(), SCIPgetSolVal(), SCIPgetVarsData(), SCIPisFeasEQ(), SCIPisFeasIntegral(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetType(), and TRUE.

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_RETCODE createNewSol ( SCIP scip,
SCIP subscip,
SCIP_VAR **  subvars,
SCIP_HEUR heur,
SCIP_SOL subsol,
SCIP_Bool success 
)
static

creates a new solution for the original problem by copying the solution of the subproblem

Parameters
sciporiginal SCIP data structure
subscipSCIP structure of the subproblem
subvarsthe variables of the subproblem
heurDINS heuristic structure
subsolsolution of the subproblem
successused to store whether new solution was found or not

Definition at line 330 of file heur_dins.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPcreateSol(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPgetNOrigVars(), SCIPgetSolVals(), SCIPgetVarsData(), SCIPsetSolVals(), SCIPtrySolFree(), and TRUE.

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_DECL_EVENTEXEC ( eventExecRins  )
static
static SCIP_DECL_HEURCOPY ( heurCopyDins  )
static

copy method for primal heuristic plugins (called when SCIP copies plugins)

Definition at line 415 of file heur_dins.c.

References HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurDins().

static SCIP_DECL_HEURFREE ( heurFreeDins  )
static

destructor of primal heuristic to free user data (called when SCIP is exiting)

Definition at line 429 of file heur_dins.c.

References NULL, SCIP_OKAY, SCIPfreeMemory, SCIPheurGetData(), and SCIPheurSetData().

static SCIP_DECL_HEURINITSOL ( heurInitsolDins  )
static

solving process initialization method of primal heuristic (called when branch and bound process is about to begin)

Definition at line 450 of file heur_dins.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPgetNBinVars(), SCIPheurGetData(), and TRUE.

static SCIP_DECL_HEUREXITSOL ( heurExitsolDins  )
static

solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)

Definition at line 481 of file heur_dins.c.

References NULL, SCIP_OKAY, SCIPfreeBlockMemoryArray, and SCIPheurGetData().

static SCIP_DECL_HEUREXEC ( heurExecDins  )
static

execution method of primal heuristic

Definition at line 502 of file heur_dins.c.

References addLocalBranchingConstraint(), createNewSol(), createSubproblem(), EVENTHDLR_DESC, EVENTHDLR_NAME, FALSE, HEUR_NAME, MAX, MIN, NULL, SCIP_Bool, SCIP_CALL, SCIP_DELAYED, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_EVENTTYPE_LPSOLVED, SCIP_FOUNDSOL, SCIP_Longint, SCIP_LPSOLSTAT_OPTIMAL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_PARAMSETTING_FAST, SCIP_PARAMSETTING_OFF, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIPallocBufferArray, SCIPblkmem(), SCIPcalcHashtableSize(), SCIPcalcMemGrowSize(), SCIPcatchEvent(), SCIPcopy(), SCIPcopyCuts(), SCIPcopyVars(), SCIPcreate(), SCIPcreateProb(), SCIPdebug, SCIPdebugMessage, SCIPdropEvent(), SCIPerrorMessage, SCIPfindBranchrule(), SCIPfindConshdlr(), SCIPfindNodesel(), SCIPfixVar(), SCIPfree(), SCIPfreeBufferArray, SCIPgetBestSol(), SCIPgetCutoffbound(), SCIPgetLowerbound(), SCIPgetLPObjval(), SCIPgetLPSolstat(), SCIPgetMemExternEstim(), SCIPgetMemUsed(), SCIPgetNBinVars(), SCIPgetNConss(), SCIPgetNIntVars(), SCIPgetNNodes(), SCIPgetNSols(), SCIPgetNSolsFound(), SCIPgetNVars(), SCIPgetProbName(), SCIPgetRealParam(), SCIPgetSolHeur(), SCIPgetSolNodenum(), SCIPgetSols(), SCIPgetSolVal(), SCIPgetSolvingTime(), SCIPgetUpperbound(), SCIPgetVarsData(), SCIPhasCurrentNodeLP(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPheurGetData(), SCIPheurGetNBestSolsFound(), SCIPheurGetNCalls(), SCIPincludeDefaultPlugins(), SCIPincludeEventhdlrBasic(), SCIPinfinity(), SCIPisFeasEQ(), SCIPisGE(), SCIPisInfinity(), SCIPisParamFixed(), SCIPisStopped(), SCIPprintStatistics(), SCIPreallocBlockMemoryArray, SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetObjlimit(), SCIPsetPresolving(), SCIPsetRealParam(), SCIPsetSeparating(), SCIPsetSubscipsOff(), SCIPsnprintf(), SCIPsolve(), SCIPsumepsilon(), SCIPtransformProb(), SCIPvarGetLbGlobal(), SCIPvarGetLPSol(), SCIPvarGetRootSol(), SCIPvarGetUbGlobal(), SCIPwarningMessage(), and TRUE.