1- user /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22/* */
33/* This file is part of the HiGHS linear optimization suite */
44/* */
@@ -272,24 +272,31 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
272272 Timer solver_timer;
273273
274274 const HighsLp& lp = lp_;
275+
276+ pdlp_log_file_ = fopen (" HiPDLP.log" , " w" );
277+ assert (pdlp_log_file_);
278+
275279 // --- 0.Using PowerMethod to estimate the largest eigenvalue ---
276280 const double op_norm_sq = PowerMethod ();
277281 // Set step sizes based on the operator norm to ensure convergence
278282 // A safe choice satisfying eta * omega * ||A||^2 < 1
279283 step_.passLp (&lp_);
280284 step_.passLogOptions (¶ms_.log_options_ );
281285 step_.passDebugLogFile (pdlp_log_file_);
282- StepSizeConfig step_size = step_.InitializeStepSizesPowerMethod (lp, op_norm_sq);
286+ StepSizeConfig step_size =
287+ step_.InitializeStepSizesPowerMethod (lp, op_norm_sq);
283288 const double fixed_eta = 0.99 / sqrt (op_norm_sq);
284289 PrimalDualParams working_params = params_;
285290
286291 working_params.omega = std::sqrt (step_size.dual_step / step_size.primal_step );
287292 working_params.eta = std::sqrt (step_size.primal_step * step_size.dual_step );
288293 current_eta_ = working_params.eta ; // Initial step size for adaptive strategy
289- highsLogUser (params_.log_options_ , HighsLogType::kInfo , " Using power method step sizes: eta = %g, omega = %g\n " ,
290- working_params.eta , working_params.omega );
294+ highsLogUser (params_.log_options_ , HighsLogType::kInfo ,
295+ " Using power method step sizes: eta = %g, omega = %g\n " ,
296+ working_params.eta , working_params.omega );
291297
292- highsLogUser (params_.log_options_ , HighsLogType::kInfo ,
298+ highsLogUser (
299+ params_.log_options_ , HighsLogType::kInfo ,
293300 " Initial step sizes from power method lambda = %g: primal = %g; dual = "
294301 " %g\n " ,
295302 step_size.power_method_lambda , step_size.primal_step ,
@@ -318,9 +325,6 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
318325
319326 logger_.print_iteration_header ();
320327
321- pdlp_log_file_ = fopen (" HiPDLP.log" , " w" );
322- assert (pdlp_log_file_);
323-
324328 // --- 2. Main PDHG Loop ---
325329 // A single loop handles max iterations, convergence, and restarts.
326330 for (int iter = 0 ; iter < params_.max_iterations ; ++iter) {
@@ -348,21 +352,20 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
348352 switch (params_.step_size_strategy ) {
349353 case StepSizeStrategy::FIXED:
350354 step_.UpdateIteratesFixed (lp, working_params, fixed_eta, x, y, Ax_new,
351- x_current_, y_current_, Ax_current,
352- pdlp_log_file_);
355+ x_current_, y_current_, Ax_current);
353356 break ;
354357
355358 case StepSizeStrategy::ADAPTIVE:
356- step_.UpdateIteratesAdaptive (
357- lp, working_params, x, y, Ax_new, x_current_, y_current_,
358- Ax_current, ATy_current, current_eta_, iter, pdlp_log_file_ );
359+ step_.UpdateIteratesAdaptive (lp, working_params, x, y, Ax_new,
360+ x_current_, y_current_, Ax_current ,
361+ ATy_current, current_eta_, iter);
359362 break ;
360363
361364 case StepSizeStrategy::MALITSKY_POCK:
362365 step_success = step_.UpdateIteratesMalitskyPock (
363366 lp, working_params, x, y, Ax_new, x_current_, y_current_,
364367 Ax_current, ATy_current, current_eta_, ratio_last_two_step_sizes_,
365- num_rejected_steps_, first_malitsky_iteration, pdlp_log_file_ );
368+ num_rejected_steps_, first_malitsky_iteration);
366369
367370 if (!step_success) {
368371 std::cerr << " Malitsky-Pock step failed at iteration " << iter
@@ -452,9 +455,8 @@ void PDLPSolver::solve(std::vector<double>& x, std::vector<double>& y) {
452455 }
453456
454457 // Perform the primal weight update using z^{n,0} and z^{n-1,0}
455- PDHG_Compute_Step_Size_Ratio (working_params,
456- restart_x, restart_y,
457- x_at_last_restart_, y_at_last_restart_);
458+ PDHG_Compute_Step_Size_Ratio (working_params, restart_x, restart_y,
459+ x_at_last_restart_, y_at_last_restart_);
458460
459461 x_at_last_restart_ = restart_x; // Current becomes the new last
460462 y_at_last_restart_ = restart_y;
@@ -766,10 +768,10 @@ double PDLPSolver::PowerMethod() {
766768 // kYanyuPowerMethod;
767769 // kYanyuPowerMethodDev;
768770 kCuPdlpAATPowerMethod ;
769- highsLogUser (params_.log_options_ , HighsLogType::kInfo , " Power method: %s\n " , power_method == kYanyuPowerMethod ? " Yanyu "
770- : power_method == kYanyuPowerMethodDev
771- ? " Yanyu dev"
772- : " CuPdlp-C" );
771+ highsLogUser (params_.log_options_ , HighsLogType::kInfo , " Power method: %s\n " ,
772+ power_method == kYanyuPowerMethod ? " Yanyu "
773+ : power_method == kYanyuPowerMethodDev ? " Yanyu dev"
774+ : " CuPdlp-C" );
773775 // Dev version of Yanyu power method (based on A'A) has
774776 //
775777 // * First iterate as vector of ones
@@ -794,7 +796,9 @@ double PDLPSolver::PowerMethod() {
794796 int log_iters =
795797 log_level == LogLevel::kVerbose || log_level == LogLevel::kDebug ;
796798
797- if (log_iters) highsLogUser (params_.log_options_ , HighsLogType::kInfo , " It lambda dl_lambda\n " );
799+ if (log_iters)
800+ highsLogUser (params_.log_options_ , HighsLogType::kInfo ,
801+ " It lambda dl_lambda\n " );
798802
799803 if (power_method == kYanyuPowerMethodDev ) {
800804 // Start from a vector
@@ -828,7 +832,8 @@ double PDLPSolver::PowerMethod() {
828832 linalg::normalize (z_vec); // Normalize the result
829833 x_vec = z_vec;
830834 if (log_iters)
831- highsLogUser (params_.log_options_ , HighsLogType::kInfo , " %2d %12.6g %11.4g\n " , iter, op_norm_sq, dl_op_norm_sq);
835+ highsLogUser (params_.log_options_ , HighsLogType::kInfo ,
836+ " %2d %12.6g %11.4g\n " , iter, op_norm_sq, dl_op_norm_sq);
832837 } else {
833838 if (power_method == kYanyuPowerMethodDev ) {
834839 // Yanyu power method without "convergence" check
@@ -868,7 +873,9 @@ double PDLPSolver::PowerMethod() {
868873 }
869874 double dl_lambda = std::fabs (lambda - previous_lambda);
870875 previous_lambda = lambda;
871- if (log_iters) highsLogUser (params_.log_options_ , HighsLogType::kInfo , " %2d %12.6g %11.4g\n " , iter, lambda, dl_lambda);
876+ if (log_iters)
877+ highsLogUser (params_.log_options_ , HighsLogType::kInfo ,
878+ " %2d %12.6g %11.4g\n " , iter, lambda, dl_lambda);
872879 }
873880 }
874881 if (power_method != kYanyuPowerMethod ) op_norm_sq = lambda;
0 commit comments