Detailed Description
LP gcgrounding heuristic that tries to recover from intermediate infeasibilities and shifts continuous variables.
Definition in file heur_gcgshifting.c.
#include <assert.h>
#include <string.h>
#include "heur_gcgshifting.h"
#include "gcg.h"
#include "relax_gcg.h"
#include "scip/misc.h"
Go to the source code of this file.
Data Structures | |
struct | SCIP_HeurData |
Macros | |
#define | HEUR_NAME "gcgshifting" |
#define | HEUR_DESC "LP rounding heuristic on original variables with infeasibility recovering also using continuous variables" |
#define | HEUR_DISPCHAR 's' |
#define | HEUR_PRIORITY -5000 |
#define | HEUR_FREQ 10 |
#define | HEUR_FREQOFS 0 |
#define | HEUR_MAXDEPTH -1 |
#define | HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
#define | HEUR_USESSUBSCIP FALSE |
#define | MAXSHIFTINGS 50 |
#define | WEIGHTFACTOR 1.1 |
#define | DEFAULT_RANDSEED 31 |
#define | heurCopyGcgshifting NULL |
#define | heurFreeGcgshifting NULL |
#define | heurExitsolGcgshifting NULL |
Functions | |
static void | updateViolations (SCIP *scip, SCIP_ROW *row, SCIP_ROW **violrows, int *violrowpos, int *nviolrows, SCIP_Real oldactivity, SCIP_Real newactivity) |
static SCIP_RETCODE | updateActivities (SCIP *scip, SCIP_Real *activities, SCIP_ROW **violrows, int *violrowpos, int *nviolrows, int nlprows, SCIP_VAR *var, SCIP_Real oldsolval, SCIP_Real newsolval) |
static SCIP_RETCODE | selectShifting (SCIP *scip, SCIP_SOL *sol, SCIP_ROW *row, SCIP_Real rowactivity, int direction, SCIP_Real *nincreases, SCIP_Real *ndecreases, SCIP_Real increaseweight, SCIP_VAR **shiftvar, SCIP_Real *oldsolval, SCIP_Real *newsolval) |
static SCIP_RETCODE | selectEssentialRounding (SCIP *scip, SCIP_SOL *sol, SCIP_Real minobj, SCIP_VAR **lpcands, int nlpcands, SCIP_VAR **shiftvar, SCIP_Real *oldsolval, SCIP_Real *newsolval) |
static void | addFracCounter (int *nfracsinrow, int nlprows, SCIP_VAR *var, int incval) |
static | SCIP_DECL_HEURINIT (heurInitGcgshifting) |
static | SCIP_DECL_HEUREXIT (heurExitGcgshifting) |
static | SCIP_DECL_HEURINITSOL (heurInitsolGcgshifting) |
static | SCIP_DECL_HEUREXEC (heurExecGcgshifting) |
SCIP_RETCODE | SCIPincludeHeurGcgshifting (SCIP *scip) |
Macro Definition Documentation
◆ HEUR_NAME
#define HEUR_NAME "gcgshifting" |
Definition at line 45 of file heur_gcgshifting.c.
◆ HEUR_DESC
#define HEUR_DESC "LP rounding heuristic on original variables with infeasibility recovering also using continuous variables" |
Definition at line 46 of file heur_gcgshifting.c.
◆ HEUR_DISPCHAR
#define HEUR_DISPCHAR 's' |
Definition at line 47 of file heur_gcgshifting.c.
◆ HEUR_PRIORITY
#define HEUR_PRIORITY -5000 |
Definition at line 48 of file heur_gcgshifting.c.
◆ HEUR_FREQ
#define HEUR_FREQ 10 |
Definition at line 49 of file heur_gcgshifting.c.
◆ HEUR_FREQOFS
#define HEUR_FREQOFS 0 |
Definition at line 50 of file heur_gcgshifting.c.
◆ HEUR_MAXDEPTH
#define HEUR_MAXDEPTH -1 |
Definition at line 51 of file heur_gcgshifting.c.
◆ HEUR_TIMING
#define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
Definition at line 52 of file heur_gcgshifting.c.
◆ HEUR_USESSUBSCIP
#define HEUR_USESSUBSCIP FALSE |
Definition at line 53 of file heur_gcgshifting.c.
◆ MAXSHIFTINGS
#define MAXSHIFTINGS 50 |
maximal number of non improving shiftings
Definition at line 55 of file heur_gcgshifting.c.
◆ WEIGHTFACTOR
#define WEIGHTFACTOR 1.1 |
Definition at line 56 of file heur_gcgshifting.c.
◆ DEFAULT_RANDSEED
#define DEFAULT_RANDSEED 31 |
initial random seed
Definition at line 57 of file heur_gcgshifting.c.
◆ heurCopyGcgshifting
#define heurCopyGcgshifting NULL |
copy method for primal heuristic plugins (called when SCIP copies plugins)
Definition at line 474 of file heur_gcgshifting.c.
◆ heurFreeGcgshifting
#define heurFreeGcgshifting NULL |
destructor of primal heuristic to free user data (called when SCIP is exiting)
Definition at line 477 of file heur_gcgshifting.c.
◆ heurExitsolGcgshifting
#define heurExitsolGcgshifting NULL |
solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)
Definition at line 542 of file heur_gcgshifting.c.
Function Documentation
◆ updateViolations()
|
static |
update row violation arrays after a row's activity value changed
- Parameters
-
scip SCIP data structure row LP row violrows array with currently violated rows violrowpos position of LP rows in violrows array nviolrows pointer to the number of currently violated rows oldactivity old activity value of LP row newactivity new activity value of LP row
Definition at line 77 of file heur_gcgshifting.c.
Referenced by updateActivities().
◆ updateActivities()
|
static |
update row activities after a variable's solution value changed
- Parameters
-
scip SCIP data structure activities LP row activities violrows array with currently violated rows violrowpos position of LP rows in violrows array nviolrows pointer to the number of currently violated rows nlprows number of rows in current LP var variable that has been changed oldsolval old solution value of variable newsolval new solution value of variable
Definition at line 136 of file heur_gcgshifting.c.
References updateViolations().
Referenced by SCIP_DECL_HEUREXEC().
◆ selectShifting()
|
static |
returns a variable, that pushes activity of the row in the given direction with minimal negative impact on other rows; if variables have equal impact, chooses the one with best objective value improvement in corresponding direction; prefer fractional integers over other variables in order to become integral during the process; shifting in a direction is forbidden, if this forces the objective value over the upper bound, or if the variable was already shifted in the opposite direction
- Parameters
-
scip SCIP data structure sol primal solution row LP row rowactivity activity of LP row direction should the activity be increased (+1) or decreased (-1)? nincreases array with weighted number of increasings per variables ndecreases array with weighted number of decreasings per variables increaseweight current weight of increase/decrease updates shiftvar pointer to store the shifting variable, returns NULL if impossible oldsolval pointer to store old solution value of shifting variable newsolval pointer to store new (shifted) solution value of shifting variable
Definition at line 210 of file heur_gcgshifting.c.
Referenced by SCIP_DECL_HEUREXEC().
◆ selectEssentialRounding()
|
static |
returns a fractional variable, that has most impact on rows in opposite direction, i.e. that is most crucial to fix in the other direction; if variables have equal impact, chooses the one with best objective value improvement in corresponding direction; shifting in a direction is forbidden, if this forces the objective value over the upper bound
- Parameters
-
scip SCIP data structure sol primal solution minobj minimal objective value possible after shifting remaining fractional vars lpcands fractional variables in LP nlpcands number of fractional variables in LP shiftvar pointer to store the shifting variable, returns NULL if impossible oldsolval old (fractional) solution value of shifting variable newsolval new (shifted) solution value of shifting variable
Definition at line 361 of file heur_gcgshifting.c.
Referenced by SCIP_DECL_HEUREXEC().
◆ addFracCounter()
|
static |
adds a given value to the fractionality counters of the rows in which the given variable appears
- Parameters
-
nfracsinrow array to store number of fractional variables per row nlprows number of rows in LP var variable for which the counting should be updated incval value that should be added to the corresponding array entries
Definition at line 441 of file heur_gcgshifting.c.
Referenced by SCIP_DECL_HEUREXEC().
◆ SCIP_DECL_HEURINIT()
|
static |
initialization method of primal heuristic (called after problem was transformed)
Definition at line 482 of file heur_gcgshifting.c.
References DEFAULT_RANDSEED, and HEUR_NAME.
◆ SCIP_DECL_HEUREXIT()
|
static |
deinitialization method of primal heuristic (called before transformed problem is freed)
Definition at line 505 of file heur_gcgshifting.c.
References HEUR_NAME.
◆ SCIP_DECL_HEURINITSOL()
|
static |
solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
Definition at line 527 of file heur_gcgshifting.c.
References HEUR_NAME.
◆ SCIP_DECL_HEUREXEC()
|
static |
execution method of primal heuristic
Definition at line 547 of file heur_gcgshifting.c.
References addFracCounter(), GCGgetMasterprob(), GCGrelaxGetCurrentOrigSol(), HEUR_NAME, MAXSHIFTINGS, selectEssentialRounding(), selectShifting(), updateActivities(), and WEIGHTFACTOR.
◆ SCIPincludeHeurGcgshifting()
SCIP_RETCODE SCIPincludeHeurGcgshifting | ( | SCIP * | scip | ) |
creates the GCG shifting heuristic with infeasibility recovering and includes it in SCIP
- Parameters
-
scip SCIP data structure
Definition at line 902 of file heur_gcgshifting.c.
References HEUR_DESC, HEUR_DISPCHAR, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_NAME, HEUR_PRIORITY, HEUR_TIMING, HEUR_USESSUBSCIP, heurCopyGcgshifting, heurExitsolGcgshifting, and heurFreeGcgshifting.
Referenced by SCIPincludeGcgPlugins().