@@ -310,15 +310,19 @@ void PDLPSolver::Solve(HighsLp & original_lp, const PrimalDualParams& params, st
310310
311311 // Set step sizes based on the operator norm to ensure convergence
312312 // A safe choice satisfying eta * omega * ||A||^2 < 1
313+ step::StepSizeConfig step_size = step::InitializeStepSizesPowerMethod (lp, op_norm_sq, status == HighsStatus::kOk );
313314 const double fixed_eta = 0.99 / sqrt (op_norm_sq);
314- current_eta_ = 1.0 ; // Initial step size for adaptive strategy
315- const double omega = 0.99 / sqrt (op_norm_sq);
316315 PrimalDualParams working_params = params;
317- working_params.omega = omega;
318- working_params.eta = fixed_eta;
319- std::cout << " Using power method step sizes: eta = " << fixed_eta << " , omega = " << omega << std::endl;
316+
317+ working_params.omega = step_size.dual_step ;
318+ working_params.eta = step_size.primal_step ;
319+ current_eta_ = step_size.primal_step ; // Initial step size for adaptive strategy
320+ std::cout << " Using power method step sizes: eta = " << step_size.primal_step
321+ << " , omega = " << step_size.dual_step << std::endl;
322+
320323 printf (" Initial step sizes from power method lambda = %g: primal = %g; dual = %g\n " ,
321- op_norm_sq, fixed_eta/omega, fixed_eta*omega);
324+ step_size.power_method_lambda , step_size.primal_step , step_size.dual_step );
325+
322326 // --- 1. Initialization ---
323327 Initialize (lp, x, y); // Sets initial x, y and results_
324328 restart_scheme_.Initialize (params, results_);
@@ -728,44 +732,21 @@ std::tuple<double, double, double, double, double> PDLPSolver::ComputeDualityGap
728732 // For the termination criteria, you need the components of the dual objective
729733 return std::make_tuple (duality_gap, qTy, lT_lambda_plus, uT_lambda_minus, cTx);
730734}
731-
732- static double ComputeWeightedNorm (const std::vector<double >& x1, const std::vector<double >& y1,
733- const std::vector<double >& x2, const std::vector<double >& y2, double omega) {
734- double norm = 0.0 ;
735- for (size_t i = 0 ; i < x1.size (); ++i) {
736- double diff_x = x1[i] - x2[i];
737- norm += (1.0 / omega) * diff_x * diff_x;
738- }
739- for (size_t i = 0 ; i < y1.size (); ++i) {
740- double diff_y = y1[i] - y2[i];
741- norm += omega * diff_y * diff_y;
742- }
743- return std::sqrt (norm);
744- }
745-
746- double ComputeNormalizedDualityGap (const HighsLp& lp, const std::vector<double >& x, const std::vector<double >& y, const std::vector<double >& x_ref, const std::vector<double >& y_ref, double omega, const std::vector<double >& ax, const std::vector<double >& aty){
747- // 1. Calculate radius r = ||z - z_ref||_omega
748- double r = ComputeWeightedNorm (x, y, x_ref, y_ref, omega);
749- if (r < 1e-9 ) return 0.0 ;
750-
751- // 2. Calculate Lagrangian gradient components
752- // g_x = c - A^T * y
753- std::vector<double > g_x (lp.num_col_ , 0.0 );
754-
755- // to do
756- return 0.0 ;
757- }
758735
759736bool PDLPSolver::CheckConvergence (const HighsLp& lp, const std::vector<double >& x, const std::vector<double >& y, const std::vector<double >& ax_vector, const std::vector<double >& aty_vector, double epsilon, SolverResults& results) {
760737 ComputeDualSlacks (lp, aty_vector);
761738 std::vector<double > lambda = ComputeLambda (lp, y, aty_vector);
762739
763- auto [primal_feasibility, q_norm] = ComputePrimalFeasibility (lp, x, ax_vector);
740+ double primal_feasibility, q_norm;
741+ std::tie (primal_feasibility, q_norm) = ComputePrimalFeasibility (lp, x, ax_vector);
764742 results.primal_feasibility = primal_feasibility;
765743
766- auto [dual_feasibility, c_norm] = ComputeDualFeasibility (lp, aty_vector);
744+ double dual_feasibility, c_norm;
745+ std::tie (dual_feasibility, c_norm) = ComputeDualFeasibility (lp, aty_vector);
767746 results.dual_feasibility = dual_feasibility;
768- auto [duality_gap, qTy, lTlambda_plus, uTlambda_minus, cTx] = ComputeDualityGap (lp, x, y, lambda);
747+
748+ double duality_gap, qTy, lTlambda_plus, uTlambda_minus, cTx;
749+ std::tie (duality_gap, qTy, lTlambda_plus, uTlambda_minus, cTx) = ComputeDualityGap (lp, x, y, lambda);
769750 results.duality_gap = duality_gap;
770751
771752 bool primal_feasible = primal_feasibility <= epsilon * (1 + q_norm);
0 commit comments