1- #ifndef HIGHS_PDLP_DEFS_HPP
2- #define HIGHS_PDLP_DEFS_HPP
1+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2+ /* */
3+ /* This file is part of the HiGHS linear optimization suite */
4+ /* */
5+ /* Available as open-source under the MIT License */
6+ /* */
7+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
8+ /* *@file pdlp/hipdlp/defs.hpp
9+ * @brief
10+ */
11+ #ifndef PDLP_HIPDLP_DEFS_HPP
12+ #define PDLP_HIPDLP_DEFS_HPP
313
414#include < cmath>
515#include < vector>
16+
617#include " Highs.h"
718
819enum class Device { CPU, GPU };
@@ -62,7 +73,7 @@ struct PrimalDualParams {
6273};
6374
6475struct PdlpIterate {
65- // Primary variables
76+ // Primary variables
6677 std::vector<double > x;
6778 std::vector<double > y;
6879
@@ -75,11 +86,15 @@ struct PdlpIterate {
7586 // Constructors
7687 PdlpIterate () = default ;
7788 PdlpIterate (int num_cols, int num_rows)
78- : x(num_cols, 0.0 ), y(num_rows, 0.0 ), Ax(num_rows, 0.0 ), Aty(num_cols, 0.0 ) {}
79- PdlpIterate (const std::vector<double >& x_init, const std::vector<double >& y_init)
89+ : x(num_cols, 0.0 ),
90+ y (num_rows, 0.0 ),
91+ Ax(num_rows, 0.0 ),
92+ Aty(num_cols, 0.0 ) {}
93+ PdlpIterate (const std::vector<double >& x_init,
94+ const std::vector<double >& y_init)
8095 : x(x_init), y(y_init), Ax(y_init.size(), 0.0), Aty(x_init.size(), 0.0) {}
8196
82- // Arithmetic operations
97+ // Arithmetic operations
8398 // z = alpha * this + beta * other
8499 void LinearCombination (const PdlpIterate& other, double alpha, double beta);
85100
@@ -95,8 +110,9 @@ struct PdlpIterate {
95110
96111 // Norms and metrics
97112 double PrimalNorm () const ; // ||x||_2
98- double DualNorm () const ; // ||y||_2
99- double WeightedNorm (double omega) const ; // sqrt(||x||_2^2 + omega^2 * ||y||_2^2)
113+ double DualNorm () const ; // ||y||_2
114+ double WeightedNorm (
115+ double omega) const ; // sqrt(||x||_2^2 + omega^2 * ||y||_2^2)
100116
101117 // Distance metrics
102118 double Distance (const PdlpIterate& other, double omega = 1.0 ) const ;
@@ -105,28 +121,28 @@ struct PdlpIterate {
105121 void ComputeAx (const HighsLp& lp) const ;
106122 void ComputeATy (const HighsLp& lp) const ;
107123 void InvalidateProducts (); // Call when x or y change
108-
124+
109125 const std::vector<double >& GetAx (const HighsLp& lp) const ;
110126 const std::vector<double >& GetATy (const HighsLp& lp) const ;
111127
112128 // For block-structured problems
113129 struct BlockStructure {
114- std::vector<int > x_block_sizes;
115- std::vector<int > y_block_sizes;
116- // std::vector<std::vector<double>> x_blocks; // Future: for block problems
117- // std::vector<std::vector<double>> y_blocks;
130+ std::vector<int > x_block_sizes;
131+ std::vector<int > y_block_sizes;
132+ // std::vector<std::vector<double>> x_blocks; // Future: for block problems
133+ // std::vector<std::vector<double>> y_blocks;
118134 };
119135
120136 // Optional: block structure for future extensions
121137 std::unique_ptr<BlockStructure> block_structure = nullptr ;
122138
123- private:
139+ private:
124140 void EnsureAxComputed (const HighsLp& lp) const ;
125141 void EnsureATyComputed (const HighsLp& lp) const ;
126142};
127143
128144namespace pdlp_iterate_ops {
129- // Compute z_new = z_old -
145+ // Compute z_new = z_old -
130146};
131147
132- #endif
148+ #endif
0 commit comments