GCG 4.1.1 (dev)

Generic Column Generation

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

Detailed Description

primal heuristic interface for LP diving heuristics on the original variables

Author
Tobias Achterberg
Christian Puchert

Definition in file heur_origdiving.c.

#include <assert.h>
#include <string.h>
#include "gcg/heur_origdiving.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_TIMING   SCIP_HEURTIMING_AFTERPLUNGE
#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_OTHERDIRECTION   TRUE
#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)
static SCIP_DECL_HEURINITSOL (heurInitsolOrigdiving)
static SCIP_DECL_HEUREXITSOL (heurExitsolOrigdiving)
 if (heurdata->divingexit !=NULL)
 SCIP_CALL (SCIPfreeSol(scip, &heurdata->sol))
 assert (result !=NULL)
 assert (masterprob !=NULL)
 if (SCIPgetStage(masterprob), SCIP_STAGE_SOLVING||!SCIPhasCurrentNodeLP(masterprob)||SCIPgetLPSolstat(masterprob) !=SCIP_LPSOLSTAT_OPTIMAL)
 if (heurdata->maxdiveavgquot > 0.0) searchavgbound
 if (SCIPisObjIntegral(scip))
 for (i=0;i< heurdata->maxdiscrepancy;++i)
 SCIP_CALL (GCGrelaxStartProbing(gcg, heur))
 SCIPenableVarHistory (scip)
 SCIPdebugMessage ("(node %"SCIP_LONGINT_FORMAT") executing %s heuristic: depth=%d, %d fractionals, dualbound=%g, avgbound=%g, cutoffbound=%g, searchbound=%g\n", SCIPgetNNodes(scip), SCIPheurGetName(heur), SCIPgetDepth(scip), nlpcands, SCIPgetDualbound(scip), SCIPgetAvgDualbound(scip), SCIPretransformObj(scip, SCIPgetCutoffbound(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 &&divedepth > 0)
 SCIP_CALL (GCGrelaxEndProbing(gcg))
 if (heurdata->divingexitexec !=NULL)
 SCIPstatistic (SCIP_CALL(SCIPfreeClock(scip, &lptime)))
 SCIPfreeBufferArray (scip, &selectedvars)
 SCIPdebugMessage ("(node %"SCIP_LONGINT_FORMAT") finished %s heuristic: %d fractionals, dive %d/%d, LP iter %"SCIP_LONGINT_FORMAT"/%"SCIP_LONGINT_FORMAT", pricerounds %d/%d, objval=%g/%g, lpsolstat=%d, cutoff=%u\n", SCIPgetNNodes(scip), SCIPheurGetName(heur), nlpcands, divedepth, maxdivedepth, heurdata->nlpiterations, maxnlpiterations, totalpricerounds, heurdata->maxpricerounds, SCIPretransformObj(scip, objval), SCIPretransformObj(scip, searchbound), lpsolstat, cutoff)
GCG_DIVINGDATA * GCGheurGetDivingDataOrig (SCIP_HEUR *heur)
void GCGheurSetDivingDataOrig (SCIP_HEUR *heur, GCG_DIVINGDATA *divingdata)
SCIP_RETCODE GCGincludeDivingHeurOrig (GCG *gcg, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, GCG_DECL_DIVINGFREE((*divingfree)), GCG_DECL_DIVINGINIT((*divinginit)), GCG_DECL_DIVINGEXIT((*divingexit)), GCG_DECL_DIVINGINITSOL((*divinginitsol)), GCG_DECL_DIVINGEXITSOL((*divingexitsol)), GCG_DECL_DIVINGINITEXEC((*divinginitexec)), GCG_DECL_DIVINGEXITEXEC((*divingexitexec)), GCG_DECL_DIVINGSELECTVAR((*divingselectvar)), GCG_DIVINGDATA *divingdata)
SCIP_RETCODE GCGincludeEventHdlrOrigdiving (GCG *gcg)

Variables

 heurdata = SCIPheurGetData(heur)
return SCIP_OKAY
heurdata nlpiterations = 0
heurdata npricerounds = 0
heurdata nsuccess = 0
static SCIP * masterprob
SCIP_LPSOLSTAT lpsolstat = SCIP_LPSOLSTAT_OPTIMAL
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 lpobj = objval
SCIP_Real objval = SCIPgetRelaxSolObj(scip)
SCIP_Real oldobjval
SCIP_Bool lperror = FALSE
SCIP_Bool lpsolved
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
 gcg = heurdata->gcg
* result = SCIP_DELAYED
 else

Macro Definition Documentation

◆ HEUR_TIMING

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERPLUNGE

Definition at line 45 of file heur_origdiving.c.

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   FALSE

Definition at line 46 of file heur_origdiving.c.

◆ DEFAULT_MINRELDEPTH

#define DEFAULT_MINRELDEPTH   0.0

minimal relative depth to start diving

Definition at line 53 of file heur_origdiving.c.

◆ DEFAULT_MAXRELDEPTH

#define DEFAULT_MAXRELDEPTH   1.0

maximal relative depth to start diving

Definition at line 54 of file heur_origdiving.c.

◆ 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_origdiving.c.

◆ DEFAULT_MAXLPITEROFS

#define DEFAULT_MAXLPITEROFS   1000

additional number of allowed LP iterations

Definition at line 56 of file heur_origdiving.c.

◆ DEFAULT_MAXPRICEROUNDS

#define DEFAULT_MAXPRICEROUNDS   0

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

Definition at line 57 of file heur_origdiving.c.

◆ DEFAULT_USEFARKASONLY

#define DEFAULT_USEFARKASONLY   FALSE

perform pricing only if infeasibility is encountered

Definition at line 58 of file heur_origdiving.c.

◆ 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_origdiving.c.

◆ 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_origdiving.c.

◆ 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_origdiving.c.

◆ 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_origdiving.c.

◆ DEFAULT_OTHERDIRECTION

#define DEFAULT_OTHERDIRECTION   TRUE

try to branch the diving variable in the other direction in case of infeasibility

Definition at line 65 of file heur_origdiving.c.

Referenced by GCGincludeDivingHeurOrig().

◆ DEFAULT_BACKTRACK

#define DEFAULT_BACKTRACK   FALSE

single backtracking by choosing another variable in case of infeasibility

Definition at line 66 of file heur_origdiving.c.

◆ DEFAULT_MAXDISCREPANCY

#define DEFAULT_MAXDISCREPANCY   2

maximal discrepancy allowed in backtracking and limited discrepancy search

Definition at line 67 of file heur_origdiving.c.

◆ DEFAULT_MAXDISCDEPTH

#define DEFAULT_MAXDISCDEPTH   0

maximal depth until which a limited discrepancy search is performed

Definition at line 68 of file heur_origdiving.c.

◆ MINLPITER

#define MINLPITER   10000

minimal number of LP iterations allowed in each LP solving call

Definition at line 70 of file heur_origdiving.c.

Function Documentation

◆ assert() [1/5]

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/5]

assert ( scip ! = NULL)

References assert().

◆ assert() [3/5]

assert ( heurdata ! = NULL)

References assert(), and heurdata.

◆ if() [1/8]

if ( heurdata->divingfree ! = NULL)

Definition at line 164 of file heur_origdiving.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 198 of file heur_origdiving.c.

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

◆ SCIP_DECL_HEURINITSOL()

SCIP_DECL_HEURINITSOL ( heurInitsolOrigdiving )
static

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

Definition at line 209 of file heur_origdiving.c.

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

◆ SCIP_DECL_HEUREXITSOL()

SCIP_DECL_HEUREXITSOL ( heurExitsolOrigdiving )
static

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

Definition at line 250 of file heur_origdiving.c.

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

◆ if() [3/8]

if ( heurdata->divingexit ! = NULL)

Definition at line 284 of file heur_origdiving.c.

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

◆ SCIP_CALL() [2/4]

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

References heurdata, and SCIP_CALL().

◆ assert() [4/5]

assert ( result ! = NULL)

References assert(), heurdata, and result.

◆ assert() [5/5]

assert ( masterprob ! = NULL)

References assert(), EVENTHDLR_NAME, and masterprob.

◆ 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 481 of file heur_origdiving.c.

References heurdata, i, SCIP_CALL(), and tabulist.

◆ SCIP_CALL() [3/4]

SCIP_CALL ( GCGrelaxStartProbing(gcg, heur) )

◆ SCIPenableVarHistory()

SCIPenableVarHistory ( scip )

References lpobj, lpsolstat, and objval.

◆ SCIPdebugMessage() [1/2]

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

◆ while()

◆ if() [7/8]

◆ SCIP_CALL() [4/4]

◆ if() [8/8]

if ( heurdata->divingexitexec ! = NULL)

Definition at line 922 of file heur_origdiving.c.

References heurdata, and SCIP_CALL().

◆ SCIPstatistic()

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

References SCIP_CALL(), and SCIPstatistic().

◆ SCIPfreeBufferArray()

SCIPfreeBufferArray ( scip ,
& selectedvars )

◆ SCIPdebugMessage() [2/2]

SCIPdebugMessage ( "(node %"SCIP_LONGINT_FORMAT") finished %s heuristic: %d fractionals,
dive %d/% d,
LP iter %"SCIP_LONGINT_FORMAT"/%"SCIP_LONGINT_FORMAT" ,
pricerounds %d/% d,
objval = %g/%g,
lpsolstat = %d )

◆ GCGheurGetDivingDataOrig()

GCG_DIVINGDATA * GCGheurGetDivingDataOrig ( SCIP_HEUR * heur)

gets diving rule specific data of a diving heuristic

Parameters
heurprimal heuristic

Definition at line 1092 of file heur_origdiving.c.

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

Referenced by assert(), and GCGheurGetDivingDataOrig().

◆ GCGheurSetDivingDataOrig()

void GCGheurSetDivingDataOrig ( SCIP_HEUR * heur,
GCG_DIVINGDATA * divingdata )

sets diving rule specific data of a diving heuristic

Parameters
heurprimal heuristic
divingdatadiving rule specific data

Definition at line 1108 of file heur_origdiving.c.

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

◆ GCGincludeDivingHeurOrig()

SCIP_RETCODE GCGincludeDivingHeurOrig ( GCG * gcg,
SCIP_HEUR ** heur,
const char * name,
const char * desc,
char dispchar,
int priority,
int freq,
int freqofs,
int maxdepth,
GCG_DECL_DIVINGFREE((*divingfree)) ,
GCG_DECL_DIVINGINIT((*divinginit)) ,
GCG_DECL_DIVINGEXIT((*divingexit)) ,
GCG_DECL_DIVINGINITSOL((*divinginitsol)) ,
GCG_DECL_DIVINGEXITSOL((*divingexitsol)) ,
GCG_DECL_DIVINGINITEXEC((*divinginitexec)) ,
GCG_DECL_DIVINGEXITEXEC((*divingexitexec)) ,
GCG_DECL_DIVINGSELECTVAR((*divingselectvar)) ,
GCG_DIVINGDATA * divingdata )

creates an original 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 1125 of file heur_origdiving.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_OTHERDIRECTION, DEFAULT_USEFARKASONLY, divingdata, SCIP_HeurData::divingdata, EVENTHDLR_NAME, SCIP_HeurData::gcg, GCG_DECL_DIVINGEXIT, GCG_DECL_DIVINGEXITEXEC, GCG_DECL_DIVINGEXITSOL, GCG_DECL_DIVINGFREE, GCG_DECL_DIVINGINIT, GCG_DECL_DIVINGINITEXEC, GCG_DECL_DIVINGINITSOL, GCG_DECL_DIVINGSELECTVAR, GCGgetMasterprob(), GCGgetOrigprob(), GCGincludeDivingHeurOrig(), 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, origprob, SCIP_HeurData::otherdirection, SCIP_CALL(), and SCIP_HeurData::usefarkasonly.

Referenced by GCGincludeDivingHeurOrig(), GCGincludeHeurGcgcoefdiving(), GCGincludeHeurGcgfracdiving(), GCGincludeHeurGcgguideddiving(), GCGincludeHeurGcglinesdiving(), GCGincludeHeurGcgpscostdiving(), and GCGincludeHeurGcgveclendiving().

◆ GCGincludeEventHdlrOrigdiving()

SCIP_RETCODE GCGincludeEventHdlrOrigdiving ( GCG * gcg)

creates event handler for origdiving event and includes it in the master problem

creates event handler for origdiving event

Parameters
gcgGCG data structure

Definition at line 1289 of file heur_origdiving.c.

References assert(), EVENTHDLR_DESC, EVENTHDLR_NAME, GCGgetMasterprob(), GCGincludeEventHdlrOrigdiving(), masterprob, and SCIP_CALL().

Referenced by GCGincludeEventHdlrOrigdiving(), and GCGincludeGcgPlugins().

Variable Documentation

◆ heurdata

heurdata = SCIPheurGetData(heur)

Definition at line 161 of file heur_origdiving.c.

◆ SCIP_OKAY

return SCIP_OKAY

Definition at line 173 of file heur_origdiving.c.

◆ nlpiterations

SCIP_Longint nlpiterations = 0

Definition at line 193 of file heur_origdiving.c.

◆ npricerounds

npricerounds = 0

Definition at line 194 of file heur_origdiving.c.

◆ nsuccess

if result heurdata nsuccess = 0

Definition at line 195 of file heur_origdiving.c.

◆ masterprob

masterprob
Initial value:
{
struct Gcg GCG
Definition type_gcg.h:44

execution method of primal heuristic

Definition at line 301 of file heur_origdiving.c.

◆ lpsolstat

Definition at line 307 of file heur_origdiving.c.

◆ selectedvars

SCIP_VAR** selectedvars

Definition at line 308 of file heur_origdiving.c.

◆ tabulist

SCIP_VAR** tabulist

Definition at line 309 of file heur_origdiving.c.

◆ discrepancies

int* discrepancies

Definition at line 310 of file heur_origdiving.c.

◆ searchubbound

else searchubbound = SCIPinfinity(scip)

Definition at line 311 of file heur_origdiving.c.

◆ searchavgbound

else searchavgbound = SCIPinfinity(scip)

Definition at line 312 of file heur_origdiving.c.

◆ searchbound

searchbound = MIN(searchubbound, searchavgbound)

Definition at line 313 of file heur_origdiving.c.

◆ lpobj

lpobj = objval

Definition at line 314 of file heur_origdiving.c.

Referenced by SCIP_DECL_DISPOUTPUT(), SCIPenableVarHistory(), and while().

◆ objval

Definition at line 315 of file heur_origdiving.c.

◆ oldobjval

SCIP_Real oldobjval

Definition at line 316 of file heur_origdiving.c.

◆ lperror

lperror = FALSE

Definition at line 317 of file heur_origdiving.c.

◆ lpsolved

◆ cutoff

cutoff = FALSE

Definition at line 319 of file heur_origdiving.c.

◆ ncalls

SCIP_Longint ncalls

Definition at line 320 of file heur_origdiving.c.

◆ nsolsfound

SCIP_Longint nsolsfound

Definition at line 321 of file heur_origdiving.c.

◆ maxnlpiterations

SCIP_Longint maxnlpiterations

Definition at line 323 of file heur_origdiving.c.

◆ totalpricerounds

totalpricerounds = 0

Definition at line 325 of file heur_origdiving.c.

Referenced by while().

◆ nlpcands

int nlpcands

Definition at line 326 of file heur_origdiving.c.

◆ startnlpcands

startnlpcands = nlpcands

Definition at line 327 of file heur_origdiving.c.

◆ depth

int depth

Definition at line 328 of file heur_origdiving.c.

◆ maxdepth

int maxdepth

Definition at line 329 of file heur_origdiving.c.

◆ maxdivedepth

int maxdivedepth

Definition at line 330 of file heur_origdiving.c.

◆ divedepth

divedepth = 0

Definition at line 331 of file heur_origdiving.c.

Referenced by while().

◆ discrepancy

discrepancy = 0

Definition at line 332 of file heur_origdiving.c.

Referenced by while().

◆ i

int i

Definition at line 350 of file heur_origdiving.c.

◆ gcg

gcg = heurdata->gcg

Definition at line 360 of file heur_origdiving.c.

◆ result

* result = SCIP_DELAYED

Definition at line 374 of file heur_origdiving.c.

◆ else

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

Definition at line 446 of file heur_origdiving.c.