diff --git a/cpp/src/dual_simplex/branch_and_bound.cpp b/cpp/src/dual_simplex/branch_and_bound.cpp index 78acd0742..2ce3ee0b4 100644 --- a/cpp/src/dual_simplex/branch_and_bound.cpp +++ b/cpp/src/dual_simplex/branch_and_bound.cpp @@ -562,8 +562,8 @@ node_status_t branch_and_bound_t::solve_node(search_tree_t& { f_t abs_fathom_tol = settings_.absolute_mip_gap_tol / 10; - std::vector& leaf_vstatus = node_ptr->vstatus; lp_solution_t leaf_solution(leaf_problem.num_rows, leaf_problem.num_cols); + std::vector& leaf_vstatus = node_ptr->vstatus; assert(leaf_vstatus.size() == leaf_problem.num_cols); std::vector bounds_changed(leaf_problem.num_cols, false); @@ -572,7 +572,6 @@ node_status_t branch_and_bound_t::solve_node(search_tree_t& // two vectors at each node and potentially cause memory issues node_ptr->get_variable_bounds(leaf_problem.lower, leaf_problem.upper, bounds_changed); - std::vector leaf_edge_norms = edge_norms_; // = node.steepest_edge_norms; simplex_solver_settings_t lp_settings = settings_; lp_settings.set_log(false); lp_settings.cut_off = upper_bound + settings_.dual_tol; @@ -587,8 +586,9 @@ node_status_t branch_and_bound_t::solve_node(search_tree_t& dual::status_t lp_status = dual::status_t::DUAL_UNBOUNDED; if (feasible) { - i_t node_iter = 0; - f_t lp_start_time = tic(); + i_t node_iter = 0; + f_t lp_start_time = tic(); + std::vector leaf_edge_norms = edge_norms_; // = node.steepest_edge_norms; lp_status = dual_phase2(2, 0, @@ -778,7 +778,7 @@ void branch_and_bound_t::exploration_ramp_up(search_tree_t* } template -void branch_and_bound_t::explore_subtree(i_t id, +void branch_and_bound_t::explore_subtree(i_t task_id, search_tree_t& search_tree, mip_node_t* start_node, lp_problem_t& leaf_problem, @@ -788,7 +788,7 @@ void branch_and_bound_t::explore_subtree(i_t id, stack.push_front(start_node); while (stack.size() > 0 && status_ == mip_exploration_status_t::RUNNING) { - if (id == 0) { repair_heuristic_solutions(); } + if (task_id == 0) { repair_heuristic_solutions(); } mip_node_t* node_ptr = stack.front(); stack.pop_front(); @@ -804,10 +804,10 @@ void branch_and_bound_t::explore_subtree(i_t id, // - The current node and its siblings uses the lower bound of the parent before solving the LP // relaxation // - The lower bound of the parent is lower or equal to its children - assert(id < local_lower_bounds_.size()); - local_lower_bounds_[id] = lower_bound; - i_t nodes_explored = (++stats_.nodes_explored); - i_t nodes_unexplored = (--stats_.nodes_unexplored); + assert(task_id < local_lower_bounds_.size()); + local_lower_bounds_[task_id] = lower_bound; + i_t nodes_explored = (++stats_.nodes_explored); + i_t nodes_unexplored = (--stats_.nodes_unexplored); stats_.nodes_since_last_log++; if (lower_bound > upper_bound || rel_gap < settings_.relative_mip_gap_tol) { @@ -818,7 +818,7 @@ void branch_and_bound_t::explore_subtree(i_t id, f_t now = toc(stats_.start_time); - if (id == 0) { + if (task_id == 0) { f_t time_since_last_log = stats_.last_log == 0 ? 1.0 : toc(stats_.last_log); if (((stats_.nodes_since_last_log >= 1000 || abs_gap < 10 * settings_.absolute_mip_gap_tol) && diff --git a/cpp/src/dual_simplex/branch_and_bound.hpp b/cpp/src/dual_simplex/branch_and_bound.hpp index 5453e8b42..23fb9eb7f 100644 --- a/cpp/src/dual_simplex/branch_and_bound.hpp +++ b/cpp/src/dual_simplex/branch_and_bound.hpp @@ -235,7 +235,7 @@ class branch_and_bound_t { i_t initial_heap_size); // Explore the search tree using the best-first search with plunging strategy. - void explore_subtree(i_t id, + void explore_subtree(i_t task_id, search_tree_t& search_tree, mip_node_t* start_node, lp_problem_t& leaf_problem,