Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ elseif(CMAKE_CUDA_LINEINFO)
set(CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS_RELEASE} -lineinfo")
endif(CMAKE_BUILD_TYPE MATCHES Debug)

# Undefine NDEBUG if assert mode is on
if(DEFINE_ASSERT)
message(STATUS "Undefining NDEBUG with assert mode enabled")
add_definitions(-UNDEBUG)
endif()


# ##################################################################################################
# - find CPM based dependencies ------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/mip/diversity/assignment_hash_map.cu
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ size_t assignment_hash_map_t<i_t, f_t>::hash_solution(solution_t<i_t, f_t>& solu
hash_solution_kernel<i_t, f_t, TPB>
<<<(integer_assignment.size() + TPB - 1) / TPB, TPB, 0, solution.handle_ptr->get_stream()>>>(
cuopt::make_span(integer_assignment), cuopt::make_span(reduction_buffer));
RAFT_CHECK_CUDA(handle_ptr->get_stream());
RAFT_CHECK_CUDA(solution.handle_ptr->get_stream());
// Get the number of blocks used in the hash_solution_kernel
int num_blocks = (integer_assignment.size() + TPB - 1) / TPB;

Expand Down
5 changes: 5 additions & 0 deletions cpp/src/mip/solution/solution.cu
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ f_t solution_t<i_t, f_t>::compute_max_int_violation()
template <typename i_t, typename f_t>
f_t solution_t<i_t, f_t>::compute_max_variable_violation()
{
cuopt_assert(problem_ptr->n_variables == assignment.size(), "Size mismatch");
cuopt_assert(problem_ptr->n_variables == problem_ptr->variable_lower_bounds.size(),
"Size mismatch");
cuopt_assert(problem_ptr->n_variables == problem_ptr->variable_upper_bounds.size(),
"Size mismatch");
return thrust::transform_reduce(
handle_ptr->get_thrust_policy(),
thrust::make_counting_iterator(0),
Expand Down
1 change: 0 additions & 1 deletion cpp/src/utilities/macros.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
// 2) medium
// 3) heavy
#ifdef ASSERT_MODE
#undef NDEBUG
#include <cassert>
#define cuopt_assert(val, msg) assert(val&& msg)
#define cuopt_func_call(func) func;
Expand Down
2 changes: 2 additions & 0 deletions cpp/tests/mip/bounds_standardization_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void test_bounds_standardization_test(std::string test_instance)
init_handler(op_problem.get_handle_ptr());
// run the problem constructor of MIP, so that we do bounds standardization
detail::problem_t<int, double> standardized_problem(op_problem);
detail::problem_t<int, double> original_problem(op_problem);
standardized_problem.preprocess_problem();
detail::trivial_presolve(standardized_problem);
detail::solution_t<int, double> solution_1(standardized_problem);
Expand All @@ -88,6 +89,7 @@ void test_bounds_standardization_test(std::string test_instance)
// only consider the pdlp results
EXPECT_TRUE(sol_1_feasible);
standardized_problem.post_process_solution(solution_1);
solution_1.problem_ptr = &original_problem;
auto optimization_prob_solution =
solution_1.get_solution(sol_1_feasible, solver_stats_t<int, double>{});
test_objective_sanity(problem,
Expand Down
7 changes: 5 additions & 2 deletions cpp/tests/mip/elim_var_remap_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void test_elim_var_solution(std::string test_instance)
init_handler(op_problem.get_handle_ptr());
// run the problem constructor of MIP, so that we do bounds standardization
detail::problem_t<int, double> standardized_problem(op_problem);
detail::problem_t<int, double> original_problem(op_problem);
standardized_problem.preprocess_problem();
trivial_presolve(standardized_problem);
detail::problem_t<int, double> sub_problem(standardized_problem);
Expand All @@ -171,7 +172,8 @@ void test_elim_var_solution(std::string test_instance)
bool sol_1_feasible = (int)result_1.get_termination_status() == CUOPT_TERIMINATION_STATUS_OPTIMAL;
EXPECT_EQ((int)result_1.get_termination_status(), CUOPT_TERIMINATION_STATUS_OPTIMAL);
standardized_problem.post_process_solution(solution_1);
auto opt_sol_1 = solution_1.get_solution(sol_1_feasible, solver_stats_t<int, double>{});
solution_1.problem_ptr = &original_problem;
auto opt_sol_1 = solution_1.get_solution(sol_1_feasible, solver_stats_t<int, double>{});
test_objective_sanity(
mps_problem, opt_sol_1.get_solution(), opt_sol_1.get_objective_value(), 1e-3);
test_constraint_sanity_per_row(
Expand All @@ -198,7 +200,8 @@ void test_elim_var_solution(std::string test_instance)
bool sol_2_feasible = (int)result_2.get_termination_status() == CUOPT_TERIMINATION_STATUS_OPTIMAL;
EXPECT_EQ((int)result_2.get_termination_status(), CUOPT_TERIMINATION_STATUS_OPTIMAL);
sub_problem.post_process_solution(solution_2);
auto opt_sol_2 = solution_2.get_solution(sol_2_feasible, solver_stats_t<int, double>{});
solution_2.problem_ptr = &original_problem;
auto opt_sol_2 = solution_2.get_solution(sol_2_feasible, solver_stats_t<int, double>{});
test_objective_sanity(
mps_problem, opt_sol_2.get_solution(), opt_sol_2.get_objective_value(), 1e-3);
test_constraint_sanity_per_row(
Expand Down