Detailed Description
NLP local search primal heuristic using sub-SCIPs.
Definition in file heur_subnlp.c.
#include "blockmemshell/memory.h"
#include "scip/nlpi_ipopt.h"
#include "scip/cons_bounddisjunction.h"
#include "scip/cons_setppc.h"
#include "scip/heur_subnlp.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_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_presol.h"
#include "scip/scip_pricer.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"
#include <string.h>
Go to the source code of this file.
Macros | |
#define | HEUR_NAME "subnlp" |
#define | HEUR_DESC "primal heuristic that performs a local search in an NLP after fixing integer variables and presolving" |
#define | HEUR_DISPCHAR SCIP_HEURDISPCHAR_LNS |
#define | HEUR_PRIORITY -2000010 |
#define | HEUR_FREQ 1 |
#define | HEUR_FREQOFS 0 |
#define | HEUR_MAXDEPTH -1 |
#define | HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
#define | HEUR_USESSUBSCIP FALSE |
Macro Definition Documentation
◆ HEUR_NAME
#define HEUR_NAME "subnlp" |
Definition at line 69 of file heur_subnlp.c.
Referenced by SCIP_DECL_HEURCOPY(), SCIPgetStartCandidateHeurSubNlp(), SCIPincludeHeurSubNlp(), and SCIPupdateStartpointHeurSubNlp().
◆ HEUR_DESC
#define HEUR_DESC "primal heuristic that performs a local search in an NLP after fixing integer variables and presolving" |
Definition at line 70 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_DISPCHAR
#define HEUR_DISPCHAR SCIP_HEURDISPCHAR_LNS |
Definition at line 71 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_PRIORITY
#define HEUR_PRIORITY -2000010 |
Definition at line 72 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_FREQ
#define HEUR_FREQ 1 |
Definition at line 73 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_FREQOFS
#define HEUR_FREQOFS 0 |
Definition at line 74 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_MAXDEPTH
#define HEUR_MAXDEPTH -1 |
Definition at line 75 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_TIMING
#define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
Definition at line 76 of file heur_subnlp.c.
Referenced by SCIP_DECL_HEUREXEC(), SCIP_DECL_HEUREXITSOL(), SCIP_DECL_HEURINITSOL(), and SCIPincludeHeurSubNlp().
◆ HEUR_USESSUBSCIP
#define HEUR_USESSUBSCIP FALSE |
does the heuristic use a secondary SCIP instance? we set this to FALSE because we want this heuristic to also run within other heuristics
Definition at line 77 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
Function Documentation
◆ runHeuristic()
|
static |
indicates whether the heuristic should be running, i.e., whether we expect something nonlinear after fixing all discrete variables
- Parameters
-
scip SCIP data structure runheur buffer to store whether to run heuristic
Definition at line 136 of file heur_subnlp.c.
References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPgetNNlpis(), SCIPhasNLPContinuousNonlinearity(), and SCIPisNLPConstructed().
Referenced by SCIP_DECL_HEUREXEC(), and SCIPupdateStartpointHeurSubNlp().
◆ freeSubSCIP()
|
static |
free sub-SCIP data structure
- Parameters
-
scip SCIP data structure heurdata heuristic data structure
Definition at line 166 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_EVENTTYPE_GBDCHANGED, SCIP_OKAY, SCIPdropVarEvent(), SCIPfree(), SCIPfreeBlockMemoryArray, SCIPgetOrigVarsData(), SCIPreleaseVar(), SCIPvarGetProbindex(), and SCIPvarIsActive().
Referenced by createSubSCIP(), SCIP_DECL_HEUREXITSOL(), SCIPapplyHeurSubNlp(), and solveSubNLP().
◆ createSubSCIP()
|
static |
creates copy of CIP from problem in SCIP
- Parameters
-
scip SCIP data structure heurdata heuristic data structure
Definition at line 219 of file heur_subnlp.c.
References FALSE, freeSubSCIP(), NULL, SCIP_Bool, SCIP_CALL, SCIP_EVENTTYPE_GBDCHANGED, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_PARAMSETTING_OFF, SCIP_STAGE_PRESOLVED, SCIP_STAGE_SOLVED, SCIP_STAGE_SOLVING, SCIP_STATUS_NODELIMIT, SCIPallocClearBlockMemoryArray, SCIPblkmem(), SCIPcaptureVar(), SCIPcatchVarEvent(), SCIPcopyConss(), SCIPcopyParamSettings(), SCIPcopyPlugins(), SCIPcopyProb(), SCIPcopyVars(), SCIPcreate(), SCIPdebugMsg, SCIPfree(), SCIPgetNBinVars(), SCIPgetNConss(), SCIPgetNIntVars(), SCIPgetNNlpis(), SCIPgetNVars(), SCIPgetProbName(), SCIPgetStage(), SCIPgetStatus(), SCIPgetVars(), SCIPgetVarsData(), SCIPhashmapCreate(), SCIPhashmapEntryGetImage(), SCIPhashmapEntryGetOrigin(), SCIPhashmapFree(), SCIPhashmapGetEntry(), SCIPhashmapGetImage(), SCIPhashmapGetNEntries(), SCIPisFeasEQ(), SCIPisNLPConstructed(), SCIPisParamFixed(), SCIPpresolve(), SCIPresetParam(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetPresolving(), SCIPsnprintf(), SCIPsolve(), SCIPtransformProb(), SCIPvarGetLbGlobal(), SCIPvarGetProbindex(), SCIPvarGetUbGlobal(), SCIPvarIsActive(), SCIPwarningMessage(), and TRUE.
Referenced by SCIPapplyHeurSubNlp().
◆ SCIP_DECL_EVENTEXEC()
|
static |
process variable global bound change event
Definition at line 468 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_EVENTTYPE_GLBCHANGED, SCIP_EVENTTYPE_GUBCHANGED, SCIP_OKAY, SCIPchgVarLbGlobal(), SCIPchgVarUbGlobal(), SCIPeventGetNewbound(), SCIPeventGetType(), SCIPeventGetVar(), SCIPgetVars(), and SCIPvarGetProbindex().
◆ createSolFromNLP()
|
static |
- Parameters
-
scip SCIP data structure heur heuristic data structure sol buffer to store solution value; if pointing to NULL, then a new solution is created, otherwise values in the given one are overwritten authorheur the heuristic which should be registered as author of the solution
Definition at line 525 of file heur_subnlp.c.
References MAX, MIN, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPcreateSol(), SCIPgetVarsData(), SCIPhasNLPSolution(), SCIPheurGetData(), SCIPsetSolVal(), SCIPsolSetHeur(), SCIPvarGetLbLocal(), SCIPvarGetNLPSol(), SCIPvarGetUbLocal(), and SCIPvarIsActive().
Referenced by processNLPSol().
◆ processNLPSol()
|
static |
creates SCIP solution from NLP and tries adding to SCIP or only checks feasibility
- Parameters
-
scip original SCIP data structure heur heuristic data structure authorheur the heuristic that should be the author of solution, if any result buffer to store result FOUNDSOL if a solution has been found and accepted resultsol a solution where to store found solution values, if any, or NULL if to try adding to SCIP
Definition at line 591 of file heur_subnlp.c.
References createSolFromNLP(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_FOUNDSOL, SCIP_OKAY, SCIPcheckSol(), SCIPdebugMsg, SCIPgetNLPObjval(), SCIPgetUpperbound(), SCIPhasNLPSolution(), SCIPheurGetData(), SCIPinfoMessage(), SCIPisLE(), SCIPtrySolFree(), and TRUE.
Referenced by solveSubNLP().
◆ createSolFromSubScipSol()
|
static |
- Parameters
-
scip SCIP data structure heur heuristic data structure sol buffer to store solution value; if pointing to NULL, then a new solution is created, otherwise values in the given one are overwritten subsol solution of sub-SCIP authorheur the heuristic which should be registered as author of the solution
Definition at line 707 of file heur_subnlp.c.
References MAX, MIN, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPcreateSol(), SCIPgetSolVal(), SCIPgetVarsData(), SCIPheurGetData(), SCIPsetSolVal(), SCIPsolSetHeur(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and SCIPvarIsActive().
Referenced by solveSubNLP().
◆ calcIterLimit()
|
static |
finds an iteration limit
- Parameters
-
scip original SCIP data structure heurdata heuristic data
Definition at line 774 of file heur_subnlp.c.
Referenced by SCIP_DECL_HEUREXEC(), and solveSubNLP().
◆ solveSubNLP()
|
static |
solves the subNLP specified in subscip
- Parameters
-
scip original SCIP data structure heur heuristic data structure result buffer to store result, DIDNOTFIND, FOUNDSOL, or CUTOFF refpoint point to take fixation of discrete variables from, and startpoint for NLP solver; if NULL, then LP solution is used resultsol a solution where to store found solution values, if any, or NULL if to try adding to SCIP
Definition at line 799 of file heur_subnlp.c.
References SCIP_NlpStatistics::boundviol, calcIterLimit(), SCIP_NlpStatistics::consviol, createSolFromSubScipSol(), FALSE, freeSubSCIP(), MAX, MIN, SCIP_NlpStatistics::niterations, NULL, processNLPSol(), REALABS, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_ERROR, SCIP_FOUNDSOL, SCIP_NLPSOLSTAT_FEASIBLE, SCIP_NLPSOLSTAT_GLOBINFEASIBLE, SCIP_NLPSOLSTAT_LOCINFEASIBLE, SCIP_NLPTERMSTAT_ITERLIMIT, SCIP_NLPTERMSTAT_OKAY, SCIP_NLPTERMSTAT_OUTOFMEMORY, SCIP_OKAY, SCIP_Real, SCIP_STAGE_PRESOLVED, SCIP_STAGE_PRESOLVING, SCIP_STAGE_SOLVED, SCIP_STAGE_SOLVING, SCIP_STATUS_BESTSOLLIMIT, SCIP_STATUS_GAPLIMIT, SCIP_STATUS_INFEASIBLE, SCIP_STATUS_INFORUNBD, SCIP_STATUS_MEMLIMIT, SCIP_STATUS_NODELIMIT, SCIP_STATUS_OPTIMAL, SCIP_STATUS_SOLLIMIT, SCIP_STATUS_STALLNODELIMIT, SCIP_STATUS_TIMELIMIT, SCIP_STATUS_TOTALNODELIMIT, SCIP_STATUS_UNBOUNDED, SCIP_STATUS_USERINTERRUPT, SCIP_VERBLEVEL_MINIMAL, SCIPABORT, SCIPallocBufferArray, SCIPcheckSol(), SCIPdebug, SCIPdebugMsg, SCIPerrorMessage, SCIPfeastol(), SCIPfreeBufferArray, SCIPgetNLPObjval(), SCIPgetNLPSolstat(), SCIPgetNLPStatistics(), SCIPgetNLPTermstat(), SCIPgetNLPVars(), SCIPgetNNLPVars(), SCIPgetNPresolRounds(), SCIPgetNSols(), SCIPgetNVars(), SCIPgetProbName(), SCIPgetRealParam(), SCIPgetSols(), SCIPgetSolVal(), SCIPgetSolvingTime(), SCIPgetStage(), SCIPgetStatus(), SCIPgetUpperbound(), SCIPheurGetData(), SCIPinfoMessage(), SCIPisInfinity(), SCIPisLE(), SCIPisNLPConstructed(), SCIPisTransformed(), SCIPisZero(), SCIPmergeNLPIStatistics(), SCIPpresolve(), SCIPprintStatistics(), SCIPsetLongintParam(), SCIPsetNLPInitialGuess(), SCIPsetRealParam(), SCIPsolGetHeur(), SCIPsolve(), SCIPsolveNLP, SCIPtrySolFree(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetOrigvarSum(), SCIPvarGetProbindex(), SCIPvarGetUbGlobal(), SCIPverbMessage(), SCIPwarningMessage(), SCIP_NlpStatistics::totaltime, and TRUE.
Referenced by SCIPapplyHeurSubNlp().
◆ forbidFixation()
|
static |
adds a set covering or bound disjunction constraint to the original problem
- Parameters
-
scip SCIP data structure heurdata heuristic data
Definition at line 1260 of file heur_subnlp.c.
References FALSE, NULL, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPaddCons(), SCIPallocBufferArray, SCIPceil(), SCIPcreateConsBounddisjunction(), SCIPcreateConsSetcover(), SCIPdebugMsg, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPgetNegatedVar(), SCIPgetOrigVarsData(), SCIPisEQ(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetProbindex(), SCIPvarGetType(), SCIPvarGetUbGlobal(), and TRUE.
Referenced by SCIPapplyHeurSubNlp().
◆ SCIP_DECL_HEURCOPY()
|
static |
copy method for primal heuristic plugins (called when SCIP copies plugins)
Definition at line 1432 of file heur_subnlp.c.
References HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurSubNlp().
◆ SCIP_DECL_HEURFREE()
|
static |
destructor of primal heuristic to free user data (called when SCIP is exiting)
Definition at line 1446 of file heur_subnlp.c.
References NULL, SCIP_OKAY, SCIPfreeBlockMemory, and SCIPheurGetData().
◆ SCIP_DECL_HEURINIT()
|
static |
initialization method of primal heuristic (called after problem was transformed)
Definition at line 1466 of file heur_subnlp.c.
References FALSE, NULL, SCIP_OKAY, SCIPfeastol(), and SCIPheurGetData().
◆ SCIP_DECL_HEURINITSOL()
|
static |
solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
Definition at line 1495 of file heur_subnlp.c.
References HEUR_TIMING, NULL, SCIP_HEURTIMING_DURINGLPLOOP, SCIP_OKAY, SCIPheurGetFreqofs(), 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 1509 of file heur_subnlp.c.
References FALSE, freeSubSCIP(), HEUR_TIMING, NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeSol(), SCIPheurGetData(), and SCIPheurSetTimingmask().
◆ SCIP_DECL_HEUREXEC()
|
static |
execution method of primal heuristic
Definition at line 1539 of file heur_subnlp.c.
References calcIterLimit(), HEUR_TIMING, NULL, runHeuristic(), SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DELAYED, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_LPSOLSTAT_OPTIMAL, SCIP_LPSOLSTAT_UNBOUNDEDRAY, SCIP_OKAY, SCIP_Real, SCIPapplyHeurSubNlp(), SCIPdebugMsg, SCIPfreeSol(), SCIPgetLocalDualbound(), SCIPgetLPSolstat(), SCIPgetNLPBranchCands(), SCIPgetNNodes(), SCIPgetPrimalbound(), SCIPheurGetData(), SCIPheurGetName(), SCIPheurGetNCalls(), SCIPheurGetNSolsFound(), SCIPheurSetTimingmask(), SCIPinfoMessage(), SCIPisEQ(), SCIPisInfinity(), and SCIPsolGetHeur().