|
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heur_ofins.c
Go to the documentation of this file.
17 * @brief OFINS - Objective Function Induced Neighborhood Search. Primal heuristic for reoptimization
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 #define HEUR_DESC "primal heuristic for reoptimization, objective function induced neighborhood search"
44 #define DEFAULT_COPYCUTS TRUE /* if DEFAULT_USELPROWS is FALSE, then should all active cuts from the cutpool
48 #define DEFAULT_MINIMPROVE 0.01 /* factor by which OFINS should at least improve the incumbent */
49 #define DEFAULT_ADDALLSOLS FALSE /* should all subproblem solutions be added to the original SCIP? */
52 #define DEFAULT_NODESQUOT 0.1 /* subproblem nodes in relation to nodes of the original problem */
53 #define DEFAULT_LPLIMFAC 2.0 /* factor by which the limit on the number of LP depends on the node limit */
65 SCIP_Bool copycuts; /**< should all active cuts from cutpool be copied to constraints in subproblem? */
72 SCIP_Real nodelimit; /**< the nodelimit employed in the current sub-SCIP, for the event handler*/
73 SCIP_Real lplimfac; /**< factor by which the limit on the number of LP depends on the node limit */
156 /** creates a new solution for the original problem by copying the solution of the subproblem */
180 /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
181 * since constraint copying may have required the copy of variables that are fixed in the main SCIP
250 /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
257 /* abort if no time is left or not enough memory to create a copy of SCIP, including external memory usage */
274 SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), SCIPcalcHashtableSize(5 * nvars)) );
293 SCIP_CALL( SCIPincludeEventhdlrBasic(subscip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, eventExecOfins, NULL) );
310 SCIPdebugMessage("OFINS subproblem: %d vars, %d cons\n", SCIPgetNVars(subscip), SCIPgetNConss(subscip));
335 if( SCIPfindNodesel(subscip, "estimate") != NULL && !SCIPisParamFixed(subscip, "nodeselection/estimate/stdpriority") )
341 if( SCIPfindBranchrule(subscip, "inference") != NULL && !SCIPisParamFixed(subscip, "branching/inference/priority") )
362 * hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
369 SCIPwarningMessage(scip, "Error while presolving subproblem in %s heuristic; sub-SCIP terminated with code <%d>\n", HEUR_NAME, retcode);
377 SCIPdebugMessage("%s presolved subproblem: %d vars, %d cons\n", HEUR_NAME, SCIPgetNVars(subscip), SCIPgetNConss(subscip));
382 SCIP_CALL( SCIPcatchEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, NULL) );
385 SCIPdebugMessage("solving subproblem: nstallnodes=%" SCIP_LONGINT_FORMAT ", maxnodes=%" SCIP_LONGINT_FORMAT "\n", nstallnodes, heurdata->maxnodes);
388 SCIP_CALL( SCIPdropEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, -1) );
391 * hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
398 SCIPwarningMessage(scip, "Error while solving subproblem in RENS heuristic; sub-SCIP terminated with code <%d>\n", retcode);
405 * due to numerics, it might happen that not all solutions are feasible -> try all solutions until one was accepted
417 SCIPstatisticPrintf("%s statistic: fixed %6.3f integer variables, needed %6.1f seconds, %" SCIP_LONGINT_FORMAT " nodes, solution %10.4f found at node %" SCIP_LONGINT_FORMAT "\n",
418 HEUR_NAME, 0.0, SCIPgetSolvingTime(subscip), SCIPgetNNodes(subscip), success ? SCIPgetPrimalbound(scip) : SCIPinfinity(scip),
498 nstallnodes = (SCIP_Longint)(nstallnodes * 3.0 * (SCIPheurGetNBestSolsFound(heur)+1.0)/(SCIPheurGetNCalls(heur) + 1.0));
499 nstallnodes -= 100 * SCIPheurGetNCalls(heur); /* count the setup costs for the sub-SCIP as 100 nodes */
508 SCIPdebugMessage("skipping OFINS: nstallnodes=%" SCIP_LONGINT_FORMAT ", minnodes=%" SCIP_LONGINT_FORMAT "\n", nstallnodes, heurdata->minnodes);
585 SCIPdebugMessage("%d (rate %.4f) changed coefficients\n", nchgcoefs, nchgcoefs/((SCIP_Real)nvars));
Definition: type_result.h:33 Definition: type_result.h:47 Definition: type_result.h:34 Definition: type_var.h:40 Definition: struct_scip.h:53 SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant) Definition: var.c:11991 void SCIPwarningMessage(SCIP *scip, const char *formatstr,...) Definition: scip.c:1220 static SCIP_RETCODE createSubproblem(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_Bool *chgcoeffs) Definition: heur_ofins.c:108 Definition: struct_var.h:196 SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, unsigned int timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata) Definition: scip.c:7221 SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize) Definition: misc.c:2052 SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value) Definition: scip.c:4015 SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata) Definition: scip.c:7747 SCIP_RETCODE SCIPgetReoptOldObjCoef(SCIP *scip, SCIP_VAR *var, int run, SCIP_Real *objcoef) Definition: scip.c:14999 SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored) Definition: scip.c:35909 SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value) Definition: scip.c:4078 SCIP_RETCODE SCIPaddLongintParam(SCIP *scip, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata) Definition: scip.c:3570 SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var) Definition: scip.c:34593 void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin) Definition: misc.c:2111 SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded) Definition: scip.c:2852 Definition: struct_sol.h:50 SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata) Definition: scip.c:3516 Definition: struct_misc.h:101 SCIP_RETCODE SCIPcopy(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool passmessagehdlr, SCIP_Bool *valid) Definition: scip.c:3223 Definition: type_result.h:35 SCIP_RETCODE SCIPchgVarUbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound) Definition: scip.c:20115 Definition: type_paramset.h:54 SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur) Definition: scip.c:33612 SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet) Definition: scip.c:4426 Definition: type_retcode.h:33 SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals) Definition: scip.c:34630 Definition: struct_heur.h:75 void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata) Definition: heur.c:1068 public data structures and miscellaneous methods SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value) Definition: scip.c:3970 SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet) Definition: scip.c:4351 SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet) Definition: scip.c:4400 SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur) Definition: heur.c:1293 SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos) Definition: scip.c:36198 const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr) Definition: event.c:278 SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree))) Definition: scip.c:7282 SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name) Definition: scip.c:8405 static SCIP_RETCODE createNewSol(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success) Definition: heur_ofins.c:158 SCIP_RETCODE SCIPchgVarLbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound) Definition: scip.c:20038 Definition: type_retcode.h:45 SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals) Definition: scip.c:34495 SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value) Definition: scip.c:3907 SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars) Definition: scip.c:10609 SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value) Definition: scip.c:3766 Definition: type_paramset.h:53 SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata) Definition: scip.c:3598 default SCIP plugins Definition: struct_event.h:185 static SCIP_RETCODE applyOfins(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, SCIP_RESULT *result, SCIP_Longint nstallnodes, SCIP_Bool *chgcoeffs) Definition: heur_ofins.c:204 SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos) Definition: scip.c:36164 OFINS - Objective Function Induced Neighborhood Search. Primal heuristic for reoptimization. |