NLP local search primal heuristic using sub-SCIPs.
Definition in file heur_subnlp.c.
#include <assert.h>
#include <string.h>
#include "scip/heur_subnlp.h"
#include "nlpi/nlpi.h"
#include "scip/cons_linear.h"
#include "scip/cons_varbound.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_bounddisjunction.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 |
#define HEUR_NAME "subnlp" |
Definition at line 37 of file heur_subnlp.c.
Referenced by SCIP_DECL_HEURCOPY(), SCIPaddLinearConsToNlpHeurSubNlp(), SCIPgetStartCandidateHeurSubNlp(), SCIPgetSubScipHeurSubNlp(), SCIPgetVarMappingScip2SubScipHeurSubNlp(), SCIPgetVarMappingSubScip2ScipHeurSubNlp(), SCIPincludeHeurSubNlp(), and SCIPupdateStartpointHeurSubNlp().
#define HEUR_DESC "primal heuristic that performs a local search in an NLP after fixing integer variables and presolving" |
Definition at line 38 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
#define HEUR_DISPCHAR 'q' |
Definition at line 39 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
#define HEUR_PRIORITY -2000000 |
Definition at line 40 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
#define HEUR_FREQ 1 |
Definition at line 41 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
#define HEUR_FREQOFS 0 |
Definition at line 42 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
#define HEUR_MAXDEPTH -1 |
Definition at line 43 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
#define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
Definition at line 44 of file heur_subnlp.c.
Referenced by SCIP_DECL_HEUREXEC(), SCIP_DECL_HEUREXITSOL(), SCIP_DECL_HEURINITSOL(), and SCIPincludeHeurSubNlp().
#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 45 of file heur_subnlp.c.
Referenced by SCIPincludeHeurSubNlp().
indicates whether the heuristic should be running, i.e., whether we expect something nonlinear after fixing all discrete variables
scip | SCIP data structure |
Definition at line 99 of file heur_subnlp.c.
References FALSE, SCIPgetNNlpis(), SCIPhasNLPContinuousNonlinearity(), SCIPisNLPConstructed(), and TRUE.
Referenced by SCIP_DECL_HEUREXEC(), and SCIP_DECL_HEURINITSOL().
|
static |
creates copy of CIP from problem in SCIP
scip | SCIP data structure |
heurdata | heuristic data structure |
Definition at line 118 of file heur_subnlp.c.
References BMSclearMemoryArray, FALSE, 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().
|
static |
free sub-SCIP data structure
scip | SCIP data structure |
heurdata | heuristic data structure |
Definition at line 331 of file heur_subnlp.c.
References 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().
|
static |
process variable global bound change event
Definition at line 389 of file heur_subnlp.c.
References SCIP_CALL, SCIP_EVENTTYPE_GLBCHANGED, SCIP_EVENTTYPE_GUBCHANGED, SCIP_OKAY, SCIPchgVarLbGlobal(), SCIPchgVarUbGlobal(), SCIPeventGetType(), SCIPeventGetVar(), SCIPgetVars(), SCIPvarGetLbGlobal(), SCIPvarGetProbindex(), and SCIPvarGetUbGlobal().
|
static |
adds linear constraints from a SCIP instance to its NLP
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 446 of file heur_subnlp.c.
References FALSE, 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().
|
static |
adds variable bound constraints from a SCIP instance to its NLP
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 519 of file heur_subnlp.c.
References 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().
|
static |
adds logic-or constraints to NLP
scip | SCIP data structure |
conshdlr | constraint handler for linear constraints |
Definition at line 576 of file heur_subnlp.c.
References 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().
|
static |
adds setppc constraints to NLP
scip | SCIP data structure |
conshdlr | constraint handler for linear constraints |
Definition at line 644 of file heur_subnlp.c.
References 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().
|
static |
adds knapsack constraints to NLP
scip | SCIP data structure |
conshdlr | constraint handler for linear constraints |
Definition at line 736 of file heur_subnlp.c.
References 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().
|
static |
adds combinatorial and/or continuous variants of linear constraints from a SCIP instance to its NLP
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 807 of file heur_subnlp.c.
References addKnapsackConstraints(), addLinearConstraints(), addLogicOrConstraints(), addSetppcConstraints(), addVarboundConstraints(), SCIP_CALL, SCIP_OKAY, and SCIPfindConshdlr().
Referenced by SCIPaddLinearConsToNlpHeurSubNlp(), and solveSubNLP().
|
static |
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 858 of file heur_subnlp.c.
References SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIPcreateSol(), SCIPgetNOrigVars(), SCIPgetOrigVars(), SCIPheurGetData(), SCIPsetSolVal(), SCIPsolSetHeur(), SCIPvarGetNLPSol(), and SCIPvarIsActive().
Referenced by solveSubNLP().
|
static |
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 909 of file heur_subnlp.c.
References SCIP_CALL, SCIP_OKAY, SCIPcreateSol(), SCIPgetNOrigVars(), SCIPgetOrigVars(), SCIPgetSolVal(), SCIPheurGetData(), SCIPsetSolVal(), SCIPsolSetHeur(), and SCIPvarIsActive().
Referenced by solveSubNLP().
|
static |
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 951 of file heur_subnlp.c.
References addLinearConstraintsToNlp(), createSolFromNLP(), createSolFromSubScipSol(), FALSE, freeSubSCIP(), MAX, REALABS, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_ERROR, SCIP_FOUNDSOL, 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().
|
static |
adds a set covering or bound disjunction constraint to the original problem
scip | SCIP data structure |
heurdata | heuristic data |
Definition at line 1507 of file heur_subnlp.c.
References FALSE, 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().
|
static |
copy method for primal heuristic plugins (called when SCIP copies plugins)
Definition at line 2035 of file heur_subnlp.c.
References HEUR_NAME, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurSubNlp().
|
static |
destructor of primal heuristic to free user data (called when SCIP is exiting)
Definition at line 2049 of file heur_subnlp.c.
References SCIP_OKAY, SCIPfreeBlockMemory, and SCIPheurGetData().
|
static |
solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
Definition at line 2069 of file heur_subnlp.c.
References createSubSCIP(), HEUR_TIMING, runHeuristic(), SCIP_CALL, SCIP_HEURTIMING_DURINGLPLOOP, SCIP_OKAY, SCIPheurGetData(), SCIPheurGetFreq(), SCIPheurGetFreqofs(), and SCIPheurSetTimingmask().
|
static |
solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)
Definition at line 2106 of file heur_subnlp.c.
References FALSE, freeSubSCIP(), HEUR_TIMING, SCIP_CALL, SCIP_OKAY, SCIPfreeSol(), SCIPheurGetData(), and SCIPheurSetTimingmask().
|
static |
execution method of primal heuristic
Definition at line 2142 of file heur_subnlp.c.
References HEUR_TIMING, runHeuristic(), SCIP_CALL, SCIP_CUTOFF, SCIP_DELAYED, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_Longint, 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().