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));
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars) Definition: scip.c:33125 Definition: type_result.h:33 Definition: type_result.h:47 Definition: type_result.h:34 Definition: struct_scip.h:53 SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy))) Definition: scip.c:7297 void SCIPwarningMessage(SCIP *scip, const char *formatstr,...) Definition: scip.c:1248 Definition: struct_var.h:196 SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, unsigned int timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata) Definition: scip.c:7252 SCIP_RETCODE SCIPchgVarUbDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound) Definition: scip.c:31772 static SCIP_DECL_HEURINIT(heurInitObjpscostdiving) Definition: heur_objpscostdiving.c:174 static void calcPscostQuot(SCIP *scip, SCIP_VAR *var, SCIP_Real primsol, SCIP_Real frac, int rounddir, SCIP_Real *pscostquot, SCIP_Bool *roundup) Definition: heur_objpscostdiving.c:79 SCIP_Real SCIPgetVarPseudocostVal(SCIP *scip, SCIP_VAR *var, SCIP_Real solvaldelta) Definition: scip.c:23218 static SCIP_DECL_HEURFREE(heurFreeObjpscostdiving) Definition: heur_objpscostdiving.c:154 SCIP_RETCODE SCIPchgVarLbDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound) Definition: scip.c:31740 Definition: struct_sol.h:50 SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata) Definition: scip.c:3573 Definition: type_result.h:35 SCIP_RETCODE SCIPchgVarObjDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj) Definition: scip.c:31699 static SCIP_DECL_HEUREXEC(heurExecObjpscostdiving) Definition: heur_objpscostdiving.c:218 SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur) Definition: scip.c:34002 Definition: type_retcode.h:33 Definition: struct_heur.h:75 void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata) Definition: heur.c:1068 Definition: type_lp.h:34 static SCIP_DECL_HEURCOPY(heurCopyObjpscostdiving) Definition: heur_objpscostdiving.c:140 SCIP_RETCODE SCIPsetHeurExit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit))) Definition: scip.c:7345 SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit))) Definition: scip.c:7329 Definition: type_lp.h:36 SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur) Definition: heur.c:1293 SCIP_RETCODE SCIPincludeHeurObjpscostdiving(SCIP *scip) Definition: heur_objpscostdiving.c:601 SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree))) Definition: scip.c:7313 static SCIP_DECL_HEUREXIT(heurExitObjpscostdiving) Definition: heur_objpscostdiving.c:198 SCIP_RETCODE SCIPsolveDiveLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff) Definition: scip.c:31999 LP diving heuristic that changes variable's objective value instead of bounds, using pseudo cost valu... Definition: objbranchrule.h:33 SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata) Definition: scip.c:3629 SCIP_RETCODE SCIPtrySol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored) Definition: scip.c:36217 SCIP_RETCODE SCIProundSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *success) Definition: scip.c:35909 |