Skip to content

Commit 9aae18d

Browse files
authored
Merge pull request ERGO-Code#2242 from ERGO-Code/fix-2239
Fix 2239
2 parents 74481e7 + 2ba3247 commit 9aae18d

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

src/presolve/HPresolve.cpp

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4782,10 +4782,6 @@ HPresolve::Result HPresolve::removeDependentEquations(
47824782

47834783
HighsSparseMatrix matrix;
47844784
matrix.num_col_ = equations.size();
4785-
highsLogDev(options->log_options, HighsLogType::kInfo,
4786-
"HPresolve::removeDependentEquations Got %d equations, checking "
4787-
"for dependent equations\n",
4788-
static_cast<int>(matrix.num_col_));
47894785
matrix.num_row_ = model->num_col_ + 1;
47904786
matrix.start_.resize(matrix.num_col_ + 1);
47914787
matrix.start_[0] = 0;
@@ -4826,18 +4822,36 @@ HPresolve::Result HPresolve::removeDependentEquations(
48264822
//
48274823
// ToDo: This is strictly non-deterministic, but so conservative
48284824
// that it'll only reap the cases when factor.build never finishes
4829-
const double time_limit = std::min(0.01 * options->time_limit, 1000.0);
4825+
const double time_limit =
4826+
std::max(1.0, std::min(0.01 * options->time_limit, 1000.0));
48304827
factor.setTimeLimit(time_limit);
48314828
// Determine rank deficiency of the equations
4829+
highsLogUser(options->log_options, HighsLogType::kInfo,
4830+
"Dependent equations search running on %d equations with time "
4831+
"limit of %.2fs\n",
4832+
static_cast<int>(matrix.num_col_), time_limit);
4833+
double time_taken = -this->timer->read();
48324834
HighsInt build_return = factor.build();
4835+
time_taken += this->timer->read();
48334836
if (build_return == kBuildKernelReturnTimeout) {
48344837
// HFactor::build has timed out, so just return
4835-
highsLogDev(options->log_options, HighsLogType::kWarning,
4836-
"HPresolve::removeDependentEquations Timed out\n");
4838+
highsLogUser(options->log_options, HighsLogType::kInfo,
4839+
"Dependent equations search terminated after %.3gs due to "
4840+
"expected time exceeding limit\n",
4841+
time_taken);
48374842
analysis_.logging_on_ = logging_on;
48384843
if (logging_on)
48394844
analysis_.stopPresolveRuleLog(kPresolveRuleDependentFreeCols);
48404845
return Result::kOk;
4846+
} else {
4847+
double pct_off_timeout =
4848+
1e2 * std::fabs(time_taken - time_limit) / time_limit;
4849+
if (pct_off_timeout < 1.0)
4850+
highsLogUser(options->log_options, HighsLogType::kWarning,
4851+
"Dependent equations search finished within %.2f%% of limit "
4852+
"of %.2fs: "
4853+
"risk of non-deterministic behaviour if solve is repeated\n",
4854+
pct_off_timeout, time_limit);
48414855
}
48424856
// build_return as rank_deficiency must be valid
48434857
assert(build_return >= 0);
@@ -4857,11 +4871,11 @@ HPresolve::Result HPresolve::removeDependentEquations(
48574871
num_fictitious_rows_skipped++;
48584872
}
48594873
}
4860-
4861-
highsLogDev(
4862-
options->log_options, HighsLogType::kInfo,
4863-
"HPresolve::removeDependentEquations Removed %d rows and %d nonzeros",
4864-
static_cast<int>(num_removed_row), static_cast<int>(num_removed_nz));
4874+
highsLogUser(options->log_options, HighsLogType::kInfo,
4875+
"Dependent equations search removed %d rows and %d nonzeros "
4876+
"in %.2fs (limit = %.2fs)\n",
4877+
static_cast<int>(num_removed_row),
4878+
static_cast<int>(num_removed_nz), time_taken, time_limit);
48654879
if (num_fictitious_rows_skipped)
48664880
highsLogDev(options->log_options, HighsLogType::kInfo,
48674881
", avoiding %d fictitious rows",

0 commit comments

Comments
 (0)