| 626 | } |
| 627 | |
| 628 | double HighsMipSolverData::computeNewUpperLimit(double ub, double mip_abs_gap, |
| 629 | double mip_rel_gap) const { |
| 630 | double new_upper_limit; |
| 631 | if (objectiveFunction.isIntegral()) { |
| 632 | new_upper_limit = |
| 633 | (std::floor(objectiveFunction.integralScale() * ub - 0.5) / |
| 634 | objectiveFunction.integralScale()); |
| 635 | |
| 636 | if (mip_rel_gap != 0.0) |
| 637 | new_upper_limit = std::min( |
| 638 | new_upper_limit, |
| 639 | ub - std::ceil(mip_rel_gap * fabs(ub + mipsolver.model_->offset_) * |
| 640 | objectiveFunction.integralScale() - |
| 641 | mipsolver.mipdata_->epsilon) / |
| 642 | objectiveFunction.integralScale()); |
| 643 | |
| 644 | if (mip_abs_gap != 0.0) |
| 645 | new_upper_limit = std::min( |
| 646 | new_upper_limit, |
| 647 | ub - std::ceil(mip_abs_gap * objectiveFunction.integralScale() - |
| 648 | mipsolver.mipdata_->epsilon) / |
| 649 | objectiveFunction.integralScale()); |
| 650 | |
| 651 | // add feasibility tolerance so that the next best integer feasible solution |
| 652 | // is definitely included in the remaining search |
| 653 | new_upper_limit += feastol; |
| 654 | } else { |
| 655 | new_upper_limit = std::min(ub - feastol, std::nextafter(ub, -kHighsInf)); |
| 656 | |
| 657 | if (mip_rel_gap != 0.0) |
| 658 | new_upper_limit = |
| 659 | std::min(new_upper_limit, |
| 660 | ub - mip_rel_gap * fabs(ub + mipsolver.model_->offset_)); |
| 661 | |
| 662 | if (mip_abs_gap != 0.0) |
| 663 | new_upper_limit = std::min(new_upper_limit, ub - mip_abs_gap); |
| 664 | } |
| 665 | |
| 666 | return new_upper_limit; |
| 667 | } |
| 668 | |
| 669 | bool HighsMipSolverData::moreHeuristicsAllowed() const { |
| 670 | // in the beginning of the search and in sub-MIP heuristics we only allow |
no test coverage detected