Skip to content

Commit ce15c6b

Browse files
committed
wip
1 parent 30163be commit ce15c6b

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

check/TestPdlp.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ TEST_CASE("cuda-sandbox", "[pdlp]") {
474474
#endif
475475

476476
TEST_CASE("hi-pdlp-halpern", "[pdlp]") {
477-
std::string model = "neso-2005"; //"afiro";
477+
std::string model = "afiro"; //"afiro";
478478
// shell //stair //25fv47 //fit2p //avgas //neso-2245 //neso-2005
479479
std::string model_file =
480480
// std::string(HIGHS_DIR) + "/srv/" + model + ".mps.gz";
@@ -498,13 +498,14 @@ TEST_CASE("hi-pdlp-halpern", "[pdlp]") {
498498
//+ kPdlpScalingL2cm
499499
+ kPdlpScalingPC;
500500
h.setOptionValue("pdlp_scaling_mode", pdlp_scaling);
501-
h.setOptionValue("pdlp_step_size_strategy", 0);
501+
h.setOptionValue("pdlp_step_size_strategy", 0); // 0: fixed, 1: adaptive, 2: Malitsky-Pock, 3: PID
502502
h.setOptionValue("pdlp_restart_strategy", kPdlpRestartStrategyHalpern); // kPdlpRestartStrategyHalpern; kPdlpRestartStrategyAdaptive kPdlpRestartStrategyOff
503503
//turn on log
504504
//h.setOptionValue("log_dev_level", kHighsLogDevLevelVerbose);
505-
h.setOptionValue("pdlp_iteration_limit", 10000);
506-
// h.setOptionValue("pdlp_time_limit", 60);
505+
//h.setOptionValue("pdlp_iteration_limit", 10000);
506+
//h.setOptionValue("pdlp_time_limit", 60);
507507
//h.setOptionValue("log_dev_level", kHighsLogDevLevelVerbose);
508+
h.setOptionValue("kkt_tolerance", 1e-4);
508509
auto start_hipdlp = std::chrono::high_resolution_clock::now();
509510
HighsStatus run_status = h.run();
510511
auto end_hipdlp = std::chrono::high_resolution_clock::now();

highs/pdlp/hipdlp/pdhg.cc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ bool PDLPSolver::runConvergenceCheckAndRestart(size_t iter,
757757

758758
if (params_.use_halpern_restart ) {
759759
if (params_.step_size_strategy == StepSizeStrategy::PID) {
760-
updatePrimalWeightAtRestart(current_results);
760+
updatePrimalWeightAtRestart(current_results);
761761
}
762762
#ifdef CUPDLP_GPU
763763
if (d_pdhg_primal_ != nullptr) {
@@ -1700,6 +1700,9 @@ void PrimalDualParams::initialise() {
17001700
this->ruiz_iterations = 10;
17011701
this->ruiz_norm = INFINITY;
17021702
this->pc_alpha = 1.0;
1703+
this->k_p = 0.99;
1704+
this->k_i = 0.01;
1705+
this->k_d = 0.0;
17031706
this->step_size_strategy = StepSizeStrategy::FIXED;
17041707
this->malitsky_pock_params.initialise();
17051708
this->adaptive_linesearch_params.initialise();
@@ -1795,14 +1798,15 @@ void PDLPSolver::updatePrimalWeightAtRestart(const SolverResults& results) {
17951798
dual_dist = std::sqrt(dual_dist);
17961799
#endif
17971800

1798-
// Compute residual ratio
1799-
double ratio = results.dual_feasibility / (results.primal_feasibility + 1e-30);
1801+
double rel_primal = results.primal_feasibility / (1.0 + unscaled_rhs_norm_);
1802+
double rel_dual = results.dual_feasibility / (1.0 + unscaled_c_norm_);
1803+
double ratio_infeas = (rel_primal > 0.0) ? (rel_dual / rel_primal) : 1e300;
18001804

1801-
const bool silent = true;
1805+
const bool silent = false;
18021806
// cuPDLPx-style weight update (PID control)
18031807
if (primal_dist > 1e-16 && dual_dist > 1e-16 &&
18041808
primal_dist < 1e12 && dual_dist < 1e12 &&
1805-
ratio > 1e-8 && ratio < 1e8) {
1809+
ratio_infeas > 1e-8 && ratio_infeas < 1e8) {
18061810

18071811
double error = std::log(dual_dist) - std::log(primal_dist) - std::log(primal_weight_);
18081812

@@ -1829,7 +1833,7 @@ void PDLPSolver::updatePrimalWeightAtRestart(const SolverResults& results) {
18291833
}
18301834

18311835
// Track best weight
1832-
double gap = std::abs(std::log10(results.dual_feasibility / (results.primal_feasibility + 1e-30)));
1836+
double gap = (rel_primal > 0.0 && rel_dual > 0.0) ? std::abs(std::log10(rel_dual / rel_primal)) : best_primal_dual_residual_gap_;
18331837
if (gap < best_primal_dual_residual_gap_) {
18341838
best_primal_dual_residual_gap_ = gap;
18351839
best_primal_weight_ = primal_weight_;

0 commit comments

Comments
 (0)