Diving heuristic that chooses fixings w.r.t. changes in the solution density after Pryor and Chinneck.
Definition in file heur_distributiondiving.c.
#include <assert.h>
#include <string.h>
#include "scip/heur_distributiondiving.h"
#include "scip/branch_distribution.h"
Go to the source code of this file.
Functions | |
static SCIP_RETCODE | heurdataEnsureArraySize (SCIP *scip, SCIP_HEURDATA *heurdata, int maxindex) |
static void | heurdataUpdateCurrentBounds (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR *var) |
static void | rowCalculateGauss (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_ROW *row, SCIP_Real *mu, SCIP_Real *sigma2, int *rowinfinitiesdown, int *rowinfinitiesup) |
static SCIP_RETCODE | calcBranchScore (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR *var, SCIP_Real lpsolval, SCIP_Real *upscore, SCIP_Real *downscore, char scoreparam) |
static SCIP_RETCODE | heurdataFreeArrays (SCIP *scip, SCIP_HEURDATA *heurdata) |
static void | heurdataAddBoundChangeVar (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR *var) |
static SCIP_VAR * | heurdataPopBoundChangeVar (SCIP *scip, SCIP_HEURDATA *heurdata) |
static SCIP_RETCODE | varProcessBoundChanges (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR *var) |
static | SCIP_DECL_EVENTFREE (eventFreeDistributiondiving) |
static | SCIP_DECL_HEURCOPY (heurCopyDistributiondiving) |
static | SCIP_DECL_HEURFREE (heurFreeDistributiondiving) |
static | SCIP_DECL_HEURINIT (heurInitDistributiondiving) |
static | SCIP_DECL_HEUREXIT (heurExitDistributiondiving) |
static | SCIP_DECL_DIVESETGETSCORE (divesetGetScoreDistributiondiving) |
static | SCIP_DECL_HEUREXEC (heurExecDistributiondiving) |
static | SCIP_DECL_EVENTEXEC (eventExecDistribution) |
SCIP_RETCODE | SCIPincludeHeurDistributiondiving (SCIP *scip) |
#define HEUR_NAME "distributiondiving" |
Definition at line 29 of file heur_distributiondiving.c.
#define HEUR_DESC "Diving heuristic that chooses fixings w.r.t. changes in the solution density" |
Definition at line 30 of file heur_distributiondiving.c.
#define HEUR_DISPCHAR 'e' |
Definition at line 31 of file heur_distributiondiving.c.
#define HEUR_PRIORITY -1003300 |
Definition at line 32 of file heur_distributiondiving.c.
#define HEUR_FREQ 10 |
Definition at line 33 of file heur_distributiondiving.c.
#define HEUR_FREQOFS 3 |
Definition at line 34 of file heur_distributiondiving.c.
#define HEUR_MAXDEPTH -1 |
Definition at line 35 of file heur_distributiondiving.c.
#define HEUR_TIMING SCIP_HEURTIMING_AFTERLPPLUNGE |
Definition at line 36 of file heur_distributiondiving.c.
#define HEUR_USESSUBSCIP FALSE |
does the heuristic use a secondary SCIP instance?
Definition at line 37 of file heur_distributiondiving.c.
#define EVENT_DISTRIBUTION SCIP_EVENTTYPE_BOUNDCHANGED |
the event type to be handled by this event handler
Definition at line 38 of file heur_distributiondiving.c.
Referenced by heurdataEnsureArraySize(), and heurdataFreeArrays().
#define EVENTHDLR_NAME "eventhdlr_distributiondiving" |
Definition at line 39 of file heur_distributiondiving.c.
#define DIVESET_DIVETYPES SCIP_DIVETYPE_INTEGRALITY |
bit mask that represents all supported dive types
Definition at line 40 of file heur_distributiondiving.c.
#define SQUARED | ( | x | ) | ((x) * (x)) |
Definition at line 42 of file heur_distributiondiving.c.
Referenced by calcBranchScore(), rowCalculateGauss(), and varProcessBoundChanges().
#define DEFAULT_MINRELDEPTH 0.0 |
minimal relative depth to start diving
Definition at line 47 of file heur_distributiondiving.c.
#define DEFAULT_MAXRELDEPTH 1.0 |
maximal relative depth to start diving
Definition at line 48 of file heur_distributiondiving.c.
#define DEFAULT_MAXLPITERQUOT 0.05 |
maximal fraction of diving LP iterations compared to node LP iterations
Definition at line 49 of file heur_distributiondiving.c.
#define DEFAULT_MAXLPITEROFS 1000 |
additional number of allowed LP iterations
Definition at line 50 of file heur_distributiondiving.c.
#define DEFAULT_MAXDIVEUBQUOT 0.8 |
maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound) where diving is performed (0.0: no limit)
Definition at line 51 of file heur_distributiondiving.c.
#define DEFAULT_MAXDIVEAVGQUOT 0.0 |
maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound) where diving is performed (0.0: no limit)
Definition at line 54 of file heur_distributiondiving.c.
#define DEFAULT_MAXDIVEUBQUOTNOSOL 0.1 |
maximal UBQUOT when no solution was found yet (0.0: no limit)
Definition at line 57 of file heur_distributiondiving.c.
#define DEFAULT_MAXDIVEAVGQUOTNOSOL 0.0 |
maximal AVGQUOT when no solution was found yet (0.0: no limit)
Definition at line 58 of file heur_distributiondiving.c.
#define DEFAULT_BACKTRACK TRUE |
use one level of backtracking if infeasibility is encountered?
Definition at line 59 of file heur_distributiondiving.c.
#define DEFAULT_LPRESOLVEDOMCHGQUOT 0.15 |
percentage of immediate domain changes during probing to trigger LP resolve
Definition at line 60 of file heur_distributiondiving.c.
#define DEFAULT_LPSOLVEFREQ 0 |
LP solve frequency for diving heuristics
Definition at line 61 of file heur_distributiondiving.c.
#define DEFAULT_ONLYLPBRANCHCANDS TRUE |
should only LP branching candidates be considered instead of the slower but more general constraint handler diving variable selection?
Definition at line 62 of file heur_distributiondiving.c.
#define SCOREPARAM_VALUES "lhwvd" |
the score;largest 'd'ifference, 'l'owest cumulative probability,'h'ighest c.p., 'v'otes lowest c.p., votes highest c.p.('w'), 'r'evolving
Definition at line 66 of file heur_distributiondiving.c.
#define SCOREPARAM_VALUESLEN 5 |
Definition at line 69 of file heur_distributiondiving.c.
#define DEFAULT_SCOREPARAM 'r' |
default scoring parameter to guide the diving
Definition at line 70 of file heur_distributiondiving.c.
#define DEFAULT_RANDSEED 117 |
initial seed for random number generation
Definition at line 71 of file heur_distributiondiving.c.
|
static |
ensure that maxindex + 1 rows can be represented in data arrays; memory gets reallocated with 10% extra space to save some time for future allocations
scip | SCIP data structure |
heurdata | heuristic data |
maxindex | row index at hand (size must be at least this large) |
Definition at line 108 of file heur_distributiondiving.c.
References EVENT_DISTRIBUTION, heurdataUpdateCurrentBounds(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPallocBufferArray, SCIPcatchVarEvent(), SCIPfeasCeil(), SCIPgetNVars(), SCIPgetStage(), SCIPgetVars(), SCIPreallocBufferArray, SCIPvarGetProbindex(), and SCIPvarIsActive().
Referenced by calcBranchScore(), and varProcessBoundChanges().
|
static |
update the variables current lower and upper bound
scip | SCIP data structure |
heurdata | heuristic data |
var | the variable to update current bounds |
Definition at line 197 of file heur_distributiondiving.c.
References rowCalculateGauss(), SCIP_Real, SCIPisFeasLE(), SCIPvarGetLbLocal(), SCIPvarGetProbindex(), and SCIPvarGetUbLocal().
Referenced by heurdataEnsureArraySize(), rowCalculateGauss(), and varProcessBoundChanges().
|
static |
calculates the initial mean and variance of the row activity normal distribution.
The mean value \( \mu \) is given by \( \mu = \sum_i=1^n c_i * (lb_i +ub_i) / 2 \) where \(n \) is the number of variables, and \( c_i, lb_i, ub_i \) are the variable coefficient and bounds, respectively. With the same notation, the variance \( \sigma^2 \) is given by \( \sigma^2 = \sum_i=1^n c_i^2 * \sigma^2_i \), with the variance being \( \sigma^2_i = ((ub_i - lb_i + 1)^2 - 1) / 12 \) for integer variables and \( \sigma^2_i = (ub_i - lb_i)^2 / 12 \) for continuous variables.
scip | SCIP data structure |
heurdata | the heuristic rule data |
row | the row for which the gaussian normal distribution has to be calculated |
mu | pointer to store the mean value of the gaussian normal distribution |
sigma2 | pointer to store the variance value of the gaussian normal distribution |
rowinfinitiesdown | pointer to store the number of variables with infinite bounds to DECREASE activity |
rowinfinitiesup | pointer to store the number of variables with infinite bounds to INCREASE activity |
Definition at line 230 of file heur_distributiondiving.c.
References calcBranchScore(), heurdataUpdateCurrentBounds(), SCIP_INVALID, SCIP_Real, SCIPcolGetVar(), SCIPdebug, SCIPdebugMsg, SCIPisFeasLE(), SCIPisFeasNegative(), SCIPisInfinity(), SCIPprintRow(), SCIProwGetCols(), SCIProwGetConstant(), SCIProwGetName(), SCIProwGetNNonz(), SCIProwGetVals(), SCIPvarCalcDistributionParameters(), SCIPvarGetLbLocal(), SCIPvarGetProbindex(), SCIPvarGetType(), SCIPvarGetUbLocal(), and SQUARED.
Referenced by calcBranchScore(), and heurdataUpdateCurrentBounds().
|
static |
calculate the branching score of a variable, depending on the chosen score parameter
scip | current SCIP |
heurdata | branch rule data |
var | candidate variable |
lpsolval | current fractional LP-relaxation solution value |
upscore | pointer to store the variable score when branching on it in upward direction |
downscore | pointer to store the variable score when branching on it in downward direction |
scoreparam | the score parameter of this heuristic |
Definition at line 343 of file heur_distributiondiving.c.
References FALSE, heurdataEnsureArraySize(), heurdataFreeArrays(), MAX, rowCalculateGauss(), SCIP_Bool, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIP_VARSTATUS_COLUMN, SCIPcolGetNNonz(), SCIPcolGetRows(), SCIPcolGetVals(), SCIPdebugMsg, SCIPfeasCeil(), SCIPfeasFloor(), SCIPgetRowLPFeasibility(), SCIPisInfinity(), SCIPisIntegral(), SCIPisNegative(), SCIPisSumPositive(), SCIProwCalcProbability(), SCIProwGetIndex(), SCIProwGetName(), SCIPupdateDistributionScore(), SCIPvarCalcDistributionParameters(), SCIPvarGetCol(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetStatus(), SCIPvarGetType(), SCIPvarGetUbLocal(), SCIPvarIsBinary(), and SQUARED.
Referenced by rowCalculateGauss().
|
static |
free heuristic data
scip | SCIP data structure |
heurdata | heuristic data |
Definition at line 545 of file heur_distributiondiving.c.
References EVENT_DISTRIBUTION, heurdataAddBoundChangeVar(), SCIP_CALL, SCIP_OKAY, SCIPdropVarEvent(), SCIPfreeBufferArray, SCIPgetNVars(), SCIPgetVars(), and SCIPvarGetProbindex().
Referenced by calcBranchScore().
|
static |
add variable to the bound change event queue; skipped if variable is already in there, or if variable has no row currently watched
scip | SCIP data structure |
heurdata | heuristic data |
var | the variable whose bound changes need to be processed |
Definition at line 598 of file heur_distributiondiving.c.
References heurdataPopBoundChangeVar(), SCIP_INVALID, and SCIPvarGetProbindex().
Referenced by heurdataFreeArrays().
|
static |
returns the next unprocessed variable (last in, first out) with pending bound changes, or NULL
scip | SCIP data structure |
heurdata | heuristic data |
Definition at line 644 of file heur_distributiondiving.c.
References SCIPvarGetProbindex(), and varProcessBoundChanges().
Referenced by heurdataAddBoundChangeVar().
|
static |
process a variable from the queue of changed variables
scip | SCIP data structure |
heurdata | heuristic data |
var | the variable whose bound changes need to be processed |
Definition at line 674 of file heur_distributiondiving.c.
References heurdataEnsureArraySize(), heurdataUpdateCurrentBounds(), MAX, SCIP_CALL, SCIP_DECL_EVENTFREE(), SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPcolGetNNonz(), SCIPcolGetRows(), SCIPcolGetVals(), SCIPinProbing(), SCIPisFeasEQ(), SCIPisFeasGE(), SCIPisInfinity(), SCIProwGetIndex(), SCIPvarCalcDistributionParameters(), SCIPvarGetCol(), SCIPvarGetLbLocal(), SCIPvarGetProbindex(), SCIPvarGetType(), SCIPvarGetUbLocal(), and SQUARED.
Referenced by heurdataPopBoundChangeVar().
|
static |
destructor of event handler to free user data (called when SCIP is exiting)
Definition at line 798 of file heur_distributiondiving.c.
Referenced by varProcessBoundChanges().
|
static |
copy method for primal heuristic plugins (called when SCIP copies plugins)
Definition at line 817 of file heur_distributiondiving.c.
|
static |
destructor of primal heuristic to free user data (called when SCIP is exiting)
Definition at line 831 of file heur_distributiondiving.c.
|
static |
initialization method of primal heuristic (called after problem was transformed)
Definition at line 851 of file heur_distributiondiving.c.
|
static |
deinitialization method of primal heuristic (called before transformed problem is freed)
Definition at line 871 of file heur_distributiondiving.c.
|
static |
scoring callback for distribution diving. best candidate maximizes the distribution score
Definition at line 890 of file heur_distributiondiving.c.
|
static |
execution method of primal heuristic
Definition at line 961 of file heur_distributiondiving.c.
|
static |
event execution method of distribution branching which handles bound change events of variables
Definition at line 1007 of file heur_distributiondiving.c.