All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heur_dins.c
Go to the documentation of this file.
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
45 #define DEFAULT_NODESQUOT 0.05 /* subproblem nodes in relation to nodes of the original problem */
46 #define DEFAULT_LPLIMFAC 1.5 /* factor by which the limit on the number of LP depends on the node limit */
47 #define DEFAULT_MINFIXINGRATE 0.3 /* minimum percentage of integer variables that have to be fixed */
48 #define DEFAULT_NWAITINGNODES 0LL /* number of nodes without incumbent change that heuristic should wait */
53 #define DEFAULT_COPYCUTS TRUE /* if DEFAULT_USELPROWS is FALSE, then should all active cuts from the cutpool
71 SCIP_Longint nwaitingnodes; /**< number of nodes without incumbent change that heuristic should wait */
75 SCIP_Real nodelimit; /**< the nodelimit employed in the current sub-SCIP, for the event handler*/
76 SCIP_Real lplimfac; /**< factor by which the limit on the number of LP depends on the node limit */
137 /* if the solution values differ by 0.5 or more, the variable is rebounded, otherwise it is just copied */
147 /* create a equally sized range around lpsol for general integers: bounds are lpsol +- (mipsol-lpsol) */
155 /* when the bound new upper bound is equal to the current MIP solution, we set both bounds to the integral bound (without eps) */
166 /* when the bound new upper bound is equal to the current MIP solution, we set both bounds to the integral bound (without eps) */
173 /* the global domain of variables might have been reduced since incumbent was found: adjust lb and ub accordingly */
186 /* the global domain of variables might have been reduced since incumbent was found: adjust it accordingly */
239 SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, SCIProwGetName(rows[i]), nnonz, consvars, vals, lhs, rhs,
330 /** creates a new solution for the original problem by copying the solution of the subproblem */
354 /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
355 * since constraint copying may have required the copy of variables that are fixed in the main SCIP
450 /** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
481 /** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed) */
577 if( SCIPgetNNodes(scip) - SCIPgetSolNodenum(scip, SCIPgetBestSol(scip)) < heurdata->nwaitingnodes )
586 maxnnodes = (SCIP_Longint) (maxnnodes * (1.0 + 2.0 * (SCIPheurGetNBestSolsFound(heur)+1.0) / (SCIPheurGetNCalls(heur) + 1.0)));
618 SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), SCIPcalcHashtableSize(5 * nvars)) );
650 SCIP_CALL( SCIPincludeEventhdlrBasic(subscip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, eventExecRins, NULL) );
668 SCIP_CALL( createSubproblem(scip, subscip, vars, subvars, nbinvars, nintvars, &fixingcounter, heurdata->uselprows) );
670 SCIPgetNVars(subscip), SCIPgetNBinVars(subscip) , SCIPgetNIntVars(subscip) , SCIPgetNConss(subscip));
692 /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
699 /* abort if no time is left or not enough memory to create a copy of SCIP, including external memory usage */
721 if( SCIPfindNodesel(subscip, "estimate") != NULL && !SCIPisParamFixed(subscip, "nodeselection/estimate/stdpriority") )
727 if( SCIPfindBranchrule(subscip, "inference") != NULL && !SCIPisParamFixed(subscip, "branching/inference/priority") )
754 /* employ a limit on the number of enforcement rounds in the quadratic constraint handler; this fixes the issue that
755 * sometimes the quadratic constraint handler needs hundreds or thousands of enforcement rounds to determine the
756 * feasibility status of a single node without fractional branching candidates by separation (namely for uflquad
757 * instances); however, the solution status of the sub-SCIP might get corrupted by this; hence no deductions shall be
760 if( SCIPfindConshdlr(subscip, "quadratic") != NULL && !SCIPisParamFixed(subscip, "constraints/quadratic/enfolplimit") )
780 /* if new binary variables have been created, e.g., due to column generation, reallocate the delta array */
788 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &heurdata->delta, heurdata->deltalength, newsize) );
799 /* hard fixing for some with mipsol(s)=lpsolval=rootlpsolval and preparation for soft fixing for the remaining */
803 /* soft fixing if the variable somewhen changed its value or the relaxations differ by adding a local branching constraint */
816 if( nsols > 1 && heurdata->lastnsolsfound != nsolsfound && delta[i] ) /* no need to update delta[i] if already FALSE */
818 /* no need to update delta[i] if already FALSE or sols[i] already checked on previous run or worse than DINS-solution of last run */
827 if( delta[i] && SCIPisFeasEQ(scip, mipsolval, lpsolval) && SCIPisFeasEQ(scip, mipsolval, rootlpsolval)
854 /* perform prepared softfixing for all unfixed vars if the number of unfixed vars is larger than the neighborhoodsize (otherwise it will be useless) */
879 cutoff = (1 - heurdata->minimprove) * SCIPgetUpperbound(scip) + heurdata->minimprove * SCIPgetLowerbound(scip);
900 SCIP_CALL( SCIPcatchEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, NULL) );
904 SCIPdebugMessage("solving DINS sub-MIP with neighborhoodsize %d and maxnodes %"SCIP_LONGINT_FORMAT"\n", heurdata->neighborhoodsize, nsubnodes);
912 SCIP_CALL( SCIPdropEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, -1) );
916 * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
923 SCIPwarningMessage(scip, "Error while solving subproblem in DINS heuristic; sub-SCIP terminated with code <%d>\n", retcode);
931 SCIPdebugMessage("DINS used %"SCIP_LONGINT_FORMAT"/%"SCIP_LONGINT_FORMAT" nodes and found %d solutions\n", SCIPgetNNodes(subscip), nsubnodes, nsubsols);
938 /* check, whether a solution was found; due to numerics, it might happen that not all solutions are feasible -> try all solutions until one was accepted */
997 "number of pool-solutions to be checked for flag array update (for hard fixing of binary variables)",
|