From 854f3d4a281490ec3ac384b858e12806831311dc Mon Sep 17 00:00:00 2001 From: Christopher Maes Date: Fri, 30 May 2025 10:15:31 -0700 Subject: [PATCH 1/3] Fix objective constant on maximization. Fix undefined memory access when solved at root node --- cpp/src/dual_simplex/branch_and_bound.cpp | 2 ++ cpp/src/mip/presolve/trivial_presolve.cuh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/src/dual_simplex/branch_and_bound.cpp b/cpp/src/dual_simplex/branch_and_bound.cpp index 1b8a307d22..c9f674b879 100644 --- a/cpp/src/dual_simplex/branch_and_bound.cpp +++ b/cpp/src/dual_simplex/branch_and_bound.cpp @@ -465,6 +465,8 @@ mip_status_t branch_and_bound_t::solve(mip_solution_t& solut uncrush_primal_solution(original_problem, original_lp, incumbent.x, solution.x); solution.objective = incumbent.objective; solution.lower_bound = lower_bound; + solution.nodes_explored = 0; + solution.simplex_iterations = root_relax_soln.iterations; settings.log.printf("Optimal solution found at root node. Objective %.16e. Time %.2f.\n", compute_user_objective(original_lp, root_objective), toc(start_time)); diff --git a/cpp/src/mip/presolve/trivial_presolve.cuh b/cpp/src/mip/presolve/trivial_presolve.cuh index d7cfa6dc1a..382f339523 100644 --- a/cpp/src/mip/presolve/trivial_presolve.cuh +++ b/cpp/src/mip/presolve/trivial_presolve.cuh @@ -233,7 +233,7 @@ void update_from_csr(problem_t& pb) } // update objective_offset - pb.presolve_data.objective_offset += + pb.presolve_data.objective_offset += pb.presolve_data.objective_scaling_factor * thrust::transform_reduce(handle_ptr->get_thrust_policy(), thrust::counting_iterator(0), thrust::counting_iterator(pb.n_variables), From 97359ba97624fd091542ea108143717796487dff Mon Sep 17 00:00:00 2001 From: Christopher Maes Date: Mon, 2 Jun 2025 10:11:33 -0700 Subject: [PATCH 2/3] Style fixes --- cpp/src/dual_simplex/branch_and_bound.cpp | 6 +++--- cpp/src/mip/presolve/trivial_presolve.cuh | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/src/dual_simplex/branch_and_bound.cpp b/cpp/src/dual_simplex/branch_and_bound.cpp index c9f674b879..f1075ed557 100644 --- a/cpp/src/dual_simplex/branch_and_bound.cpp +++ b/cpp/src/dual_simplex/branch_and_bound.cpp @@ -463,9 +463,9 @@ mip_status_t branch_and_bound_t::solve(mip_solution_t& solut global_variables::mutex_upper.unlock(); // We should be done here uncrush_primal_solution(original_problem, original_lp, incumbent.x, solution.x); - solution.objective = incumbent.objective; - solution.lower_bound = lower_bound; - solution.nodes_explored = 0; + solution.objective = incumbent.objective; + solution.lower_bound = lower_bound; + solution.nodes_explored = 0; solution.simplex_iterations = root_relax_soln.iterations; settings.log.printf("Optimal solution found at root node. Objective %.16e. Time %.2f.\n", compute_user_objective(original_lp, root_objective), diff --git a/cpp/src/mip/presolve/trivial_presolve.cuh b/cpp/src/mip/presolve/trivial_presolve.cuh index 382f339523..e201f401ed 100644 --- a/cpp/src/mip/presolve/trivial_presolve.cuh +++ b/cpp/src/mip/presolve/trivial_presolve.cuh @@ -233,7 +233,8 @@ void update_from_csr(problem_t& pb) } // update objective_offset - pb.presolve_data.objective_offset += pb.presolve_data.objective_scaling_factor * + pb.presolve_data.objective_offset += + pb.presolve_data.objective_scaling_factor * thrust::transform_reduce(handle_ptr->get_thrust_policy(), thrust::counting_iterator(0), thrust::counting_iterator(pb.n_variables), From c6d9f6d53886a9413aa8acb6497c847bed4dc7a4 Mon Sep 17 00:00:00 2001 From: Christopher Maes Date: Mon, 2 Jun 2025 10:17:06 -0700 Subject: [PATCH 3/3] Remove prefix from log file --- cpp/src/linear_programming/utilities/logger_init.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp/src/linear_programming/utilities/logger_init.hpp b/cpp/src/linear_programming/utilities/logger_init.hpp index 0e847065dc..4d93f8cb66 100644 --- a/cpp/src/linear_programming/utilities/logger_init.hpp +++ b/cpp/src/linear_programming/utilities/logger_init.hpp @@ -37,6 +37,8 @@ class init_logger_t { // TODO save the defaul sink and restore it cuopt::default_logger().sinks().push_back( std::make_shared(log_file, true)); + cuopt::default_logger().set_pattern("%v"); + cuopt::default_logger().flush_on(rapids_logger::level_enum::info); } } ~init_logger_t() { cuopt::reset_default_logger(); }