MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / computeNewUpperLimit

Method computeNewUpperLimit

highs/mip/HighsMipSolverData.cpp:628–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628double 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
669bool HighsMipSolverData::moreHeuristicsAllowed() const {
670 // in the beginning of the search and in sub-MIP heuristics we only allow

Callers 1

addIncumbentMethod · 0.80

Calls 3

nextafterFunction · 0.85
isIntegralMethod · 0.45
integralScaleMethod · 0.45

Tested by

no test coverage detected