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 "gcg/heur_gcgshifting.h"#include "gcg/gcg.h"#include "gcg/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 | heurExitsolGcgshifting NULL |
Variables | |
| heurdata = SCIPheurGetData(heur) | |
| return | SCIP_OKAY |
| heurdata | lastlp = -1 |
| SCIP_SOL * | sol = heurdata->sol |
| SCIP_VAR ** | lpcands |
| SCIP_Real * | lpcandssol |
| SCIP_ROW ** | lprows |
| SCIP_Real * | activities |
| SCIP_ROW ** | violrows |
| SCIP_Real * | nincreases |
| SCIP_Real * | ndecreases |
| int * | violrowpos |
| int * | nfracsinrow |
| SCIP_Real | increaseweight = 1.0 |
| SCIP_Real | obj |
| SCIP_Real | minobj = SCIPgetSolTransObj(scip, sol) |
| int | nlpcands |
| int | nlprows |
| int | nvars |
| int | nfrac |
| int | nviolrows |
| int | minnviolrows = INT_MAX |
| int | nnonimprovingshifts = 0 |
| int | c |
| int | r |
| SCIP_Longint | nlps |
| SCIP_Longint | ncalls |
| SCIP_Longint | nsolsfound |
| SCIP_Longint | nnodes |
| masterprob = GCGgetMasterprob(heurdata->gcg) | |
| * | result = SCIP_DIDNOTRUN |
Macro Definition Documentation
◆ HEUR_NAME
| #define HEUR_NAME "gcgshifting" |
Definition at line 46 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 47 of file heur_gcgshifting.c.
◆ HEUR_DISPCHAR
| #define HEUR_DISPCHAR 's' |
Definition at line 48 of file heur_gcgshifting.c.
◆ HEUR_PRIORITY
| #define HEUR_PRIORITY -5000 |
Definition at line 49 of file heur_gcgshifting.c.
◆ HEUR_FREQ
| #define HEUR_FREQ 10 |
Definition at line 50 of file heur_gcgshifting.c.
◆ HEUR_FREQOFS
| #define HEUR_FREQOFS 0 |
Definition at line 51 of file heur_gcgshifting.c.
◆ HEUR_MAXDEPTH
| #define HEUR_MAXDEPTH -1 |
Definition at line 52 of file heur_gcgshifting.c.
◆ HEUR_TIMING
| #define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
Definition at line 53 of file heur_gcgshifting.c.
◆ HEUR_USESSUBSCIP
| #define HEUR_USESSUBSCIP FALSE |
Definition at line 54 of file heur_gcgshifting.c.
◆ MAXSHIFTINGS
| #define MAXSHIFTINGS 50 |
maximal number of non improving shiftings
Definition at line 56 of file heur_gcgshifting.c.
Referenced by while().
◆ WEIGHTFACTOR
| #define WEIGHTFACTOR 1.1 |
Definition at line 57 of file heur_gcgshifting.c.
Referenced by while().
◆ DEFAULT_RANDSEED
| #define DEFAULT_RANDSEED 31 |
initial random seed
Definition at line 58 of file heur_gcgshifting.c.
◆ heurCopyGcgshifting
| #define heurCopyGcgshifting NULL |
copy method for primal heuristic plugins (called when SCIP copies plugins)
Definition at line 476 of file heur_gcgshifting.c.
Referenced by GCGincludeHeurGcgshifting().
◆ heurExitsolGcgshifting
| #define heurExitsolGcgshifting NULL |
solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)
Definition at line 554 of file heur_gcgshifting.c.
Referenced by GCGincludeHeurGcgshifting().
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 79 of file heur_gcgshifting.c.
References assert(), nviolrows, updateViolations(), violrowpos, and violrows.
◆ 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 138 of file heur_gcgshifting.c.
References activities, assert(), nlprows, nviolrows, oldsolval, updateActivities(), updateViolations(), var, violrowpos, and violrows.
◆ 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 212 of file heur_gcgshifting.c.
References assert(), c, increaseweight, ndecreases, nincreases, oldsolval, selectShifting(), sol, solval, and var.
Referenced by selectShifting(), and while().
◆ 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 363 of file heur_gcgshifting.c.
References assert(), lpcands, minobj, nlpcands, obj, oldsolval, selectEssentialRounding(), sol, solval, and var.
◆ 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 443 of file heur_gcgshifting.c.
References addFracCounter(), assert(), nfracsinrow, nlprows, and var.
Referenced by addFracCounter(), and while().
◆ assert() [1/6]
| assert | ( | strcmp(SCIPheurGetName(heur), HEUR_NAME) | = =0 | ) |
◆ assert() [2/6]
◆ SCIPfreeMemory()
| SCIPfreeMemory | ( | scip | , |
| & | heurdata ) |
References heurdata, and SCIPfreeMemory().
◆ SCIP_CALL() [1/4]
| SCIP_CALL | ( | SCIPcreateSol(scip, &heurdata->sol, heur) | ) |
References heurdata, and SCIP_CALL().
◆ SCIP_CALL() [2/4]
| SCIP_CALL | ( | SCIPcreateRandom(scip, &heurdata->randnumgen, SCIPinitializeRandomSeed(scip, DEFAULT_RANDSEED), TRUE) | ) |
References DEFAULT_RANDSEED, heurdata, and SCIP_CALL().
◆ SCIPheurSetData()
◆ SCIP_CALL() [3/4]
| SCIP_CALL | ( | SCIPfreeSol(scip, &heurdata->sol) | ) |
References heurdata, and SCIP_CALL().
◆ SCIPfreeRandom()
◆ SCIP_DECL_HEURINITSOL()
|
static |
solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
Definition at line 539 of file heur_gcgshifting.c.
References assert(), HEUR_NAME, heurdata, and SCIP_HeurData::lastlp.
◆ assert() [3/6]
◆ assert() [4/6]
◆ assert() [5/6]
| assert | ( | masterprob ! | = NULL | ) |
References assert(), and masterprob.
◆ if() [1/4]
| if | ( | ! | SCIPisRelaxSolValidscip | ) |
Definition at line 607 of file heur_gcgshifting.c.
References SCIPdebugMessage().
◆ if() [2/4]
| if | ( | SCIPgetStage(masterprob) | , |
| SCIP_STAGE_SOLVING||SCIPgetLPSolstat(masterprob) ! | = SCIP_LPSOLSTAT_OPTIMAL ) |
Definition at line 614 of file heur_gcgshifting.c.
References activities, assert(), GCGrelaxGetCurrentOrigSol(), heurdata, lpcands, lpcandssol, lprows, masterprob, ncalls, ndecreases, nfrac, nfracsinrow, nincreases, nlpcands, nlprows, nlps, nnodes, nsolsfound, nvars, nviolrows, result, SCIP_CALL(), SCIPdebugMessage(), violrowpos, and violrows.
◆ for()
| for | ( | ) |
Definition at line 710 of file heur_gcgshifting.c.
References c, lpcands, lpcandssol, minobj, nlpcands, and obj.
◆ assert() [6/6]
◆ SCIP_CALL() [4/4]
| SCIP_CALL | ( | SCIPlinkRelaxSol(scip, sol) | ) |
References minobj, SCIP_CALL(), and sol.
◆ if() [3/4]
| if | ( | minobj >= | SCIPgetCutoffboundscip | ) |
Definition at line 699 of file heur_gcgshifting.c.
References activities, minobj, ndecreases, nfracsinrow, nincreases, result, SCIPfreeBufferArray(), violrowpos, and violrows.
◆ while()
| while | ( | ) |
Definition at line 723 of file heur_gcgshifting.c.
References activities, addFracCounter(), assert(), heurdata, i, increaseweight, lpcands, MAXSHIFTINGS, minnviolrows, minobj, ndecreases, nfrac, nfracsinrow, nincreases, nlpcands, nlprows, nnonimprovingshifts, nvars, nviolrows, obj, oldsolval, SCIP_HeurData::randnumgen, SCIP_CALL(), SCIPdebugMessage(), selectEssentialRounding(), selectShifting(), sol, updateActivities(), violrowpos, violrows, and WEIGHTFACTOR.
◆ if() [4/4]
Definition at line 876 of file heur_gcgshifting.c.
References nfrac, nviolrows, result, SCIP_CALL(), SCIPdebugMessage(), and sol.
◆ SCIPfreeBufferArray()
| SCIPfreeBufferArray | ( | scip | , |
| & | ndecreases ) |
References activities, ndecreases, nfracsinrow, nincreases, SCIPfreeBufferArray(), violrowpos, and violrows.
◆ GCGincludeHeurGcgshifting()
| SCIP_RETCODE GCGincludeHeurGcgshifting | ( | GCG * | gcg | ) |
creates the GCG shifting heuristic with infeasibility recovering and includes it in SCIP
- Parameters
-
gcg GCG data structure
Definition at line 914 of file heur_gcgshifting.c.
References SCIP_HeurData::gcg, GCGgetOrigprob(), GCGincludeHeurGcgshifting(), HEUR_DESC, HEUR_DISPCHAR, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_NAME, HEUR_PRIORITY, HEUR_TIMING, HEUR_USESSUBSCIP, heurCopyGcgshifting, heurdata, heurExitsolGcgshifting, origprob, and SCIP_CALL().
Referenced by GCGincludeGcgPlugins(), and GCGincludeHeurGcgshifting().
Variable Documentation
◆ heurdata
| heurdata = SCIPheurGetData(heur) |
execution method of primal heuristic
Definition at line 487 of file heur_gcgshifting.c.
◆ SCIP_OKAY
| return SCIP_OKAY |
Definition at line 491 of file heur_gcgshifting.c.
◆ lastlp
| heurdata lastlp = -1 |
Definition at line 507 of file heur_gcgshifting.c.
◆ sol
| sol = heurdata->sol |
Definition at line 563 of file heur_gcgshifting.c.
◆ lpcands
| lpcands[c] |
Definition at line 564 of file heur_gcgshifting.c.
◆ lpcandssol
| SCIP_Real* lpcandssol |
Definition at line 565 of file heur_gcgshifting.c.
◆ lprows
| SCIP_ROW** lprows |
Definition at line 566 of file heur_gcgshifting.c.
◆ activities
| SCIP_Real* activities |
Definition at line 567 of file heur_gcgshifting.c.
◆ violrows
| SCIP_ROW** violrows |
Definition at line 568 of file heur_gcgshifting.c.
◆ nincreases
| SCIP_Real* nincreases |
Definition at line 569 of file heur_gcgshifting.c.
Referenced by if(), if(), SCIPfreeBufferArray(), selectShifting(), and while().
◆ ndecreases
| SCIP_Real* ndecreases |
Definition at line 570 of file heur_gcgshifting.c.
Referenced by if(), if(), SCIPfreeBufferArray(), selectShifting(), and while().
◆ violrowpos
| int* violrowpos |
Definition at line 571 of file heur_gcgshifting.c.
◆ nfracsinrow
| int* nfracsinrow |
Definition at line 572 of file heur_gcgshifting.c.
Referenced by addFracCounter(), if(), if(), SCIPfreeBufferArray(), and while().
◆ increaseweight
| increaseweight = 1.0 |
Definition at line 573 of file heur_gcgshifting.c.
Referenced by selectShifting(), and while().
◆ obj
| SCIP_Real obj |
Definition at line 574 of file heur_gcgshifting.c.
◆ minobj
| minobj = SCIPgetSolTransObj(scip, sol) |
Definition at line 575 of file heur_gcgshifting.c.
◆ nlpcands
| int nlpcands |
Definition at line 576 of file heur_gcgshifting.c.
◆ nlprows
| nlprows |
Definition at line 577 of file heur_gcgshifting.c.
◆ nvars
| int nvars |
Definition at line 578 of file heur_gcgshifting.c.
◆ nfrac
| int nfrac |
Definition at line 579 of file heur_gcgshifting.c.
◆ nviolrows
| int nviolrows |
Definition at line 580 of file heur_gcgshifting.c.
◆ minnviolrows
| minnviolrows = INT_MAX |
Definition at line 581 of file heur_gcgshifting.c.
Referenced by while().
◆ nnonimprovingshifts
| nnonimprovingshifts = 0 |
Definition at line 582 of file heur_gcgshifting.c.
Referenced by while().
◆ c
| int c |
Definition at line 583 of file heur_gcgshifting.c.
◆ r
| int r |
Definition at line 584 of file heur_gcgshifting.c.
◆ nlps
| SCIP_Longint nlps |
Definition at line 585 of file heur_gcgshifting.c.
◆ ncalls
| SCIP_Longint ncalls |
Definition at line 586 of file heur_gcgshifting.c.
◆ nsolsfound
| SCIP_Longint nsolsfound |
Definition at line 587 of file heur_gcgshifting.c.
◆ nnodes
| SCIP_Longint nnodes |
Definition at line 588 of file heur_gcgshifting.c.
◆ masterprob
| masterprob = GCGgetMasterprob(heurdata->gcg) |
Definition at line 599 of file heur_gcgshifting.c.
◆ result
| * result = SCIP_DIDNOTRUN |
Definition at line 602 of file heur_gcgshifting.c.