FJ numerical fix + fix clang build#835
Conversation
📝 WalkthroughWalkthroughAdds an explicit template instantiation, suppresses an unused warning with a maybe_unused attribute, enforces non-negativity and bounds checks in feasibility-jump weight updates (with finite checks), tightens feasibility comparisons to non-strict inequalities, and adds an unused-variable suppression in a local-search callback. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cpp/src/mip/local_search/local_search.cu (1)
85-92:⚠️ Potential issue | 🔴 CriticalFix lambda capture:
problem_ptris no longer in scope.
The callback now captures onlypopulation, but still usesproblem_ptrin the log. This will not compile (or will bind to the wrong symbol if any). Capturethisor a local pointer and referencecontext.problem_ptr.🐛 Proposed fix
- cpu_fj.fj_cpu->improvement_callback = [&population](f_t obj, const std::vector<f_t>& h_vec) { + cpu_fj.fj_cpu->improvement_callback = [this, &population](f_t obj, const std::vector<f_t>& h_vec) { population.add_external_solution(h_vec, obj, solution_origin_t::CPUFJ); if (obj < local_search_best_obj) { CUOPT_LOG_TRACE("******* New local search best obj %g, best overall %g", - problem_ptr->get_user_obj_from_solver_obj(obj), - problem_ptr->get_user_obj_from_solver_obj( + context.problem_ptr->get_user_obj_from_solver_obj(obj), + context.problem_ptr->get_user_obj_from_solver_obj( population.is_feasible() ? population.best_feasible().get_objective() : std::numeric_limits<f_t>::max())); local_search_best_obj = obj; } };
|
/merge |
This PR includes a fix for a numerical edge case bug in FJ, along with additional safeguards; changes have been made to ensure compilation works with clang.
Summary by CodeRabbit
Bug Fixes
Chores