Detailed Description
improvement heuristic that alters single variable values
Definition in file heur_oneopt.c.
#include "blockmemshell/memory.h"
#include "scip/heur_oneopt.h"
#include "scip/pub_heur.h"
#include "scip/pub_lp.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_misc_sort.h"
#include "scip/pub_sol.h"
#include "scip/pub_var.h"
#include "scip/scip_copy.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_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_tree.h"
#include <string.h>
Go to the source code of this file.
Macros | |
#define | HEUR_NAME "oneopt" |
#define | HEUR_DESC "1-opt heuristic which tries to improve setting of single integer variables" |
#define | HEUR_DISPCHAR SCIP_HEURDISPCHAR_ITERATIVE |
#define | HEUR_PRIORITY -20000 |
#define | HEUR_FREQ 1 |
#define | HEUR_FREQOFS 0 |
#define | HEUR_MAXDEPTH -1 |
#define | HEUR_TIMING SCIP_HEURTIMING_BEFOREPRESOL | SCIP_HEURTIMING_AFTERNODE |
#define | HEUR_USESSUBSCIP FALSE |
#define | DEFAULT_WEIGHTEDOBJ TRUE |
#define | DEFAULT_DURINGROOT TRUE |
#define | DEFAULT_BEFOREPRESOL FALSE |
#define | DEFAULT_FORCELPCONSTRUCTION FALSE |
#define | DEFAULT_USELOOP TRUE |
Functions | |
static SCIP_Real | calcShiftVal (SCIP *scip, SCIP_VAR *var, SCIP_Real solval, SCIP_Real *activities) |
static SCIP_RETCODE | updateRowActivities (SCIP *scip, SCIP_Real *activities, SCIP_VAR *var, SCIP_Real shiftval) |
static SCIP_RETCODE | setupAndSolveSubscipOneopt (SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_VAR **vars, SCIP_VAR **subvars, SCIP_SOL *bestsol, SCIP_RESULT *result, SCIP_Bool *valid) |
static | SCIP_DECL_HEURCOPY (heurCopyOneopt) |
static | SCIP_DECL_HEURFREE (heurFreeOneopt) |
static | SCIP_DECL_HEURINITSOL (heurInitsolOneopt) |
static | SCIP_DECL_HEUREXITSOL (heurExitsolOneopt) |
static | SCIP_DECL_HEURINIT (heurInitOneopt) |
static | SCIP_DECL_HEUREXEC (heurExecOneopt) |
SCIP_RETCODE | SCIPincludeHeurOneopt (SCIP *scip) |
Macro Definition Documentation
◆ HEUR_NAME
#define HEUR_NAME "oneopt" |
Definition at line 52 of file heur_oneopt.c.
Referenced by SCIP_DECL_HEURCOPY(), SCIP_DECL_HEUREXITSOL(), SCIP_DECL_HEURFREE(), SCIP_DECL_HEURINITSOL(), and SCIPincludeHeurOneopt().
◆ HEUR_DESC
#define HEUR_DESC "1-opt heuristic which tries to improve setting of single integer variables" |
Definition at line 53 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ HEUR_DISPCHAR
#define HEUR_DISPCHAR SCIP_HEURDISPCHAR_ITERATIVE |
Definition at line 54 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ HEUR_PRIORITY
#define HEUR_PRIORITY -20000 |
Definition at line 55 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ HEUR_FREQ
#define HEUR_FREQ 1 |
Definition at line 56 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ HEUR_FREQOFS
#define HEUR_FREQOFS 0 |
Definition at line 57 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ HEUR_MAXDEPTH
#define HEUR_MAXDEPTH -1 |
Definition at line 58 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ HEUR_TIMING
#define HEUR_TIMING SCIP_HEURTIMING_BEFOREPRESOL | SCIP_HEURTIMING_AFTERNODE |
Definition at line 59 of file heur_oneopt.c.
Referenced by SCIP_DECL_HEUREXEC(), SCIP_DECL_HEUREXITSOL(), and SCIPincludeHeurOneopt().
◆ HEUR_USESSUBSCIP
#define HEUR_USESSUBSCIP FALSE |
does the heuristic use a secondary SCIP instance?
Definition at line 60 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ DEFAULT_WEIGHTEDOBJ
#define DEFAULT_WEIGHTEDOBJ TRUE |
should the objective be weighted with the potential shifting value when sorting the shifting candidates?
Definition at line 62 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ DEFAULT_DURINGROOT
#define DEFAULT_DURINGROOT TRUE |
should the heuristic be called before and during the root node?
Definition at line 63 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ DEFAULT_BEFOREPRESOL
#define DEFAULT_BEFOREPRESOL FALSE |
should the heuristic be called before presolving
Definition at line 64 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ DEFAULT_FORCELPCONSTRUCTION
#define DEFAULT_FORCELPCONSTRUCTION FALSE |
should the construction of the LP be forced even if LP solving is deactivated?
Definition at line 65 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
◆ DEFAULT_USELOOP
#define DEFAULT_USELOOP TRUE |
should the heuristic continue to run as long as improvements are found?
Definition at line 66 of file heur_oneopt.c.
Referenced by SCIPincludeHeurOneopt().
Function Documentation
◆ calcShiftVal()
|
static |
compute value by which the solution of variable var
can be shifted
- Parameters
-
scip SCIP data structure var variable that should be shifted solval current solution value activities LP row activities
Definition at line 89 of file heur_oneopt.c.
References FALSE, MAX, NULL, SCIP_Bool, SCIP_Real, SCIPcolGetNLPNonz(), SCIPcolGetRows(), SCIPcolGetVals(), SCIPdebugMsg, SCIPfeasFloor(), SCIPgetNLPRows(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPisInfinity(), SCIProwGetLhs(), SCIProwGetLPPos(), SCIProwGetName(), SCIProwGetRhs(), SCIProwIsInLP(), SCIProwIsLocal(), SCIPvarGetCol(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetUbGlobal(), and TRUE.
Referenced by SCIP_DECL_HEUREXEC().
◆ updateRowActivities()
|
static |
update row activities after a variable's solution value changed
- Parameters
-
scip SCIP data structure activities LP row activities var variable that has been changed shiftval value that is added to variable
Definition at line 185 of file heur_oneopt.c.
References NULL, SCIP_OKAY, SCIP_Real, SCIPcolGetNLPNonz(), SCIPcolGetRows(), SCIPcolGetVals(), SCIPgetNLPRows(), SCIPinfinity(), SCIPisInfinity(), SCIProwGetLPPos(), SCIProwIsLocal(), and SCIPvarGetCol().
Referenced by SCIP_DECL_HEUREXEC().
◆ setupAndSolveSubscipOneopt()
|
static |
setup and solve oneopt sub-SCIP
- Parameters
-
scip SCIP data structure subscip sub-SCIP data structure heur oneopt heuristic vars SCIP variables subvars subproblem's variables bestsol incumbent solution result pointer to store the result valid pointer to store the valid value
Definition at line 235 of file heur_oneopt.c.
References FALSE, NULL, SCIP_CALL, SCIP_CALL_ABORT, SCIP_FOUNDSOL, SCIP_OKAY, SCIP_PARAMSETTING_OFF, SCIPblkmem(), SCIPcopy(), SCIPcopyLimits(), SCIPcreateOrigSol(), SCIPgetNVars(), SCIPgetSolVal(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPisParamFixed(), SCIPprintStatistics(), SCIPsetBoolParam(), SCIPsetHeuristics(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetPresolving(), SCIPsetSeparating(), SCIPsetSolVal(), SCIPsolve(), SCIPtransformProb(), SCIPtranslateSubSols(), SCIPtrySolFree(), SCIPunfixParam(), SCIPwarningMessage(), and TRUE.
Referenced by SCIP_DECL_HEUREXEC().
◆ SCIP_DECL_HEURCOPY()
|
static |
copy method for primal heuristic plugins (called when SCIP copies plugins)
Definition at line 361 of file heur_oneopt.c.
References HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurOneopt().
◆ SCIP_DECL_HEURFREE()
|
static |
destructor of primal heuristic to free user data (called when SCIP is exiting)
Definition at line 375 of file heur_oneopt.c.
References HEUR_NAME, NULL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPheurGetData(), SCIPheurGetName(), and SCIPheurSetData().
◆ SCIP_DECL_HEURINITSOL()
|
static |
solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
Definition at line 395 of file heur_oneopt.c.
References HEUR_NAME, NULL, SCIP_HEURTIMING_BEFORENODE, SCIP_HEURTIMING_DURINGLPLOOP, SCIP_OKAY, SCIPheurGetData(), SCIPheurGetFreqofs(), SCIPheurGetName(), and SCIPheurSetTimingmask().
◆ SCIP_DECL_HEUREXITSOL()
|
static |
solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)
Definition at line 414 of file heur_oneopt.c.
References HEUR_NAME, HEUR_TIMING, NULL, SCIP_OKAY, SCIPheurGetName(), and SCIPheurSetTimingmask().
◆ SCIP_DECL_HEURINIT()
|
static |
initialization method of primal heuristic (called after problem was transformed)
Definition at line 427 of file heur_oneopt.c.
References NULL, SCIP_OKAY, and SCIPheurGetData().
◆ SCIP_DECL_HEUREXEC()
|
static |
execution method of primal heuristic
Definition at line 446 of file heur_oneopt.c.
References calcShiftVal(), FALSE, HEUR_TIMING, NULL, SCIP_Bool, SCIP_CALL, SCIP_DELAYED, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_FOUNDSOL, SCIP_HEURTIMING_BEFORENODE, SCIP_HEURTIMING_BEFOREPRESOL, SCIP_LPSOLSTAT_OPTIMAL, SCIP_OKAY, SCIP_Real, SCIP_VARSTATUS_COLUMN, SCIPallocBufferArray, SCIPcheckCopyLimits(), SCIPchgVarLbDive(), SCIPchgVarUbDive(), SCIPconstructLP(), SCIPcreate(), SCIPcreateSolCopy(), SCIPcutoffNode(), SCIPdebug, SCIPdebugMsg, SCIPendDive(), SCIPflushLP(), SCIPfree(), SCIPfreeBufferArray, SCIPfreeSol(), SCIPgetBestSol(), SCIPgetCurrentNode(), SCIPgetLPRowsData(), SCIPgetLPSolstat(), SCIPgetNLPIterations(), SCIPgetNLPRows(), SCIPgetNNodes(), SCIPgetRowSolActivity(), SCIPgetSolVal(), SCIPgetVarsData(), SCIPhasCurrentNodeLP(), SCIPheurGetData(), SCIPheurSetTimingmask(), SCIPisFeasGE(), SCIPisFeasGT(), SCIPisFeasLE(), SCIPisFeasLT(), SCIPisFeasZero(), SCIPlinkLPSol(), SCIPprintRow(), SCIPprintSol(), SCIPreallocBufferArray, SCIProwGetLhs(), SCIProwGetLPPos(), SCIProwGetName(), SCIProwGetRhs(), SCIProwIsLocal(), SCIPsetSolVal(), SCIPsolGetIndex(), SCIPsolIsOriginal(), SCIPsolSetHeur(), SCIPsolveDiveLP(), SCIPsortRealPtr(), SCIPstartDive(), SCIPtrySol(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetStatus(), SCIPvarGetType(), SCIPvarGetUbGlobal(), SCIPwarningMessage(), setupAndSolveSubscipOneopt(), TRUE, and updateRowActivities().