All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heur_clique.c
Go to the documentation of this file.
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
44 #define DEFAULT_MINFIXINGRATE 0.5 /**< minimum percentage of integer variables that have to be fixed */
45 #define DEFAULT_MINIMPROVE 0.01 /**< factor by which clique heuristic should at least improve the
49 #define DEFAULT_NODESOFS 500LL /**< number of nodes added to the contingent of the total nodes */
50 #define DEFAULT_NODESQUOT 0.1 /**< subproblem nodes in relation to nodes of the original problem */
73 SCIP_Real minimprove; /**< factor by which clique heuristic should at least improve the incumbent */
110 /** sort the binary variable array w.r.t. the clique partition; thereby ensure the current order within the cliques are
134 /* @note: we don't want to loose order from same clique numbers, so we need a stable sorting algorithm, or we first
157 /* to reach the goal that all variables of each clique will be standing next to each other we will initialize the
158 * starting pointers for each clique by adding the number of each clique to the last clique starting pointer
159 * e.g. clique1 has 4 elements and clique2 has 3 elements the the starting pointer for clique1 will be the pointer
160 * to vars[0], the starting pointer to clique2 will be the pointer to vars[4] and to clique3 it will be
253 int* probingdepthofonefix,/**< pointer to store in which depth the last fixing to was applied */
289 /* @todo maybe try to fix more than one variable to one in each probing node, to gain faster results */
352 /* @todo need to be check if it's ok to always try to round and check the solution in each probing step */
364 SCIPdebugMessage("clique heuristic found roundable primal solution: obj=%g\n", SCIPgetSolOrigObj(scip, sol));
390 assert((*probingdepthofonefix > 0 && *nonefixvars > 0) || (*probingdepthofonefix == 0 && *nonefixvars == 0));
391 assert(*cutoff || (nbinvars - v == ncliques - c) || (v == nbinvars && (c == ncliques || c == ncliques - 1)));
397 SCIPdebugMessage("clique heuristic rounded %d solutions and tried %d of them\n", nsolsround, nsolstried);
402 /** creates a new solution for the original problem by copying the solution of the subproblem */
426 /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
427 * since constraint copying may have required the copy of variables that are fixed in the main SCIP
579 nstallnodes = (SCIP_Longint)(nstallnodes * 3.0 * (SCIPheurGetNBestSolsFound(heur)+1.0)/(SCIPheurGetNCalls(heur) + 1.0));
580 nstallnodes -= 100 * SCIPheurGetNCalls(heur); /* count the setup costs for the sub-MIP as 100 nodes */
590 SCIPdebugMessage("skipping "HEUR_NAME": nstallnodes=%"SCIP_LONGINT_FORMAT", minnodes=%"SCIP_LONGINT_FORMAT"\n", nstallnodes, heurdata->minnodes);
622 /* disable conflict analysis, because we can it better than SCIP itself, cause we have more information */
636 /* sort the cliques together by respecting the current order (which is w.r.t. the objective coefficients */
660 SCIP_CALL( applyCliqueFixings(scip, heurdata, binvars, nbinvars, cliquepartition, ncliques, onefixvars, &nonefixvars, sol, &probingdepthofonefix, &cutoff, result) );
695 /* solve LP; errors in the LP solver should not kill the overall solving process, if the LP is just needed for a
696 * heuristic. hence in optimized mode, the return code is caught and a warning is printed, only in debug mode,
705 SCIPwarningMessage(scip, "Error while solving LP in clique heuristic; LP solve terminated with code <%d>\n",
716 SCIPdebugMessage(" -> new LP iterations: %"SCIP_LONGINT_FORMAT"\n", SCIPgetNLPIterations(scip));
759 if( lpstatus == SCIP_LPSOLSTAT_INFEASIBLE || lpstatus == SCIP_LPSOLSTAT_OBJLIMIT || backtrackcutoff )
761 /* in case the last fixing in both direction led to infeasibility or to a reached objlimit than our conflict will
767 (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN, "conf%"SCIP_LONGINT_FORMAT"", SCIPgetNNodes(scip));
773 SCIP_CALL( SCIPcreateConsLogicor(scip, &conflictcons, consname, (shortconflict ? nonefixvars - 1 : nonefixvars), onefixvars,
784 /* if no solution has been found yet and the subproblem is still feasible --> fix all other variables by subscip if
787 if( !allfixsolfound && lpstatus != SCIP_LPSOLSTAT_INFEASIBLE && lpstatus != SCIP_LPSOLSTAT_OBJLIMIT && !backtrackcutoff )
835 /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
842 /* abort if no time is left or not enough memory to create a copy of SCIP, including external memory usage */
867 /* employ a limit on the number of enforcement rounds in the quadratic constraint handler; this fixes the issue that
868 * sometimes the quadratic constraint handler needs hundreds or thousands of enforcement rounds to determine the
869 * feasibility status of a single node without fractional branching candidates by separation (namely for uflquad
870 * instances); however, the solution status of the sub-SCIP might get corrupted by this; hence no deductions shall be
873 if( SCIPfindConshdlr(subscip, "quadratic") != NULL && !SCIPisParamFixed(subscip, "constraints/quadratic/enfolplimit") )
916 /* Errors in the LP solver should not kill the overall solving process, if the LP is just needed for a heuristic.
917 * Hence in optimized mode, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
925 SCIPwarningMessage(scip, "Error while presolving subMIP in clique heuristic; sub-SCIP terminated with code <%d>\n", retstat);
932 SCIPdebugMessage("clique heuristic presolved subproblem: %d vars, %d cons; fixing value = %g\n", SCIPgetNVars(subscip), SCIPgetNConss(subscip), ((nvars - SCIPgetNVars(subscip)) / (SCIP_Real)nvars));
934 /* after presolving, we should have at least reached a certain fixing rate over ALL variables (including continuous)
943 SCIPdebugMessage("solving subproblem: nstallnodes=%"SCIP_LONGINT_FORMAT", maxnodes=%"SCIP_LONGINT_FORMAT"\n", nstallnodes, heurdata->maxnodes);
951 SCIPwarningMessage(scip, "Error while solving subMIP in clique heuristic; sub-SCIP terminated with code <%d>\n",retstat);
957 SCIPdebugMessage("ending solving clique-submip at time %g, status = %d\n", SCIPgetSolvingTime(scip), SCIPgetStatus(subscip));
959 /* check, whether a solution was found; due to numerics, it might happen that not all solutions are feasible ->
976 /* in case the last fixing in both direction led to infeasibility or to a reached objlimit than our conflict will only include all variable before that last fixing */
980 (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN, "conf%"SCIP_LONGINT_FORMAT"", SCIPgetNNodes(scip));
986 SCIP_CALL( SCIPcreateConsLogicor(scip, &conflictcons, consname, (shortconflict ? nonefixvars - 1 : nonefixvars), onefixvars,
1037 SCIPdebugMessage("Next run will be at node %"SCIP_LONGINT_FORMAT".\n", heurdata->nnodefornextrun);
|