All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heur_crossover.c
Go to the documentation of this file.
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33 #define HEUR_DESC "LNS heuristic that fixes all variables that are identic in a couple of solutions"
43 #define DEFAULT_MINIMPROVE 0.01 /* factor by which Crossover should at least improve the incumbent */
45 #define DEFAULT_MINFIXINGRATE 0.666 /* minimum percentage of integer variables that have to be fixed */
47 #define DEFAULT_NODESQUOT 0.1 /* subproblem nodes in relation to nodes of the original problem */
48 #define DEFAULT_LPLIMFAC 2.0 /* factor by which the limit on the number of LP depends on the node limit */
50 #define DEFAULT_NWAITINGNODES 200LL /* number of nodes without incumbent change heuristic should wait */
52 #define DEFAULT_DONTWAITATROOT FALSE /* should the nwaitingnodes parameter be ignored at the root node? */
55 #define DEFAULT_COPYCUTS TRUE /* if DEFAULT_USELPROWS is FALSE, then should all active cuts from the
58 #define DEFAULT_PERMUTE FALSE /* should the subproblem be permuted to increase diversification? */
85 SCIP_Longint nwaitingnodes; /**< number of nodes without incumbent change heuristic should wait */
87 SCIP_Longint nextnodenumber; /**< number of nodes at which crossover should be called the next time */
90 SCIP_Real nodelimit; /**< the nodelimit employed in the current sub-SCIP, for the event handler*/
91 SCIP_Real lplimfac; /**< factor by which the limit on the number of LP depends on the node limit */
93 SCIP_Bool dontwaitatroot; /**< should the nwaitingnodes parameter be ignored at the root node? */
237 /* checks whether the new solution was found at the same node by the same heuristic as an already selected one */
256 /** randomly selects the solutions crossover will use from the pool of all solutions found so far */
374 fixable = fixable && SCIPvarGetLbGlobal(vars[i]) <= solval && solval <= SCIPvarGetUbGlobal(vars[i]);
387 /* if all variables were fixed or amount of fixed variables is insufficient, skip residual part of
443 SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, SCIProwGetName(rows[i]), nnonz, consvars, vals, lhs, rhs,
481 /* use nusedsols best solutions if randomization is deactivated or there are only nusedsols solutions at hand
483 if( !heurdata->randomization || nsols == nusedsols || heurdata->prevlastsol != sols[nusedsols-1] )
498 /* check, whether all solutions have been found by the same heuristic at the same node; in this case we do not run
514 /* if solution tuple has already been tried, randomization is allowed and enough solutions are at hand, try
515 * to randomize another tuple. E.g., this can happen if the last crossover solution was among the best ones */
549 /** creates a new solution for the original problem by copying the solution of the subproblem */
573 /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
574 * since constraint copying may have required the copy of variables that are fixed in the main SCIP
603 /* increase number of failures, calculate next node at which crossover should be called and update actual solutions */
797 /* in nonrandomized mode: only recall heuristic, if at least one new good solution was found in the meantime */
806 if( SCIPgetNNodes(scip) - SCIPgetSolNodenum(scip,SCIPgetBestSol(scip)) < heurdata->nwaitingnodes
817 (nstallnodes * (1.0 + 2.0*(SCIPheurGetNBestSolsFound(heur)+1.0)/(SCIPheurGetNCalls(heur)+1.0)));
847 SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), SCIPcalcHashtableSize(5 * nvars)) );
879 SCIP_CALL( SCIPincludeEventhdlrBasic(subscip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, eventExecCrossover, NULL) );
905 /* if creation of sub-SCIP was aborted (e.g. due to number of fixings), free sub-SCIP and abort */
910 /* this run will be counted as a failure since no new solution tuple could be generated or the neighborhood of the
935 /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
942 /* abort if no time is left or not enough memory to create a copy of SCIP, including external memory usage */
962 if( SCIPfindNodesel(subscip, "estimate") != NULL && !SCIPisParamFixed(subscip, "nodeselection/estimate/stdpriority") )
968 if( SCIPfindBranchrule(subscip, "inference") != NULL && !SCIPisParamFixed(subscip, "branching/inference/priority") )
995 /* employ a limit on the number of enforcement rounds in the quadratic constraint handler; this fixes the issue that
996 * sometimes the quadratic constraint handler needs hundreds or thousands of enforcement rounds to determine the
997 * feasibility status of a single node without fractional branching candidates by separation (namely for uflquad
998 * instances); however, the solution status of the sub-SCIP might get corrupted by this; hence no deductions shall be
1001 if( SCIPfindConshdlr(subscip, "quadratic") != NULL && !SCIPisParamFixed(subscip, "constraints/quadratic/enfolplimit") )
1013 cutoff = (1-heurdata->minimprove)*SCIPgetUpperbound(scip) + heurdata->minimprove*SCIPgetLowerbound(scip);
1028 SCIP_CALL( SCIPpermuteProb(subscip, (unsigned int) SCIPheurGetNCalls(heur), TRUE, TRUE, TRUE, TRUE, TRUE) );
1037 SCIP_CALL( SCIPcatchEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, NULL) );
1049 SCIP_CALL( SCIPdropEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, -1) );
1053 * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop. */
1059 SCIPwarningMessage(scip, "Error while solving subproblem in Crossover heuristic; sub-SCIP terminated with code <%d>\n", retcode);
1075 * due to numerics, it might happen that not all solutions are feasible -> try all solutions until one was accepted */
1093 /* insert all crossings of the new solution and (nusedsols-1) of its parents into the hashtable
1107 /* if solution was among the best ones, crossover should not be called until another good solution was found */
1115 /* if solution is not better then incumbent or could not be added to problem => run is counted as a failure */
|