Scippy

SCIP

Solving Constraint Integer Programs

heur_zeroobj.c File Reference

Detailed Description

heuristic that tries to solve the problem without objective. In Gurobi, this heuristic is known as "Hail Mary"

Author
Timo Berthold

Definition in file heur_zeroobj.c.

#include <assert.h>
#include <string.h>
#include "scip/heur_zeroobj.h"
#include "scip/cons_linear.h"

Go to the source code of this file.

Macros

#define HEUR_NAME   "zeroobj"
 
#define HEUR_DESC   "heuristic trying to solve the problem without objective"
 
#define HEUR_DISPCHAR   'Z'
 
#define HEUR_PRIORITY   100
 
#define HEUR_FREQ   -1
 
#define HEUR_FREQOFS   0
 
#define HEUR_MAXDEPTH   0
 
#define HEUR_TIMING   SCIP_HEURTIMING_BEFORENODE | SCIP_HEURTIMING_BEFOREPRESOL
 
#define HEUR_USESSUBSCIP   TRUE
 
#define EVENTHDLR_NAME   "Zeroobj"
 
#define EVENTHDLR_DESC   "LP event handler for " HEUR_NAME " heuristic"
 
#define DEFAULT_MAXNODES   1000LL /* maximum number of nodes to regard in the subproblem */
 
#define DEFAULT_MINIMPROVE   0.01 /* factor by which zeroobj should at least improve the incumbent */
 
#define DEFAULT_MINNODES   100LL /* minimum number of nodes to regard in the subproblem */
 
#define DEFAULT_MAXLPITERS   5000LL /* maximum number of LP iterations to be performed in the subproblem */
 
#define DEFAULT_NODESOFS   100LL /* number of nodes added to the contingent of the total nodes */
 
#define DEFAULT_NODESQUOT   0.1 /* subproblem nodes in relation to nodes of the original problem */
 
#define DEFAULT_ADDALLSOLS   FALSE /* should all subproblem solutions be added to the original SCIP? */
 
#define DEFAULT_ONLYWITHOUTSOL   TRUE
 
#define DEFAULT_USEUCT   FALSE /* should uct node selection be used at the beginning of the search? */
 

Functions

static SCIP_RETCODE createNewSol (SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
 
static SCIP_DECL_EVENTEXEC (eventExecZeroobj)
 
static SCIP_DECL_HEURCOPY (heurCopyZeroobj)
 
static SCIP_DECL_HEURFREE (heurFreeZeroobj)
 
static SCIP_DECL_HEURINIT (heurInitZeroobj)
 
static SCIP_DECL_HEUREXEC (heurExecZeroobj)
 
static SCIP_RETCODE setupAndSolveSubscip (SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_Real minimprove, SCIP_Longint nnodes)
 
SCIP_RETCODE SCIPapplyZeroobj (SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_Real minimprove, SCIP_Longint nnodes)
 
SCIP_RETCODE SCIPincludeHeurZeroobj (SCIP *scip)
 

Macro Definition Documentation

◆ HEUR_NAME

#define HEUR_NAME   "zeroobj"

Definition at line 29 of file heur_zeroobj.c.

Referenced by SCIP_DECL_HEURCOPY(), SCIPincludeHeurZeroobj(), and setupAndSolveSubscip().

◆ HEUR_DESC

#define HEUR_DESC   "heuristic trying to solve the problem without objective"

Definition at line 30 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ HEUR_DISPCHAR

#define HEUR_DISPCHAR   'Z'

Definition at line 31 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ HEUR_PRIORITY

#define HEUR_PRIORITY   100

Definition at line 32 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ HEUR_FREQ

#define HEUR_FREQ   -1

Definition at line 33 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ HEUR_FREQOFS

#define HEUR_FREQOFS   0

Definition at line 34 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ HEUR_MAXDEPTH

#define HEUR_MAXDEPTH   0

Definition at line 35 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ HEUR_TIMING

Definition at line 36 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   TRUE

does the heuristic use a secondary SCIP instance?

Definition at line 37 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ EVENTHDLR_NAME

#define EVENTHDLR_NAME   "Zeroobj"

Definition at line 40 of file heur_zeroobj.c.

Referenced by SCIP_DECL_EVENTEXEC(), and setupAndSolveSubscip().

◆ EVENTHDLR_DESC

#define EVENTHDLR_DESC   "LP event handler for " HEUR_NAME " heuristic"

Definition at line 41 of file heur_zeroobj.c.

Referenced by setupAndSolveSubscip().

◆ DEFAULT_MAXNODES

#define DEFAULT_MAXNODES   1000LL /* maximum number of nodes to regard in the subproblem */

Definition at line 44 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ DEFAULT_MINIMPROVE

#define DEFAULT_MINIMPROVE   0.01 /* factor by which zeroobj should at least improve the incumbent */

Definition at line 45 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ DEFAULT_MINNODES

#define DEFAULT_MINNODES   100LL /* minimum number of nodes to regard in the subproblem */

Definition at line 46 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ DEFAULT_MAXLPITERS

#define DEFAULT_MAXLPITERS   5000LL /* maximum number of LP iterations to be performed in the subproblem */

Definition at line 47 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ DEFAULT_NODESOFS

#define DEFAULT_NODESOFS   100LL /* number of nodes added to the contingent of the total nodes */

Definition at line 48 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ DEFAULT_NODESQUOT

#define DEFAULT_NODESQUOT   0.1 /* subproblem nodes in relation to nodes of the original problem */

Definition at line 49 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ DEFAULT_ADDALLSOLS

#define DEFAULT_ADDALLSOLS   FALSE /* should all subproblem solutions be added to the original SCIP? */

Definition at line 50 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ DEFAULT_ONLYWITHOUTSOL

#define DEFAULT_ONLYWITHOUTSOL   TRUE

should heuristic only be executed if no primal solution was found, yet?

Definition at line 51 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

◆ DEFAULT_USEUCT

#define DEFAULT_USEUCT   FALSE /* should uct node selection be used at the beginning of the search? */

Definition at line 52 of file heur_zeroobj.c.

Referenced by SCIPincludeHeurZeroobj().

Function Documentation

◆ createNewSol()

static SCIP_RETCODE createNewSol ( SCIP scip,
SCIP subscip,
SCIP_VAR **  subvars,
SCIP_HEUR heur,
SCIP_SOL subsol,
SCIP_Bool success 
)
static

creates a new solution for the original problem by copying the solution of the subproblem

Parameters
sciporiginal SCIP data structure
subscipSCIP structure of the subproblem
subvarsthe variables of the subproblem
heurzeroobj heuristic structure
subsolsolution of the subproblem
successused to store whether new solution was found or not

Definition at line 80 of file heur_zeroobj.c.

References FALSE, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPcreateSol(), SCIPfreeBufferArray, SCIPgetNOrigVars(), SCIPgetSolVals(), SCIPgetVarsData(), SCIPsetSolVals(), SCIPtrySolFree(), and TRUE.

Referenced by setupAndSolveSubscip().

◆ SCIP_DECL_EVENTEXEC()

◆ SCIP_DECL_HEURCOPY()

static SCIP_DECL_HEURCOPY ( heurCopyZeroobj  )
static

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

Definition at line 156 of file heur_zeroobj.c.

References HEUR_NAME, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurZeroobj().

◆ SCIP_DECL_HEURFREE()

static SCIP_DECL_HEURFREE ( heurFreeZeroobj  )
static

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

Definition at line 170 of file heur_zeroobj.c.

References SCIP_OKAY, SCIPfreeBlockMemory, SCIPheurGetData(), and SCIPheurSetData().

◆ SCIP_DECL_HEURINIT()

static SCIP_DECL_HEURINIT ( heurInitZeroobj  )
static

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

Definition at line 191 of file heur_zeroobj.c.

References SCIP_OKAY, and SCIPheurGetData().

◆ SCIP_DECL_HEUREXEC()

static SCIP_DECL_HEUREXEC ( heurExecZeroobj  )
static

◆ setupAndSolveSubscip()

static SCIP_RETCODE setupAndSolveSubscip ( SCIP scip,
SCIP subscip,
SCIP_HEUR heur,
SCIP_RESULT result,
SCIP_Real  minimprove,
SCIP_Longint  nnodes 
)
static

setup and solve subscip

Parameters
scipSCIP data structure
subscipSCIP data structure
heurheuristic data structure
resultresult data structure
minimprovefactor by which zeroobj should at least improve the incumbent
nnodesnode limit for the subproblem

Definition at line 261 of file heur_zeroobj.c.

References createNewSol(), EVENTHDLR_DESC, EVENTHDLR_NAME, FALSE, HEUR_NAME, MAX, SCIP_Bool, SCIP_CALL, SCIP_CALL_ABORT, SCIP_EVENTTYPE_NODESOLVED, SCIP_FOUNDSOL, SCIP_OKAY, SCIP_PARAMSETTING_FAST, SCIP_PARAMSETTING_OFF, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIPaddCoefLinear(), SCIPaddCons(), SCIPallocBufferArray, SCIPblkmem(), SCIPcatchEvent(), SCIPchgVarLbGlobal(), SCIPchgVarObj(), SCIPchgVarUbGlobal(), SCIPcopy(), SCIPcopyLimits(), SCIPcreateConsLinear(), SCIPdebugMsg, SCIPdropEvent(), SCIPerrorMessage, SCIPfeastol(), SCIPfindBranchrule(), SCIPfindConshdlr(), SCIPfindNodesel(), SCIPfreeBufferArray, SCIPgetLowerbound(), SCIPgetNObjVars(), SCIPgetNSols(), SCIPgetSols(), SCIPgetUpperbound(), SCIPgetVarsData(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPheurGetData(), SCIPincludeEventhdlrBasic(), SCIPinfinity(), SCIPisFeasZero(), SCIPisInfinity(), SCIPisParamFixed(), SCIPprintStatistics(), SCIPreleaseCons(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetPresolving(), SCIPsetSeparating(), SCIPsetSubscipsOff(), SCIPsolve(), SCIPsumepsilon(), SCIPtransformProb(), SCIPvarGetLbGlobal(), SCIPvarGetObj(), SCIPvarGetUbGlobal(), and TRUE.

Referenced by SCIPapplyZeroobj().