Skip to content

Commit

Permalink
Modified dependent equations timeout so it also works on a model of t…
Browse files Browse the repository at this point in the history
…he time remaining, otherwise bdry2 never times out
  • Loading branch information
jajhall committed Nov 28, 2022
1 parent b6d4b3d commit e021356
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/util/HFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,10 @@ HighsInt HFactor::buildKernel() {

const bool progress_report = false; // num_basic != num_row;
const HighsInt progress_frequency = 10000;
const HighsInt timer_frequency = 100;
// Initial timer frequency: may be reduced if iterations get slow
HighsInt timer_frequency = 100;
double previous_iteration_time = 0;
double iteration_time = 0;
const bool check_for_timeout = this->time_limit_ < kHighsInf;
HighsInt search_k = 0;

Expand All @@ -890,9 +893,19 @@ HighsInt HFactor::buildKernel() {
reportAsm();
}
// Detemine whether to return due to exceeding the time limit
if (check_for_timeout && search_k % timer_frequency == 0)
if (build_timer_->readRunHighsClock() > this->time_limit_)
if (check_for_timeout && search_k % timer_frequency == 0) {
double current_time = build_timer_->readRunHighsClock();
double time_difference = current_time - previous_iteration_time;
previous_iteration_time = current_time;
iteration_time = time_difference / (1.0 * timer_frequency);
if (time_difference > this->time_limit_/1e3)
timer_frequency = std::max(1, timer_frequency/10);
HighsInt iterations_left = kernel_dim - search_k + 1;
double remaining_time_bound = iteration_time * iterations_left;
double total_time_bound = current_time + remaining_time_bound;
if (current_time > this->time_limit_ || total_time_bound > this->time_limit_)
return kBuildKernelReturnTimeout;
}

/**
* 1. Search for the pivot
Expand Down

0 comments on commit e021356

Please sign in to comment.