Detailed Description
NLP local search primal heuristic using sub-SCIPs.
Definition in file heur_subnlp.c.
#include "blockmemshell/memory.h"
#include "nlpi/nlpi.h"
#include "scip/cons_bounddisjunction.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_varbound.h"
#include "scip/heur_subnlp.h"
#include "scip/pub_cons.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_numerics.h"
#include "scip/scip_param.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 'q' |
#define | HEUR_PRIORITY -2000000 |
#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 62 of file heur_subnlp.c.
Referenced by SCIP_DECL_HEURCOPY(), SCIPaddLinearConsToNlpHeurSubNlp(), SCIPgetStartCandidateHeurSubNlp(), SCIPgetSubScipHeurSubNlp(), SCIPgetVarMappingScip2SubScipHeurSubNlp(), SCIPgetVarMappingSubScip2ScipHeurSubNlp(), 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 63 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_DISPCHAR
#define HEUR_DISPCHAR 'q' |
Definition at line 64 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_PRIORITY
#define HEUR_PRIORITY -2000000 |
Definition at line 65 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_FREQ
#define HEUR_FREQ 1 |
Definition at line 66 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_FREQOFS
#define HEUR_FREQOFS 0 |
Definition at line 67 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_MAXDEPTH
#define HEUR_MAXDEPTH -1 |
Definition at line 68 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
◆ HEUR_TIMING
#define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
Definition at line 69 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 70 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
Function Documentation
◆ runHeuristic()
indicates whether the heuristic should be running, i.e., whether we expect something nonlinear after fixing all discrete variables
- Parameters
-
scip SCIP data structure
Definition at line 124 of file heur_subnlp.c.
References FALSE, NULL, SCIPgetNNlpis(), SCIPhasNLPContinuousNonlinearity(), SCIPisNLPConstructed(), and TRUE.
Referenced by SCIP_DECL_HEUREXEC(), SCIP_DECL_HEURINITSOL(), and SCIPupdateStartpointHeurSubNlp().
◆ createSubSCIP()
|
static |
creates copy of CIP from problem in SCIP
- Parameters
-
scip SCIP data structure heurdata heuristic data structure
Definition at line 143 of file heur_subnlp.c.
References BMSclearMemoryArray, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_EVENTTYPE_GBDCHANGED, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_VERBLEVEL_FULL, SCIPallocBlockMemoryArray, SCIPblkmem(), SCIPcaptureVar(), SCIPcatchVarEvent(), SCIPcopyConss(), SCIPcopyParamSettings(), SCIPcopyPlugins(), SCIPcopyVars(), SCIPcreate(), SCIPcreateProb(), SCIPdebugMsg, SCIPfree(), SCIPgetNConss(), SCIPgetNNlpis(), SCIPgetProbName(), SCIPgetSubscipDepth(), SCIPgetVarsData(), SCIPhashmapCreate(), SCIPhashmapEntryGetImage(), SCIPhashmapEntryGetOrigin(), SCIPhashmapFree(), SCIPhashmapGetEntry(), SCIPhashmapGetImage(), SCIPhashmapGetNEntries(), SCIPisFeasEQ(), SCIPisParamFixed(), SCIPnlpStatisticsCreate(), SCIPresetParam(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetSubscipDepth(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetProbindex(), SCIPvarGetUbGlobal(), SCIPvarIsActive(), SCIPverbMessage(), and TRUE.
Referenced by SCIP_DECL_HEURINITSOL(), SCIPapplyHeurSubNlp(), and SCIPresolveSolHeurSubNlp().
◆ freeSubSCIP()
|
static |
free sub-SCIP data structure
- Parameters
-
scip SCIP data structure heurdata heuristic data structure
Definition at line 352 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_EVENTTYPE_GBDCHANGED, SCIP_OKAY, SCIPblkmem(), SCIPdropVarEvent(), SCIPfree(), SCIPfreeBlockMemoryArray, SCIPgetOrigVarsData(), SCIPnlpStatisticsFree(), SCIPreleaseVar(), SCIPvarGetProbindex(), and SCIPvarIsActive().
Referenced by SCIP_DECL_HEUREXITSOL(), SCIPapplyHeurSubNlp(), SCIPresolveSolHeurSubNlp(), and solveSubNLP().
◆ SCIP_DECL_EVENTEXEC()
|
static |
process variable global bound change event
Definition at line 410 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_EVENTTYPE_GLBCHANGED, SCIP_EVENTTYPE_GUBCHANGED, SCIP_OKAY, SCIPchgVarLbGlobal(), SCIPchgVarUbGlobal(), SCIPeventGetType(), SCIPeventGetVar(), SCIPgetVars(), SCIPvarGetLbGlobal(), SCIPvarGetProbindex(), and SCIPvarGetUbGlobal().
◆ addLinearConstraints()
|
static |
adds linear constraints from a SCIP instance to its NLP
- Parameters
-
scip SCIP data structure conshdlr constraint handler for linear constraints addcombconss whether to add combinatorial linear constraints to NLP addcontconss whether to add continuous linear constraints to NLP
Definition at line 467 of file heur_subnlp.c.
References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPaddNlRow(), SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconsIsChecked(), SCIPconsIsEnabled(), SCIPcreateNlRow(), SCIPgetLhsLinear(), SCIPgetNVarsLinear(), SCIPgetRhsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPisRelLE(), SCIPreleaseNlRow(), SCIPvarGetType(), and TRUE.
Referenced by addLinearConstraintsToNlp().
◆ addVarboundConstraints()
|
static |
adds variable bound constraints from a SCIP instance to its NLP
- Parameters
-
scip SCIP data structure conshdlr constraint handler for linear constraints addcombconss whether to add combinatorial linear constraints to NLP addcontconss whether to add continuous linear constraints to NLP
Definition at line 540 of file heur_subnlp.c.
References NULL, SCIP_Bool, SCIP_CALL, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddNlRow(), SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconsIsChecked(), SCIPconsIsEnabled(), SCIPcreateNlRow(), SCIPgetLhsVarbound(), SCIPgetRhsVarbound(), SCIPgetVarVarbound(), SCIPgetVbdcoefVarbound(), SCIPgetVbdvarVarbound(), SCIPreleaseNlRow(), and SCIPvarGetType().
Referenced by addLinearConstraintsToNlp().
◆ addLogicOrConstraints()
|
static |
adds logic-or constraints to NLP
- Parameters
-
scip SCIP data structure conshdlr constraint handler for linear constraints
Definition at line 597 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, SCIP_Real, SCIPaddNlRow(), SCIPallocBufferArray, SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconsIsChecked(), SCIPconsIsEnabled(), SCIPcreateNlRow(), SCIPfreeBufferArrayNull, SCIPgetNVarsLogicor(), SCIPgetVarsLogicor(), SCIPinfinity(), SCIPreallocBufferArray, and SCIPreleaseNlRow().
Referenced by addLinearConstraintsToNlp().
◆ addSetppcConstraints()
|
static |
adds setppc constraints to NLP
- Parameters
-
scip SCIP data structure conshdlr constraint handler for linear constraints
Definition at line 665 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_ERROR, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, SCIP_Real, SCIP_SETPPCTYPE_COVERING, SCIP_SETPPCTYPE_PACKING, SCIP_SETPPCTYPE_PARTITIONING, SCIPaddNlRow(), SCIPallocBufferArray, SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconsIsChecked(), SCIPconsIsEnabled(), SCIPcreateNlRow(), SCIPerrorMessage, SCIPfreeBufferArrayNull, SCIPgetNVarsSetppc(), SCIPgetTypeSetppc(), SCIPgetVarsSetppc(), SCIPinfinity(), SCIPreallocBufferArray, and SCIPreleaseNlRow().
Referenced by addLinearConstraintsToNlp().
◆ addKnapsackConstraints()
|
static |
adds knapsack constraints to NLP
- Parameters
-
scip SCIP data structure conshdlr constraint handler for linear constraints
Definition at line 757 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_EXPRCURV_LINEAR, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIPaddNlRow(), SCIPallocBufferArray, SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconsIsChecked(), SCIPconsIsEnabled(), SCIPcreateNlRow(), SCIPfreeBufferArrayNull, SCIPgetCapacityKnapsack(), SCIPgetNVarsKnapsack(), SCIPgetVarsKnapsack(), SCIPgetWeightsKnapsack(), SCIPinfinity(), SCIPreallocBufferArray, and SCIPreleaseNlRow().
Referenced by addLinearConstraintsToNlp().
◆ addLinearConstraintsToNlp()
|
static |
adds combinatorial and/or continuous variants of linear constraints from a SCIP instance to its NLP
- Parameters
-
scip SCIP data structure addcombconss whether to add combinatorial linear constraints to NLP addcontconss whether to add continuous linear constraints to NLP
Definition at line 828 of file heur_subnlp.c.
References addKnapsackConstraints(), addLinearConstraints(), addLogicOrConstraints(), addSetppcConstraints(), addVarboundConstraints(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPfindConshdlr().
Referenced by SCIPaddLinearConsToNlpHeurSubNlp(), and solveSubNLP().
◆ 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 879 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIPcreateSol(), SCIPgetNOrigVars(), SCIPgetOrigVars(), SCIPheurGetData(), SCIPsetSolVal(), SCIPsolSetHeur(), SCIPvarGetNLPSol(), and SCIPvarIsActive().
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 930 of file heur_subnlp.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPcreateSol(), SCIPgetNOrigVars(), SCIPgetOrigVars(), SCIPgetSolVal(), SCIPheurGetData(), SCIPsetSolVal(), SCIPsolSetHeur(), and SCIPvarIsActive().
Referenced by solveSubNLP().
◆ solveSubNLP()
|
static |
- 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 itercontingent iteration limit for NLP solver, or -1 for default of NLP heuristic timelimit time limit for NLP solver iterused buffer to store number of iterations used by NLP solver, or NULL if not of interest tighttolerances whether to use tight feasibility tolerances and reduce presolve resultsol a solution where to store found solution values, if any, or NULL if to try adding to SCIP
Definition at line 972 of file heur_subnlp.c.
References addLinearConstraintsToNlp(), createSolFromNLP(), createSolFromSubScipSol(), FALSE, freeSubSCIP(), MAX, MIN, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_ERROR, SCIP_FOUNDSOL, SCIP_LONGINT_FORMAT, SCIP_NLPPAR_FEASTOL, SCIP_NLPPAR_ITLIM, SCIP_NLPPAR_OPTFILE, SCIP_NLPPAR_TILIM, SCIP_NLPPAR_VERBLEVEL, SCIP_NLPSOLSTAT_FEASIBLE, SCIP_NLPTERMSTAT_MEMERR, SCIP_OKAY, SCIP_PARAMSETTING_DEFAULT, SCIP_PARAMSETTING_FAST, SCIP_Real, SCIP_STAGE_PRESOLVED, SCIP_STAGE_PRESOLVING, SCIP_STAGE_SOLVED, 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(), SCIPdebugMsg, SCIPepsilon(), SCIPerrorMessage, SCIPfeastol(), SCIPfreeBufferArray, SCIPfreeSol(), SCIPfreeTransform(), SCIPgetMessagehdlr(), SCIPgetNLPObjval(), SCIPgetNLPSolstat(), SCIPgetNLPStatistics(), SCIPgetNLPTermstat(), SCIPgetNLPVars(), SCIPgetNNLPVars(), SCIPgetNSols(), SCIPgetNVars(), SCIPgetObjlimit(), SCIPgetProbName(), SCIPgetRealParam(), SCIPgetSols(), SCIPgetSolVal(), SCIPgetStage(), SCIPgetStatus(), SCIPheurGetData(), SCIPisLE(), SCIPisNLPConstructed(), SCIPisParamFixed(), SCIPisZero(), SCIPmessagePrintInfo(), SCIPnlpStatisticsGetNIterations(), SCIPnlpStatisticsGetTotalTime(), SCIPpresolve(), SCIPpressedCtrlC(), SCIPresetParam(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetNLPInitialGuess(), SCIPsetNLPIntPar(), SCIPsetNLPRealPar(), SCIPsetNLPStringPar(), SCIPsetPresolving(), SCIPsetRealParam(), SCIPsolGetHeur(), SCIPsolve(), SCIPsolveNLP(), SCIPtransformProb(), SCIPtrySol(), SCIPtrySolFree(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetOrigvarSum(), SCIPvarGetProbindex(), SCIPvarGetUbGlobal(), SCIPverbMessage(), SCIPwarningMessage(), and TRUE.
Referenced by SCIPapplyHeurSubNlp(), and SCIPresolveSolHeurSubNlp().
◆ 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 1533 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, SCIPcreateConsBounddisjunction(), SCIPcreateConsSetcover(), SCIPdebugMsg, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPgetNegatedVar(), SCIPgetOrigVarsData(), SCIPisEQ(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetProbindex(), SCIPvarGetType(), SCIPvarGetUbGlobal(), SCIPwarningMessage(), and TRUE.
Referenced by SCIPapplyHeurSubNlp().
◆ SCIP_DECL_HEURCOPY()
|
static |
copy method for primal heuristic plugins (called when SCIP copies plugins)
Definition at line 2061 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 2075 of file heur_subnlp.c.
References NULL, SCIP_OKAY, SCIPfreeBlockMemory, 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 2095 of file heur_subnlp.c.
References createSubSCIP(), HEUR_TIMING, NULL, runHeuristic(), SCIP_CALL, SCIP_HEURTIMING_DURINGLPLOOP, SCIP_OKAY, SCIPheurGetData(), SCIPheurGetFreq(), 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 2132 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 2168 of file heur_subnlp.c.
References HEUR_TIMING, MIN, NULL, runHeuristic(), SCIP_CALL, SCIP_CUTOFF, SCIP_DELAYED, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_Longint, SCIP_LONGINT_FORMAT, SCIP_LPSOLSTAT_OPTIMAL, SCIP_LPSOLSTAT_UNBOUNDEDRAY, SCIP_OKAY, SCIP_Real, SCIPapplyHeurSubNlp(), SCIPdebugMsg, SCIPfreeSol(), SCIPgetLocalDualbound(), SCIPgetLPSolstat(), SCIPgetMessagehdlr(), SCIPgetNLPBranchCands(), SCIPgetNNodes(), SCIPgetPrimalbound(), SCIPgetRealParam(), SCIPgetSolvingTime(), SCIPheurGetData(), SCIPheurGetName(), SCIPheurGetNCalls(), SCIPheurSetTimingmask(), SCIPisEQ(), SCIPisInfinity(), SCIPmessagePrintInfo(), and SCIPsolGetHeur().