From 836ff0a8b24dac49134b8ac31d0c421e0d7c5bba Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Mon, 29 Nov 2021 17:13:28 +0100 Subject: [PATCH] use as much aircrafts as possible --- aman/sys/RecedingHorizonControl.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/aman/sys/RecedingHorizonControl.py b/aman/sys/RecedingHorizonControl.py index a6a2466..d14214e 100644 --- a/aman/sys/RecedingHorizonControl.py +++ b/aman/sys/RecedingHorizonControl.py @@ -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