瀏覽代碼

use as much aircrafts as possible

Sven Czarnian 3 年之前
父節點
當前提交
836ff0a8b2
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      aman/sys/RecedingHorizonControl.py

+ 6 - 5
aman/sys/RecedingHorizonControl.py

@@ -117,18 +117,19 @@ class RecedingHorizonControl:
             return None, None
             return None, None
 
 
         inbounds = []
         inbounds = []
-        earliestArrivalTime = None
+        earliestArrivalTime = self.Windows[self.FreezedIndex].StartTime
 
 
         # check the overlapping windows
         # 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:
             for inbound in self.Windows[i].Inbounds:
                 inbounds.append(inbound)
                 inbounds.append(inbound)
 
 
+            if 20 <= len(inbounds):
+                break
+
         # check if we found relevant inbounds
         # check if we found relevant inbounds
         if 0 != len(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
             return inbounds, earliestArrivalTime
         else:
         else:
             return None, None
             return None, None