Skip to content

Commit 0890c8b

Browse files
committed
Now to identify why time limit is not respected
1 parent 66f735e commit 0890c8b

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/presolve/HPresolve.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4584,18 +4584,30 @@ HPresolve::Result HPresolve::removeDependentEquations(
45844584
//
45854585
// ToDo: This is strictly non-deterministic, but so conservative
45864586
// that it'll only reap the cases when factor.build never finishes
4587-
const double time_limit = std::min(0.01 * options->time_limit, 1000.0);
4587+
const double time_limit =
4588+
std::max(1.0, std::min(0.01 * options->time_limit, 1000.0));
45884589
factor.setTimeLimit(time_limit);
45894590
// Determine rank deficiency of the equations
4591+
double time_taken = -this->timer->read();
45904592
HighsInt build_return = factor.build();
4593+
time_taken += this->timer->read();
45914594
if (build_return == kBuildKernelReturnTimeout) {
45924595
// HFactor::build has timed out, so just return
4593-
highsLogDev(options->log_options, HighsLogType::kWarning,
4594-
"HPresolve::removeDependentEquations Timed out\n");
4596+
highsLogUser(options->log_options, HighsLogType::kInfo,
4597+
"Presolve dependent equations timed out after limit of %gs\n",
4598+
time_limit);
45954599
analysis_.logging_on_ = logging_on;
45964600
if (logging_on)
45974601
analysis_.stopPresolveRuleLog(kPresolveRuleDependentFreeCols);
45984602
return Result::kOk;
4603+
} else {
4604+
double pct_off_timeout = std::fabs(time_taken - time_limit) / time_limit;
4605+
if (pct_off_timeout < 1.0)
4606+
highsLogUser(
4607+
options->log_options, HighsLogType::kWarning,
4608+
"Presolve dependent equations finished within %g\% of limit of %gs: "
4609+
"risk of non-deterministic behaviour if solve is repeated\n",
4610+
pct_off_timeout, time_limit);
45994611
}
46004612
// build_return as rank_deficiency must be valid
46014613
assert(build_return >= 0);
@@ -4616,10 +4628,12 @@ HPresolve::Result HPresolve::removeDependentEquations(
46164628
}
46174629
}
46184630

4619-
highsLogDev(
4620-
options->log_options, HighsLogType::kInfo,
4621-
"HPresolve::removeDependentEquations Removed %d rows and %d nonzeros",
4622-
(int)num_removed_row, (int)num_removed_nz);
4631+
highsLogUser(options->log_options, HighsLogType::kInfo,
4632+
"Presolve dependent equations removed %d rows and %d nonzeros "
4633+
"in %gs (limit = %gs)",
4634+
int(num_removed_row), int(num_removed_nz), time_taken,
4635+
time_limit);
4636+
46234637
if (num_fictitious_rows_skipped)
46244638
highsLogDev(options->log_options, HighsLogType::kInfo,
46254639
", avoiding %d fictitious rows",

0 commit comments

Comments
 (0)