Skip to content

Commit 3a92b40

Browse files
committed
Now reporting possible presolve_rule_off settings when options_->log_dev_level is nonzero
1 parent bc91e0b commit 3a92b40

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
lines changed

highs/presolve/HPresolveAnalysis.cpp

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,19 @@ void HPresolveAnalysis::setup(const HighsLp* model_,
1919

2020
this->allow_rule_.assign(kPresolveRuleCount, true);
2121

22-
if (options->presolve_rule_off) {
22+
if (options->presolve_rule_off || options_->log_dev_level) {
2323
// Some presolve rules are off
2424
//
2525
// Transform options->presolve_rule_off into logical settings in
2626
// allow_rule_[*], commenting on the rules switched off
27-
highsLogUser(options->log_options, HighsLogType::kInfo,
28-
"Presolve rules not allowed:\n");
27+
if (options->presolve_rule_off) {
28+
highsLogUser(options->log_options, HighsLogType::kInfo,
29+
"Presolve rules not allowed:\n");
30+
} else {
31+
highsLogUser(options->log_options, HighsLogType::kInfo,
32+
"Permitted suppression of presolve rules via "
33+
"presolve_rule_off option:\n");
34+
}
2935
HighsInt bit = 1;
3036
for (HighsInt rule_type = kPresolveRuleMin; rule_type < kPresolveRuleCount;
3137
rule_type++) {
@@ -35,17 +41,19 @@ void HPresolveAnalysis::setup(const HighsLp* model_,
3541
// This is a rule that can be switched off, so comment
3642
// positively if it is off
3743
allow_rule_[rule_type] = allow;
38-
if (!allow)
44+
if (!allow || (!options->presolve_rule_off && options_->log_dev_level))
3945
highsLogUser(options->log_options, HighsLogType::kInfo,
40-
" Rule %2d (bit %4d): %s\n", (int)rule_type, (int)bit,
46+
" Rule %2d (set bit %2d = %5d): %s\n", int(rule_type),
47+
int(rule_type), int(bit),
4148
utilPresolveRuleTypeToString(rule_type).c_str());
4249
} else if (!allow) {
4350
// This is a rule that cannot be switched off so, if an
4451
// attempt is made, don't allow it to be off and comment
4552
// negatively
4653
highsLogUser(options->log_options, HighsLogType::kWarning,
47-
"Cannot disallow rule %2d (bit %4d): %s\n", (int)rule_type,
48-
(int)bit, utilPresolveRuleTypeToString(rule_type).c_str());
54+
"Cannot disallow rule %2d (bit %2d = %5d): %s\n",
55+
int(rule_type), int(rule_type), int(bit),
56+
utilPresolveRuleTypeToString(rule_type).c_str());
4957
}
5058
bit *= 2;
5159
}
@@ -175,32 +183,33 @@ bool HPresolveAnalysis::analysePresolveRuleLog(const bool report) {
175183
if (report && sum_removed_row + sum_removed_col) {
176184
const std::string rule =
177185
"-------------------------------------------------------";
178-
highsLogDev(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
179-
highsLogDev(log_options, HighsLogType::kInfo,
180-
"%-25s Rows Cols Calls\n",
181-
"Presolve rule removed");
182-
highsLogDev(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
186+
highsLogUser(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
187+
highsLogUser(log_options, HighsLogType::kInfo,
188+
"%-25s Rows Cols Calls\n",
189+
"Presolve rule removed");
190+
highsLogUser(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
183191
for (HighsInt rule_type = kPresolveRuleMin; rule_type < kPresolveRuleCount;
184192
rule_type++)
185193
if (presolve_log_.rule[rule_type].call ||
186194
presolve_log_.rule[rule_type].row_removed ||
187195
presolve_log_.rule[rule_type].col_removed)
188-
highsLogDev(log_options, HighsLogType::kInfo, "%-25s %9d %9d %9d\n",
189-
utilPresolveRuleTypeToString(rule_type).c_str(),
190-
(int)presolve_log_.rule[rule_type].row_removed,
191-
(int)presolve_log_.rule[rule_type].col_removed,
192-
(int)presolve_log_.rule[rule_type].call);
193-
highsLogDev(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
194-
highsLogDev(log_options, HighsLogType::kInfo, "%-25s %9d %9d\n",
195-
"Total reductions", (int)sum_removed_row, (int)sum_removed_col);
196-
highsLogDev(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
197-
highsLogDev(log_options, HighsLogType::kInfo, "%-25s %9d %9d\n",
198-
"Original model", (int)original_num_row_,
199-
(int)original_num_col_);
200-
highsLogDev(log_options, HighsLogType::kInfo, "%-25s %9d %9d\n",
201-
"Presolved model", (int)(original_num_row_ - sum_removed_row),
202-
(int)(original_num_col_ - sum_removed_col));
203-
highsLogDev(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
196+
highsLogUser(log_options, HighsLogType::kInfo, "%-25s %9d %9d %9d\n",
197+
utilPresolveRuleTypeToString(rule_type).c_str(),
198+
(int)presolve_log_.rule[rule_type].row_removed,
199+
(int)presolve_log_.rule[rule_type].col_removed,
200+
(int)presolve_log_.rule[rule_type].call);
201+
highsLogUser(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
202+
highsLogUser(log_options, HighsLogType::kInfo, "%-25s %9d %9d\n",
203+
"Total reductions", (int)sum_removed_row,
204+
(int)sum_removed_col);
205+
highsLogUser(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
206+
highsLogUser(log_options, HighsLogType::kInfo, "%-25s %9d %9d\n",
207+
"Original model", (int)original_num_row_,
208+
(int)original_num_col_);
209+
highsLogUser(log_options, HighsLogType::kInfo, "%-25s %9d %9d\n",
210+
"Presolved model", (int)(original_num_row_ - sum_removed_row),
211+
(int)(original_num_col_ - sum_removed_col));
212+
highsLogUser(log_options, HighsLogType::kInfo, "%s\n", rule.c_str());
204213
}
205214
if (original_num_row_ == model->num_row_ &&
206215
original_num_col_ == model->num_col_) {

0 commit comments

Comments
 (0)