Skip to content

Commit 30163be

Browse files
author
Julian Hall
committed
Added PID Option
1 parent dcef9f9 commit 30163be

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

highs/lp_data/HConst.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ enum PdlpStepSizeStrategy {
405405
kPdlpStepSizeStrategyMin = kPdlpStepSizeStrategyFixed,
406406
kPdlpStepSizeStrategyAdaptive,
407407
kPdlpStepSizeStrategyMalitskyPock,
408-
kPdlpStepSizeStrategyMax = kPdlpStepSizeStrategyMalitskyPock
408+
kPdlpStepSizeStrategyPid,
409+
kPdlpStepSizeStrategyMax = kPdlpStepSizeStrategyPid
409410
};
410411

411412
enum PdlpRestartStrategy {

highs/lp_data/HighsOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ class HighsOptions : public HighsOptionsStruct {
13371337
record_int = new OptionRecordInt(
13381338
"pdlp_step_size_strategy",
13391339
"Step size strategy for PDLP solver: 0 => fixed; "
1340-
"1 => adaptive; 2 => Malitsky-Pock",
1340+
"1 => adaptive; 2 => Malitsky-Pock; 3 => PID",
13411341
advanced, &pdlp_step_size_strategy, kPdlpStepSizeStrategyMin,
13421342
kPdlpStepSizeStrategyAdaptive, kPdlpRestartStrategyMax);
13431343
records.push_back(record_int);

highs/pdlp/hipdlp/defs.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ enum class ScalingMethod { NONE, RUIZ, POCK_CHAMBOLLE, L2_NORM, COMBINED };
2222

2323
enum class RestartStrategy { NO_RESTART, FIXED_RESTART, ADAPTIVE_RESTART, HALPERN_RESTART};
2424

25-
enum class StepSizeStrategy { FIXED, ADAPTIVE, MALITSKY_POCK };
25+
enum class StepSizeStrategy { FIXED, ADAPTIVE, MALITSKY_POCK, PID };
2626

2727
enum class PostSolveRetcode {
2828
OK = 0,

highs/pdlp/hipdlp/pdhg.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,9 @@ bool PDLPSolver::runConvergenceCheckAndRestart(size_t iter,
756756

757757

758758
if (params_.use_halpern_restart ) {
759-
updatePrimalWeightAtRestart(current_results);
759+
if (params_.step_size_strategy == StepSizeStrategy::PID) {
760+
updatePrimalWeightAtRestart(current_results);
761+
}
760762
#ifdef CUPDLP_GPU
761763
if (d_pdhg_primal_ != nullptr) {
762764
// Halpern: always restart to pdhg iterate (matching cuPDLPx)
@@ -863,6 +865,8 @@ void PDLPSolver::performPdhgStep() {
863865
// Note: Error handling for MP failure simplified for brevity
864866
updateIteratesMalitskyPock(false);
865867
break;
868+
case StepSizeStrategy::PID:
869+
assert(111==999);
866870
}
867871

868872
#if PDLP_PROFILE
@@ -1636,6 +1640,9 @@ void PDLPSolver::setup(const HighsOptions& options, HighsTimer& timer) {
16361640
} else if (options.pdlp_step_size_strategy ==
16371641
kPdlpStepSizeStrategyMalitskyPock) {
16381642
params_.step_size_strategy = StepSizeStrategy::MALITSKY_POCK;
1643+
} else if (options.pdlp_step_size_strategy ==
1644+
kPdlpStepSizeStrategyPid) {
1645+
params_.step_size_strategy = StepSizeStrategy::PID;
16391646
}
16401647
}
16411648
// params_.malitsky_pock_params.initialise(); Not set in parse_options_file
@@ -1791,6 +1798,7 @@ void PDLPSolver::updatePrimalWeightAtRestart(const SolverResults& results) {
17911798
// Compute residual ratio
17921799
double ratio = results.dual_feasibility / (results.primal_feasibility + 1e-30);
17931800

1801+
const bool silent = true;
17941802
// cuPDLPx-style weight update (PID control)
17951803
if (primal_dist > 1e-16 && dual_dist > 1e-16 &&
17961804
primal_dist < 1e12 && dual_dist < 1e12 &&
@@ -1808,14 +1816,15 @@ void PDLPSolver::updatePrimalWeightAtRestart(const SolverResults& results) {
18081816
);
18091817

18101818
primal_weight_last_error_ = error;
1811-
1812-
logger_.info("Primal weight updated: " + std::to_string(primal_weight_));
1819+
if (!silent)
1820+
logger_.info("Primal weight updated: " + std::to_string(primal_weight_));
18131821
} else {
18141822
// Revert to best known weight
18151823
primal_weight_ = best_primal_weight_;
18161824
primal_weight_error_sum_ = 0.0;
18171825
primal_weight_last_error_ = 0.0;
1818-
logger_.info("Weight update failed (bad norms/ratio), reverted to best: " +
1826+
if (!silent)
1827+
logger_.info("Weight update failed (bad norms/ratio), reverted to best: " +
18191828
std::to_string(primal_weight_));
18201829
}
18211830

0 commit comments

Comments
 (0)