All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
heur_shifting.c
Go to the documentation of this file.
17 * @brief LP rounding heuristic that tries to recover from intermediate infeasibilities and shifts continuous variables
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 #define HEUR_DESC "LP rounding heuristic with infeasibility recovering also using continuous variables"
182 /** returns a variable, that pushes activity of the row in the given direction with minimal negative impact on other rows;
183 * if variables have equal impact, chooses the one with best objective value improvement in corresponding direction;
184 * prefer fractional integers over other variables in order to become integral during the process;
185 * shifting in a direction is forbidden, if this forces the objective value over the upper bound, or if the variable
224 activitydelta = (direction == +1 ? SCIProwGetLhs(row) - rowactivity : SCIProwGetRhs(row) - rowactivity);
252 isinteger = (SCIPvarGetType(var) == SCIP_VARTYPE_BINARY || SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER);
289 assert(shiftval <= solval); /* may be equal due to numerical digit erasement in the subtraction */
308 assert(shiftval >= solval); /* may be equal due to numerical digit erasement in the subtraction */
334 /** returns a fractional variable, that has most impact on rows in opposite direction, i.e. that is most crucial to
336 * if variables have equal impact, chooses the one with best objective value improvement in corresponding direction;
343 SCIP_Real minobj, /**< minimal objective value possible after shifting remaining fractional vars */
372 assert(SCIPvarGetType(var) == SCIP_VARTYPE_BINARY || SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER);
385 if( (nlocks > maxnlocks || deltaobj < bestdeltaobj) && minobj - obj < SCIPgetCutoffbound(scip) )
401 if( (nlocks > maxnlocks || deltaobj < bestdeltaobj) && minobj + obj < SCIPgetCutoffbound(scip) )
416 /** adds a given value to the fractionality counters of the rows in which the given variable appears */
501 /** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
612 * the rows should be feasible, but due to numerical inaccuracies in the LP solver, they can be violated
654 bestshiftval = obj > 0.0 ? SCIPfeasFloor(scip, lpcandssol[c]) : SCIPfeasCeil(scip, lpcandssol[c]);
670 SCIPdebugMessage("shifting heuristic: nfrac=%d, nviolrows=%d, obj=%g (best possible obj: %g), cutoff=%g\n",
677 * - if a violated row exists, shift a variable decreasing the violation, that has least impact on other rows
678 * - otherwise, shift a variable, that has strongest devastating impact on rows in opposite direction
732 SCIP_CALL( selectEssentialRounding(scip, sol, minobj, lpcands, nlpcands, &shiftvar, &oldsolval, &newsolval) );
742 SCIPdebugMessage("shifting heuristic: -> shift var <%s>[%g,%g], type=%d, oldval=%g, newval=%g, obj=%g\n",
743 SCIPvarGetName(shiftvar), SCIPvarGetLbGlobal(shiftvar), SCIPvarGetUbGlobal(shiftvar), SCIPvarGetType(shiftvar),
760 /* update fractionality counter and minimal objective value possible after shifting remaining variables */
762 && (SCIPvarGetType(shiftvar) == SCIP_VARTYPE_BINARY || SCIPvarGetType(shiftvar) == SCIP_VARTYPE_INTEGER);
764 if( (SCIPvarGetType(shiftvar) == SCIP_VARTYPE_BINARY || SCIPvarGetType(shiftvar) == SCIP_VARTYPE_INTEGER)
773 /* the rounding was already calculated into the minobj -> update only if rounding in "wrong" direction */
808 SCIPdebugMessage("shifting heuristic: -> nfrac=%d, nviolrows=%d, obj=%g (best possible obj: %g)\n",
|