Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cpp/src/branch_and_bound/branch_and_bound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,7 @@ void branch_and_bound_t<i_t, f_t>::plunge_with(bfs_worker_t<i_t, f_t>* worker,
// relaxation
// - The lower bound of the parent is lower or equal to its children
worker->lower_bound = node_ptr->lower_bound;
fetch_max(exploration_stats_.max_node_depth, node_ptr->depth);
Comment thread
nguidotti marked this conversation as resolved.
Outdated

if (node_ptr->lower_bound > upper_bound_.load()) {
search_tree_.graphviz_node(settings_.log, node_ptr, "cutoff", node_ptr->lower_bound);
Expand Down Expand Up @@ -1772,6 +1773,18 @@ void branch_and_bound_t<i_t, f_t>::plunge_with(bfs_worker_t<i_t, f_t>* worker,
break;
}

i_t max_node_depth = exploration_stats_.max_node_depth;
i_t plunge_depth = node_ptr->depth - start_node->depth;

if (plunge_depth >= settings_.bnb_min_plunge_depth * max_node_depth) {
f_t max_bound = lower_bound + settings_.bnb_plunge_gap_factor * (upper_bound - lower_bound);
if (node_ptr->lower_bound >= max_bound ||
plunge_depth >= settings_.bnb_max_plunge_depth * max_node_depth) {
stack.push_front(node_ptr);
break;
}
}

decompress_vstatus(
node_ptr->packed_vstatus, worker->leaf_problem.num_cols, worker->leaf_vstatus);
assert(worker->leaf_vstatus.size() == worker->leaf_problem.num_cols);
Expand Down
1 change: 1 addition & 0 deletions cpp/src/branch_and_bound/worker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct branch_and_bound_stats_t {
omp_atomic_t<int64_t> nodes_unexplored = 0;
// Tracks the number of nodes being solved by the workers at a given time
omp_atomic_t<i_t> nodes_being_solved = 0;
omp_atomic_t<i_t> max_node_depth = 0;

omp_atomic_t<int64_t> total_simplex_iters = 0;
omp_atomic_t<i_t> nodes_since_last_log = 0;
Expand Down
6 changes: 6 additions & 0 deletions cpp/src/dual_simplex/simplex_solver_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ struct simplex_solver_settings_t {
bnb_steal_chance(-1),
bnb_nodes_per_steal(-1),
bnb_max_steal_attempts(-1),
bnb_plunge_gap_factor(0.25),
bnb_min_plunge_depth(0.1),
bnb_max_plunge_depth(0.5),
reliability_branching(-1),
inside_mip(0),
inside_submip(0),
Expand Down Expand Up @@ -222,6 +225,9 @@ struct simplex_solver_settings_t {
f_t bnb_steal_chance;
i_t bnb_nodes_per_steal;
i_t bnb_max_steal_attempts;
f_t bnb_plunge_gap_factor;
f_t bnb_min_plunge_depth;
f_t bnb_max_plunge_depth;

// Settings for the reliability branching.
// - -1: automatic
Expand Down
12 changes: 12 additions & 0 deletions cpp/src/utilities/omp_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class omp_atomic_t {

friend double fetch_min(omp_atomic_t<double>& atomic_var, double other);
friend double fetch_max(omp_atomic_t<double>& atomic_var, double other);
friend double fetch_max(omp_atomic_t<int>& atomic_var, int other);
Comment thread
nguidotti marked this conversation as resolved.
Outdated
};

// Free non-template functions are necessary because of a clang 20 bug
Expand Down Expand Up @@ -246,6 +247,17 @@ inline double fetch_max(omp_atomic_t<double>& atomic_var, double other)
return old;
}

inline double fetch_max(omp_atomic_t<int>& atomic_var, int other)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add as a member function to omp_atomic_t ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there was a bug in clang found by @aliceb-nv. I will try to put it back

{
double old;
#pragma omp atomic compare capture
{
old = atomic_var.val;
if (other > atomic_var.val) { atomic_var.val = other; }
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
return old;
}

} // namespace cuopt

#endif
Loading