All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heur_localbranching.c
Go to the documentation of this file.
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
45 #define DEFAULT_MINIMPROVE 0.01 /* factor by which localbranching should at least improve the incumbent */
47 #define DEFAULT_NODESQUOT 0.05 /* contingent of sub problem nodes in relation to original nodes */
48 #define DEFAULT_LPLIMFAC 1.5 /* factor by which the limit on the number of LP depends on the node limit */
49 #define DEFAULT_NWAITINGNODES 200 /* number of nodes without incumbent change that heuristic should wait */
52 #define DEFAULT_COPYCUTS TRUE /* if DEFAULT_USELPROWS is FALSE, then should all active cuts from the cutpool
78 SCIP_Real minimprove; /**< factor by which localbranching should at least improve the incumbent */
79 SCIP_Real nodelimit; /**< the nodelimit employed in the current sub-SCIP, for the event handler*/
80 SCIP_Real lplimfac; /**< factor by which the limit on the number of LP depends on the node limit */
98 /** copies the problem of scip to the problem of subscip - only necessary if uselprows is false */
145 SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, SCIProwGetName(rows[i]), nnonz, consvars, vals, lhs, rhs,
228 /** creates a new solution for the original problem by copying the solution of the subproblem */
251 /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
252 * since constraint copying may have required the copy of variables that are fixed in the main SCIP
356 /* with a little abuse we initialize the heurdata as if localbranching would have finished its last step regularly */
428 if( SCIPsolGetHeur(bestsol) != NULL && strcmp(SCIPheurGetName(SCIPsolGetHeur(bestsol)), "trivial") == 0 )
451 maxnnodes = (SCIP_Longint)(maxnnodes * (1.0 + 2.0*(SCIPheurGetNBestSolsFound(heur)+1.0)/(SCIPheurGetNCalls(heur)+1.0)));
452 maxnnodes -= 100 * SCIPheurGetNCalls(heur); /* count the setup costs for the sub-MIP as 100 nodes */
478 SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), SCIPcalcHashtableSize(5 * nvars)) );
500 SCIP_CALL( SCIPcopy(scip, subscip, varmapfw, NULL, "localbranchsub", TRUE, FALSE, TRUE, &success) );
509 SCIP_CALL( SCIPincludeEventhdlrBasic(subscip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, eventExecLocalbranching, NULL) );
545 /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
552 /* abort if no time is left or not enough memory to create a copy of SCIP, including external memory usage */
574 if( SCIPfindNodesel(subscip, "estimate") != NULL && !SCIPisParamFixed(subscip, "nodeselection/estimate/stdpriority") )
580 if( SCIPfindBranchrule(subscip, "inference") != NULL && !SCIPisParamFixed(subscip, "branching/inference/priority") )
607 /* employ a limit on the number of enforcement rounds in the quadratic constraint handler; this fixes the issue that
608 * sometimes the quadratic constraint handler needs hundreds or thousands of enforcement rounds to determine the
609 * feasibility status of a single node without fractional branching candidates by separation (namely for uflquad
610 * instances); however, the solution status of the sub-SCIP might get corrupted by this; hence no deductions shall be
613 if( SCIPfindConshdlr(subscip, "quadratic") != NULL && !SCIPisParamFixed(subscip, "constraints/quadratic/enfolplimit") )
632 cutoff = (1-heurdata->minimprove)*SCIPgetUpperbound(scip) + heurdata->minimprove*SCIPgetLowerbound(scip);
650 SCIP_CALL( SCIPcatchEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, NULL) );
654 SCIPdebugMessage("solving local branching subproblem with neighborhoodsize %d and maxnodes %"SCIP_LONGINT_FORMAT"\n",
663 SCIP_CALL( SCIPdropEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, -1) );
667 * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
674 SCIPwarningMessage(scip, "Error while solving subproblem in local branching heuristic; sub-SCIP terminated with code <%d>\n",retcode);
691 * due to numerics, it might happen that not all solutions are feasible -> try all solutions until one was accepted
712 heurdata->callstatus = WAITFORNEWSOL; /* new solution will immediately be installed at next call */
720 heurdata->curneighborhoodsize = (heurdata->emptyneighborhoodsize + heurdata->curneighborhoodsize)/2;
722 SCIPdebugMessage(" -> node limit reached: reduced neighborhood to %d, increased minnodes to %d\n",
727 SCIPdebugMessage(" -> new neighborhood was already proven to be empty: wait for new solution\n");
735 heurdata->curneighborhoodsize = MAX(heurdata->curneighborhoodsize, heurdata->emptyneighborhoodsize + 2);
737 SCIPdebugMessage(" -> neighborhood is empty: increased neighborhood to %d\n", heurdata->curneighborhoodsize);
749 SCIPdebugMessage(" -> unexpected sub-MIP status <%d>: waiting for new solution\n", SCIPgetStatus(subscip));
|