-
Notifications
You must be signed in to change notification settings - Fork 219
Fix root cut CPUFJ solutions being dropped by the GPU heuristics #1497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -507,6 +507,17 @@ solution_t<i_t, f_t> mip_solver_t<i_t, f_t>::run_solver() | |
| sol = dm.run_solver(); | ||
| } // implicit barrier for all tasks created in B&B and heuristics | ||
|
|
||
| if (!context.settings.heuristics_only && branch_and_bound->has_solver_space_incumbent()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? The callback already registers it on the heuristic thread, right? Is it because of the different thread completion orders?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not, I added this to err on the safe side in case future additions neglect to run the gpu heuristic callback |
||
| solution_t<i_t, f_t> branch_and_bound_sol(*context.problem_ptr); | ||
| branch_and_bound_sol.copy_new_assignment(branch_and_bound_solution.x); | ||
| branch_and_bound_sol.compute_feasibility(); | ||
|
|
||
| if (branch_and_bound_sol.get_feasible() && | ||
| (!sol.get_feasible() || branch_and_bound_sol.get_objective() < sol.get_objective())) { | ||
| sol = std::move(branch_and_bound_sol); | ||
| } | ||
| } | ||
|
|
||
| if (!context.settings.heuristics_only) { | ||
| if (branch_and_bound_solution.lower_bound > -std::numeric_limits<f_t>::infinity()) { | ||
| context.stats.set_solution_bound( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Unconditional
solution_callbackinvocation bypasses the incumbent-improvement/feasibility gate used elsewhere.Every other call site (
repair_heuristic_solutions,add_feasible_solution) only invokessettings_.solution_callbackafter confirming the solution actually improves the incumbent (improves_incumbent(...)) and is feasibility-checked. Here the callback fires unconditionally for any CPUFJ improvement, beforeset_solution_from_heuristicsvalidates feasibility viacheck_guess. Since the callback drivesdm->rins.new_best_incumbent_callback, which is documented/named to represent a genuine new best incumbent, this can report non-improving or not-yet-validated solutions to RINS/population, polluting downstream state.🐛 Proposed fix to gate the callback on actual incumbent improvement
} else { - if (settings_.solution_callback != nullptr) { - settings_.solution_callback(user_assignment, obj); - } + if (settings_.solution_callback != nullptr && improves_incumbent(obj)) { + settings_.solution_callback(user_assignment, obj); + } set_solution_from_heuristics(user_assignment); }📝 Committable suggestion
🤖 Prompt for AI Agents