Scippy

SCIP

Solving Constraint Integer Programs

heur_completesol.c File Reference

Detailed Description

COMPLETESOL - primal heuristic trying to complete given partial solutions.

Author
Jakob Witzig

Definition in file heur_completesol.c.

#include <assert.h>
#include <string.h>
#include <stdio.h>
#include "scip/heur_completesol.h"
#include "scip/scipdefplugins.h"
#include "scip/pub_misc.h"
#include "scip/def.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   'h'
 
#define HEUR_PRIORITY   0
 
#define HEUR_FREQ   1
 
#define HEUR_FREQOFS   0
 
#define HEUR_MAXDEPTH   0
 
#define HEUR_TIMING   SCIP_HEURTIMING_BEFOREPRESOL
 
#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 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, SCIP_Bool *success)
 
static SCIP_RETCODE createNewSol (SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
 
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)
 
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 32 of file heur_completesol.c.

Referenced by applyCompletesol(), and SCIPincludeHeurCompletesol().

◆ HEUR_DESC

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

Definition at line 33 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ HEUR_DISPCHAR

#define HEUR_DISPCHAR   'h'

Definition at line 34 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ HEUR_PRIORITY

#define HEUR_PRIORITY   0

Definition at line 35 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ HEUR_FREQ

#define HEUR_FREQ   1

Definition at line 36 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ HEUR_FREQOFS

#define HEUR_FREQOFS   0

Definition at line 37 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ HEUR_MAXDEPTH

#define HEUR_MAXDEPTH   0

Definition at line 38 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ HEUR_TIMING

#define HEUR_TIMING   SCIP_HEURTIMING_BEFOREPRESOL

Definition at line 39 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   TRUE

does the heuristic use a secondary SCIP instance?

Definition at line 40 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_MAXNODES

#define DEFAULT_MAXNODES   5000LL

maximum number of nodes to regard in the subproblem

Definition at line 43 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_MAXUNKRATE

#define DEFAULT_MAXUNKRATE   0.85

maximum percentage of unknown solution values

Definition at line 44 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 45 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_MINNODES

#define DEFAULT_MINNODES   50LL

minimum number of nodes to regard in the subproblem

Definition at line 46 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_NODESOFS

#define DEFAULT_NODESOFS   500LL

number of nodes added to the contingent of the total nodes

Definition at line 47 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_NODESQUOT

#define DEFAULT_NODESQUOT   0.1

subproblem nodes in relation to nodes of the original problem

Definition at line 48 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_LPLIMFAC

#define DEFAULT_LPLIMFAC   2.0

factor by which the limit on the number of LP depends on the node limit

Definition at line 49 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_OBJWEIGHT

#define DEFAULT_OBJWEIGHT   1.0

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

Definition at line 50 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ 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 51 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 56 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ DEFAULT_MINOBJWEIGHT

#define DEFAULT_MINOBJWEIGHT   1e-3

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

Definition at line 57 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 58 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 59 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 60 of file heur_completesol.c.

Referenced by SCIPincludeHeurCompletesol().

◆ EVENTHDLR_NAME

#define EVENTHDLR_NAME   "Completesol"

Definition at line 63 of file heur_completesol.c.

Referenced by applyCompletesol().

◆ EVENTHDLR_DESC

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

Definition at line 64 of file heur_completesol.c.

Referenced by applyCompletesol().

Function Documentation

◆ SCIP_DECL_EVENTEXEC()

static SCIP_DECL_EVENTEXEC ( eventExecCompletesol  )
static

Definition at line 95 of file heur_completesol.c.

◆ createSubproblem()

static SCIP_RETCODE createSubproblem ( SCIP scip,
SCIP subscip,
SCIP_HEURDATA heurdata,
SCIP_VAR **  subvars,
SCIP_SOL partialsol,
SCIP_Bool tightened,
SCIP_Bool success 
)
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
successpointer to store whether the creation was successful

Definition at line 120 of file heur_completesol.c.

References createNewSol(), FALSE, MIN, NULL, 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 TRUE.

Referenced by applyCompletesol().

◆ 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
heurCompletesol heuristic structure
subsolsolution of the subproblem or the partial
successused to store whether new solution was found or not

Definition at line 313 of file heur_completesol.c.

References chgProbingBound(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_UNKNOWN, SCIPcreateSol(), SCIPgetNOrigVars(), SCIPgetSolVal(), SCIPgetVarsData(), SCIPisInfinity(), SCIPsetSolVal(), SCIPtrySolFree(), and TRUE.

Referenced by applyCompletesol(), and createSubproblem().

◆ 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 361 of file heur_completesol.c.

References FALSE, NULL, 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(), tightenVariables(), and TRUE.

Referenced by createNewSol(), and tightenVariables().

◆ tightenVariables()

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

◆ 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 solutions

Definition at line 704 of file heur_completesol.c.

References createNewSol(), createSubproblem(), EVENTHDLR_DESC, EVENTHDLR_NAME, FALSE, HEUR_NAME, NULL, SCIP_Bool, SCIP_CALL, SCIP_CALL_ABORT, SCIP_DECL_HEURCOPY(), SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_EVENTTYPE_LPSOLVED, SCIP_FOUNDSOL, SCIP_OKAY, SCIP_PARAMSETTING_FAST, SCIP_PARAMSETTING_OFF, SCIP_PLUGINNOTFOUND, SCIP_VERBLEVEL_FULL, SCIP_VERBLEVEL_NONE, SCIPallocBufferArray, SCIPallocClearBufferArray, SCIPblkmem(), SCIPcatchEvent(), SCIPcheckCopyLimits(), SCIPcopyConsCompression(), SCIPcopyLimits(), SCIPcreate(), SCIPdebug, SCIPdebugMsg, SCIPdropEvent(), SCIPendProbing(), SCIPerrorMessage, SCIPfindBranchrule(), SCIPfindNodesel(), SCIPfree(), SCIPfreeBufferArray, SCIPgetBestSol(), SCIPgetNConss(), SCIPgetNNodes(), SCIPgetNSols(), SCIPgetNVars(), SCIPgetPrimalbound(), SCIPgetSols(), SCIPgetSolvingTime(), SCIPgetVars(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPincludeEventhdlrBasic(), SCIPinfinity(), SCIPisParamFixed(), SCIPprintStatistics(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetPresolving(), SCIPsetSeparating(), SCIPsetSubscipsOff(), SCIPsolGetNodenum(), SCIPsolve(), SCIPstartProbing(), SCIPstatisticPrintf, SCIPtransformProb(), tightenVariables(), and TRUE.

Referenced by tightenVariables().

◆ SCIP_DECL_HEURCOPY()

static SCIP_DECL_HEURCOPY ( heurCopyCompletesol  )
static

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

Definition at line 901 of file heur_completesol.c.

Referenced by applyCompletesol().

◆ 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 915 of file heur_completesol.c.

◆ SCIP_DECL_HEUREXEC()

static SCIP_DECL_HEUREXEC ( heurExecCompletesol  )
static

execution method of primal heuristic

Definition at line 935 of file heur_completesol.c.