Skip to content

Commit

Permalink
Can also switch off adaptive stepsize and restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
jajhall committed Jan 27, 2025
1 parent f1ad82b commit 5132861
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/lp_data/HConst.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ const int8_t kPivotMarkowitz = 4;
enum PdlpFeaturesOff {
kPdlpAllFeaturesOn = 0,
kPdlpScalingOff = 1,
kPdlpRestartsOff = 2,
kPdlpRestartOff = 2,
kPdlpAdaptiveStepSizeOff = 4,
kPdlpPrimalWeightUpdateOff = 8,
kPdlpAllFeaturesOff = kPdlpScalingOff + kPdlpRestartsOff +
kPdlpAllFeaturesOff = kPdlpScalingOff + kPdlpRestartOff +
kPdlpAdaptiveStepSizeOff + kPdlpPrimalWeightUpdateOff
};

Expand Down
6 changes: 3 additions & 3 deletions src/lp_data/HighsOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ class HighsOptions : public HighsOptionsStruct {

record_int = new OptionRecordInt(
"pdlp_features_off",
"Mask for switching PDLP features off: 1 => Scaling; 2 => Restarts; 4 "
"Mask for switching PDLP features off: 1 => Scaling; 2 => Restart; 4 "
"=> AdaptiveStepSize; 8 => PrimalWeightUpdate",
advanced, &pdlp_features_off, kPdlpAllFeaturesOn, kPdlpAllFeaturesOn,
kPdlpAllFeaturesOff);
Expand All @@ -1105,8 +1105,8 @@ class HighsOptions : public HighsOptionsStruct {

record_int = new OptionRecordInt("pdlp_e_restart_method",
"Restart mode for PDLP solver: 0 => none; "
"1 => GPU (default); 2 => CPU ",
advanced, &pdlp_e_restart_method, 0, 1, 2);
"1 => GPU",
advanced, &pdlp_e_restart_method, 0, 1, 1);
records.push_back(record_int);

record_double = new OptionRecordDouble(
Expand Down
28 changes: 25 additions & 3 deletions src/pdlp/CupdlpWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,25 @@ void getUserParamsFromOptions(const HighsOptions& options,
intParam[N_LOG_LEVEL] = getCupdlpLogLevel(options);
//
ifChangeIntParam[IF_SCALING] = true;
cupdlp_int scaling_off = options.pdlp_features_off & kPdlpScalingOff;
cupdlp_int scaling_on = scaling_off == 0 ? 1 : 0;
cupdlp_int scaling_on =
(options.pdlp_features_off & kPdlpScalingOff) == 0 ? 1 : 0;
intParam[IF_SCALING] = scaling_on;
if (scaling_on == 0)
highsLogUser(options.log_options, HighsLogType::kInfo,
"PDLP: Scaling off\n");
//
ifChangeIntParam[E_LINE_SEARCH_METHOD] = true;
cupdlp_int adaptive_lineasearch =
(options.pdlp_features_off & kPdlpAdaptiveStepSizeOff) == 0 ? 1 : 0;
intParam[E_LINE_SEARCH_METHOD] = adaptive_lineasearch;
if (adaptive_lineasearch == 1) {
intParam[E_LINE_SEARCH_METHOD] = PDHG_ADAPTIVE_LINESEARCH;
} else {
intParam[E_LINE_SEARCH_METHOD] = PDHG_FIXED_LINESEARCH;
}
if (adaptive_lineasearch == 0)
highsLogUser(options.log_options, HighsLogType::kInfo,
"PDLP: Adaptive line search off\n");
//
ifChangeFloatParam[D_PRIMAL_TOL] = true;
floatParam[D_PRIMAL_TOL] = options.primal_feasibility_tolerance;
Expand All @@ -595,7 +611,13 @@ void getUserParamsFromOptions(const HighsOptions& options,
floatParam[D_TIME_LIM] = options.time_limit;
//
ifChangeIntParam[E_RESTART_METHOD] = true;
intParam[E_RESTART_METHOD] = int(options.pdlp_e_restart_method);
cupdlp_int restart_on =
(options.pdlp_features_off & kPdlpRestartOff) == 0 ? 1 : 0;
if (options.pdlp_e_restart_method == 0) restart_on = 0;
intParam[E_RESTART_METHOD] = restart_on;
if (restart_on == 0)
highsLogUser(options.log_options, HighsLogType::kInfo,
"PDLP: Restart off\n");
//
ifChangeIntParam[I_INF_NORM_ABS_LOCAL_TERMINATION] = true;
intParam[I_INF_NORM_ABS_LOCAL_TERMINATION] = !options.pdlp_native_termination;
Expand Down

0 comments on commit 5132861

Please sign in to comment.