Skip to content

Commit 13f8444

Browse files
committed
formatted
1 parent f2a782e commit 13f8444

22 files changed

+2506
-2316
lines changed

app/HighsRuntimeOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void setupCommandLineOptions(CLI::App& app,
106106
"\"ipm\"\n"
107107
#ifdef HIPO
108108
"\"hipo\"\n"
109-
#endif
109+
#endif
110110
"\"ipx\"\n"
111111
"\"pdlp\"");
112112

check/TestPdlp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ TEST_CASE("pdlp-restart-add-row", "[pdlp]") {
331331
}
332332

333333
TEST_CASE("hi-pdlp", "[pdlp]") {
334-
std::string model = "avgas";//"adlittle";//"afiro";//
334+
std::string model = "avgas"; //"adlittle";//"afiro";//
335335
std::string model_file =
336336
std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
337337
Highs h;
338338
// h.setOptionValue("output_flag", dev_run);
339339
REQUIRE(h.readModel(model_file) == HighsStatus::kOk);
340340
h.setOptionValue("solver", kHiPdlpString);
341-
h.setOptionValue("kkt_tolerance", 1e-6);//kkt_tolerance);
341+
h.setOptionValue("kkt_tolerance", 1e-6); // kkt_tolerance);
342342

343343
h.setOptionValue("pdlp_scaling_mode", 0);
344344
h.setOptionValue("pdlp_restart_strategy", 0);

highs/lp_data/HighsInterface.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ void Highs::reportModelStats() const {
6767
highsLogDev(log_options, HighsLogType::kInfo, "%4s : %s\n",
6868
problem_type.c_str(), lp.model_name_.c_str());
6969
highsLogDev(log_options, HighsLogType::kInfo,
70-
"Row%s : %" HIGHSINT_FORMAT "\n",
70+
"Row%s : %" HIGHSINT_FORMAT "\n",
7171
lp.num_row_ == 1 ? "" : "s", lp.num_row_);
7272
highsLogDev(log_options, HighsLogType::kInfo,
73-
"Col%s : %" HIGHSINT_FORMAT "\n",
73+
"Col%s : %" HIGHSINT_FORMAT "\n",
7474
lp.num_col_ == 1 ? "" : "s", lp.num_col_);
7575
if (q_num_nz) {
7676
highsLogDev(log_options, HighsLogType::kInfo,
@@ -79,7 +79,7 @@ void Highs::reportModelStats() const {
7979
"Hessian Nz: %" HIGHSINT_FORMAT "\n", q_num_nz);
8080
} else {
8181
highsLogDev(log_options, HighsLogType::kInfo,
82-
"Nonzero%s : %" HIGHSINT_FORMAT "\n",
82+
"Nonzero%s : %" HIGHSINT_FORMAT "\n",
8383
a_num_nz == 1 ? "" : "s", a_num_nz);
8484
}
8585
if (num_integer)
@@ -2878,10 +2878,11 @@ HighsStatus Highs::lpKktCheck(const HighsLp& lp, const std::string& message) {
28782878
info.primal_dual_objective_error / optimality_tolerance;
28792879
foundOptimalityError();
28802880
if (was_optimal)
2881-
highsLogUser(log_options, HighsLogType::kWarning,
2882-
" %8.3g relative P-D objective error "
2883-
"(tolerance = %4.0e)\n",
2884-
info.primal_dual_objective_error, optimality_tolerance);
2881+
highsLogUser(
2882+
log_options, HighsLogType::kWarning,
2883+
" %8.3g relative P-D objective error "
2884+
"(tolerance = %4.0e)\n",
2885+
info.primal_dual_objective_error, optimality_tolerance);
28852886
}
28862887
// Set the primal and dual solution status according to tolerance failure
28872888
if (max_primal_tolerance_relative_violation >

highs/lp_data/HighsOptions.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,26 @@ bool optionOffOnOk(const HighsLogOptions& report_log_options,
8080
bool optionSolverOk(const HighsLogOptions& report_log_options,
8181
const string& value) {
8282
if (value == kSimplexString || value == kHighsChooseString ||
83-
value == kIpmString ||
83+
value == kIpmString ||
8484
#ifdef HIPO
8585
value == kHipoString ||
8686
#endif
87-
value == kIpxString ||
88-
value == kPdlpString || value == kCuPdlpString || value == kHiPdlpString)
87+
value == kIpxString || value == kPdlpString || value == kCuPdlpString ||
88+
value == kHiPdlpString)
8989
return true;
9090
highsLogUser(report_log_options, HighsLogType::kWarning,
91-
"Value \"%s\" for solver option is not one of \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", "
91+
"Value \"%s\" for solver option is not one of \"%s\", \"%s\", "
92+
"\"%s\", \"%s\", \"%s\", "
9293
#ifdef HIPO
9394
"\"%s\", "
9495
#endif
9596
"\"%s\" or \"%s\"\n",
96-
value.c_str(),
97-
kSimplexString.c_str(),
98-
kHighsChooseString.c_str(),
99-
kIpmString.c_str(),
97+
value.c_str(), kSimplexString.c_str(),
98+
kHighsChooseString.c_str(), kIpmString.c_str(),
10099
#ifdef HIPO
101100
kHipoString.c_str(),
102101
#endif
103-
kIpxString.c_str(),
104-
kPdlpString.c_str(),
105-
kCuPdlpString.c_str(),
102+
kIpxString.c_str(), kPdlpString.c_str(), kCuPdlpString.c_str(),
106103
kHiPdlpString.c_str());
107104
return false;
108105
}

highs/lp_data/HighsOptions.h

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ struct HighsOptionsStruct {
540540
ipm_optimality_tolerance(0.0),
541541
ipm_iteration_limit(0),
542542
hipo_system(""),
543-
pdlp_features_off(0),
543+
pdlp_features_off(0),
544544
pdlp_iteration_limit(0),
545545
pdlp_scaling_mode(0),
546546
pdlp_ruiz_iterations(0),
@@ -711,8 +711,9 @@ class HighsOptions : public HighsOptionsStruct {
711711
#ifdef HIPO
712712
", \"hipo\""
713713
#endif
714-
" or \"pdlp\"/\"cupdlp\"/\"hipdlp\". If "
715-
"\"simplex\"/\"ipm\"/\"pdlp\"/\"cupdlp\"/\"hipdlp\" is chosen then, for a MIP (QP) the "
714+
" or \"pdlp\"/\"cupdlp\"/\"hipdlp\". If "
715+
"\"simplex\"/\"ipm\"/\"pdlp\"/\"cupdlp\"/\"hipdlp\" is chosen then, "
716+
"for a MIP (QP) the "
716717
"integrality "
717718
"constraint (quadratic term) will be ignored",
718719
advanced, &solver, kHighsChooseString);
@@ -1281,36 +1282,41 @@ class HighsOptions : public HighsOptionsStruct {
12811282
&pdlp_iteration_limit, 0, kHighsIInf, kHighsIInf);
12821283
records.push_back(record_int);
12831284

1284-
record_int = new OptionRecordInt("pdlp_scaling_mode",
1285-
"Scaling mode for PDLP solver (default = "
1286-
"5): 1 => Ruiz; 2 => L2; 4 => PC",
1287-
advanced, &pdlp_scaling_mode,
1288-
kPdlpScalingMin, kPdlpScalingRuiz+kPdlpScalingPC, kPdlpScalingMax);
1285+
record_int =
1286+
new OptionRecordInt("pdlp_scaling_mode",
1287+
"Scaling mode for PDLP solver (default = "
1288+
"5): 1 => Ruiz; 2 => L2; 4 => PC",
1289+
advanced, &pdlp_scaling_mode, kPdlpScalingMin,
1290+
kPdlpScalingRuiz + kPdlpScalingPC, kPdlpScalingMax);
12891291
records.push_back(record_int);
12901292

1291-
record_int = new OptionRecordInt("pdlp_ruiz_iterations",
1292-
"Number of Ruiz scaling iteraitons for PDLP solver",
1293-
advanced, &pdlp_ruiz_iterations, 0, 10, kHighsIInf);
1293+
record_int =
1294+
new OptionRecordInt("pdlp_ruiz_iterations",
1295+
"Number of Ruiz scaling iteraitons for PDLP solver",
1296+
advanced, &pdlp_ruiz_iterations, 0, 10, kHighsIInf);
12941297
records.push_back(record_int);
12951298

1296-
record_int = new OptionRecordInt("pdlp_restart_strategy",
1297-
"Restart strategy for PDLP solver: 0 => off; "
1298-
"1 => fixed; 2 => adaptive",
1299-
advanced, &pdlp_restart_strategy,
1300-
kPdlpRestartStrategyMin, kPdlpRestartStrategyOff, kPdlpRestartStrategyMax);
1299+
record_int = new OptionRecordInt(
1300+
"pdlp_restart_strategy",
1301+
"Restart strategy for PDLP solver: 0 => off; "
1302+
"1 => fixed; 2 => adaptive",
1303+
advanced, &pdlp_restart_strategy, kPdlpRestartStrategyMin,
1304+
kPdlpRestartStrategyOff, kPdlpRestartStrategyMax);
13011305
records.push_back(record_int);
13021306

1303-
record_int = new OptionRecordInt("pdlp_cupdlpc_restart_method",
1304-
"Restart mode for cuPDLP-C solver: 0 => none; "
1305-
"1 => GPU (default); 2 => CPU ",
1306-
advanced, &pdlp_cupdlpc_restart_method, 0, 1, 2);
1307+
record_int =
1308+
new OptionRecordInt("pdlp_cupdlpc_restart_method",
1309+
"Restart mode for cuPDLP-C solver: 0 => none; "
1310+
"1 => GPU (default); 2 => CPU ",
1311+
advanced, &pdlp_cupdlpc_restart_method, 0, 1, 2);
13071312
records.push_back(record_int);
13081313

1309-
record_int = new OptionRecordInt("pdlp_step_size_strategy",
1310-
"Step size strategy for PDLP solver: 0 => fixed; "
1311-
"1 => adaptive; 2 => Malitsky-Pock",
1312-
advanced, &pdlp_step_size_strategy,
1313-
kPdlpStepSizeStrategyMin, kPdlpStepSizeStrategyFixed, kPdlpRestartStrategyMax);
1314+
record_int = new OptionRecordInt(
1315+
"pdlp_step_size_strategy",
1316+
"Step size strategy for PDLP solver: 0 => fixed; "
1317+
"1 => adaptive; 2 => Malitsky-Pock",
1318+
advanced, &pdlp_step_size_strategy, kPdlpStepSizeStrategyMin,
1319+
kPdlpStepSizeStrategyFixed, kPdlpRestartStrategyMax);
13141320
records.push_back(record_int);
13151321

13161322
record_double = new OptionRecordDouble(

highs/lp_data/HighsSolve.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,21 @@ HighsStatus solveLp(HighsLpSolverObject& solver_object, const string message) {
117117
sub_solver_call_time.run_time[kSubSolverPdlp] =
118118
-solver_object.timer_.read();
119119
if (options.solver == kPdlpString || options.solver == kCuPdlpString) {
120-
try {
121-
call_status = solveLpCupdlp(solver_object);
122-
} catch (const std::exception& exception) {
123-
highsLogDev(options.log_options, HighsLogType::kError,
124-
"Exception %s in solveLpCupdlp\n", exception.what());
125-
call_status = HighsStatus::kError;
126-
}
120+
try {
121+
call_status = solveLpCupdlp(solver_object);
122+
} catch (const std::exception& exception) {
123+
highsLogDev(options.log_options, HighsLogType::kError,
124+
"Exception %s in solveLpCupdlp\n", exception.what());
125+
call_status = HighsStatus::kError;
126+
}
127127
} else {
128-
try {
129-
call_status = solveLpHiPdlp(solver_object);
130-
} catch (const std::exception& exception) {
131-
highsLogDev(options.log_options, HighsLogType::kError,
132-
"Exception %s in solveHiPdlp\n", exception.what());
133-
call_status = HighsStatus::kError;
134-
}
128+
try {
129+
call_status = solveLpHiPdlp(solver_object);
130+
} catch (const std::exception& exception) {
131+
highsLogDev(options.log_options, HighsLogType::kError,
132+
"Exception %s in solveHiPdlp\n", exception.what());
133+
call_status = HighsStatus::kError;
134+
}
135135
}
136136
sub_solver_call_time.run_time[kSubSolverPdlp] +=
137137
solver_object.timer_.read();
@@ -600,7 +600,8 @@ bool useIpm(const std::string& solver) {
600600
}
601601

602602
bool usePdlp(const std::string& solver) {
603-
return solver == kPdlpString || solver == kHiPdlpString || solver == kCuPdlpString;
603+
return solver == kPdlpString || solver == kHiPdlpString ||
604+
solver == kCuPdlpString;
604605
}
605606

606607
// Decide whether to use the HiPO IPM solver

highs/mip/HighsPrimalHeuristics.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,17 @@ bool HighsPrimalHeuristics::solveSubMip(
162162
mipsolver.analysis_.mipTimerStop(kMipClockSubMipSolve);
163163
mipsolver.sub_solver_call_time_.num_call[kSubSolverSubMip]++;
164164
mipsolver.sub_solver_call_time_.run_time[kSubSolverSubMip] +=
165-
mipsolver.timer_.read();
165+
mipsolver.timer_.read();
166166
}
167167
// 22/07/25: Seems impossible for submipsolver.mipdata_ to be a null
168168
// pointer after calling HighsMipSolver::run(), and assert isn't
169169
// triggered for anything in ctest, but use direct test of
170170
// submipsolver.termination_status_, rather than
171171
// submipsolver.mipdata_.terminatorTerminated()
172172
if (!submipsolver.mipdata_) {
173-
printf("HighsPrimalHeuristics::solveSubMip: submipsolver.mipdata_ is "
174-
"nullptr\n");
173+
printf(
174+
"HighsPrimalHeuristics::solveSubMip: submipsolver.mipdata_ is "
175+
"nullptr\n");
175176
assert(submipsolver.mipdata_);
176177
}
177178
if (submipsolver.termination_status_ != HighsModelStatus::kNotset) {

0 commit comments

Comments
 (0)