Scippy

SCIP

Solving Constraint Integer Programs

heur_farkasdiving.c File Reference

Detailed Description

LP diving heuristic that tries to construct a Farkas-proof.

Author
Jakob Witzig

The heuristic dives into the direction of the pseudosolution, i.e., variables get rounded towards their best bound w.r.t there objective coefficient. This strategy is twofold, if a feasible solution is found the solution has potentially a very good objective value; on the other hand, the left-hand side of a potential Farkas-proof \(y^Tb - y^TA{l',u'} > 0\) (i.e., infeasibility proof) gets increased, where \(l',u'\) are the local bounds. The contribution of each variable \(x_i\) to the Farkas-proof can be approximated by \(c_i = y^TA_i\) because we only dive on basic variables with reduced costs \(c_i - y^TA_i = 0\).

Definition in file heur_farkasdiving.c.

#include "blockmemshell/memory.h"
#include "scip/heur_farkasdiving.h"
#include "scip/heuristics.h"
#include "scip/pub_heur.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_misc_sort.h"
#include "scip/pub_tree.h"
#include "scip/pub_var.h"
#include "scip/scip_branch.h"
#include "scip/scip_heur.h"
#include "scip/scip_lp.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_sol.h"
#include "scip/scip_tree.h"
#include <string.h>

Go to the source code of this file.

Macros

#define HEUR_NAME   "farkasdiving"
 
#define HEUR_DESC   "LP diving heuristic that tries to construct a Farkas-proof"
 
#define HEUR_DISPCHAR   'u'
 
#define HEUR_PRIORITY   -900000
 
#define HEUR_FREQ   10
 
#define HEUR_FREQOFS   0
 
#define HEUR_MAXDEPTH   -1
 
#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPPLUNGE
 
#define HEUR_USESSUBSCIP   FALSE
 
#define DIVESET_DIVETYPES   SCIP_DIVETYPE_INTEGRALITY | SCIP_DIVETYPE_SOS1VARIABLE
 
#define DEFAULT_MINRELDEPTH   0.0
 
#define DEFAULT_MAXRELDEPTH   1.0
 
#define DEFAULT_MAXLPITERQUOT   0.05
 
#define DEFAULT_MAXLPITEROFS   1000
 
#define DEFAULT_MAXDIVEUBQUOT   0.8
 
#define DEFAULT_MAXDIVEAVGQUOT   0.0
 
#define DEFAULT_MAXDIVEUBQUOTNOSOL   0.1
 
#define DEFAULT_MAXDIVEAVGQUOTNOSOL   0.0
 
#define DEFAULT_BACKTRACK   TRUE
 
#define DEFAULT_LPRESOLVEDOMCHGQUOT   0.15
 
#define DEFAULT_LPSOLVEFREQ   1
 
#define DEFAULT_ONLYLPBRANCHCANDS   FALSE
 
#define DEFAULT_RANDSEED   151
 
#define DEFAULT_MAXOBJOCC   1.0
 
#define DEFAULT_OBJDYN   0.0001
 
#define DEFAULT_CHECKCANDS   FALSE
 
#define DEFAULT_SCALESCORE   TRUE
 
#define DEFAULT_ROOTSUCCESS   TRUE
 
#define DEFAULT_SCALETYPE   'i'
 
#define MIN_RAND   1e-06
 
#define MAX_RAND   1e-05
 

Functions

static SCIP_RETCODE checkDivingCandidates (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR **divecandvars, int ndivecands, SCIP_Bool *success)
 
static SCIP_RETCODE checkGlobalProperties (SCIP *scip, SCIP_HEURDATA *heurdata)
 
static SCIP_DECL_HEURCOPY (heurCopyFarkasdiving)
 
static SCIP_DECL_HEURFREE (heurFreeFarkasdiving)
 
static SCIP_DECL_HEURINIT (heurInitFarkasdiving)
 
static SCIP_DECL_HEUREXIT (heurExitFarkasdiving)
 
static SCIP_DECL_HEURINITSOL (heurInitsolFarkasdiving)
 
static SCIP_DECL_HEUREXEC (heurExecFarkasdiving)
 
static SCIP_DECL_DIVESETGETSCORE (divesetGetScoreFarkasdiving)
 
SCIP_RETCODE SCIPincludeHeurFarkasdiving (SCIP *scip)
 

Macro Definition Documentation

◆ HEUR_NAME

#define HEUR_NAME   "farkasdiving"

Definition at line 52 of file heur_farkasdiving.c.

◆ HEUR_DESC

#define HEUR_DESC   "LP diving heuristic that tries to construct a Farkas-proof"

Definition at line 53 of file heur_farkasdiving.c.

◆ HEUR_DISPCHAR

#define HEUR_DISPCHAR   'u'

Definition at line 54 of file heur_farkasdiving.c.

◆ HEUR_PRIORITY

#define HEUR_PRIORITY   -900000

Definition at line 55 of file heur_farkasdiving.c.

◆ HEUR_FREQ

#define HEUR_FREQ   10

Definition at line 56 of file heur_farkasdiving.c.

◆ HEUR_FREQOFS

#define HEUR_FREQOFS   0

Definition at line 57 of file heur_farkasdiving.c.

◆ HEUR_MAXDEPTH

#define HEUR_MAXDEPTH   -1

Definition at line 58 of file heur_farkasdiving.c.

◆ HEUR_TIMING

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPPLUNGE

Definition at line 59 of file heur_farkasdiving.c.

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   FALSE

does the heuristic use a secondary SCIP instance?

Definition at line 60 of file heur_farkasdiving.c.

◆ DIVESET_DIVETYPES

#define DIVESET_DIVETYPES   SCIP_DIVETYPE_INTEGRALITY | SCIP_DIVETYPE_SOS1VARIABLE

bit mask that represents all supported dive types

Definition at line 61 of file heur_farkasdiving.c.

◆ DEFAULT_MINRELDEPTH

#define DEFAULT_MINRELDEPTH   0.0

minimal relative depth to start diving

Definition at line 68 of file heur_farkasdiving.c.

◆ DEFAULT_MAXRELDEPTH

#define DEFAULT_MAXRELDEPTH   1.0

maximal relative depth to start diving

Definition at line 69 of file heur_farkasdiving.c.

◆ DEFAULT_MAXLPITERQUOT

#define DEFAULT_MAXLPITERQUOT   0.05

maximal fraction of diving LP iterations compared to node LP iterations

Definition at line 70 of file heur_farkasdiving.c.

◆ DEFAULT_MAXLPITEROFS

#define DEFAULT_MAXLPITEROFS   1000

additional number of allowed LP iterations

Definition at line 71 of file heur_farkasdiving.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 72 of file heur_farkasdiving.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 75 of file heur_farkasdiving.c.

◆ DEFAULT_MAXDIVEUBQUOTNOSOL

#define DEFAULT_MAXDIVEUBQUOTNOSOL   0.1

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

Definition at line 78 of file heur_farkasdiving.c.

◆ DEFAULT_MAXDIVEAVGQUOTNOSOL

#define DEFAULT_MAXDIVEAVGQUOTNOSOL   0.0

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

Definition at line 79 of file heur_farkasdiving.c.

◆ DEFAULT_BACKTRACK

#define DEFAULT_BACKTRACK   TRUE

use one level of backtracking if infeasibility is encountered?

Definition at line 80 of file heur_farkasdiving.c.

◆ DEFAULT_LPRESOLVEDOMCHGQUOT

#define DEFAULT_LPRESOLVEDOMCHGQUOT   0.15

percentage of immediate domain changes during probing to trigger LP resolve

Definition at line 81 of file heur_farkasdiving.c.

◆ DEFAULT_LPSOLVEFREQ

#define DEFAULT_LPSOLVEFREQ   1

LP solve frequency for diving heuristics

Definition at line 82 of file heur_farkasdiving.c.

◆ DEFAULT_ONLYLPBRANCHCANDS

#define DEFAULT_ONLYLPBRANCHCANDS   FALSE

should only LP branching candidates be considered instead of the slower but more general constraint handler diving variable selection?

Definition at line 83 of file heur_farkasdiving.c.

◆ DEFAULT_RANDSEED

#define DEFAULT_RANDSEED   151

initial seed for random number generation

Definition at line 86 of file heur_farkasdiving.c.

◆ DEFAULT_MAXOBJOCC

#define DEFAULT_MAXOBJOCC   1.0

maximal occurance factor of an objective coefficient

Definition at line 88 of file heur_farkasdiving.c.

◆ DEFAULT_OBJDYN

#define DEFAULT_OBJDYN   0.0001

minimal objective dynamism (log)

Definition at line 89 of file heur_farkasdiving.c.

◆ DEFAULT_CHECKCANDS

#define DEFAULT_CHECKCANDS   FALSE

should diving candidates be checked before running?

Definition at line 90 of file heur_farkasdiving.c.

◆ DEFAULT_SCALESCORE

#define DEFAULT_SCALESCORE   TRUE

should the score be scaled?

Definition at line 91 of file heur_farkasdiving.c.

◆ DEFAULT_ROOTSUCCESS

#define DEFAULT_ROOTSUCCESS   TRUE

should the heuristic only run within the tree if at least one solution was found at the root node?

Definition at line 92 of file heur_farkasdiving.c.

◆ DEFAULT_SCALETYPE

#define DEFAULT_SCALETYPE   'i'

scale score by [f]ractionality or [i]mpact on farkasproof

Definition at line 95 of file heur_farkasdiving.c.

◆ MIN_RAND

#define MIN_RAND   1e-06

Definition at line 439 of file heur_farkasdiving.c.

◆ MAX_RAND

#define MAX_RAND   1e-05

Definition at line 440 of file heur_farkasdiving.c.

Function Documentation

◆ checkDivingCandidates()

static SCIP_RETCODE checkDivingCandidates ( SCIP scip,
SCIP_HEURDATA heurdata,
SCIP_VAR **  divecandvars,
int  ndivecands,
SCIP_Bool success 
)
static

check whether the diving candidates fulfill requirements

Parameters
scipSCIP data structure
heurdataheuristic data
divecandvarsdiving candidates to check
ndivecandsnumber of diving candidates
successpointer to store whether the check was successfull

Definition at line 115 of file heur_farkasdiving.c.

References checkGlobalProperties(), FALSE, NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMsg, SCIPfreeBufferArray, SCIPgetCurrentNode(), SCIPgetNObjVars(), SCIPisGT(), SCIPisZero(), SCIPnodeGetNumber(), SCIPsortReal(), SCIPvarGetObj(), and TRUE.

Referenced by checkGlobalProperties().

◆ checkGlobalProperties()

static SCIP_RETCODE checkGlobalProperties ( SCIP scip,
SCIP_HEURDATA heurdata 
)
static

check whether the objective functions has nonzero coefficients corresponding to binary and integer variables

Parameters
scipSCIP data structure
heurdataheuristic data

Definition at line 243 of file heur_farkasdiving.c.

References checkDivingCandidates(), NULL, SCIP_Bool, SCIP_CALL, SCIP_DECL_HEURCOPY(), SCIP_OKAY, SCIPdebugMsg, SCIPgetNBinVars(), SCIPgetNIntVars(), SCIPgetVars(), and TRUE.

Referenced by checkDivingCandidates().

◆ SCIP_DECL_HEURCOPY()

static SCIP_DECL_HEURCOPY ( heurCopyFarkasdiving  )
static

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

Definition at line 279 of file heur_farkasdiving.c.

Referenced by checkGlobalProperties().

◆ SCIP_DECL_HEURFREE()

static SCIP_DECL_HEURFREE ( heurFreeFarkasdiving  )
static

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

Definition at line 293 of file heur_farkasdiving.c.

◆ SCIP_DECL_HEURINIT()

static SCIP_DECL_HEURINIT ( heurInitFarkasdiving  )
static

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

Definition at line 314 of file heur_farkasdiving.c.

◆ SCIP_DECL_HEUREXIT()

static SCIP_DECL_HEUREXIT ( heurExitFarkasdiving  )
static

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

Definition at line 337 of file heur_farkasdiving.c.

◆ SCIP_DECL_HEURINITSOL()

static SCIP_DECL_HEURINITSOL ( heurInitsolFarkasdiving  )
static

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

Definition at line 356 of file heur_farkasdiving.c.

◆ SCIP_DECL_HEUREXEC()

static SCIP_DECL_HEUREXEC ( heurExecFarkasdiving  )
static

execution method of primal heuristic

Definition at line 376 of file heur_farkasdiving.c.

◆ SCIP_DECL_DIVESETGETSCORE()

static SCIP_DECL_DIVESETGETSCORE ( divesetGetScoreFarkasdiving  )
static

calculate score and preferred rounding direction for the candidate variable

Definition at line 444 of file heur_farkasdiving.c.