diff --git a/cpp/src/mip/problem/load_balanced_problem.cu b/cpp/src/mip/problem/load_balanced_problem.cu index 2fe6842f3..4a63bd729 100644 --- a/cpp/src/mip/problem/load_balanced_problem.cu +++ b/cpp/src/mip/problem/load_balanced_problem.cu @@ -282,9 +282,11 @@ void create_variable_graph(const raft::handle_t* handle_ptr, template void compact_bins(std::vector& bins, i_t num_items) { - auto found_last_bin = std::lower_bound(bins.begin(), bins.end(), num_items) - bins.begin(); - auto max_degree_cnst = 2 << (found_last_bin - 3); - if (max_degree_cnst > 256) { found_last_bin = 10; } + auto found_last_bin = std::lower_bound(bins.begin(), bins.end(), num_items) - bins.begin(); + if (found_last_bin >= 3) { + auto max_degree_cnst = 2 << (found_last_bin - 3); + if (max_degree_cnst > 256) { found_last_bin = 10; } + } // bins[0:found_last_bin-1] = 0; for (int i = 2; i <= found_last_bin - 1; ++i) { bins[i] = bins[1]; diff --git a/cpp/src/mip/problem/problem.cu b/cpp/src/mip/problem/problem.cu index d5be3ce7a..0facd0fcd 100644 --- a/cpp/src/mip/problem/problem.cu +++ b/cpp/src/mip/problem/problem.cu @@ -777,6 +777,11 @@ void problem_t::compute_binary_var_table() template void problem_t::compute_related_variables(double time_limit) { + if (n_variables == 0) { + related_variables.resize(0, handle_ptr->get_stream()); + related_variables_offsets.resize(0, handle_ptr->get_stream()); + return; + } auto pb_view = view(); handle_ptr->sync_stream();