Skip to content
Closed
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
4 changes: 3 additions & 1 deletion cpp/src/mip/solution/solution.cu
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ 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()
{
const auto num_variables = view().assignment.size();

cuopt_assert(problem_ptr->n_variables == assignment.size(), "Size mismatch");
cuopt_assert(problem_ptr->n_variables == problem_ptr->variable_lower_bounds.size(),
"Size mismatch");
Expand All @@ -549,7 +551,7 @@ f_t solution_t<i_t, f_t>::compute_max_variable_violation()
return thrust::transform_reduce(
handle_ptr->get_thrust_policy(),
thrust::make_counting_iterator(0),
thrust::make_counting_iterator(0) + problem_ptr->n_variables,
thrust::make_counting_iterator(0) + num_variables,
cuda::proclaim_return_type<f_t>([v = view()] __device__(i_t idx) -> f_t {
f_t lower_vio = max(0., v.problem.variable_lower_bounds[idx] - v.assignment[idx]);
f_t upper_vio = max(0., v.assignment[idx] - v.problem.variable_upper_bounds[idx]);
Expand Down
Loading