Skip to content

Commit 915f04e

Browse files
committed
wip
1 parent 132feb4 commit 915f04e

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

check/TestPdlp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ TEST_CASE("hi-pdlp", "[pdlp]") {
344344
h.setOptionValue("pdlp_restart_strategy", 0);
345345
h.setOptionValue("pdlp_step_size_strategy", 0);
346346

347-
h.setOptionValue("pdlp_iteration_limit", 1000000);
347+
h.setOptionValue("pdlp_iteration_limit", 15);
348348
// h.setOptionValue("log_dev_level", kHighsLogDevLevelVerbose);
349349
HighsStatus run_status = h.run();
350350
// REQUIRE(run_status == HighsStatus::kOk);

highs/pdlp/cupdlp/cupdlp_step.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ void PDHG_primalGradientStep(CUPDLPwork *work, CUPDLPvec *xUpdate,
1818
cupdlp_float dPrimalStepSize) {
1919
CUPDLPproblem *problem = work->problem;
2020

21+
// print norm of A'y
22+
double aty_norm = 0.0;
23+
cupdlp_twoNorm(work, problem->nCols, ATy->data, &aty_norm);
24+
cupdlp_printf("Norm of A'y: %g\n", aty_norm);
25+
2126
#if !defined(CUPDLP_CPU) && USE_KERNELS
2227
cupdlp_pgrad_cuda(xUpdate->data, x->data, problem->cost,
2328
ATy->data, problem->lower, problem->upper, dPrimalStepSize,
@@ -192,6 +197,11 @@ void PDHG_Update_Iterate_Constant_Step_Size(CUPDLPwork *pdhg) {
192197
CUPDLPvec *atyUpdate = iterates->aty[(iter + 1) % 2];
193198

194199
Ax(pdhg, ax, x);
200+
//pint norm of Ax
201+
double ax_norm = 0.0;
202+
cupdlp_twoNorm(pdhg, problem->nRows, ax->data,
203+
&ax_norm);
204+
cupdlp_printf("Norm of Ax: %g\n", ax_norm);
195205
ATy(pdhg, aty, y);
196206

197207
// x^{k+1} = proj_{X}(x^k - dPrimalStep * (c - A'y^k))

highs/pdlp/hipdlp/pdhg.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,7 @@ void PDLPSolver::Solve(HighsLp& original_lp, const PrimalDualParams& params,
350350
// We need Ax for the y-update and for computing residuals
351351
std::vector<double> Ax_current(lp.num_row_, 0.0);
352352
std::vector<double> ATy_current(lp.num_col_, 0.0);
353-
linalg::Ax(lp, x_current_, Ax_current);
354-
linalg::ATy(lp, y_current_, ATy_current);
353+
355354
std::vector<double> Ax_new(lp.num_row_, 0.0);
356355
std::vector<double> ATy_new(lp.num_col_, 0.0);
357356

@@ -364,6 +363,12 @@ void PDLPSolver::Solve(HighsLp& original_lp, const PrimalDualParams& params,
364363
// A single loop handles max iterations, convergence, and restarts.
365364
for (int iter = 0; iter < params.max_iterations; ++iter) {
366365
pdlpLog(pdlp_log_file, iter);
366+
linalg::Ax(lp, x_current_, Ax_current);
367+
//print norm of Ax
368+
double ax_norm = linalg::vector_norm(Ax_current);
369+
std::cout << "Norm of Ax: " << ax_norm << std::endl;
370+
371+
linalg::ATy(lp, y_current_, ATy_current);
367372
if (solver_timer.read() > params.time_limit) {
368373
logger_.info("Time limit reached.");
369374
final_iter_count_ = iter;

highs/pdlp/hipdlp/step.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ void UpdateX(std::vector<double>& x_new, const std::vector<double>& x_current,
8989
double eta, double omega) {
9090
std::vector<double> ATy_cache(lp.num_col_);
9191
linalg::ATy(lp, y_current, ATy_cache);
92-
92+
//print the norm of ATy_cache
93+
double aty_norm = linalg::vector_norm(ATy_cache);
94+
std::cout << "Norm of A'y: " << aty_norm << std::endl;
9395
for (HighsInt i = 0; i < lp.num_col_; i++) {
9496
double gradient = lp.col_cost_[i] - ATy_cache[i];
9597
x_new[i] = linalg::project_box(x_current[i] - (eta / omega) * gradient,

0 commit comments

Comments
 (0)