@@ -460,13 +460,15 @@ PostSolveRetcode PDLPSolver::postprocess(HighsSolution& solution) {
460460}
461461
462462void PDLPSolver::solve (std::vector<double >& x, std::vector<double >& y) {
463+ auto solve_start = std::chrono::high_resolution_clock::now ();
463464 Timer solver_timer;
464465 const HighsLp& lp = lp_;
465466
466467 debug_pdlp_log_file_ = fopen (" HiPDLP.log" , " w" );
467468 assert (debug_pdlp_log_file_);
468469
469470 // --- 0. Using PowerMethod to estimate the largest eigenvalue ---
471+ auto init_start = std::chrono::high_resolution_clock::now ();
470472 InitializeStepSizes ();
471473
472474 PrimalDualParams working_params = params_;
@@ -511,6 +513,9 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
511513
512514 logger_.print_iteration_header ();
513515
516+ auto init_end = std::chrono::high_resolution_clock::now ();
517+ timings_.other_time += std::chrono::duration<double >(init_end - init_start).count ();
518+
514519 // --- 2. Main PDHG Loop ---
515520 debugPdlpIterHeaderLog (debug_pdlp_log_file_);
516521 debugPdlpDataInitialise (&debug_pdlp_data_);
@@ -538,14 +543,19 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
538543
539544 bool_checking = (bool_checking || iter % PDHG_CHECK_INTERVAL == 0 );
540545 if (bool_checking) {
546+ auto avg_start = std::chrono::high_resolution_clock::now ();
541547 ComputeAverageIterate (Ax_avg, ATy_avg);
548+ auto avg_end = std::chrono::high_resolution_clock::now ();
549+ timings_.average_iterate_time += std::chrono::duration<double >(avg_end - avg_start).count ();
550+
542551 // Reset the average iterate accumulation
543552 int inner_iter = iter - restart_scheme_.GetLastRestartIter ();
544553
545554 // Compute residuals and convergence metrics
546555 SolverResults current_results;
547556 SolverResults average_results;
548557
558+ auto conv_start = std::chrono::high_resolution_clock::now ();
549559 // Compute residuals for current iterate
550560 bool current_converged = CheckConvergence (
551561 iter, x_current_, y_current_, Ax_cache_, ATy_cache_,
@@ -555,6 +565,8 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
555565 bool average_converged =
556566 CheckConvergence (iter, x_avg_, y_avg_, Ax_avg, ATy_avg,
557567 params_.tolerance , average_results, " [A]" );
568+ auto conv_end = std::chrono::high_resolution_clock::now ();
569+ timings_.convergence_check_time += std::chrono::duration<double >(conv_end - conv_start).count ();
558570
559571 debugPdlpIterHeaderLog (debug_pdlp_log_file_);
560572
@@ -585,6 +597,7 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
585597 }
586598
587599 // --- 4. Restart Check (using computed results) ---
600+ auto restart_start = std::chrono::high_resolution_clock::now ();
588601 RestartInfo restart_info =
589602 restart_scheme_.Check (iter, current_results, average_results);
590603
@@ -618,17 +631,21 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
618631 sum_weights_ = 0.0 ;
619632
620633 restart_scheme_.last_restart_iter_ = iter;
621-
634+ auto matvec_start = std::chrono::high_resolution_clock::now ();
622635 // Recompute Ax and ATy for the restarted iterates
623636 linalg::Ax (lp, x_current_, Ax_cache_);
624637 linalg::ATy (lp, y_current_, ATy_cache_);
638+ auto matvec_end = std::chrono::high_resolution_clock::now ();
639+ timings_.matrix_multiply_time += std::chrono::duration<double >(matvec_end - matvec_start).count ();
640+
625641 restart_scheme_.SetLastRestartIter (iter);
626-
627- // continue; //same logic as cupdlp
628642 }
643+ auto restart_end = std::chrono::high_resolution_clock::now ();
644+ timings_.restart_check_time += std::chrono::duration<double >(restart_end - restart_start).count ();
629645 }
630646
631647 // --- 5. Core PDHG Update Step ---
648+ auto update_start = std::chrono::high_resolution_clock::now ();
632649 bool step_success = true ;
633650
634651 // Store current iterates before update (for next iteration's x_current_,
@@ -661,15 +678,25 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
661678 return ;
662679 }
663680 }
681+ auto update_end = std::chrono::high_resolution_clock::now ();
682+ timings_.iterate_update_time += std::chrono::duration<double >(update_end - update_start).count ();
664683
665684 // Compute ATy for the new iterate
666685 Ax_cache_ = Ax_next_;
686+ auto aty_start = std::chrono::high_resolution_clock::now ();
667687 linalg::ATy (lp, y_next_, ATy_cache_);
688+ auto aty_end = std::chrono::high_resolution_clock::now ();
689+ timings_.matrix_multiply_time += std::chrono::duration<double >(aty_end - aty_start).count ();
690+
668691
669692 // --- 6. Update Average Iterates ---
670693 // The number of iterations since the last restart
671694 int inner_iter = iter - restart_scheme_.GetLastRestartIter ();
672- UpdateAverageIterates (x_next_, y_next_, working_params, inner_iter);;
695+ auto avg_update_start = std::chrono::high_resolution_clock::now ();
696+ UpdateAverageIterates (x_next_, y_next_, working_params, inner_iter);
697+ auto avg_update_end = std::chrono::high_resolution_clock::now ();
698+ timings_.average_iterate_time += std::chrono::duration<double >(avg_update_end - avg_update_start).count ();
699+
673700
674701 // --- 7. Prepare for next iteration ---
675702 x_current_ = x_next_;
@@ -686,6 +713,8 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
686713 y = y_avg_;
687714
688715 results_.term_code = TerminationStatus::TIMEOUT;
716+ auto solve_end = std::chrono::high_resolution_clock::now ();
717+ timings_.total_time = std::chrono::duration<double >(solve_end - solve_start).count ();
689718 return ;
690719}
691720
@@ -1352,12 +1381,24 @@ std::vector<double> PDLPSolver::UpdateY(const std::vector<double> &y, const std:
13521381}
13531382
13541383void PDLPSolver::UpdateIteratesFixed () {
1355- x_next_ = UpdateX (x_current_, ATy_cache_,stepsize_.primal_step );
1384+ auto proj_start = std::chrono::high_resolution_clock::now ();
1385+ x_next_ = UpdateX (x_current_, ATy_cache_, stepsize_.primal_step );
1386+ auto proj_end = std::chrono::high_resolution_clock::now ();
1387+ timings_.projection_time += std::chrono::duration<double >(proj_end - proj_start).count ();
1388+
1389+ auto ax_start = std::chrono::high_resolution_clock::now ();
13561390 linalg::Ax (lp_, x_next_, Ax_next_);
1357- y_next_ = UpdateY (y_current_, Ax_cache_,Ax_next_, stepsize_.dual_step );
1391+ auto ax_end = std::chrono::high_resolution_clock::now ();
1392+ timings_.matrix_multiply_time += std::chrono::duration<double >(ax_end - ax_start).count ();
1393+
1394+ auto proj_y_start = std::chrono::high_resolution_clock::now ();
1395+ y_next_ = UpdateY (y_current_, Ax_cache_, Ax_next_, stepsize_.dual_step );
1396+ auto proj_y_end = std::chrono::high_resolution_clock::now ();
1397+ timings_.projection_time += std::chrono::duration<double >(proj_y_end - proj_y_start).count ();
13581398}
13591399
13601400void PDLPSolver::UpdateIteratesAdaptive () {
1401+ auto step_adjust_start = std::chrono::high_resolution_clock::now ();
13611402 const double MIN_ETA = 1e-6 ;
13621403 const double MAX_ETA = 1.0 ;
13631404
@@ -1393,12 +1434,26 @@ void PDLPSolver::UpdateIteratesAdaptive() {
13931434 double dual_step_update = dStepSizeUpdate * std::sqrt (stepsize_.beta );
13941435
13951436 // Primal update
1396- xupdate = UpdateX (x_candidate, aty_candidate,primal_step_update); // need to take aty
1397- linalg::Ax (lp_, xupdate , axupdate);
1398-
1399- // Dual update
1400- yupdate = UpdateY (y_candidate, ax_candidate,axupdate, dual_step_update);
1437+ auto proj_start = std::chrono::high_resolution_clock::now ();
1438+ xupdate = UpdateX (x_candidate, aty_candidate, primal_step_update);
1439+ auto proj_end = std::chrono::high_resolution_clock::now ();
1440+ timings_.projection_time += std::chrono::duration<double >(proj_end - proj_start).count ();
1441+
1442+ auto ax_start = std::chrono::high_resolution_clock::now ();
1443+ linalg::Ax (lp_, xupdate, axupdate);
1444+ auto ax_end = std::chrono::high_resolution_clock::now ();
1445+ timings_.matrix_multiply_time += std::chrono::duration<double >(ax_end - ax_start).count ();
1446+
1447+ // Dual update with timing
1448+ auto proj_y_start = std::chrono::high_resolution_clock::now ();
1449+ yupdate = UpdateY (y_candidate, ax_candidate, axupdate, dual_step_update);
1450+ auto proj_y_end = std::chrono::high_resolution_clock::now ();
1451+ timings_.projection_time += std::chrono::duration<double >(proj_y_end - proj_y_start).count ();
1452+
1453+ auto aty_start = std::chrono::high_resolution_clock::now ();
14011454 linalg::ATy (lp_, yupdate, atyupdate);
1455+ auto aty_end = std::chrono::high_resolution_clock::now ();
1456+ timings_.matrix_multiply_time += std::chrono::duration<double >(aty_end - aty_start).count ();
14021457
14031458 // Compute deltas
14041459 std::vector<double > delta_x (lp_.num_col_ );
@@ -1473,6 +1528,9 @@ void PDLPSolver::UpdateIteratesAdaptive() {
14731528 current_eta_ = dStepSizeUpdate;
14741529 stepsize_.primal_step = dStepSizeUpdate / std::sqrt (stepsize_.beta );
14751530 stepsize_.dual_step = dStepSizeUpdate * std::sqrt (stepsize_.beta );
1531+
1532+ auto step_adjust_end = std::chrono::high_resolution_clock::now ();
1533+ timings_.step_size_adjustment_time += std::chrono::duration<double >(step_adjust_end - step_adjust_start).count ();
14761534}
14771535
14781536bool PDLPSolver::UpdateIteratesMalitskyPock (
0 commit comments