All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
primal.c
Go to the documentation of this file.
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
218 SCIPdebugMessage("changing cutoff bound from %g to %g changes objective limit from %g to %g\n", primal->cutoffbound, cutoffbound, SCIPprobGetObjlim(origprob, set), objval);
224 SCIP_CALL( primalSetCutoffbound(primal, blkmem, set, stat, transprob, eventqueue, tree, lp, cutoffbound) );
260 /* if objective value is always integral, the cutoff bound can be reduced to nearly the previous integer number */
268 cutoffbound = MIN(cutoffbound, upperbound); /* SCIPsetFeasCeil() can increase bound by almost 1.0 due to numerics
277 SCIP_CALL( primalSetCutoffbound(primal, blkmem, set, stat, prob, eventqueue, tree, lp, cutoffbound) );
308 SCIP_CALL( primalSetUpperbound(primal, blkmem, set, stat, eventqueue, prob, tree, lp, upperbound) );
319 /** updates upper bound and cutoff bound in primal data after a tightening of the problem's objective limit */
345 SCIP_CALL( primalSetCutoffbound(primal, blkmem, set, stat, transprob, eventqueue, tree, lp, objlimit) );
351 SCIP_CALL( primalSetUpperbound(primal, blkmem, set, stat, eventqueue, transprob, tree, lp, objlimit) );
357 /** recalculates upper bound and cutoff bound in primal data after a change of the problem's objective offset */
407 SCIP_CALL( primalSetUpperbound(primal, blkmem, set, stat, eventqueue, transprob, tree, lp, SCIPsetInfinity(set)) );
414 SCIP_CALL( primalSetCutoffbound(primal, blkmem, set, stat, transprob, eventqueue, tree, lp, upperbound) );
417 SCIP_CALL( primalSetUpperbound(primal, blkmem, set, stat, eventqueue, transprob, tree, lp, upperbound) );
422 /** adds additional objective offset in original space to all existing solution (in original space) */
442 assert(SCIPsetIsLE(set, SCIPsolGetOrigObj(primal->sols[i-1]), SCIPsolGetOrigObj(primal->sols[i])));
454 /** returns whether the current primal bound is justified with a feasible primal solution; if not, the primal bound
466 return (primal->nsols > 0 && SCIPsetIsEQ(set, primal->upperbound, SCIPsolGetObj(primal->sols[0], set, transprob, origprob)));
509 SCIPdebug( SCIP_CALL( SCIPsolPrint(sol, set, messagehdlr, stat, transprob, NULL, NULL, FALSE) ) );
514 * (this may fail, because in the LP solver, the feasibility tolerance is a relative measure against the row's norm
520 SCIP_CALL( SCIPsolCheck(sol, set, messagehdlr, blkmem, stat, transprob, TRUE, TRUE, TRUE, &feasible) );
532 /* completely fill the solution's own value array to unlink it from the LP or pseudo solution */
538 /* if set->limit_maxsol was decreased in the meantime, free all solutions exceeding the limit */
575 if( SCIPsetIsFeasLE(set, obj, SCIPprobInternObjval(transprob, origprob, set, SCIPprobGetObjlim(origprob, set))) )
594 SCIPdebugMessage("-> %"SCIP_LONGINT_FORMAT" nodes, %d runs, %.2g time, %d depth, %.15g objective\n", stat->nnodesbeforefirst, stat->nrunsbeforefirst,
598 SCIPdebugMessage(" -> stored at position %d of %d solutions, found %"SCIP_LONGINT_FORMAT" solutions\n",
615 SCIP_CALL( SCIPprimalSetUpperbound(primal, blkmem, set, stat, eventqueue, transprob, tree, lp, obj) );
636 /* if an original solution was added during solving, try to transfer it to the transformed space */
637 if( SCIPsolIsOriginal(sol) && SCIPsetGetStage(set) == SCIP_STAGE_SOLVING && set->misc_transorigsols )
641 SCIP_CALL( SCIPprimalTransformSol(primal, sol, blkmem, set, messagehdlr, stat, origprob, transprob, tree, lp,
644 SCIPdebugMessage("original solution %p was successfully transferred to the transformed problem space\n",
671 SCIPdebugMessage("insert primal solution candidate %p with obj %g at position %d:\n", (void*)sol, SCIPsolGetOrigObj(sol), insertpos);
697 SCIPdebugMessage(" -> stored at position %d of %d solutions, found %"SCIP_LONGINT_FORMAT" solutions\n",
799 SCIP_Bool* replace /**< pointer to store whether the solution at insertpos should be replaced */
822 /* due to transferring the objective value of transformed solutions to the original space, small numerical errors might occur
825 assert(SCIPsetIsLE(set, solobj, obj) || (REALABS(obj) > 1e+13 * SCIPsetEpsilon(set) && SCIPsetIsFeasLE(set, solobj, obj)));
848 /* due to transferring the objective value of transformed solutions to the original space, small numerical errors might occur
851 assert( SCIPsetIsGE(set, solobj, obj) || (REALABS(obj) > 1e+13 * SCIPsetEpsilon(set) && SCIPsetIsFeasGE(set, solobj, obj)));
870 /** returns whether the given primal solution is already existent in the original solution candidate storage */
940 /* check if we are willing to check worse solutions; a solution is better if the objective is smaller than the
949 /* the solution should be added, if the insertpos is smaller than the maximum number of solutions to be stored
950 * and it does not already exist or it does exist, but the existing solution should be replaced by the new one
953 (!primalExistsSol(primal, set, stat, origprob, transprob, sol, insertpos, replace) || (*replace)) )
976 if( (*insertpos) < set->limit_maxorigsol && !primalExistsOrigSol(primal, set, stat, origprob, sol, *insertpos) )
1028 assert(SCIPsetIsLE(set, SCIPsolGetObj(primal->sols[i], set, transprob, origprob), SCIPsolGetObj(primal->sols[i+1], set, transprob, origprob)));
1133 /** adds primal solution to solution candidate storage of original problem space, frees the solution afterwards */
1195 SCIP_CALL( SCIPsolCreateCurrentSol(&primal->currentsol, blkmem, set, stat, prob, primal, tree, lp, heur) );
1276 SCIP_CALL( SCIPsolCheck(sol, set, messagehdlr, blkmem, stat, transprob, printreason, checkbounds, checkintegrality, checklprows, &feasible) );
1345 SCIP_CALL( SCIPsolCheck(*sol, set, messagehdlr, blkmem, stat, transprob, printreason, checkbounds, checkintegrality, checklprows, &feasible) );
1519 SCIP_Bool* solvalset, /**< array for internal use to store which solution values were set, or NULL;
1554 SCIPdebugMessage("try to transfer original solution %p with objective %g into the transformed problem space\n",
1557 /* if no solvals and solvalset arrays are given, allocate local ones, otherwise use the given ones */
1575 /* for each original variable, get the corresponding active, fixed or multi-aggregated variable;
1576 * if it resolves to an active variable, we set its solution value or check whether an already stored solution value
1577 * is consistent; if it resolves to a fixed variable, we check that the fixing matches the original solution value;
1578 * multi-aggregated variables are skipped, because their value is defined by setting solution values for the active
1602 SCIPdebugMessage("original variable <%s> (solval=%g) resolves to fixed variable <%s> (original solval=%g)\n",
1609 /* if we already assigned a solution value to the transformed variable, check that it corresponds to the
1616 SCIPdebugMessage("original variable <%s> (solval=%g) resolves to active variable <%s> with assigned solval %g (original solval=%g)\n",
1617 SCIPvarGetName(origvars[v]), solval, SCIPvarGetName(var), localsolvals[SCIPvarGetProbindex(var)],
1633 /* we do not have to handle multi-aggregated variables here, since by assigning values to all active variabes,
1641 /* if the solution values of fixed and active variables lead to no contradiction, construct solution and try it */
1660 SCIPdebugMessage("solution transferred, %d/%d active variables set (stored=%u)\n", nvarsset, ntransvars, *added);
|