From 646e9d472e3b7bf8f890de641bb2946e229f6d8f Mon Sep 17 00:00:00 2001 From: adityasinghz Date: Mon, 24 Nov 2025 13:31:05 +0530 Subject: [PATCH 1/2] Add message when optimal solution is found during presolve --- cpp/src/mip/solve.cu | 1 + cpp/src/mip/solver.cu | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cpp/src/mip/solve.cu b/cpp/src/mip/solve.cu index 16227c431..0227907d6 100644 --- a/cpp/src/mip/solve.cu +++ b/cpp/src/mip/solve.cu @@ -70,6 +70,7 @@ mip_solution_t run_mip(detail::problem_t& problem, pdlp_hyper_params::update_step_size_on_initial_solution = true; // if the input problem is empty: early exit if (problem.empty) { + CUOPT_LOG_INFO("Optimal solution found during presolve"); detail::solution_t solution(problem); problem.preprocess_problem(); thrust::for_each(problem.handle_ptr->get_thrust_policy(), diff --git a/cpp/src/mip/solver.cu b/cpp/src/mip/solver.cu index 28659cccd..91da23125 100644 --- a/cpp/src/mip/solver.cu +++ b/cpp/src/mip/solver.cu @@ -100,6 +100,7 @@ solution_t mip_solver_t::run_solver() "preprocess_problem should be called before running the solver"); if (context.problem_ptr->empty) { + CUOPT_LOG_INFO("Optimal solution found during presolve"); CUOPT_LOG_INFO("Problem fully reduced in presolve"); solution_t sol(*context.problem_ptr); sol.set_problem_fully_reduced(); @@ -118,6 +119,7 @@ solution_t mip_solver_t::run_solver() return sol; } if (context.problem_ptr->empty) { + CUOPT_LOG_INFO("Optimal solution found during presolve"); CUOPT_LOG_INFO("Problem full reduced in presolve"); solution_t sol(*context.problem_ptr); sol.set_problem_fully_reduced(); From 527cd6023f1c3dabbe2868d9a2d2d78283c648cc Mon Sep 17 00:00:00 2001 From: adityasinghz Date: Mon, 24 Nov 2025 20:02:55 +0530 Subject: [PATCH 2/2] Move optimal solution message to presolve function Move the 'Optimal solution found during presolve' message to the presolve function itself (third_party_presolve.cpp) where we can accurately detect when presolve finds the optimal solution. This ensures the message only appears when presolve actually found the solution, not when the problem is empty for other reasons. Removed the message from generic empty problem checks in: - cpp/src/mip/solve.cu (run_mip function) - cpp/src/mip/solver.cu (run_solver function - both locations) --- cpp/src/mip/presolve/third_party_presolve.cpp | 5 +++++ cpp/src/mip/solve.cu | 1 - cpp/src/mip/solver.cu | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/src/mip/presolve/third_party_presolve.cpp b/cpp/src/mip/presolve/third_party_presolve.cpp index 22827c6e2..3439801ce 100644 --- a/cpp/src/mip/presolve/third_party_presolve.cpp +++ b/cpp/src/mip/presolve/third_party_presolve.cpp @@ -425,6 +425,11 @@ std::optional> third_party_presolve_t(papilo_problem, op_problem.get_handle_ptr()); auto col_flags = papilo_problem.getColFlags(); diff --git a/cpp/src/mip/solve.cu b/cpp/src/mip/solve.cu index 0227907d6..16227c431 100644 --- a/cpp/src/mip/solve.cu +++ b/cpp/src/mip/solve.cu @@ -70,7 +70,6 @@ mip_solution_t run_mip(detail::problem_t& problem, pdlp_hyper_params::update_step_size_on_initial_solution = true; // if the input problem is empty: early exit if (problem.empty) { - CUOPT_LOG_INFO("Optimal solution found during presolve"); detail::solution_t solution(problem); problem.preprocess_problem(); thrust::for_each(problem.handle_ptr->get_thrust_policy(), diff --git a/cpp/src/mip/solver.cu b/cpp/src/mip/solver.cu index 91da23125..28659cccd 100644 --- a/cpp/src/mip/solver.cu +++ b/cpp/src/mip/solver.cu @@ -100,7 +100,6 @@ solution_t mip_solver_t::run_solver() "preprocess_problem should be called before running the solver"); if (context.problem_ptr->empty) { - CUOPT_LOG_INFO("Optimal solution found during presolve"); CUOPT_LOG_INFO("Problem fully reduced in presolve"); solution_t sol(*context.problem_ptr); sol.set_problem_fully_reduced(); @@ -119,7 +118,6 @@ solution_t mip_solver_t::run_solver() return sol; } if (context.problem_ptr->empty) { - CUOPT_LOG_INFO("Optimal solution found during presolve"); CUOPT_LOG_INFO("Problem full reduced in presolve"); solution_t sol(*context.problem_ptr); sol.set_problem_fully_reduced();