Skip to content

Commit 5132861

Browse files
committed
Can also switch off adaptive stepsize and restarts
1 parent f1ad82b commit 5132861

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

src/lp_data/HConst.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,10 @@ const int8_t kPivotMarkowitz = 4;
321321
enum PdlpFeaturesOff {
322322
kPdlpAllFeaturesOn = 0,
323323
kPdlpScalingOff = 1,
324-
kPdlpRestartsOff = 2,
324+
kPdlpRestartOff = 2,
325325
kPdlpAdaptiveStepSizeOff = 4,
326326
kPdlpPrimalWeightUpdateOff = 8,
327-
kPdlpAllFeaturesOff = kPdlpScalingOff + kPdlpRestartsOff +
327+
kPdlpAllFeaturesOff = kPdlpScalingOff + kPdlpRestartOff +
328328
kPdlpAdaptiveStepSizeOff + kPdlpPrimalWeightUpdateOff
329329
};
330330

src/lp_data/HighsOptions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ class HighsOptions : public HighsOptionsStruct {
10861086

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

11061106
record_int = new OptionRecordInt("pdlp_e_restart_method",
11071107
"Restart mode for PDLP solver: 0 => none; "
1108-
"1 => GPU (default); 2 => CPU ",
1109-
advanced, &pdlp_e_restart_method, 0, 1, 2);
1108+
"1 => GPU",
1109+
advanced, &pdlp_e_restart_method, 0, 1, 1);
11101110
records.push_back(record_int);
11111111

11121112
record_double = new OptionRecordDouble(

src/pdlp/CupdlpWrapper.cpp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,25 @@ void getUserParamsFromOptions(const HighsOptions& options,
578578
intParam[N_LOG_LEVEL] = getCupdlpLogLevel(options);
579579
//
580580
ifChangeIntParam[IF_SCALING] = true;
581-
cupdlp_int scaling_off = options.pdlp_features_off & kPdlpScalingOff;
582-
cupdlp_int scaling_on = scaling_off == 0 ? 1 : 0;
581+
cupdlp_int scaling_on =
582+
(options.pdlp_features_off & kPdlpScalingOff) == 0 ? 1 : 0;
583583
intParam[IF_SCALING] = scaling_on;
584+
if (scaling_on == 0)
585+
highsLogUser(options.log_options, HighsLogType::kInfo,
586+
"PDLP: Scaling off\n");
587+
//
588+
ifChangeIntParam[E_LINE_SEARCH_METHOD] = true;
589+
cupdlp_int adaptive_lineasearch =
590+
(options.pdlp_features_off & kPdlpAdaptiveStepSizeOff) == 0 ? 1 : 0;
591+
intParam[E_LINE_SEARCH_METHOD] = adaptive_lineasearch;
592+
if (adaptive_lineasearch == 1) {
593+
intParam[E_LINE_SEARCH_METHOD] = PDHG_ADAPTIVE_LINESEARCH;
594+
} else {
595+
intParam[E_LINE_SEARCH_METHOD] = PDHG_FIXED_LINESEARCH;
596+
}
597+
if (adaptive_lineasearch == 0)
598+
highsLogUser(options.log_options, HighsLogType::kInfo,
599+
"PDLP: Adaptive line search off\n");
584600
//
585601
ifChangeFloatParam[D_PRIMAL_TOL] = true;
586602
floatParam[D_PRIMAL_TOL] = options.primal_feasibility_tolerance;
@@ -595,7 +611,13 @@ void getUserParamsFromOptions(const HighsOptions& options,
595611
floatParam[D_TIME_LIM] = options.time_limit;
596612
//
597613
ifChangeIntParam[E_RESTART_METHOD] = true;
598-
intParam[E_RESTART_METHOD] = int(options.pdlp_e_restart_method);
614+
cupdlp_int restart_on =
615+
(options.pdlp_features_off & kPdlpRestartOff) == 0 ? 1 : 0;
616+
if (options.pdlp_e_restart_method == 0) restart_on = 0;
617+
intParam[E_RESTART_METHOD] = restart_on;
618+
if (restart_on == 0)
619+
highsLogUser(options.log_options, HighsLogType::kInfo,
620+
"PDLP: Restart off\n");
599621
//
600622
ifChangeIntParam[I_INF_NORM_ABS_LOCAL_TERMINATION] = true;
601623
intParam[I_INF_NORM_ABS_LOCAL_TERMINATION] = !options.pdlp_native_termination;

0 commit comments

Comments
 (0)