Kaynağa Gözat

use as much aircrafts as possible

Sven Czarnian 3 yıl önce
ebeveyn
işleme
836ff0a8b2
1 değiştirilmiş dosya ile 6 ekleme ve 5 silme
  1. 6 5
      aman/sys/RecedingHorizonControl.py

+ 6 - 5
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