SCIP Doxygen Documentation
Loading...
Searching...
No Matches

Detailed Description

LNS heuristic that finds the optimal rounding to a given point.

Author
Timo Berthold

Definition in file heur_rens.c.

#include "blockmemshell/memory.h"
#include "scip/heuristics.h"
#include "scip/heur_rens.h"
#include "scip/pub_event.h"
#include "scip/pub_heur.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_sol.h"
#include "scip/pub_var.h"
#include "scip/scip_branch.h"
#include "scip/scip_cons.h"
#include "scip/scip_copy.h"
#include "scip/scip_event.h"
#include "scip/scip_general.h"
#include "scip/scip_heur.h"
#include "scip/scip_lp.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_nlp.h"
#include "scip/scip_nlpi.h"
#include "scip/scip_nodesel.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_sol.h"
#include "scip/scip_solve.h"
#include "scip/scip_solvingstats.h"
#include "scip/scip_timing.h"
#include "scip/scip_var.h"

Go to the source code of this file.

Macros

#define HEUR_NAME   "rens"
#define HEUR_DESC   "LNS exploring fractional neighborhood of relaxation's optimum"
#define HEUR_DISPCHAR   SCIP_HEURDISPCHAR_LNS
#define HEUR_PRIORITY   -1100000
#define HEUR_FREQ   0
#define HEUR_FREQOFS   0
#define HEUR_MAXDEPTH   -1
#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPNODE
#define HEUR_USESSUBSCIP   TRUE
#define DEFAULT_BINARYBOUNDS   TRUE
#define DEFAULT_MAXNODES   5000LL
#define DEFAULT_MINFIXINGRATE   0.5
#define DEFAULT_MINIMPROVE   0.01
#define DEFAULT_MINNODES   50LL
#define DEFAULT_NODESOFS   500LL
#define DEFAULT_NODESQUOT   0.1
#define DEFAULT_LPLIMFAC   2.0
#define DEFAULT_STARTSOL   'l'
#define STARTSOL_CHOICES   "nl"
#define DEFAULT_USELPROWS   FALSE
#define DEFAULT_COPYCUTS   TRUE
#define DEFAULT_EXTRATIME   FALSE
#define DEFAULT_ADDALLSOLS   FALSE
#define DEFAULT_FULLSCALE   FALSE
#define DEFAULT_BESTSOLLIMIT   -1
#define DEFAULT_USEUCT   FALSE
#define EVENTHDLR_NAME   "Rens"
#define EVENTHDLR_DESC   "LP event handler for " HEUR_NAME " heuristic"

Functions

static SCIP_RETCODE computeFixingrate (SCIP *scip, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int *nfixedvars, int fixedvarssize, SCIP_Real minfixingrate, char *startsol, SCIP_Real *fixingrate, SCIP_Bool *success)
static SCIP_RETCODE restrictToBinaryBounds (SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, char startsol)
static SCIP_DECL_EVENTEXEC (eventExecRens)
static SCIP_RETCODE setupAndSolveSubscip (SCIP *scip, SCIP *subscip, SCIP_RESULT *result, SCIP_HEUR *heur, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Real intfixingrate, SCIP_Real minfixingrate, SCIP_Real minimprove, SCIP_Longint maxnodes, SCIP_Longint nstallnodes, char startsol, SCIP_Bool binarybounds, SCIP_Bool uselprows)
SCIP_RETCODE SCIPapplyRens (SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_Real minfixingrate, SCIP_Real minimprove, SCIP_Longint maxnodes, SCIP_Longint nstallnodes, char startsol, SCIP_Bool binarybounds, SCIP_Bool uselprows)
static SCIP_DECL_HEURCOPY (heurCopyRens)
static SCIP_DECL_HEURFREE (heurFreeRens)
static SCIP_DECL_HEURINIT (heurInitRens)
static SCIP_DECL_HEUREXEC (heurExecRens)
SCIP_RETCODE SCIPincludeHeurRens (SCIP *scip)

Macro Definition Documentation

◆ HEUR_NAME

#define HEUR_NAME   "rens"

Definition at line 65 of file heur_rens.c.

◆ HEUR_DESC

#define HEUR_DESC   "LNS exploring fractional neighborhood of relaxation's optimum"

Definition at line 66 of file heur_rens.c.

◆ HEUR_DISPCHAR

#define HEUR_DISPCHAR   SCIP_HEURDISPCHAR_LNS

Definition at line 67 of file heur_rens.c.

◆ HEUR_PRIORITY

#define HEUR_PRIORITY   -1100000

Definition at line 68 of file heur_rens.c.

◆ HEUR_FREQ

#define HEUR_FREQ   0

Definition at line 69 of file heur_rens.c.

◆ HEUR_FREQOFS

#define HEUR_FREQOFS   0

Definition at line 70 of file heur_rens.c.

◆ HEUR_MAXDEPTH

#define HEUR_MAXDEPTH   -1

Definition at line 71 of file heur_rens.c.

◆ HEUR_TIMING

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPNODE

Definition at line 72 of file heur_rens.c.

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   TRUE

does the heuristic use a secondary SCIP instance?

Definition at line 73 of file heur_rens.c.

◆ DEFAULT_BINARYBOUNDS

#define DEFAULT_BINARYBOUNDS   TRUE

Definition at line 76 of file heur_rens.c.

Referenced by SCIPincludeHeurRens().

◆ DEFAULT_MAXNODES

#define DEFAULT_MAXNODES   5000LL

Definition at line 77 of file heur_rens.c.

◆ DEFAULT_MINFIXINGRATE

#define DEFAULT_MINFIXINGRATE   0.5

Definition at line 78 of file heur_rens.c.

◆ DEFAULT_MINIMPROVE

#define DEFAULT_MINIMPROVE   0.01

Definition at line 79 of file heur_rens.c.

◆ DEFAULT_MINNODES

#define DEFAULT_MINNODES   50LL

Definition at line 80 of file heur_rens.c.

◆ DEFAULT_NODESOFS

#define DEFAULT_NODESOFS   500LL

Definition at line 81 of file heur_rens.c.

◆ DEFAULT_NODESQUOT

#define DEFAULT_NODESQUOT   0.1

Definition at line 82 of file heur_rens.c.

◆ DEFAULT_LPLIMFAC

#define DEFAULT_LPLIMFAC   2.0

Definition at line 83 of file heur_rens.c.

◆ DEFAULT_STARTSOL

#define DEFAULT_STARTSOL   'l'

Definition at line 84 of file heur_rens.c.

Referenced by SCIPincludeHeurRens().

◆ STARTSOL_CHOICES

#define STARTSOL_CHOICES   "nl"

Definition at line 85 of file heur_rens.c.

Referenced by SCIPincludeHeurRens().

◆ DEFAULT_USELPROWS

#define DEFAULT_USELPROWS   FALSE

Definition at line 86 of file heur_rens.c.

◆ DEFAULT_COPYCUTS

#define DEFAULT_COPYCUTS   TRUE

Definition at line 88 of file heur_rens.c.

◆ DEFAULT_EXTRATIME

#define DEFAULT_EXTRATIME   FALSE

Definition at line 91 of file heur_rens.c.

Referenced by SCIPincludeHeurRens().

◆ DEFAULT_ADDALLSOLS

#define DEFAULT_ADDALLSOLS   FALSE

Definition at line 94 of file heur_rens.c.

◆ DEFAULT_FULLSCALE

#define DEFAULT_FULLSCALE   FALSE

Definition at line 96 of file heur_rens.c.

Referenced by SCIPincludeHeurRens().

◆ DEFAULT_BESTSOLLIMIT

#define DEFAULT_BESTSOLLIMIT   -1

Definition at line 100 of file heur_rens.c.

◆ DEFAULT_USEUCT

#define DEFAULT_USEUCT   FALSE

Definition at line 101 of file heur_rens.c.

◆ EVENTHDLR_NAME

#define EVENTHDLR_NAME   "Rens"

Definition at line 104 of file heur_rens.c.

◆ EVENTHDLR_DESC

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

Definition at line 105 of file heur_rens.c.

Function Documentation

◆ computeFixingrate()

SCIP_RETCODE computeFixingrate ( SCIP * scip,
SCIP_VAR ** fixedvars,
SCIP_Real * fixedvals,
int * nfixedvars,
int fixedvarssize,
SCIP_Real minfixingrate,
char * startsol,
SCIP_Real * fixingrate,
SCIP_Bool * success )
static

compute the number of initial fixings and check whether the fixing rate exceeds the minimum fixing rate

Parameters
scipSCIP data structure
fixedvarsarray to store source SCIP variables whose copies should be fixed in the sub-SCIP
fixedvalsarray to store solution values for variable fixing
nfixedvarspointer to store the number of fixed variables
fixedvarssizesize of the arrays to store fixing variables
minfixingratepercentage of integer variables that have to be fixed
startsolpointer to solution used for fixing values ('l'p relaxation, 'n'lp relaxation)
fixingratepercentage of integers that get actually fixed
successpointer to store whether minimum fixingrate is exceeded

Definition at line 145 of file heur_rens.c.

References assert(), computeFixingrate(), FALSE, i, MAX, NULL, SCIP_Bool, SCIP_CALL, SCIP_NLPSOLSTAT_FEASIBLE, SCIP_NLPSOLSTAT_GLOBOPT, SCIP_NLPSOLSTAT_LOCOPT, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, SCIPfloor(), SCIPgetNLPSolstat(), SCIPgetVarsData(), SCIPisFeasIntegral(), SCIPisNLPConstructed(), SCIPsetNLPInitialGuessSol(), SCIPsolveNLP, SCIPvarGetLPSol(), SCIPvarGetNLPSol(), TRUE, and vars.

Referenced by computeFixingrate(), and SCIPapplyRens().

◆ restrictToBinaryBounds()

SCIP_RETCODE restrictToBinaryBounds ( SCIP * scip,
SCIP * subscip,
SCIP_VAR ** subvars,
char startsol )
static

fixes bounds of unfixed integer variables to binary bounds

Parameters
sciporiginal SCIP data structure
subscipSCIP data structure for the subproblem
subvarsthe variables of the subproblem
startsolsolution used for fixing values ('l'p relaxation, 'n'lp relaxation)

Definition at line 252 of file heur_rens.c.

References assert(), i, NULL, restrictToBinaryBounds(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPchgVarLbGlobal(), SCIPchgVarUbGlobal(), SCIPfeasCeil(), SCIPfeasFloor(), SCIPfloor(), SCIPgetVarsData(), SCIPisFeasEQ(), SCIPisFeasIntegral(), SCIPvarGetLbGlobal(), SCIPvarGetLPSol(), SCIPvarGetNLPSol(), SCIPvarGetUbGlobal(), and vars.

Referenced by restrictToBinaryBounds(), and setupAndSolveSubscip().

◆ SCIP_DECL_EVENTEXEC()

◆ setupAndSolveSubscip()

SCIP_RETCODE setupAndSolveSubscip ( SCIP * scip,
SCIP * subscip,
SCIP_RESULT * result,
SCIP_HEUR * heur,
SCIP_VAR ** fixedvars,
SCIP_Real * fixedvals,
int nfixedvars,
SCIP_Real intfixingrate,
SCIP_Real minfixingrate,
SCIP_Real minimprove,
SCIP_Longint maxnodes,
SCIP_Longint nstallnodes,
char startsol,
SCIP_Bool binarybounds,
SCIP_Bool uselprows )
static

setup and solve the RENS sub-SCIP

Parameters
scipSCIP data structure
subscipsub SCIP data structure
resultresult pointer
heurheuristic data structure
fixedvarsarray of variables that should be fixed
fixedvalsarray of fixing values
nfixedvarsnumber of variables that should be fixed
intfixingratepercentage of integer variables fixed
minfixingrateminimum percentage of integer variables that have to be fixed
minimprovefactor by which RENS should at least improve the incumbent
maxnodesmaximum number of nodes for the subproblem
nstallnodesnumber of stalling nodes for the subproblem
startsolsolution used for fixing values ('l'p relaxation, 'n'lp relaxation)
binaryboundsshould general integers get binary bounds [floor(.),ceil(.)]?
uselprowsshould subproblem be created out of the rows in the LP rows?

Definition at line 345 of file heur_rens.c.

References assert(), cutoff, EVENTHDLR_DESC, EVENTHDLR_NAME, FALSE, HEUR_NAME, heurdata, i, MAX, MIN, NULL, nvars, restrictToBinaryBounds(), result, SCIP_Bool, SCIP_CALL, SCIP_EVENTTYPE_LPSOLVED, SCIP_FOUNDSOL, SCIP_Longint, SCIP_LONGINT_FORMAT, SCIP_OKAY, SCIP_PARAMSETTING_FAST, SCIP_PARAMSETTING_OFF, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIPABORT, SCIPallocBufferArray, SCIPblkmem(), SCIPcatchEvent(), SCIPcopyLargeNeighborhoodSearch(), SCIPcopyLimits(), SCIPdebug, SCIPdebugMsg, SCIPdropEvent(), SCIPerrorMessage, SCIPfindBranchrule(), SCIPfindNodesel(), SCIPfreeBufferArray, SCIPgetBestSol(), SCIPgetLowerbound(), SCIPgetNConss(), SCIPgetNNodes(), SCIPgetNOrigVars(), SCIPgetNSols(), SCIPgetNVars(), SCIPgetPrimalbound(), SCIPgetSols(), SCIPgetSolvingTime(), SCIPgetUpperbound(), SCIPgetVarsData(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPheurGetData(), SCIPincludeEventhdlrBasic(), SCIPinfinity(), SCIPisInfinity(), SCIPisParamFixed(), SCIPmergeVariableStatistics(), SCIPpresolve(), SCIPprintStatistics(), SCIPsetBoolParam(), SCIPsetCharParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetObjlimit(), SCIPsetPresolving(), SCIPsetSeparating(), SCIPsetSubscipsOff(), SCIPsolGetNodenum(), SCIPsolve(), SCIPstatisticPrintf, SCIPsumepsilon(), SCIPtransformProb(), SCIPtranslateSubSol(), SCIPtrySolFree(), SCIPwarningMessage(), setupAndSolveSubscip(), TRUE, and vars.

Referenced by applyVbounds(), SCIPapplyRens(), SCIPapplyZeroobj(), setupAndSolveSubscip(), setupAndSolveSubscip(), and setupAndSolveSubscip().

◆ SCIP_DECL_HEURCOPY()

SCIP_DECL_HEURCOPY ( heurCopyRens )
static

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

Definition at line 694 of file heur_rens.c.

References assert(), HEUR_NAME, NULL, SCIP_CALL, SCIP_DECL_HEURCOPY, SCIP_INVALIDCALL, SCIP_OKAY, SCIP_STRINGEQ, SCIPheurGetName(), and SCIPincludeHeurRens().

◆ SCIP_DECL_HEURFREE()

SCIP_DECL_HEURFREE ( heurFreeRens )
static

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

Definition at line 709 of file heur_rens.c.

References assert(), heurdata, NULL, SCIP_DECL_HEURFREE, SCIP_OKAY, SCIPfreeBlockMemory, SCIPheurGetData(), and SCIPheurSetData().

◆ SCIP_DECL_HEURINIT()

SCIP_DECL_HEURINIT ( heurInitRens )
static

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

Definition at line 729 of file heur_rens.c.

References assert(), heurdata, NULL, SCIP_DECL_HEURINIT, SCIP_OKAY, and SCIPheurGetData().

◆ SCIP_DECL_HEUREXEC()