@@ -248,42 +248,40 @@ static void check_csr_representation([[maybe_unused]] const rmm::device_uvector<
248248}
249249
250250template <typename i_t , typename f_t >
251- static void check_var_bounds_sanity (const detail::problem_t <i_t , f_t >& problem)
251+ static bool check_var_bounds_sanity (const detail::problem_t <i_t , f_t >& problem)
252252{
253253 bool crossing_bounds_detected =
254254 thrust::any_of (problem.handle_ptr ->get_thrust_policy (),
255255 thrust::counting_iterator (0 ),
256256 thrust::counting_iterator ((i_t )problem.variable_lower_bounds .size ()),
257- [lb = make_span (problem.variable_lower_bounds ),
258- ub = make_span (problem.variable_upper_bounds )] __device__ (i_t index) {
259- return lb[index] > ub[index];
257+ [tolerance = problem.tolerances .presolve_absolute_tolerance ,
258+ lb = make_span (problem.variable_lower_bounds ),
259+ ub = make_span (problem.variable_upper_bounds )] __device__ (i_t index) {
260+ return (lb[index] > ub[index] + tolerance);
260261 });
261- cuopt_expects (!crossing_bounds_detected,
262- error_type_t ::ValidationError,
263- " There shouldn't be any crossing bounds in variable bounds." );
262+ return !crossing_bounds_detected;
264263}
265264
266265template <typename i_t , typename f_t >
267- static void check_constraint_bounds_sanity (const detail::problem_t <i_t , f_t >& problem)
266+ static bool check_constraint_bounds_sanity (const detail::problem_t <i_t , f_t >& problem)
268267{
269268 bool crossing_bounds_detected =
270269 thrust::any_of (problem.handle_ptr ->get_thrust_policy (),
271270 thrust::counting_iterator (0 ),
272271 thrust::counting_iterator ((i_t )problem.constraint_lower_bounds .size ()),
273- [lb = make_span (problem.constraint_lower_bounds ),
274- ub = make_span (problem.constraint_upper_bounds )] __device__ (i_t index) {
275- return lb[index] > ub[index];
272+ [tolerance = problem.tolerances .presolve_absolute_tolerance ,
273+ lb = make_span (problem.constraint_lower_bounds ),
274+ ub = make_span (problem.constraint_upper_bounds )] __device__ (i_t index) {
275+ return (lb[index] > ub[index] + tolerance);
276276 });
277- cuopt_expects (!crossing_bounds_detected,
278- error_type_t ::ValidationError,
279- " There shouldn't be any crossing bounds in constraints bounds." );
277+ return !crossing_bounds_detected;
280278}
281279
282280template <typename i_t , typename f_t >
283- static void check_bounds_sanity (const detail::problem_t <i_t , f_t >& problem)
281+ static bool check_bounds_sanity (const detail::problem_t <i_t , f_t >& problem)
284282{
285- check_var_bounds_sanity<i_t , f_t >(problem);
286- check_constraint_bounds_sanity<i_t , f_t >(problem);
283+ return check_var_bounds_sanity<i_t , f_t >(problem) &&
284+ check_constraint_bounds_sanity<i_t , f_t >(problem);
287285}
288286
289287} // namespace cuopt::linear_programming::detail
0 commit comments