use as much aircrafts as possible

This commit is contained in:
Sven Czarnian
2021-11-29 17:13:28 +01:00
parent 8277721edb
commit 836ff0a8b2

View File

@@ -117,18 +117,19 @@ class RecedingHorizonControl:
return None, None
inbounds = []
earliestArrivalTime = None
earliestArrivalTime = self.Windows[self.FreezedIndex].StartTime
# check the overlapping windows
for i in range(self.FreezedIndex + 1, min(len(self.Windows), self.FreezedIndex + 1 + self.Configuration.WindowOverlap)):
if None == earliestArrivalTime:
earliestArrivalTime = self.Windows[i].StartTime
for i in range(self.FreezedIndex + 1, len(self.Windows)):
for inbound in self.Windows[i].Inbounds:
inbounds.append(inbound)
if 20 <= len(inbounds):
break
# check if we found relevant inbounds
if 0 != len(inbounds):
inbounds.sort(key = lambda x: x.InitialArrivalTime)
inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.InitialArrivalTime)
return inbounds, earliestArrivalTime
else:
return None, None