Skip to content

Commit cb73cb6

Browse files
committed
Added noHipoErrorLog method to HighsOptions.cpp to avoid duplicate code
1 parent bc91e0b commit cb73cb6

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

highs/lp_data/HighsOptions.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,23 @@ bool optionOffOnOk(const HighsLogOptions& report_log_options,
8080
return false;
8181
}
8282

83+
#ifndef HIPO
84+
static void noHipoErrorLog(const HighsLogOptions& report_log_options,
85+
const string& option_name) {
86+
highsLogUser(
87+
report_log_options, HighsLogType::kError,
88+
"The HiPO solver was requested via the \"%s\" option, but this build "
89+
"was compiled without HiPO support. Reconfigure with -DFAST_BUILD=ON "
90+
"and -DHIPO=ON to enable HiPO.\n",
91+
option_name.c_str());
92+
}
93+
#endif
94+
8395
bool optionSolverOk(const HighsLogOptions& report_log_options,
8496
const string& value) {
8597
#ifndef HIPO
8698
if (value == kHipoString) {
87-
highsLogUser(
88-
report_log_options, HighsLogType::kError,
89-
"The HiPO solver was requested via the \"%s\" option, but this build "
90-
"was compiled without HiPO support. Reconfigure with FAST_BUILD=ON "
91-
"and -DHIPO=ON to enable HiPO.\n",
92-
kSolverString.c_str());
99+
noHipoErrorLog(report_log_options, kSolverString);
93100
return false;
94101
}
95102
#endif
@@ -119,12 +126,7 @@ bool optionMipLpSolverOk(const HighsLogOptions& report_log_options,
119126
const string& value) {
120127
#ifndef HIPO
121128
if (value == kHipoString) {
122-
highsLogUser(
123-
report_log_options, HighsLogType::kError,
124-
"The HiPO solver was requested via the \"%s\" option, but this build "
125-
"was compiled without HiPO support. Reconfigure with FAST_BUILD=ON "
126-
"and -DHIPO=ON to enable HiPO.\n",
127-
kMipLpSolverString.c_str());
129+
noHipoErrorLog(report_log_options, kMipLpSolverString);
128130
return false;
129131
}
130132
#endif
@@ -155,12 +157,7 @@ bool optionMipIpmSolverOk(const HighsLogOptions& report_log_options,
155157
const string& value) {
156158
#ifndef HIPO
157159
if (value == kHipoString) {
158-
highsLogUser(
159-
report_log_options, HighsLogType::kError,
160-
"The HiPO solver was requested via the \"%s\" option, but this build "
161-
"was compiled without HiPO support. Reconfigure with FAST_BUILD=ON "
162-
"and -DHIPO=ON to enable HiPO.\n",
163-
kMipIpmSolverString.c_str());
160+
noHipoErrorLog(report_log_options, kMipIpmSolverString);
164161
return false;
165162
}
166163
#endif

0 commit comments

Comments
 (0)