All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heur_objpscostdiving.c
Go to the documentation of this file.
17 * @brief LP diving heuristic that changes variable's objective value instead of bounds, using pseudo cost values as guide
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 #define HEUR_DESC "LP diving heuristic that changes variable's objective values instead of bounds, using pseudo costs as guide"
46 #define DEFAULT_MAXLPITERQUOT 0.01 /**< maximal fraction of diving LP iterations compared to total iteration number */
48 #define DEFAULT_MAXSOLS -1 /**< total number of feasible solutions found up to which heuristic is called
50 #define DEFAULT_DEPTHFAC 0.5 /**< maximal diving depth: number of binary/integer variables times depthfac */
51 #define DEFAULT_DEPTHFACNOSOL 2.0 /**< maximal diving depth factor if no feasible solution was found yet */
62 SCIP_Real maxlpiterquot; /**< maximal fraction of diving LP iterations compared to total iteration number */
66 SCIP_Real depthfac; /**< maximal diving depth: number of binary/integer variables times depthfac */
67 SCIP_Real depthfacnosol; /**< maximal diving depth factor if no feasible solution was found yet */
293 /* only try to dive, if we are in the correct part of the tree, given by minreldepth and maxreldepth */
304 maxnlpiterations = (SCIP_Longint)((1.0 + 10.0*(nsolsfound+1.0)/(ncalls+1.0)) * heurdata->maxlpiterquot * nlpiterations);
315 SCIP_CALL( SCIPgetLPBranchCands(scip, &lpcands, &lpcandssol, &lpcandsfrac, &nlpcands, NULL, NULL) );
339 SCIPdebugMessage("(node %"SCIP_LONGINT_FORMAT") executing objpscostdiving heuristic: depth=%d, %d fractionals, dualbound=%g, maxnlpiterations=%"SCIP_LONGINT_FORMAT", maxdivedepth=%d\n",
340 SCIPgetNNodes(scip), SCIPgetDepth(scip), nlpcands, SCIPgetDualbound(scip), maxnlpiterations, maxdivedepth);
342 /* dive as long we are in the given diving depth and iteration limits and fractional variables exist, but
343 * - if the last objective change was in a direction, that corresponds to a feasible rounding, we continue in any case
345 * - if the number of fractional variables decreased at least with 1 variable per 2 dive depths, we continue diving
365 * - of these variables, change objective value of variable with largest rel. difference of pseudo cost values
383 /* the candidate may be rounded: choose this candidate only, if the best candidate may also be rounded */
387 * - if variable may be rounded in both directions, round corresponding to the pseudo cost values
388 * - otherwise, round in the infeasible direction, because feasible direction is tried by rounding
475 SCIPdebugMessage(" dive %d/%d: var <%s>, round=%u/%u, sol=%g, was already soft rounded upwards -> bounds=[%g,%g]\n",
483 SCIPdebugMessage(" dive %d/%d: var <%s>, round=%u/%u, sol=%g, was already soft rounded downwards -> bounds=[%g,%g]\n",
519 SCIPdebugMessage(" dive %d/%d, LP iter %"SCIP_LONGINT_FORMAT"/%"SCIP_LONGINT_FORMAT": var <%s>, round=%u/%u, sol=%g, bounds=[%g,%g], obj=%g, newobj=%g\n",
522 lpcandssol[bestcand], SCIPgetVarLbDive(scip, var), SCIPgetVarUbDive(scip, var), oldobj, newobj);
527 retcode = SCIPsolveDiveLP(scip, MAX((int)(maxnlpiterations - heurdata->nlpiterations), MINLPITER), &lperror, NULL);
530 /* Errors in the LP solver should not kill the overall solving process, if the LP is just needed for a heuristic.
531 * Hence in optimized mode, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
541 SCIPwarningMessage(scip, "Error while solving LP in Objpscostdiving heuristic; LP solve terminated with code <%d>\n", retcode);
542 SCIPwarningMessage(scip, "This does not affect the remaining solution procedure --> continue\n");
555 SCIP_CALL( SCIPgetLPBranchCands(scip, &lpcands, &lpcandssol, &lpcandsfrac, &nlpcands, NULL, NULL) );
567 SCIPdebugMessage("objpscostdiving found primal solution: obj=%g\n", SCIPgetSolOrigObj(scip, heurdata->sol));
|