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

Detailed Description

COMPLETESOL - primal heuristic trying to complete given partial solutions.

Author
Jakob Witzig

Definition in file heur_completesol.c.

#include "blockmemshell/memory.h"
#include "scip/cons_linear.h"
#include "scip/heur_completesol.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_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_nlp.h"
#include "scip/scip_nodesel.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_probing.h"
#include "scip/scip_sol.h"
#include "scip/scip_solve.h"
#include "scip/scip_solvingstats.h"
#include "scip/scip_timing.h"
#include "scip/scip_tree.h"
#include "scip/scip_var.h"
#include <string.h>

Go to the source code of this file.

Macros

#define HEUR_NAME   "completesol"
 
#define HEUR_DESC   "primal heuristic trying to complete given partial solutions"
 
#define HEUR_DISPCHAR   SCIP_HEURDISPCHAR_LNS
 
#define HEUR_PRIORITY   0
 
#define HEUR_FREQ   0
 
#define HEUR_FREQOFS   0
 
#define HEUR_MAXDEPTH   0
 
#define HEUR_TIMING   SCIP_HEURTIMING_BEFOREPRESOL | SCIP_HEURTIMING_BEFORENODE
 
#define HEUR_USESSUBSCIP   TRUE
 
#define DEFAULT_MAXNODES   5000LL
 
#define DEFAULT_MAXUNKRATE   0.85
 
#define DEFAULT_ADDALLSOLS   FALSE
 
#define DEFAULT_MINNODES   50LL
 
#define DEFAULT_NODESOFS   500LL
 
#define DEFAULT_NODESQUOT   0.1
 
#define DEFAULT_LPLIMFAC   2.0
 
#define DEFAULT_OBJWEIGHT   1.0
 
#define DEFAULT_BOUNDWIDENING   0.1
 
#define DEFAULT_MINIMPROVE   0.01
 
#define DEFAULT_MINOBJWEIGHT   1e-3
 
#define DEFAULT_IGNORECONT   FALSE
 
#define DEFAULT_BESTSOLS   5
 
#define DEFAULT_MAXPROPROUNDS   10
 
#define DEFAULT_MAXLPITER   -1LL
 
#define DEFAULT_MAXCONTVARS   -1
 
#define DEFAULT_BEFOREPRESOL   TRUE
 
#define EVENTHDLR_NAME   "Completesol"
 
#define EVENTHDLR_DESC   "LP event handler for " HEUR_NAME " heuristic"
 

Functions

static SCIP_DECL_EVENTEXEC (eventExecCompletesol)
 
static SCIP_RETCODE createSubproblem (SCIP *scip, SCIP *subscip, SCIP_HEURDATA *heurdata, SCIP_VAR **subvars, SCIP_SOL *partialsol, SCIP_Bool *tightened)
 
static SCIP_RETCODE chgProbingBound (SCIP *scip, SCIP_VAR *var, SCIP_Real newval, SCIP_BRANCHDIR branchdir, SCIP_Bool *success)
 
static SCIP_RETCODE tightenVariables (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR **vars, int nvars, SCIP_SOL *sol, SCIP_Bool *tightened, SCIP_Bool *infeasible)
 
static SCIP_RETCODE setupAndSolve (SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, SCIP_RESULT *result, SCIP_Longint nstallnodes, SCIP_SOL *partialsol, SCIP_Bool *tightened)
 
static SCIP_RETCODE applyCompletesol (SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, SCIP_RESULT *result, SCIP_Longint nstallnodes, SCIP_SOL *partialsol)
 
static SCIP_DECL_HEURCOPY (heurCopyCompletesol)
 
static SCIP_DECL_HEURFREE (heurFreeCompletesol)
 
static SCIP_DECL_HEUREXEC (heurExecCompletesol)
 
SCIP_RETCODE SCIPincludeHeurCompletesol (SCIP *scip)
 

Macro Definition Documentation

◆ HEUR_NAME

#define HEUR_NAME   "completesol"

Definition at line 64 of file heur_completesol.c.

◆ HEUR_DESC

#define HEUR_DESC   "primal heuristic trying to complete given partial solutions"

Definition at line 65 of file heur_completesol.c.

◆ HEUR_DISPCHAR

#define HEUR_DISPCHAR   SCIP_HEURDISPCHAR_LNS

Definition at line 66 of file heur_completesol.c.

◆ HEUR_PRIORITY

#define HEUR_PRIORITY   0

Definition at line 67 of file heur_completesol.c.

◆ HEUR_FREQ

#define HEUR_FREQ   0

Definition at line 68 of file heur_completesol.c.

◆ HEUR_FREQOFS

#define HEUR_FREQOFS   0

Definition at line 69 of file heur_completesol.c.

◆ HEUR_MAXDEPTH

#define HEUR_MAXDEPTH   0

Definition at line 70 of file heur_completesol.c.

◆ HEUR_TIMING

Definition at line 71 of file heur_completesol.c.

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   TRUE

does the heuristic use a secondary SCIP instance?

Definition at line 72 of file heur_completesol.c.

◆ DEFAULT_MAXNODES

#define DEFAULT_MAXNODES   5000LL

maximum number of nodes to regard in the subproblem

Definition at line 75 of file heur_completesol.c.

◆ DEFAULT_MAXUNKRATE

#define DEFAULT_MAXUNKRATE   0.85

maximum percentage of unknown solution values

Definition at line 76 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_ADDALLSOLS

#define DEFAULT_ADDALLSOLS   FALSE

should all subproblem solutions be added to the original SCIP?

Definition at line 77 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol(), SCIPincludeHeurOfins(), and SCIPincludeHeurZeroobj().

◆ DEFAULT_MINNODES

#define DEFAULT_MINNODES   50LL

minimum number of nodes to regard in the subproblem

Definition at line 78 of file heur_completesol.c.

◆ DEFAULT_NODESOFS

#define DEFAULT_NODESOFS   500LL

number of nodes added to the contingent of the total nodes

Definition at line 79 of file heur_completesol.c.

◆ DEFAULT_NODESQUOT

#define DEFAULT_NODESQUOT   0.1

subproblem nodes in relation to nodes of the original problem

Definition at line 80 of file heur_completesol.c.

◆ DEFAULT_LPLIMFAC

#define DEFAULT_LPLIMFAC   2.0

◆ DEFAULT_OBJWEIGHT

#define DEFAULT_OBJWEIGHT   1.0

weight of the original objective function (1: only original objective)

Definition at line 82 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol(), and SCIPincludeSepaCGMIP().

◆ DEFAULT_BOUNDWIDENING

#define DEFAULT_BOUNDWIDENING   0.1

bound widening factor applied to continuous variables (0: round bounds to next integer, 1: relax to global bounds)

Definition at line 83 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_MINIMPROVE

#define DEFAULT_MINIMPROVE   0.01

factor by which the incumbent should be improved at least

Definition at line 86 of file heur_completesol.c.

◆ DEFAULT_MINOBJWEIGHT

#define DEFAULT_MINOBJWEIGHT   1e-3

minimal weight for original objective function (zero could lead to infinite solutions)

Definition at line 87 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_IGNORECONT

#define DEFAULT_IGNORECONT   FALSE

should solution values for continuous variables be ignored?

Definition at line 88 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_BESTSOLS

#define DEFAULT_BESTSOLS   5

heuristic stops, if the given number of improving solutions were found (-1: no limit)

Definition at line 89 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_MAXPROPROUNDS

#define DEFAULT_MAXPROPROUNDS   10

maximal number of iterations in propagation (-1: no limit)

Definition at line 90 of file heur_completesol.c.

◆ DEFAULT_MAXLPITER

#define DEFAULT_MAXLPITER   -1LL

maximal number of LP iterations (-1: no limit)

Definition at line 91 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_MAXCONTVARS

#define DEFAULT_MAXCONTVARS   -1

maximal number of continuous variables after presolving (-1: no limit)

Definition at line 92 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_BEFOREPRESOL

#define DEFAULT_BEFOREPRESOL   TRUE

should the heuristic run before presolving?

Definition at line 93 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol(), and SCIPincludeHeurOneopt().

◆ EVENTHDLR_NAME

#define EVENTHDLR_NAME   "Completesol"

Definition at line 96 of file heur_completesol.c.

◆ EVENTHDLR_DESC

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

Definition at line 97 of file heur_completesol.c.

Function Documentation

◆ SCIP_DECL_EVENTEXEC()

◆ createSubproblem()

static SCIP_RETCODE createSubproblem ( SCIP * scip,
SCIP * subscip,
SCIP_HEURDATA * heurdata,
SCIP_VAR ** subvars,
SCIP_SOL * partialsol,
SCIP_Bool * tightened )
static

creates a subproblem by fixing a number of variables

Parameters
sciporiginal SCIP data structure
subscipSCIP data structure for the subproblem
heurdataheuristic's private data structure
subvarsthe variables of the subproblem
partialsolpartial solution
tightenedarray to store for which variables we have found bound tightenings

Definition at line 156 of file heur_completesol.c.

References assert(), cutoff, eps, FALSE, frac, heurdata, i, MIN, NULL, nvars, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OBJSENSE_MAXIMIZE, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIP_UNKNOWN, SCIP_VARTYPE_CONTINUOUS, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPchgVarObj(), SCIPcreateConsBasicLinear(), SCIPcreateVarBasic(), SCIPdebugMsg, SCIPfeasFrac(), SCIPgetLowerbound(), SCIPgetNSols(), SCIPgetNVars(), SCIPgetObjsense(), SCIPgetSolVal(), SCIPgetUpperbound(), SCIPgetVars(), SCIPinfinity(), SCIPisEQ(), SCIPisInfinity(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), SCIPsumepsilon(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetProbindex(), SCIPvarIsActive(), SCIPvarIsBinary(), and vars.

Referenced by setupAndSolve().

◆ chgProbingBound()

static SCIP_RETCODE chgProbingBound ( SCIP * scip,
SCIP_VAR * var,
SCIP_Real newval,
SCIP_BRANCHDIR branchdir,
SCIP_Bool * success )
static

perform a probing bound change or fixes the variable

Parameters
sciporiginal SCIP data structure
varproblem variable
newvalnew bound
branchdirbound change direction
successpointer to store whether the bound could be tightened

Definition at line 349 of file heur_completesol.c.

References assert(), FALSE, NULL, SCIP_Bool, SCIP_BRANCHDIR_DOWNWARDS, SCIP_BRANCHDIR_FIXED, SCIP_BRANCHDIR_UPWARDS, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPchgVarLbProbing(), SCIPchgVarUbProbing(), SCIPfixVarProbing(), SCIPisGE(), SCIPisGT(), SCIPisLE(), SCIPisLT(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), TRUE, and var.

Referenced by tightenVariables().

◆ tightenVariables()

static SCIP_RETCODE tightenVariables ( SCIP * scip,
SCIP_HEURDATA * heurdata,
SCIP_VAR ** vars,
int nvars,
SCIP_SOL * sol,
SCIP_Bool * tightened,
SCIP_Bool * infeasible )
static

tries variables bound changes guided by the given solution

Parameters
sciporiginal SCIP data structure
heurdataheuristic's private data structure
varsproblem variables
nvarsnumber of problem variables
solsolution to guide the bound changes
tightenedarray to store if variable bound could be tightened
infeasiblepointer to store whether subproblem is infeasible

Definition at line 399 of file heur_completesol.c.

References assert(), chgProbingBound(), cutoff, FALSE, heurdata, NULL, nvars, REALABS, SCIP_Bool, SCIP_BRANCHDIR_DOWNWARDS, SCIP_BRANCHDIR_FIXED, SCIP_BRANCHDIR_UPWARDS, SCIP_CALL, SCIP_Longint, SCIP_MAXTREEDEPTH, SCIP_OKAY, SCIP_Real, SCIP_SOLORIGIN_PARTIAL, SCIP_UNKNOWN, SCIPbacktrackProbing(), SCIPceil(), SCIPdebugMsg, SCIPfloor(), SCIPgetNContVars(), SCIPgetProbingDepth(), SCIPgetSolVal(), SCIPisEQ(), SCIPisGT(), SCIPisInfinity(), SCIPisIntegral(), SCIPisLT(), SCIPnewProbingNode(), SCIPpropagateProbing(), SCIPsolGetOrigin(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetProbindex(), SCIPvarGetUbGlobal(), SCIPvarGetUbLocal(), SCIPvarIsActive(), SCIPvarIsIntegral(), sol, TRUE, and vars.

Referenced by applyCompletesol().

◆ setupAndSolve()

static SCIP_RETCODE setupAndSolve ( SCIP * scip,
SCIP * subscip,
SCIP_HEUR * heur,
SCIP_HEURDATA * heurdata,
SCIP_RESULT * result,
SCIP_Longint nstallnodes,
SCIP_SOL * partialsol,
SCIP_Bool * tightened )
static
Parameters
sciporiginal SCIP data structure
subscipsub-SCIP data structure
heurheuristic data structure
heurdataheuristic's private data structure
resultresult data structure
nstallnodesnumber of stalling nodes for the subproblem
partialsolpartial solution
tightenedarray to store whether a variable was already tightened

Definition at line 711 of file heur_completesol.c.

References assert(), createSubproblem(), EVENTHDLR_DESC, EVENTHDLR_NAME, FALSE, HEUR_NAME, heurdata, i, NULL, nvars, 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_STAGE_PRESOLVED, SCIP_STATUS_INFEASIBLE, SCIP_STATUS_MEMLIMIT, SCIP_STATUS_NODELIMIT, SCIP_STATUS_TIMELIMIT, SCIP_VERBLEVEL_FULL, SCIP_VERBLEVEL_HIGH, SCIP_VERBLEVEL_NONE, SCIPABORT, SCIPallocBufferArray, SCIPblkmem(), SCIPcatchEvent(), SCIPcopyConsCompression(), SCIPcopyLimits(), SCIPdebug, SCIPdebugMsg, SCIPdropEvent(), SCIPerrorMessage, SCIPfindBranchrule(), SCIPfindNodesel(), SCIPfreeBufferArray, SCIPgetBestSol(), SCIPgetNBinVars(), SCIPgetNConss(), SCIPgetNContVars(), SCIPgetNIntVars(), SCIPgetNNodes(), SCIPgetNSols(), SCIPgetNVars(), SCIPgetPrimalbound(), SCIPgetSols(), SCIPgetSolvingTime(), SCIPgetStage(), SCIPgetStatus(), SCIPgetVars(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPincludeEventhdlrBasic(), SCIPinfinity(), SCIPisNLPEnabled(), SCIPisParamFixed(), SCIPpresolve(), SCIPprintStatistics(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetPresolving(), SCIPsetSeparating(), SCIPsetSubscipsOff(), SCIPsolGetNodenum(), SCIPsolve(), SCIPstatisticPrintf, SCIPtransformProb(), SCIPtranslateSubSol(), SCIPtrySolFree(), SCIPverbMessage(), SCIPwarningMessage(), TRUE, valid, and vars.

Referenced by applyCompletesol().

◆ applyCompletesol()

static SCIP_RETCODE applyCompletesol ( SCIP * scip,
SCIP_HEUR * heur,
SCIP_HEURDATA * heurdata,
SCIP_RESULT * result,
SCIP_Longint nstallnodes,
SCIP_SOL * partialsol )
static

main procedure of the completesol heuristic, creates and solves a sub-SCIP

Parameters
sciporiginal SCIP data structure
heurheuristic data structure
heurdataheuristic's private data structure
resultresult data structure
nstallnodesnumber of stalling nodes for the subproblem
partialsolpartial solution

Definition at line 949 of file heur_completesol.c.

References assert(), heurdata, NULL, nvars, result, SCIP_Bool, SCIP_CALL, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_Longint, SCIP_OKAY, SCIP_VERBLEVEL_HIGH, SCIPallocClearBufferArray, SCIPcheckCopyLimits(), SCIPcreate(), SCIPdebugMsg, SCIPendProbing(), SCIPfree(), SCIPfreeBufferArray, SCIPgetNVars(), SCIPgetVars(), SCIPstartProbing(), SCIPverbMessage(), setupAndSolve(), tightenVariables(), and vars.

Referenced by SCIP_DECL_HEUREXEC().

◆ SCIP_DECL_HEURCOPY()

static SCIP_DECL_HEURCOPY ( heurCopyCompletesol )
static

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

Definition at line 1025 of file heur_completesol.c.

References assert(), HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurCompletesol().

◆ SCIP_DECL_HEURFREE()

static SCIP_DECL_HEURFREE ( heurFreeCompletesol )
static

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

Definition at line 1039 of file heur_completesol.c.

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

◆ SCIP_DECL_HEUREXEC()