Skip to content

Commit 3943b5f

Browse files
committed
Address review comments
1 parent 2823464 commit 3943b5f

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

cpp/src/linear_programming/pdlp.cu

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,14 @@ void pdlp_solver_t<i_t, f_t>::set_initial_dual_solution(
253253
initial_dual_.data(), initial_dual_solution.data(), initial_dual_solution.size(), stream_view_);
254254
}
255255

256-
static bool time_limit_reached(const timer_t& timer, double seconds)
257-
{
258-
return timer.check_time_limit();
259-
}
256+
static bool time_limit_reached(const timer_t& timer) { return timer.check_time_limit(); }
260257

261258
template <typename i_t, typename f_t>
262259
std::optional<optimization_problem_solution_t<i_t, f_t>> pdlp_solver_t<i_t, f_t>::check_limits(
263260
const timer_t& timer)
264261
{
265262
// Check for time limit
266-
if (time_limit_reached(timer, settings_.time_limit)) {
263+
if (time_limit_reached(timer)) {
267264
if (settings_.save_best_primal_so_far) {
268265
#ifdef PDLP_VERBOSE_MODE
269266
RAFT_CUDA_TRY(cudaDeviceSynchronize());

cpp/src/linear_programming/solve.cu

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ run_dual_simplex(dual_simplex::user_problem_t<i_t, f_t>& user_problem,
300300
pdlp_solver_settings_t<i_t, f_t> const& settings,
301301
const timer_t& timer)
302302
{
303+
timer_t timer_dual_simplex(timer.remaining_time());
303304
f_t norm_user_objective = dual_simplex::vector_norm2<i_t, f_t>(user_problem.objective);
304305
f_t norm_rhs = dual_simplex::vector_norm2<i_t, f_t>(user_problem.rhs);
305306

@@ -316,7 +317,9 @@ run_dual_simplex(dual_simplex::user_problem_t<i_t, f_t>& user_problem,
316317
auto status =
317318
dual_simplex::solve_linear_program<i_t, f_t>(user_problem, dual_simplex_settings, solution);
318319

319-
CUOPT_LOG_INFO("Dual simplex finished in %.2f seconds", timer.elapsed_time());
320+
CUOPT_LOG_INFO("Dual simplex finished in %.2f seconds, total time %.2f",
321+
timer_dual_simplex.elapsed_time(),
322+
timer.elapsed_time());
320323

321324
if (settings.concurrent_halt != nullptr && (status == dual_simplex::lp_status_t::OPTIMAL ||
322325
status == dual_simplex::lp_status_t::UNBOUNDED ||
@@ -370,14 +373,17 @@ optimization_problem_solution_t<i_t, f_t> run_pdlp(detail::problem_t<i_t, f_t>&
370373
{
371374
auto start_solver = std::chrono::high_resolution_clock::now();
372375
f_t start_time = dual_simplex::tic();
373-
auto sol = run_pdlp_solver(problem, settings, timer, is_batch_mode);
376+
timer_t timer_pdlp(timer.remaining_time());
377+
auto sol = run_pdlp_solver(problem, settings, timer, is_batch_mode);
378+
auto pdlp_solve_time = timer_pdlp.elapsed_time();
374379
sol.set_solve_time(timer.elapsed_time());
375380
CUOPT_LOG_INFO("PDLP finished");
376381
if (sol.get_termination_status() != pdlp_termination_status_t::ConcurrentLimit) {
377-
CUOPT_LOG_INFO("Status: %s Objective: %.8e Iterations: %d Time: %.3fs",
382+
CUOPT_LOG_INFO("Status: %s Objective: %.8e Iterations: %d Time: %.3fs, Total time %.3fs",
378383
sol.get_termination_status_string().c_str(),
379384
sol.get_objective_value(),
380385
sol.get_additional_termination_information().number_of_steps_taken,
386+
pdlp_solve_time,
381387
sol.get_solve_time());
382388
}
383389

@@ -474,6 +480,7 @@ optimization_problem_solution_t<i_t, f_t> run_concurrent(
474480
bool is_batch_mode)
475481
{
476482
CUOPT_LOG_INFO("Running concurrent\n");
483+
timer_t timer_concurrent(timer.remaining_time());
477484

478485
// Copy the settings so that we can set the concurrent halt pointer
479486
pdlp_solver_settings_t<i_t, f_t> settings_pdlp(settings,
@@ -513,7 +520,8 @@ optimization_problem_solution_t<i_t, f_t> run_concurrent(
513520
std::get<4>(*sol_dual_simplex_ptr));
514521

515522
f_t end_time = timer.elapsed_time();
516-
CUOPT_LOG_INFO("Concurrent time: %.3fs", end_time);
523+
CUOPT_LOG_INFO(
524+
"Concurrent time: %.3fs, total time %.3fs", timer_concurrent.elapsed_time(), end_time);
517525
// Check status to see if we should return the pdlp solution or the dual simplex solution
518526
if (sol_dual_simplex.get_termination_status() == pdlp_termination_status_t::Optimal ||
519527
sol_dual_simplex.get_termination_status() == pdlp_termination_status_t::PrimalInfeasible ||

0 commit comments

Comments
 (0)