Skip to content

Commit 9e341c1

Browse files
committed
Very sensitive to power method result; logging of HiPDLP primal and dual step lengths probably incorrect
1 parent 0140a4c commit 9e341c1

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

check/TestPdlp.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,19 @@ TEST_CASE("hi-pdlp", "[pdlp]") {
339339
REQUIRE(h.readModel(model_file) == HighsStatus::kOk);
340340
h.setOptionValue("solver", kHiPdlpString);
341341
h.setOptionValue("kkt_tolerance", kkt_tolerance);
342+
342343
h.setOptionValue("pdlp_scaling_mode", 0);
343344
h.setOptionValue("pdlp_restart_strategy", 0);
344345
h.setOptionValue("pdlp_step_size_strategy", 0);
345-
// h.setOptionValue("pdlp_iteration_limit", 10000);
346+
347+
h.setOptionValue("pdlp_iteration_limit", 100000);
346348
// h.setOptionValue("log_dev_level", kHighsLogDevLevelVerbose);
347349
HighsStatus run_status = h.run();
348350
// REQUIRE(run_status == HighsStatus::kOk);
349351
// REQUIRE(h.getModelStatus() == HighsModelStatus::kOptimal);
350-
const bool cupdlp_test = false;
352+
const bool cupdlp_test = true;
351353
if (cupdlp_test) {
354+
h.clearSolver();
352355
h.setOptionValue("solver", kCuPdlpString);
353356
h.setOptionValue("pdlp_features_off", kPdlpAllFeaturesOff);
354357
run_status = h.run();

highs/pdlp/cupdlp/cupdlp_step.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ cupdlp_retcode PDHG_Power_Method(CUPDLPwork *work, cupdlp_float *lambda) {
9595
//
9696
// y is stored in aty->data
9797
//
98-
int log_iters = work->settings->nLogLevel > 0;
99-
log_iters = 1;
98+
int log_iters = work->settings->nLogLevel > 1;
99+
// log_iters = 1;
100100

101101
if (log_iters)
102102
cupdlp_printf("It lambda dl_lambda residual\n");
@@ -318,6 +318,7 @@ cupdlp_retcode PDHG_Init_Step_Sizes(CUPDLPwork *pdhg) {
318318

319319
if (stepsize->eLineSearchMethod == PDHG_FIXED_LINESEARCH) {
320320
CUPDLP_CALL(PDHG_Power_Method(pdhg, &stepsize->dPrimalStep));
321+
cupdlp_float power_method_lambda = stepsize->dPrimalStep;
321322
// PDLP Intial primal weight = norm(cost) / norm(rhs) = sqrt(beta)
322323
// cupdlp_float a = twoNormSquared(problem->cost, problem->nCols);
323324
// cupdlp_float b = twoNormSquared(problem->rhs, problem->nRows);
@@ -336,6 +337,8 @@ cupdlp_retcode PDHG_Init_Step_Sizes(CUPDLPwork *pdhg) {
336337
stepsize->dDualStep = stepsize->dPrimalStep;
337338
stepsize->dPrimalStep /= sqrt(stepsize->dBeta);
338339
stepsize->dDualStep *= sqrt(stepsize->dBeta);
340+
cupdlp_printf("Initial step sizes from power method lambda = %g: primal = %g; dual = %g\n",
341+
power_method_lambda, stepsize->dPrimalStep, stepsize->dDualStep);
339342
} else {
340343
stepsize->dTheta = 1.0;
341344

highs/pdlp/hipdlp/pdhg.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ void PDLPSolver::Solve(HighsLp & original_lp, const PrimalDualParams& params, st
317317
working_params.omega = omega;
318318
working_params.eta = fixed_eta;
319319
std::cout << "Using power method step sizes: eta = " << fixed_eta << ", omega = " << omega << std::endl;
320-
320+
printf("Initial step sizes from power method lambda = %g: primal = %g; dual = %g\n",
321+
op_norm_sq, fixed_eta/omega, fixed_eta*omega);
321322
// --- 1. Initialization ---
322323
Initialize(lp, x, y); // Sets initial x, y and results_
323324
restart_scheme_.Initialize(params, results_);
@@ -805,7 +806,7 @@ HighsStatus PDLPSolver::PowerMethod(HighsLp &lp, double& op_norm_sq) {
805806
const HighsInt kATAPowerMethod = 1;
806807
const HighsInt kCuPdlpAATPowerMethod = 2;
807808

808-
const HighsInt power_method = kCuPdlpAATPowerMethod;
809+
const HighsInt power_method = kYanyuPowerMethod;//kCuPdlpAATPowerMethod;//
809810
// Allocate memory for matrix-vector products
810811
std::vector<double> y_vec;
811812
std::vector<double> z_vec;
@@ -820,7 +821,7 @@ HighsStatus PDLPSolver::PowerMethod(HighsLp &lp, double& op_norm_sq) {
820821
double op_norm_sq_old = 0.0;
821822
LogLevel log_level = logger_.getLogLevel();
822823
int log_iters = log_level == LogLevel::kVerbose || log_level == LogLevel::kDebug;
823-
log_iters = 1;
824+
// log_iters = 1;
824825

825826
if (log_iters) printf("It lambda dl_lambda\n");
826827

0 commit comments

Comments
 (0)