If we manage to reach a 0 cost early, stop the annealer, there is no point

looking any further.  This significantly reduces the timeslot scheduling time.
In most cases we reach 0 in a couple thousand iterations, but we need high
effort because some timeslot scheduling problems are hard to assign.
This commit is contained in:
dave 2006-08-12 08:07:02 +00:00
parent c247119663
commit 145c6f88ff

View File

@ -229,6 +229,7 @@ class annealer {
$n_accepted++;
// if($current_cost < $this->cost)
$this->cost = $current_cost;
// TRACE("Move accepted, cost=$current_cost\n");
} else {
// TRACE("Move rejected\n");
@ -238,7 +239,16 @@ class annealer {
TRACE(" {$this->iterations} iterations, cost={$this->cost}, temperature=$temperature\n");
// $this->print_buckets();
}
if($this->cost == 0) {
/* If we manage to get to a 0 cost
* solution, don't look any more */
break;
}
}
if($this->cost == 0) break;
if($this->cost == $last_cost) {
$last_cost_count ++;
} else {