-
Notifications
You must be signed in to change notification settings - Fork 164
Add MIP gap to heuristic log during dual-simplex root relaxation #942
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 1 commit
033f1ce
a7e4ad3
7de6985
971f2d1
d7ddec7
bc09270
f10d720
4ad65b5
2be4f5b
6a0d60b
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 |
|---|---|---|
|
|
@@ -282,8 +282,9 @@ branch_and_bound_t<i_t, f_t>::branch_and_bound_t( | |
| } | ||
| #endif | ||
|
|
||
| upper_bound_ = inf; | ||
| root_objective_ = std::numeric_limits<f_t>::quiet_NaN(); | ||
| upper_bound_ = inf; | ||
| root_lp_current_lower_bound_ = -inf; | ||
| root_objective_ = std::numeric_limits<f_t>::quiet_NaN(); | ||
| } | ||
|
|
||
| template <typename i_t, typename f_t> | ||
|
|
@@ -318,9 +319,19 @@ void branch_and_bound_t<i_t, f_t>::report_heuristic(f_t obj) | |
| user_gap.c_str(), | ||
| toc(exploration_stats_.start_time)); | ||
| } else { | ||
| settings_.log.printf("New solution from primal heuristics. Objective %+.6e. Time %.2f\n", | ||
| compute_user_objective(original_lp_, obj), | ||
| toc(exploration_stats_.start_time)); | ||
| f_t user_obj = compute_user_objective(original_lp_, obj); | ||
| f_t user_lower = get_lower_bound(); | ||
| if (!std::isfinite(user_lower)) { | ||
| f_t root_lower = root_lp_current_lower_bound_.load(); | ||
| if (std::isfinite(root_lower)) { user_lower = root_lower; } | ||
| } | ||
| std::string gap_str = std::isfinite(user_lower) | ||
| ? (". Gap: " + user_mip_gap<f_t>(user_obj, user_lower) + "\n") | ||
| : "\n"; | ||
| settings_.log.printf("New solution from primal heuristics. Objective %+.6e. Time %.2f%s", | ||
|
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. We follow the convention that time is always the last item in the log line. So I think this should read |
||
| user_obj, | ||
| toc(exploration_stats_.start_time), | ||
| gap_str.c_str()); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1943,6 +1954,7 @@ mip_status_t branch_and_bound_t<i_t, f_t>::solve(mip_solution_t<i_t, f_t>& solut | |
| log.log_prefix = settings_.log.log_prefix; | ||
| solver_status_ = mip_status_t::UNSET; | ||
| is_running_ = false; | ||
| root_lp_current_lower_bound_ = -inf; | ||
| exploration_stats_.nodes_unexplored = 0; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| exploration_stats_.nodes_explored = 0; | ||
| original_lp_.A.to_compressed_row(Arow_); | ||
|
|
@@ -1972,6 +1984,9 @@ mip_status_t branch_and_bound_t<i_t, f_t>::solve(mip_solution_t<i_t, f_t>& solut | |
| lp_settings.inside_mip = 1; | ||
| lp_settings.scale_columns = false; | ||
| lp_settings.concurrent_halt = get_root_concurrent_halt(); | ||
| lp_settings.root_lp_progress_callback = [this](f_t user_obj) { | ||
| root_lp_current_lower_bound_.store(user_obj); | ||
| }; | ||
| std::vector<i_t> basic_list(original_lp_.num_rows); | ||
| std::vector<i_t> nonbasic_list; | ||
| basis_update_mpf_t<i_t, f_t> basis_update(original_lp_.num_rows, settings_.refactor_frequency); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,7 @@ struct simplex_solver_settings_t { | |
| sub_mip(0), | ||
| solution_callback(nullptr), | ||
| heuristic_preemption_callback(nullptr), | ||
| root_lp_progress_callback(nullptr), | ||
| concurrent_halt(nullptr) | ||
| { | ||
| } | ||
|
|
@@ -202,6 +203,8 @@ struct simplex_solver_settings_t { | |
| std::function<void(const std::vector<f_t>&, f_t)> node_processed_callback; | ||
| std::function<void()> heuristic_preemption_callback; | ||
| std::function<void(std::vector<f_t>&, std::vector<f_t>&, f_t)> set_simplex_solution_callback; | ||
| std::function<void(f_t)> | ||
|
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. I think we should call this dual_simplex_objective_callback. It's potentially useful beyond the root lp. |
||
| root_lp_progress_callback; // Called with current dual obj during root LP | ||
| mutable logger_t log; | ||
| std::atomic<int>* concurrent_halt; // if nullptr ignored, if !nullptr, 0 if solver should | ||
| // continue, 1 if solver should halt | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.