55#include < limits>
66
77#include " linalg.hpp"
8+ #include " pdlp/cupdlp/cupdlp.h" // For pdlpLogging
89
910namespace step {
1011
@@ -86,12 +87,13 @@ double ComputeNonlinearity(const std::vector<double>& delta_primal,
8687
8788void UpdateX (std::vector<double >& x_new, const std::vector<double >& x_current,
8889 const HighsLp& lp, const std::vector<double >& y_current,
89- double eta, double omega) {
90+ double eta, double omega,
91+ FILE* pdlp_log_file) {
9092 std::vector<double > ATy_cache (lp.num_col_ );
9193 linalg::ATy (lp, y_current, ATy_cache);
9294 // print the norm of ATy_cache
9395 double aty_norm = linalg::vector_norm (ATy_cache);
94- std::cout << " Norm of A'y: " << aty_norm << std::endl ;
96+ pdlpAtyNormLog (pdlp_log_file, aty_norm) ;
9597 for (HighsInt i = 0 ; i < lp.num_col_ ; i++) {
9698 double gradient = lp.col_cost_ [i] - ATy_cache[i];
9799 x_new[i] = linalg::project_box (x_current[i] - (eta / omega) * gradient,
@@ -139,8 +141,9 @@ void UpdateIteratesFixed(const HighsLp& lp, const PrimalDualParams& params,
139141 std::vector<double >& ax_new,
140142 const std::vector<double >& x_current,
141143 const std::vector<double >& y_current,
142- const std::vector<double >& ax_current) {
143- UpdateX (x_new, x_current, lp, y_current, params.eta , params.omega );
144+ const std::vector<double >& ax_current,
145+ FILE* pdlp_log_file) {
146+ UpdateX (x_new, x_current, lp, y_current, params.eta , params.omega , pdlp_log_file);
144147 linalg::Ax (lp, x_new, ax_new);
145148 UpdateY (y_new, y_current, lp, ax_new, ax_current, params.eta , params.omega );
146149}
@@ -153,7 +156,8 @@ void UpdateIteratesAdaptive(const HighsLp& lp, const PrimalDualParams& params,
153156 const std::vector<double >& y_current,
154157 const std::vector<double >& ax_current,
155158 const std::vector<double >& aty_current,
156- double & current_eta, int & step_size_iter_count) {
159+ double & current_eta, int & step_size_iter_count,
160+ FILE* pdlp_log_file) {
157161 const double MIN_ETA = 1e-6 ;
158162 const double MAX_ETA = 1.0 ;
159163
@@ -178,7 +182,7 @@ void UpdateIteratesAdaptive(const HighsLp& lp, const PrimalDualParams& params,
178182 std::vector<double > aty_candidate (lp.num_col_ );
179183
180184 // Primal update
181- UpdateX (x_candidate, x_current, lp, y_current, current_eta, params.omega );
185+ UpdateX (x_candidate, x_current, lp, y_current, current_eta, params.omega , pdlp_log_file );
182186 linalg::Ax (lp, x_candidate, ax_candidate);
183187
184188 // Dual update
@@ -263,14 +267,15 @@ bool UpdateIteratesMalitskyPock(
263267 const std::vector<double >& y_current, const std::vector<double >& ax_current,
264268 const std::vector<double >& aty_current, double & current_eta,
265269 double & ratio_last_two_step_sizes, int & num_rejected_steps,
266- bool first_iteration) // Add this parameter to track first iteration
270+ bool first_iteration,
271+ FILE* pdlp_log_file) // Add this parameter to track first iteration
267272{
268273 // Step 1: Compute primal update first (without extrapolation)
269274 const double primal_step_size = current_eta / params.omega ;
270275
271276 std::vector<double > x_candidate (lp.num_col_ );
272277 UpdateX (x_candidate, x_current, lp, y_current, primal_step_size,
273- params.omega );
278+ params.omega , pdlp_log_file );
274279
275280 // Compute Ax for the primal candidate
276281 std::vector<double > ax_candidate (lp.num_row_ );
0 commit comments