Commit a7089186 authored by David Johnson's avatar David Johnson

Fix an IsFeasible bug where start and end of different reservations overlap.

When IsFeasible processes the list of events (i.e. reservation
start/end, expt start/end), it processes them in sorted order of event
time, but if times are equal, there is no secondary sort, and thus the
additive (incoming) reservation might be processed before the reductive
(outgoing) reservation), which would create a false negative hole in the
forecast.  This commit adds the secondary sort.
parent fccd4e04
...@@ -828,8 +828,15 @@ sub IsFeasible($$;$$$$$) ...@@ -828,8 +828,15 @@ sub IsFeasible($$;$$$$$)
push( @$forecast, \%origin ); push( @$forecast, \%origin );
} }
my @events = sort { $a->{'t'} <=> $b->{'t'} } @timeline; my @events = sort {
if ($a->{'t'} == $b->{'t'}) {
return $a->{'reserved'} <=> $b->{'reserved'};
else {
return $a->{'t'} <=> $b->{'t'};
} @timeline;
foreach my $event ( @events ) { foreach my $event ( @events ) {
my $pid = $event->{'pid'}; my $pid = $event->{'pid'};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment