GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
heur_gcgrounding.c File Reference

Detailed Description

LP gcgrounding heuristic that tries to recover from intermediate infeasibilities.

Author
Tobias Achterberg
Christian Puchert

Definition in file heur_gcgrounding.c.

#include <assert.h>
#include <string.h>
#include "gcg/heur_gcgrounding.h"
#include "gcg/relax_gcg.h"
#include "gcg/gcg.h"

Go to the source code of this file.

Data Structures

struct  SCIP_HeurData

Macros

#define HEUR_NAME   "gcgrounding"
#define HEUR_DESC   "LP rounding heuristic on original variables with infeasibility recovering"
#define HEUR_DISPCHAR   'R'
#define HEUR_PRIORITY   -1000
#define HEUR_FREQ   1
#define HEUR_FREQOFS   0
#define HEUR_MAXDEPTH   -1
#define HEUR_TIMING   SCIP_HEURTIMING_AFTERNODE
#define HEUR_USESSUBSCIP   FALSE
#define DEFAULT_SUCCESSFACTOR   100
#define heurCopyGcgrounding   NULL
#define heurExitsolGcgrounding   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 selectRounding (SCIP *scip, SCIP_SOL *sol, SCIP_Real minobj, SCIP_ROW *row, int direction, SCIP_VAR **roundvar, SCIP_Real *oldsolval, SCIP_Real *newsolval)
static SCIP_RETCODE selectIncreaseRounding (SCIP *scip, SCIP_SOL *sol, SCIP_Real minobj, SCIP_ROW *row, SCIP_VAR **roundvar, SCIP_Real *oldsolval, SCIP_Real *newsolval)
static SCIP_RETCODE selectDecreaseRounding (SCIP *scip, SCIP_SOL *sol, SCIP_Real minobj, SCIP_ROW *row, SCIP_VAR **roundvar, 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 **roundvar, SCIP_Real *oldsolval, SCIP_Real *newsolval)
static assert (heur !=NULL)
 assert (strcmp(SCIPheurGetName(heur), HEUR_NAME)==0)
 assert (scip !=NULL)
 assert (heurdata !=NULL)
 SCIPfreeMemory (scip, &heurdata)
 SCIPheurSetData (heur, NULL)
 SCIP_CALL (SCIPcreateSol(scip, &heurdata->sol, heur))
 SCIP_CALL (SCIPfreeSol(scip, &heurdata->sol))
static SCIP_DECL_HEURINITSOL (heurInitsolGcgrounding)
 assert (result !=NULL)
 assert (masterprob !=NULL)
 if (!SCIPisRelaxSolValid(scip))
 if (SCIPgetStage(masterprob), SCIP_STAGE_SOLVING||SCIPgetLPSolstat(masterprob) !=SCIP_LPSOLSTAT_OPTIMAL)
 assert (sol !=NULL)
 SCIP_CALL (SCIPlinkRelaxSol(scip, sol))
 if (minobj >=SCIPgetCutoffbound(scip))
 for (c=0;c< nlpcands;++c)
 while (nfrac > 0)
 if (nfrac==0 &&nviolrows==0)
 SCIPfreeBufferArray (scip, &violrowpos)
SCIP_RETCODE GCGincludeHeurGcgrounding (GCG *gcg)

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
int * violrowpos
SCIP_Real obj
SCIP_Real minobj = SCIPgetSolTransObj(scip, sol)
int nlpcands
int nlprows
int nfrac
int nviolrows
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   "gcgrounding"

Definition at line 45 of file heur_gcgrounding.c.

◆ HEUR_DESC

#define HEUR_DESC   "LP rounding heuristic on original variables with infeasibility recovering"

Definition at line 46 of file heur_gcgrounding.c.

◆ HEUR_DISPCHAR

#define HEUR_DISPCHAR   'R'

Definition at line 47 of file heur_gcgrounding.c.

◆ HEUR_PRIORITY

#define HEUR_PRIORITY   -1000

Definition at line 48 of file heur_gcgrounding.c.

◆ HEUR_FREQ

#define HEUR_FREQ   1

Definition at line 49 of file heur_gcgrounding.c.

◆ HEUR_FREQOFS

#define HEUR_FREQOFS   0

Definition at line 50 of file heur_gcgrounding.c.

◆ HEUR_MAXDEPTH

#define HEUR_MAXDEPTH   -1

Definition at line 51 of file heur_gcgrounding.c.

◆ HEUR_TIMING

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERNODE

Definition at line 52 of file heur_gcgrounding.c.

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   FALSE

Definition at line 53 of file heur_gcgrounding.c.

◆ DEFAULT_SUCCESSFACTOR

#define DEFAULT_SUCCESSFACTOR   100

number of calls per found solution that are considered as standard success, a higher factor causes the heuristic to be called more often

Definition at line 55 of file heur_gcgrounding.c.

Referenced by GCGincludeHeurGcgrounding().

◆ heurCopyGcgrounding

#define heurCopyGcgrounding   NULL

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

Definition at line 436 of file heur_gcgrounding.c.

Referenced by GCGincludeHeurGcgrounding().

◆ heurExitsolGcgrounding

#define heurExitsolGcgrounding   NULL

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

Definition at line 510 of file heur_gcgrounding.c.

Referenced by GCGincludeHeurGcgrounding().

Function Documentation

◆ updateViolations()

void updateViolations ( SCIP * scip,
SCIP_ROW * row,
SCIP_ROW ** violrows,
int * violrowpos,
int * nviolrows,
SCIP_Real oldactivity,
SCIP_Real newactivity )
static

update row violation arrays after a row's activity value changed

Parameters
scipSCIP data structure
rowLP row
violrowsarray with currently violated rows
violrowposposition of LP rows in violrows array
nviolrowspointer to the number of currently violated rows
oldactivityold activity value of LP row
newactivitynew activity value of LP row

Definition at line 80 of file heur_gcgrounding.c.

References assert(), nviolrows, updateViolations(), violrowpos, and violrows.

Referenced by updateActivities(), updateActivities(), updateViolations(), and updateViolations().

◆ updateActivities()

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

update row activities after a variable's solution value changed

Parameters
scipSCIP data structure
activitiesLP row activities
violrowsarray with currently violated rows
violrowposposition of LP rows in violrows array
nviolrowspointer to the number of currently violated rows
nlprowsnumber of rows in current LP
varvariable that has been changed
oldsolvalold solution value of variable
newsolvalnew solution value of variable

Definition at line 139 of file heur_gcgrounding.c.

References activities, assert(), nlprows, nviolrows, oldsolval, updateActivities(), updateViolations(), var, violrowpos, and violrows.

Referenced by SCIP_DECL_HEUREXEC(), updateActivities(), updateActivities(), updateActivities(), while(), and while().

◆ selectRounding()

SCIP_RETCODE selectRounding ( SCIP * scip,
SCIP_SOL * sol,
SCIP_Real minobj,
SCIP_ROW * row,
int direction,
SCIP_VAR ** roundvar,
SCIP_Real * oldsolval,
SCIP_Real * newsolval )
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; rounding in a direction is forbidden, if this forces the objective value over the upper bound

Parameters
scipSCIP data structure
solprimal solution
minobjminimal objective value possible after rounding remaining fractional vars
rowLP row
directionshould the activity be increased (+1) or decreased (-1)?
roundvarpointer to store the rounding variable, returns NULL if impossible
oldsolvalpointer to store old (fractional) solution value of rounding variable
newsolvalpointer to store new (rounded) solution value of rounding variable

Definition at line 211 of file heur_gcgrounding.c.

References assert(), c, minobj, obj, oldsolval, selectRounding(), sol, solval, and var.

Referenced by selectDecreaseRounding(), selectIncreaseRounding(), and selectRounding().

◆ selectIncreaseRounding()

SCIP_RETCODE selectIncreaseRounding ( SCIP * scip,
SCIP_SOL * sol,
SCIP_Real minobj,
SCIP_ROW * row,
SCIP_VAR ** roundvar,
SCIP_Real * oldsolval,
SCIP_Real * newsolval )
static

returns a variable, that increases the activity of the row

Parameters
scipSCIP data structure
solprimal solution
minobjminimal objective value possible after rounding remaining fractional vars
rowLP row
roundvarpointer to store the rounding variable, returns NULL if impossible
oldsolvalold (fractional) solution value of rounding variable
newsolvalnew (rounded) solution value of rounding variable

Definition at line 316 of file heur_gcgrounding.c.

References minobj, oldsolval, selectIncreaseRounding(), selectRounding(), and sol.

Referenced by selectIncreaseRounding(), and while().

◆ selectDecreaseRounding()

SCIP_RETCODE selectDecreaseRounding ( SCIP * scip,
SCIP_SOL * sol,
SCIP_Real minobj,
SCIP_ROW * row,
SCIP_VAR ** roundvar,
SCIP_Real * oldsolval,
SCIP_Real * newsolval )
static

returns a variable, that decreases the activity of the row

Parameters
scipSCIP data structure
solprimal solution
minobjminimal objective value possible after rounding remaining fractional vars
rowLP row
roundvarpointer to store the rounding variable, returns NULL if impossible
oldsolvalold (fractional) solution value of rounding variable
newsolvalnew (rounded) solution value of rounding variable

Definition at line 331 of file heur_gcgrounding.c.

References minobj, oldsolval, selectDecreaseRounding(), selectRounding(), and sol.

Referenced by selectDecreaseRounding(), and while().

◆ selectEssentialRounding()

SCIP_RETCODE selectEssentialRounding ( SCIP * scip,
SCIP_SOL * sol,
SCIP_Real minobj,
SCIP_VAR ** lpcands,
int nlpcands,
SCIP_VAR ** roundvar,
SCIP_Real * oldsolval,
SCIP_Real * newsolval )
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; rounding in a direction is forbidden, if this forces the objective value over the upper bound

Parameters
scipSCIP data structure
solprimal solution
minobjminimal objective value possible after rounding remaining fractional vars
lpcandsfractional variables in LP
nlpcandsnumber of fractional variables in LP
roundvarpointer to store the rounding variable, returns NULL if impossible
oldsolvalold (fractional) solution value of rounding variable
newsolvalnew (rounded) solution value of rounding variable

Definition at line 350 of file heur_gcgrounding.c.

References assert(), lpcands, minobj, nlpcands, obj, oldsolval, selectEssentialRounding(), sol, solval, and var.

Referenced by selectEssentialRounding(), selectEssentialRounding(), while(), and while().

◆ assert() [1/7]

assert ( heur ! = NULL)

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

References assert().

◆ assert() [2/7]

assert ( strcmp(SCIPheurGetName(heur), HEUR_NAME) = =0)

initialization method of primal heuristic (called after problem was transformed)

deinitialization method of primal heuristic (called before transformed problem is freed)

References assert(), and HEUR_NAME.

◆ assert() [3/7]

assert ( scip ! = NULL)

References assert().

◆ assert() [4/7]

assert ( heurdata ! = NULL)

References assert(), and heurdata.

◆ SCIPfreeMemory()

SCIPfreeMemory ( scip ,
& heurdata )

References heurdata, and SCIPfreeMemory().

◆ SCIPheurSetData()

SCIPheurSetData ( heur ,
NULL  )

◆ SCIP_CALL() [1/3]

SCIP_CALL ( SCIPcreateSol(scip, &heurdata->sol, heur) )

References heurdata, and SCIP_CALL().

◆ SCIP_CALL() [2/3]

SCIP_CALL ( SCIPfreeSol(scip, &heurdata->sol) )

References heurdata, and SCIP_CALL().

◆ SCIP_DECL_HEURINITSOL()

SCIP_DECL_HEURINITSOL ( heurInitsolGcgrounding )
static

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

Definition at line 495 of file heur_gcgrounding.c.

References assert(), HEUR_NAME, heurdata, and SCIP_HeurData::lastlp.

◆ assert() [5/7]

assert ( result ! = NULL)

References assert(), heurdata, and result.

◆ assert() [6/7]

assert ( masterprob ! = NULL)

References assert(), and masterprob.

◆ if() [1/4]

if ( ! SCIPisRelaxSolValidscip)

Definition at line 556 of file heur_gcgrounding.c.

◆ if() [2/4]

◆ assert() [7/7]

assert ( sol ! = NULL)

References assert(), and sol.

◆ SCIP_CALL() [3/3]

SCIP_CALL ( SCIPlinkRelaxSol(scip, sol) )

References minobj, SCIP_CALL(), and sol.

◆ if() [3/4]

if ( minobj >= SCIPgetCutoffboundscip)

Definition at line 637 of file heur_gcgrounding.c.

References activities, minobj, result, SCIPfreeBufferArray(), violrowpos, and violrows.

◆ for()

for ( )

Definition at line 645 of file heur_gcgrounding.c.

References c, lpcands, lpcandssol, minobj, nlpcands, and obj.

◆ while()

◆ if() [4/4]

if ( nfrac = = 0 && nviolrows == 0)

Definition at line 732 of file heur_gcgrounding.c.

References nfrac, nviolrows, result, SCIP_CALL(), SCIPdebugMessage(), and sol.

◆ SCIPfreeBufferArray()

SCIPfreeBufferArray ( scip ,
& violrowpos )

◆ GCGincludeHeurGcgrounding()

SCIP_RETCODE GCGincludeHeurGcgrounding ( GCG * gcg)

Variable Documentation

◆ heurdata

heurdata = SCIPheurGetData(heur)

execution method of primal heuristic

Definition at line 449 of file heur_gcgrounding.c.

◆ SCIP_OKAY

return SCIP_OKAY

Definition at line 454 of file heur_gcgrounding.c.

◆ lastlp

heurdata lastlp = -1

Definition at line 472 of file heur_gcgrounding.c.

◆ sol

◆ lpcands

SCIP_VAR** lpcands

Definition at line 520 of file heur_gcgrounding.c.

◆ lpcandssol

SCIP_Real* lpcandssol

Definition at line 521 of file heur_gcgrounding.c.

◆ lprows

SCIP_ROW** lprows

Definition at line 522 of file heur_gcgrounding.c.

Referenced by if(), SCIP_DECL_HEUREXEC(), and SCIP_DECL_SEPAEXECLP().

◆ activities

◆ violrows

◆ violrowpos

◆ obj

◆ minobj

◆ nlpcands

int nlpcands

Definition at line 528 of file heur_gcgrounding.c.

◆ nlprows

◆ nfrac

int nfrac

Definition at line 530 of file heur_gcgrounding.c.

Referenced by if(), if(), while(), and while().

◆ nviolrows

◆ c

int c

Definition at line 532 of file heur_gcgrounding.c.

◆ r

int r

Definition at line 533 of file heur_gcgrounding.c.

◆ nlps

Definition at line 534 of file heur_gcgrounding.c.

Referenced by if(), if(), SCIP_DECL_HEUREXEC(), and selectCandidate().

◆ ncalls

SCIP_Longint ncalls

Definition at line 535 of file heur_gcgrounding.c.

◆ nsolsfound

SCIP_Longint nsolsfound

Definition at line 536 of file heur_gcgrounding.c.

◆ nnodes

◆ masterprob

masterprob = GCGgetMasterprob(heurdata->gcg)

Definition at line 548 of file heur_gcgrounding.c.

◆ result

* result = SCIP_DIDNOTRUN

Definition at line 551 of file heur_gcgrounding.c.