Scippy

SCIP

Solving Constraint Integer Programs

heur_vbounds.c File Reference

Detailed Description

LNS heuristic uses the variable lower and upper bounds to determine the search neighborhood.

Author
Timo Berthold
Stefan Heinz
Jens Schulz
Gerald Gamrath

Definition in file heur_vbounds.c.

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

Go to the source code of this file.

Macros

#define HEUR_NAME   "vbounds"
 
#define HEUR_DESC   "LNS heuristic uses the variable lower and upper bounds to determine the search neighborhood"
 
#define HEUR_DISPCHAR   'V'
 
#define HEUR_PRIORITY   -1106000
 
#define HEUR_FREQ   -1
 
#define HEUR_FREQOFS   0
 
#define HEUR_MAXDEPTH   -1
 
#define HEUR_TIMING   SCIP_HEURTIMING_BEFORENODE
 
#define HEUR_USESSUBSCIP   TRUE
 
#define DEFAULT_MAXNODES   5000LL /* maximum number of nodes to regard in the subproblem */
 
#define DEFAULT_MINFIXINGRATE   0.25 /* minimum percentage of integer variables that have to be fixed */
 
#define DEFAULT_MINIMPROVE   0.01 /* factor by which vbounds heuristic should at least improve the incumbent */
 
#define DEFAULT_MINNODES   500LL /* minimum number of nodes to regard in the subproblem */
 
#define DEFAULT_NODESOFS   500LL /* number of nodes added to the contingent of the total nodes */
 
#define DEFAULT_NODESQUOT   0.1 /* subproblem nodes in relation to nodes of the original problem */
 
#define DEFAULT_MAXPROPROUNDS   2 /* maximum number of propagation rounds during probing */
 
#define DEFAULT_COPYCUTS   TRUE
 

Propagator defines

The propagator works on indices representing a bound of a variable. This index will be called bound index in the following. For a given active variable with problem index i (note that active variables have problem indices between 0 and nactivevariable - 1), the bound index of its lower bound is 2*i, the bound index of its upper bound is 2*i + 1. The other way around, a given bound index i corresponds to the variable with problem index i/2 (rounded down), and to the lower bound, if i is even, to the upper bound if i is odd. The following macros can be used to convert bound index into variable problem index and boundtype and vice versa.

#define getLbIndex(idx)   (2*(idx))
 
#define getUbIndex(idx)   (2*(idx)+1)
 
#define getVarIndex(idx)   ((idx)/2)
 
#define getBoundtype(idx)   (((idx) % 2 == 0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER)
 
#define isIndexLowerbound(idx)   ((idx) % 2 == 0)
 
static void heurdataReset (SCIP_HEURDATA *heurdata)
 
static SCIP_RETCODE dfs (SCIP *scip, int startnode, SCIP_Bool *visited, int *dfsstack, int *stacknextedge, int *dfsnodes, int *ndfsnodes)
 
static SCIP_RETCODE topologicalSort (SCIP *scip, int *vbvars, int *nvbvars)
 
static SCIP_RETCODE initializeCandsLists (SCIP *scip, SCIP_HEURDATA *heurdata)
 
static SCIP_RETCODE applyVboundsFixings (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR **vars, int nvbvars, SCIP_Bool forward, SCIP_Bool tighten, SCIP_Bool obj, SCIP_Bool *infeasible, SCIP_VAR **lastvar, SCIP_Bool *fixedtolb)
 
static SCIP_RETCODE createNewSol (SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_SOL *newsol, SCIP_SOL *subsol, SCIP_Bool *success)
 
static SCIP_RETCODE applyVbounds (SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, SCIP_VAR **vbvars, int nvbvars, SCIP_Bool forward, SCIP_Bool tighten, SCIP_Bool obj, SCIP_RESULT *result)
 
static SCIP_DECL_HEURCOPY (heurCopyVbounds)
 
static SCIP_DECL_HEURFREE (heurFreeVbounds)
 
static SCIP_DECL_HEUREXITSOL (heurExitsolVbounds)
 
static SCIP_DECL_HEUREXEC (heurExecVbounds)
 
SCIP_RETCODE SCIPincludeHeurVbounds (SCIP *scip)
 

Macro Definition Documentation

#define HEUR_NAME   "vbounds"

Definition at line 40 of file heur_vbounds.c.

Referenced by applyVbounds(), and SCIPincludeHeurVbounds().

#define HEUR_DESC   "LNS heuristic uses the variable lower and upper bounds to determine the search neighborhood"

Definition at line 41 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define HEUR_DISPCHAR   'V'

Definition at line 42 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define HEUR_PRIORITY   -1106000

Definition at line 43 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define HEUR_FREQ   -1

Definition at line 44 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define HEUR_FREQOFS   0

Definition at line 45 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define HEUR_MAXDEPTH   -1

Definition at line 46 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define HEUR_TIMING   SCIP_HEURTIMING_BEFORENODE

Definition at line 47 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define HEUR_USESSUBSCIP   TRUE

does the heuristic use a secondary SCIP instance?

Definition at line 48 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

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

Definition at line 50 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

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

Definition at line 51 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

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

Definition at line 52 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

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

Definition at line 53 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

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

Definition at line 54 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

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

Definition at line 55 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define DEFAULT_MAXPROPROUNDS   2 /* maximum number of propagation rounds during probing */

Definition at line 56 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define DEFAULT_COPYCUTS   TRUE

should all active cuts from the cutpool of the original scip be copied to constraints of the subscip

Definition at line 57 of file heur_vbounds.c.

Referenced by SCIPincludeHeurVbounds().

#define getLbIndex (   idx)    (2*(idx))

Definition at line 100 of file heur_vbounds.c.

Referenced by dfs().

#define getUbIndex (   idx)    (2*(idx)+1)

Definition at line 101 of file heur_vbounds.c.

Referenced by dfs().

#define getVarIndex (   idx)    ((idx)/2)

Definition at line 102 of file heur_vbounds.c.

Referenced by dfs(), and initializeCandsLists().

#define getBoundtype (   idx)    (((idx) % 2 == 0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER)

Definition at line 103 of file heur_vbounds.c.

Referenced by initializeCandsLists().

#define isIndexLowerbound (   idx)    ((idx) % 2 == 0)

Definition at line 104 of file heur_vbounds.c.

Referenced by dfs().

Function Documentation

static void heurdataReset ( SCIP_HEURDATA heurdata)
static

reset heuristic data structure

Parameters
heurdatastructure containing heurdata

Definition at line 117 of file heur_vbounds.c.

References dfs(), FALSE, and NULL.

Referenced by SCIPincludeHeurVbounds().

static SCIP_RETCODE dfs ( SCIP scip,
int  startnode,
SCIP_Bool visited,
int *  dfsstack,
int *  stacknextedge,
int *  dfsnodes,
int *  ndfsnodes 
)
static

performs depth-first-search in the implicitly given directed graph from the given start index

Parameters
scipSCIP data structure
startnodenode to start the depth-first-search
visitedarray to store for each node, whether it was already visited
dfsstackarray of size number of nodes to store the stack; only needed for performance reasons
stacknextedgearray of size number of nodes to store the number of adjacent nodes already visited for each node on the stack; only needed for performance reasons
dfsnodesarray of nodes that can be reached starting at startnode, in reverse dfs order
ndfsnodespointer to store number of nodes that can be reached starting at startnode

Definition at line 131 of file heur_vbounds.c.

References FALSE, getLbIndex, getUbIndex, getVarIndex, isIndexLowerbound, NULL, SCIP_Bool, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPgetNVars(), SCIPgetVars(), SCIPisPositive(), SCIPvarGetNVlbs(), SCIPvarGetNVubs(), SCIPvarGetProbindex(), SCIPvarGetType(), SCIPvarGetVlbCoefs(), SCIPvarGetVlbVars(), SCIPvarGetVubCoefs(), SCIPvarGetVubVars(), SCIPvarIsActive(), topologicalSort(), and TRUE.

Referenced by heurdataReset(), and topologicalSort().

static SCIP_RETCODE topologicalSort ( SCIP scip,
int *  vbvars,
int *  nvbvars 
)
static

sort the bounds of variables topologically

Parameters
scipSCIP data structure
vbvarsarray to store variable bounds in topological order
nvbvarsarray to store number of variable bounds in the graph

Definition at line 249 of file heur_vbounds.c.

References BMSclearMemoryArray, dfs(), initializeCandsLists(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPfreeBufferArray, and SCIPgetNVars().

Referenced by dfs(), and initializeCandsLists().

static SCIP_RETCODE initializeCandsLists ( SCIP scip,
SCIP_HEURDATA heurdata 
)
static

initialize candidate lists

Parameters
sciporiginal SCIP data structure
heurdatastructure containing heurdata

Definition at line 292 of file heur_vbounds.c.

References applyVboundsFixings(), getBoundtype, getVarIndex, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPallocMemoryArray, SCIPcaptureVar(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPgetNVars(), SCIPgetProbName(), SCIPgetVars(), SCIPstatisticMessage, topologicalSort(), and TRUE.

Referenced by topologicalSort().

static SCIP_RETCODE applyVboundsFixings ( SCIP scip,
SCIP_HEURDATA heurdata,
SCIP_VAR **  vars,
int  nvbvars,
SCIP_Bool  forward,
SCIP_Bool  tighten,
SCIP_Bool  obj,
SCIP_Bool infeasible,
SCIP_VAR **  lastvar,
SCIP_Bool fixedtolb 
)
static

apply variable bound fixing during probing

Parameters
sciporiginal SCIP data structure
heurdatastructure containing heurdata
varsvariables to fix during probing
nvbvarsnumber of variables in the variable bound graph
forwardshould fixings be done forward w.r.t. the vbound graph?
tightenshould variables be fixed to cause other fixings?
objshould the objective be taken into account?
infeasiblepointer to store whether problem is infeasible
lastvarlast fixed variable
fixedtolbwas last fixed variable fixed to its lower bound?

Definition at line 349 of file heur_vbounds.c.

References createNewSol(), FALSE, NULL, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPdebugMessage, SCIPfixVarProbing(), SCIPgetDepth(), SCIPgetDepthLimit(), SCIPgetNPseudoBranchCands(), SCIPnewProbingNode(), SCIPpropagateProbing(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetType(), SCIPvarGetUbLocal(), and TRUE.

Referenced by applyVbounds(), and initializeCandsLists().

static SCIP_RETCODE createNewSol ( SCIP scip,
SCIP subscip,
SCIP_VAR **  subvars,
SCIP_SOL newsol,
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
newsolworking solution
subsolsolution of the subproblem
successused to store whether new solution was found or not

Definition at line 425 of file heur_vbounds.c.

References applyVbounds(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPgetNOrigVars(), SCIPgetSolVals(), SCIPgetVarsData(), SCIPsetSolVals(), SCIPtrySol(), and TRUE.

Referenced by applyVbounds(), and applyVboundsFixings().

static SCIP_RETCODE applyVbounds ( SCIP scip,
SCIP_HEUR heur,
SCIP_HEURDATA heurdata,
SCIP_VAR **  vbvars,
int  nvbvars,
SCIP_Bool  forward,
SCIP_Bool  tighten,
SCIP_Bool  obj,
SCIP_RESULT result 
)
static

main procedure of the vbounds heuristic

Parameters
sciporiginal SCIP data structure
heurheuristic
heurdataheuristic data structure
vbvarsvariables to fix during probing
nvbvarsnumber of variables to fix
forwardshould fixings be done forward w.r.t. the vbound graph?
tightenshould variables be fixed to cause other fixings?
objshould the objective be taken into account?
resultpointer to store the result

Definition at line 468 of file heur_vbounds.c.

References applyVboundsFixings(), createNewSol(), FALSE, HEUR_NAME, MIN, NULL, SCIP_Bool, SCIP_CALL, SCIP_DECL_HEURCOPY(), SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_FOUNDSOL, SCIP_Longint, SCIP_LPSOLSTAT_ERROR, SCIP_LPSOLSTAT_INFEASIBLE, SCIP_LPSOLSTAT_OBJLIMIT, SCIP_LPSOLSTAT_OPTIMAL, SCIP_OKAY, SCIP_PARAMSETTING_FAST, SCIP_PARAMSETTING_OFF, SCIP_Real, SCIPallocBufferArray, SCIPbacktrackProbing(), SCIPblkmem(), SCIPcalcHashtableSize(), SCIPclearSol(), SCIPclockGetTime(), SCIPconstructLP(), SCIPcopy(), SCIPcopyCuts(), SCIPcreate(), SCIPcreateClock(), SCIPcreateSol(), SCIPdebugMessage, SCIPendProbing(), SCIPfindBranchrule(), SCIPfindConshdlr(), SCIPfindNodesel(), SCIPfixVarProbing(), SCIPflushLP(), SCIPfree(), SCIPfreeBufferArray, SCIPfreeClock(), SCIPfreeSol(), SCIPgetCurrentNode(), SCIPgetLowerbound(), SCIPgetLPSolstat(), SCIPgetMemExternEstim(), SCIPgetMemUsed(), SCIPgetNConss(), SCIPgetNLPIterations(), SCIPgetNNodes(), SCIPgetNPseudoBranchCands(), SCIPgetNSols(), SCIPgetNVars(), SCIPgetProbingDepth(), SCIPgetRealParam(), SCIPgetSolOrigObj(), SCIPgetSols(), SCIPgetSolvingTime(), SCIPgetUpperbound(), SCIPgetVarsData(), SCIPhasCurrentNodeLP(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPheurGetNBestSolsFound(), SCIPheurGetNCalls(), SCIPinfinity(), SCIPisInfinity(), SCIPisLPConstructed(), SCIPisParamFixed(), SCIPisStopped(), SCIPlinkLPSol(), SCIPnodeGetNumber(), SCIPpresolve(), SCIPprintStatistics(), SCIPpropagateProbing(), SCIProundSol(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetObjlimit(), SCIPsetPresolving(), SCIPsetRealParam(), SCIPsetSeparating(), SCIPsetSubscipsOff(), SCIPsolve(), SCIPsolveProbingLP(), SCIPstartClock(), SCIPstartProbing(), SCIPstatistic, SCIPstatisticMessage, SCIPstopClock(), SCIPsumepsilon(), SCIPtrySol(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), SCIPwarningMessage(), and TRUE.

Referenced by createNewSol().

static SCIP_DECL_HEURCOPY ( heurCopyVbounds  )
static

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

Definition at line 917 of file heur_vbounds.c.

Referenced by applyVbounds().

static SCIP_DECL_HEURFREE ( heurFreeVbounds  )
static

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

Definition at line 931 of file heur_vbounds.c.

static SCIP_DECL_HEUREXITSOL ( heurExitsolVbounds  )
static

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

Definition at line 947 of file heur_vbounds.c.

static SCIP_DECL_HEUREXEC ( heurExecVbounds  )
static

execution method of primal heuristic

Definition at line 973 of file heur_vbounds.c.