GCG 4.1.1 (dev)

Generic Column Generation

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

Detailed Description

primal heuristic interface for LP diving heuristics on the master variables

Author
Tobias Achterberg
Christian Puchert

Definition in file heur_masterdiving.c.

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

Go to the source code of this file.

Data Structures

struct  SCIP_HeurData

Macros

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPPLUNGE
#define HEUR_USESSUBSCIP   FALSE
#define DEFAULT_MINRELDEPTH   0.0
#define DEFAULT_MAXRELDEPTH   1.0
#define DEFAULT_MAXLPITERQUOT   0.05
#define DEFAULT_MAXLPITEROFS   1000
#define DEFAULT_MAXPRICEROUNDS   0
#define DEFAULT_USEFARKASONLY   FALSE
#define DEFAULT_MAXDIVEUBQUOT   0.8
#define DEFAULT_MAXDIVEAVGQUOT   0.0
#define DEFAULT_MAXDIVEUBQUOTNOSOL   0.1
#define DEFAULT_MAXDIVEAVGQUOTNOSOL   0.0
#define DEFAULT_BACKTRACK   FALSE
#define DEFAULT_MAXDISCREPANCY   2
#define DEFAULT_MAXDISCDEPTH   0
#define MINLPITER   10000

Functions

static assert (heur !=NULL)
 assert (scip !=NULL)
 assert (heurdata !=NULL)
 if (heurdata->divingfree !=NULL)
 SCIPfreeMemory (scip, &heurdata)
 SCIPheurSetData (heur, NULL)
 SCIP_CALL (SCIPcreateSol(scip, &heurdata->sol, heur))
 if (heurdata->divinginit !=NULL)
 if (heurdata->divingexit !=NULL)
 SCIP_CALL (SCIPfreeSol(scip, &heurdata->sol))
static SCIP_DECL_HEURINITSOL (heurInitsolMasterdiving)
static SCIP_DECL_HEUREXITSOL (heurExitsolMasterdiving)
 assert (result !=NULL)
 if (!SCIPhasCurrentNodeLP(scip)||SCIPgetLPSolstat(scip) !=SCIP_LPSOLSTAT_OPTIMAL)
 if (heurdata->maxdiveavgquot > 0.0) searchavgbound
 if (SCIPisObjIntegral(scip))
 for (i=0;i< heurdata->maxdiscrepancy;++i)
 SCIP_CALL (SCIPstartProbing(scip))
 SCIPenableVarHistory (scip)
 SCIPdebugMessage ("(node %"SCIP_LONGINT_FORMAT") executing %s heuristic: depth=%d, %d fractionals, dualbound=%g, searchbound=%g\n", SCIPgetNNodes(scip), SCIPheurGetName(heur), SCIPgetDepth(scip), nlpcands, SCIPgetDualbound(scip), SCIPretransformObj(scip, searchbound))
 while (!lperror &&!cutoff &&lpsolstat==SCIP_LPSOLSTAT_OPTIMAL &&nlpcands > 0 &&(divedepth< 10||nlpcands<=startnlpcands - divedepth/2||(divedepth< maxdivedepth &&heurdata->nlpiterations< maxnlpiterations &&objval< searchbound)) &&!SCIPisStopped(scip))
 if (nlpcands==0 &&!lperror &&!cutoff &&lpsolstat==SCIP_LPSOLSTAT_OPTIMAL)
 SCIP_CALL (SCIPendProbing(scip))
 if (heurdata->divingexitexec !=NULL)
 SCIPstatistic (SCIP_CALL(SCIPfreeClock(scip, &lptime)))
 SCIPfreeBufferArray (scip, &selectedvars)
 SCIPdebugMessage ("%s heuristic finished\n", SCIPheurGetName(heur))
GCG_MASTER_DIVINGDATA * GCGheurGetDivingDataMaster (SCIP_HEUR *heur)
void GCGheurSetDivingDataMaster (SCIP_HEUR *heur, GCG_MASTER_DIVINGDATA *divingdata)
SCIP_RETCODE GCGincludeDivingHeurMaster (GCG *gcg, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, GCG_DECL_MASTER_DIVINGFREE((*divingfree)), GCG_DECL_MASTER_DIVINGINIT((*divinginit)), GCG_DECL_MASTER_DIVINGEXIT((*divingexit)), GCG_DECL_MASTER_DIVINGINITSOL((*divinginitsol)), GCG_DECL_MASTER_DIVINGEXITSOL((*divingexitsol)), GCG_DECL_MASTER_DIVINGINITEXEC((*divinginitexec)), GCG_DECL_MASTER_DIVINGEXITEXEC((*divingexitexec)), GCG_DECL_MASTER_DIVINGSELECTVAR((*divingselectvar)), GCG_MASTER_DIVINGDATA *divingdata)
SCIP_RETCODE GCGincludeEventHdlrMasterdiving (GCG *gcg)

Variables

 heurdata = SCIPheurGetData(heur)
return SCIP_OKAY
heurdata nlpiterations = 0
heurdata npricerounds = 0
heurdata nsuccess = 0
static SCIP_LPSOLSTAT lpsolstat
SCIP_VAR ** selectedvars
SCIP_VAR ** tabulist
int * discrepancies
SCIP_Real searchubbound = SCIPinfinity(scip)
SCIP_Real searchavgbound = SCIPinfinity(scip)
SCIP_Real searchbound = MIN(searchubbound, searchavgbound)
SCIP_Real objval = SCIPgetLPObjval(scip)
SCIP_Real oldobjval
SCIP_Bool lperror = FALSE
SCIP_Bool cutoff = FALSE
SCIP_Longint ncalls
SCIP_Longint nsolsfound
SCIP_Longint maxnlpiterations
int totalpricerounds = 0
int nlpcands
int startnlpcands = nlpcands
int depth
int maxdepth
int maxdivedepth
int divedepth = 0
int discrepancy = 0
int i
* result = SCIP_DELAYED
 else

Macro Definition Documentation

◆ HEUR_TIMING

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPPLUNGE

Definition at line 45 of file heur_masterdiving.c.

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   FALSE

does the heuristic use a secondary SCIP instance?

Definition at line 46 of file heur_masterdiving.c.

◆ DEFAULT_MINRELDEPTH

#define DEFAULT_MINRELDEPTH   0.0

minimal relative depth to start diving

Definition at line 53 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_MAXRELDEPTH

#define DEFAULT_MAXRELDEPTH   1.0

maximal relative depth to start diving

Definition at line 54 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_MAXLPITERQUOT

#define DEFAULT_MAXLPITERQUOT   0.05

maximal fraction of diving LP iterations compared to node LP iterations

Definition at line 55 of file heur_masterdiving.c.

◆ DEFAULT_MAXLPITEROFS

#define DEFAULT_MAXLPITEROFS   1000

additional number of allowed LP iterations

Definition at line 56 of file heur_masterdiving.c.

◆ DEFAULT_MAXPRICEROUNDS

#define DEFAULT_MAXPRICEROUNDS   0

maximal number of allowed pricing rounds (-1: no limit)

Definition at line 57 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_USEFARKASONLY

#define DEFAULT_USEFARKASONLY   FALSE

perform pricing only if infeasibility is encountered

Definition at line 58 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_MAXDIVEUBQUOT

#define DEFAULT_MAXDIVEUBQUOT   0.8

maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound) where diving is performed (0.0: no limit)

Definition at line 59 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_MAXDIVEAVGQUOT

#define DEFAULT_MAXDIVEAVGQUOT   0.0

maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound) where diving is performed (0.0: no limit)

Definition at line 61 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_MAXDIVEUBQUOTNOSOL

#define DEFAULT_MAXDIVEUBQUOTNOSOL   0.1

maximal UBQUOT when no solution was found yet (0.0: no limit)

Definition at line 63 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_MAXDIVEAVGQUOTNOSOL

#define DEFAULT_MAXDIVEAVGQUOTNOSOL   0.0

maximal AVGQUOT when no solution was found yet (0.0: no limit)

Definition at line 64 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_BACKTRACK

#define DEFAULT_BACKTRACK   FALSE

single backtracking by choosing another variable in case of infeasibility

Definition at line 65 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_MAXDISCREPANCY

#define DEFAULT_MAXDISCREPANCY   2

maximal discrepancy allowed in backtracking and limited discrepancy search

Definition at line 66 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ DEFAULT_MAXDISCDEPTH

#define DEFAULT_MAXDISCDEPTH   0

maximal depth until which a limited discrepancy search is performed

Definition at line 67 of file heur_masterdiving.c.

Referenced by GCGincludeDivingHeurMaster(), and GCGincludeDivingHeurOrig().

◆ MINLPITER

#define MINLPITER   10000

minimal number of LP iterations allowed in each LP solving call

Definition at line 69 of file heur_masterdiving.c.

Function Documentation

◆ assert() [1/4]

assert ( heur ! = NULL)

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

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

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

References assert().

◆ assert() [2/4]

assert ( scip ! = NULL)

References assert().

◆ assert() [3/4]

assert ( heurdata ! = NULL)

References assert(), and heurdata.

◆ if() [1/8]

if ( heurdata->divingfree ! = NULL)

Definition at line 163 of file heur_masterdiving.c.

References SCIP_HeurData::gcg, heurdata, and SCIP_CALL().

◆ SCIPfreeMemory()

SCIPfreeMemory ( scip ,
& heurdata )

References heurdata, and SCIPfreeMemory().

◆ SCIPheurSetData()

SCIPheurSetData ( heur ,
NULL  )

◆ SCIP_CALL() [1/4]

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

References heurdata, and SCIP_CALL().

◆ if() [2/8]

if ( heurdata->divinginit ! = NULL)

Definition at line 196 of file heur_masterdiving.c.

References SCIP_HeurData::gcg, heurdata, and SCIP_CALL().

◆ if() [3/8]

if ( heurdata->divingexit ! = NULL)

Definition at line 218 of file heur_masterdiving.c.

References SCIP_HeurData::gcg, heurdata, and SCIP_CALL().

◆ SCIP_CALL() [2/4]

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

References heurdata, and SCIP_CALL().

◆ SCIP_DECL_HEURINITSOL()

SCIP_DECL_HEURINITSOL ( heurInitsolMasterdiving )
static

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

Definition at line 232 of file heur_masterdiving.c.

References assert(), SCIP_HeurData::gcg, heurdata, and SCIP_CALL().

◆ SCIP_DECL_HEUREXITSOL()

SCIP_DECL_HEUREXITSOL ( heurExitsolMasterdiving )
static

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

Definition at line 273 of file heur_masterdiving.c.

References assert(), SCIP_HeurData::gcg, heurdata, and SCIP_CALL().

◆ assert() [4/4]

assert ( result ! = NULL)

References assert(), EVENTHDLR_NAME, heurdata, and result.

◆ if() [4/8]

◆ if() [5/8]

if ( heurdata-> maxdiveavgquot,
0. 0 )

References heurdata, and searchavgbound.

◆ if() [6/8]

◆ for()

for ( i = 0; i < heurdata->maxdiscrepancy; ++i)

Definition at line 456 of file heur_masterdiving.c.

References SCIP_HeurData::gcg, heurdata, i, SCIP_CALL(), and tabulist.

◆ SCIP_CALL() [3/4]

SCIP_CALL ( SCIPstartProbing(scip) )

References SCIP_CALL().

◆ SCIPenableVarHistory()

SCIPenableVarHistory ( scip )

References lpsolstat, and objval.

◆ SCIPdebugMessage() [1/2]

SCIPdebugMessage ( "(node %"SCIP_LONGINT_FORMAT") executing %s heuristic: depth = %d,
%d fractionals,
dualbound = %g )

◆ while()

◆ if() [7/8]

◆ SCIP_CALL() [4/4]

SCIP_CALL ( SCIPendProbing(scip) )

◆ if() [8/8]

if ( heurdata->divingexitexec ! = NULL)

Definition at line 790 of file heur_masterdiving.c.

References SCIP_HeurData::gcg, heurdata, and SCIP_CALL().

◆ SCIPstatistic()

SCIPstatistic ( SCIP_CALL(SCIPfreeClock(scip, &lptime)) )

References SCIP_CALL(), and SCIPstatistic().

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

◆ SCIPfreeBufferArray()

SCIPfreeBufferArray ( scip ,
& selectedvars )

◆ SCIPdebugMessage() [2/2]

SCIPdebugMessage ( "%s heuristic finished\n" ,
SCIPheurGetName(heur)  )

References SCIPdebugMessage().

◆ GCGheurGetDivingDataMaster()

GCG_MASTER_DIVINGDATA * GCGheurGetDivingDataMaster ( SCIP_HEUR * heur)

gets diving rule specific data of a diving heuristic

Parameters
heurprimal heuristic

Definition at line 972 of file heur_masterdiving.c.

References assert(), SCIP_HeurData::divingdata, GCGheurGetDivingDataMaster(), and heurdata.

Referenced by GCGheurGetDivingDataMaster().

◆ GCGheurSetDivingDataMaster()

void GCGheurSetDivingDataMaster ( SCIP_HEUR * heur,
GCG_MASTER_DIVINGDATA * divingdata )

sets diving rule specific data of a diving heuristic

Parameters
heurprimal heuristic
divingdatadiving rule specific data

Definition at line 988 of file heur_masterdiving.c.

References assert(), divingdata, SCIP_HeurData::divingdata, GCGheurSetDivingDataMaster(), and heurdata.

Referenced by GCGheurSetDivingDataMaster().

◆ GCGincludeDivingHeurMaster()

SCIP_RETCODE GCGincludeDivingHeurMaster ( GCG * gcg,
SCIP_HEUR ** heur,
const char * name,
const char * desc,
char dispchar,
int priority,
int freq,
int freqofs,
int maxdepth,
GCG_DECL_MASTER_DIVINGFREE((*divingfree)) ,
GCG_DECL_MASTER_DIVINGINIT((*divinginit)) ,
GCG_DECL_MASTER_DIVINGEXIT((*divingexit)) ,
GCG_DECL_MASTER_DIVINGINITSOL((*divinginitsol)) ,
GCG_DECL_MASTER_DIVINGEXITSOL((*divingexitsol)) ,
GCG_DECL_MASTER_DIVINGINITEXEC((*divinginitexec)) ,
GCG_DECL_MASTER_DIVINGEXITEXEC((*divingexitexec)) ,
GCG_DECL_MASTER_DIVINGSELECTVAR((*divingselectvar)) ,
GCG_MASTER_DIVINGDATA * divingdata )

creates a master diving heuristic and includes it in GCG

Parameters
gcgGCG data structure
heurpointer to diving heuristic
namename of primal heuristic
descdescription of primal heuristic
dispchardisplay character of primal heuristic
prioritypriority of the primal heuristic
freqfrequency for calling primal heuristic
freqofsfrequency offset for calling primal heuristic
maxdepthmaximal depth level to call heuristic at (-1: no limit)
-destructor of diving heuristic
-initialize diving heuristic
-deinitialize diving heuristic
-solving process initialization method of diving heuristic
-solving process deinitialization method of diving heuristic
-execution initialization method of diving heuristic
-execution deinitialization method of diving heuristic
-variable selection method of diving heuristic
divingdatadiving rule specific data (or NULL)

Definition at line 1005 of file heur_masterdiving.c.

References assert(), SCIP_HeurData::backtrack, DEFAULT_BACKTRACK, DEFAULT_MAXDISCDEPTH, DEFAULT_MAXDISCREPANCY, DEFAULT_MAXDIVEAVGQUOT, DEFAULT_MAXDIVEAVGQUOTNOSOL, DEFAULT_MAXDIVEUBQUOT, DEFAULT_MAXDIVEUBQUOTNOSOL, DEFAULT_MAXLPITEROFS, DEFAULT_MAXLPITERQUOT, DEFAULT_MAXPRICEROUNDS, DEFAULT_MAXRELDEPTH, DEFAULT_MINRELDEPTH, DEFAULT_USEFARKASONLY, divingdata, SCIP_HeurData::divingdata, EVENTHDLR_NAME, SCIP_HeurData::gcg, GCG_DECL_MASTER_DIVINGEXIT, GCG_DECL_MASTER_DIVINGEXITEXEC, GCG_DECL_MASTER_DIVINGEXITSOL, GCG_DECL_MASTER_DIVINGFREE, GCG_DECL_MASTER_DIVINGINIT, GCG_DECL_MASTER_DIVINGINITEXEC, GCG_DECL_MASTER_DIVINGINITSOL, GCG_DECL_MASTER_DIVINGSELECTVAR, GCGgetMasterprob(), GCGincludeDivingHeurMaster(), HEUR_TIMING, HEUR_USESSUBSCIP, heurdata, masterprob, maxdepth, SCIP_HeurData::maxdiscdepth, SCIP_HeurData::maxdiscrepancy, SCIP_HeurData::maxdiveavgquot, SCIP_HeurData::maxdiveavgquotnosol, SCIP_HeurData::maxdiveubquot, SCIP_HeurData::maxdiveubquotnosol, SCIP_HeurData::maxlpiterofs, SCIP_HeurData::maxlpiterquot, SCIP_HeurData::maxpricerounds, SCIP_HeurData::maxreldepth, SCIP_HeurData::minreldepth, SCIP_CALL(), and SCIP_HeurData::usefarkasonly.

Referenced by GCGincludeDivingHeurMaster(), GCGincludeHeurMastercoefdiving(), GCGincludeHeurMasterfracdiving(), GCGincludeHeurMasterlinesdiving(), and GCGincludeHeurMastervecldiving().

◆ GCGincludeEventHdlrMasterdiving()

SCIP_RETCODE GCGincludeEventHdlrMasterdiving ( GCG * gcg)

creates event handler for masterdiving event

Parameters
gcgGCG data structure

Definition at line 1157 of file heur_masterdiving.c.

References assert(), EVENTHDLR_DESC, EVENTHDLR_NAME, GCGgetMasterprob(), GCGincludeEventHdlrMasterdiving(), and SCIP_CALL().

Referenced by GCGincludeEventHdlrMasterdiving(), and GCGincludeMasterPlugins().

Variable Documentation

◆ heurdata

heurdata = SCIPheurGetData(heur)

Definition at line 160 of file heur_masterdiving.c.

◆ SCIP_OKAY

return SCIP_OKAY

Definition at line 172 of file heur_masterdiving.c.

◆ nlpiterations

SCIP_Longint nlpiterations = 0

Definition at line 191 of file heur_masterdiving.c.

◆ npricerounds

◆ nsuccess

if result heurdata nsuccess = 0

Definition at line 193 of file heur_masterdiving.c.

◆ lpsolstat

lpsolstat
Initial value:
{
static SCIP_HEURDATA * heurdata
struct SCIP_HeurData SCIP_HEURDATA

execution method of primal heuristic

Definition at line 303 of file heur_masterdiving.c.

Referenced by if(), if(), performProbing(), SCIPdebugMessage(), SCIPenableVarHistory(), and while().

◆ selectedvars

SCIP_VAR** selectedvars

Definition at line 304 of file heur_masterdiving.c.

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

◆ tabulist

SCIP_VAR** tabulist

Definition at line 305 of file heur_masterdiving.c.

Referenced by assert(), for(), for(), if(), SCIPfreeBufferArray(), and while().

◆ discrepancies

int* discrepancies

Definition at line 306 of file heur_masterdiving.c.

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

◆ searchubbound

else searchubbound = SCIPinfinity(scip)

Definition at line 307 of file heur_masterdiving.c.

Referenced by if(), and if().

◆ searchavgbound

else searchavgbound = SCIPinfinity(scip)

Definition at line 308 of file heur_masterdiving.c.

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

◆ searchbound

searchbound = MIN(searchubbound, searchavgbound)

Definition at line 309 of file heur_masterdiving.c.

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

◆ objval

◆ oldobjval

SCIP_Real oldobjval

Definition at line 311 of file heur_masterdiving.c.

Referenced by while().

◆ lperror

◆ cutoff

◆ ncalls

SCIP_Longint ncalls

Definition at line 314 of file heur_masterdiving.c.

◆ nsolsfound

SCIP_Longint nsolsfound

Definition at line 315 of file heur_masterdiving.c.

◆ maxnlpiterations

SCIP_Longint maxnlpiterations

Definition at line 317 of file heur_masterdiving.c.

◆ totalpricerounds

totalpricerounds = 0

◆ nlpcands

int nlpcands

Definition at line 319 of file heur_masterdiving.c.

◆ startnlpcands

startnlpcands = nlpcands

Definition at line 320 of file heur_masterdiving.c.

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

◆ depth

◆ maxdepth

◆ maxdivedepth

int maxdivedepth

Definition at line 323 of file heur_masterdiving.c.

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

◆ divedepth

divedepth = 0

Definition at line 324 of file heur_masterdiving.c.

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

◆ discrepancy

discrepancy = 0

Definition at line 325 of file heur_masterdiving.c.

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

◆ i

int i

Definition at line 342 of file heur_masterdiving.c.

◆ result

* result = SCIP_DELAYED

Definition at line 360 of file heur_masterdiving.c.

◆ else

else
Initial value:
{
if( heurdata->maxdiveubquot > 0.0 )
SCIP_Real SCIPgetLowerbound(SCIP *scip)
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
SCIP_Real searchubbound
SCIP_Real maxdiveubquot

Definition at line 421 of file heur_masterdiving.c.