Skip to content

Conversation

@aliceb-nv
Copy link
Contributor

The non-trivial presolve did not report optimality if the problem was fully reduced. Fixed by this PR

Closes https://github.com/rapidsai/cuopt/issues/2507

@aliceb-nv aliceb-nv added this to the 25.05 milestone May 22, 2025
@aliceb-nv aliceb-nv requested a review from a team as a code owner May 22, 2025 09:32
@aliceb-nv aliceb-nv requested review from chris-maes and kaatish May 22, 2025 09:32
@aliceb-nv aliceb-nv added bug Something isn't working non-breaking Introduces a non-breaking change labels May 22, 2025
@aliceb-nv
Copy link
Contributor Author

/ok to test

@aliceb-nv
Copy link
Contributor Author

/ok to test

@akifcorduk
Copy link
Contributor

We need to add the bound here too:
https://github.com/NVIDIA/cuopt/blob/branch-25.05/cpp/src/mip/solver.cu#L101

@aliceb-nv
Copy link
Contributor Author

/ok to test

@aliceb-nv
Copy link
Contributor Author

/ok to test

Copy link
Contributor

@chris-maes chris-maes left a comment

Choose a reason for hiding this comment

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

This looks good to me. But I'm not an expert on this code. You might want @akifcorduk to get eyes on this as well.

Thanks for taking the initiative to fix this bug Alice. Your work is much appreciated!

CUOPT_LOG_INFO("Problem fully reduced at trivial presolve");
solution_t<i_t, f_t> sol(*context.problem_ptr);
sol.set_problem_fully_reduced();
context.problem_ptr->post_process_solution(sol);
Copy link
Contributor

Choose a reason for hiding this comment

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

Dumb question: is this where the solution is populated? Where does presolve store the information about the solution when the problem is fully reduced in presolve?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the case of fully presolved problems the solution is populated by post_process_solution() (which tracks the transformations made by presolve) and additional solving stats information is added when get_solution() is called to return the final mip_solution_t : https://github.com/NVIDIA/cuopt/blob/branch-25.05/cpp/src/mip/solution/solution.cu#L560-L606

@aliceb-nv
Copy link
Contributor Author

/ok to test

// gets the is_feasible
bool get_feasible();
// gets the is_problem_infeasible
bool get_problem_infeasible();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we remove the infeasible options? The problem can be infeasible right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to cover both the case of infeasibility and optimality after presolve with set_problem_fully_reduced. get_solution() then determines, based on the status of the solution after post_process, which status to return (Optimal or Infeasible)
This ended up making the code more concise so that's why I went with this :)

https://github.com/NVIDIA/cuopt/pull/26/files#diff-115aa63d798001b25f7e001080d8ff9136923b2509328d8ccd079131e4dbc2b8L589-R613

CUOPT_LOG_INFO("Problem proven infeasible in presolve");
solution_t<i_t, f_t> sol(*context.problem_ptr);
sol.set_problem_infeasible();
sol.set_problem_fully_reduced();
Copy link
Contributor

Choose a reason for hiding this comment

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

If we decide to keep infeasible, here it makes more sense to keep set_problem_infeasible

@akifcorduk
Copy link
Contributor

/merge

@rapids-bot rapids-bot bot merged commit d50c8a9 into NVIDIA:branch-25.05 May 23, 2025
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants