use deep copies for the optimization to avoid the visualization of intermediate sequences

This commit is contained in:
Sven Czarnian
2021-12-23 16:28:31 +01:00
parent 57867a2e21
commit 64fcb8ed01

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import copy
import time import time
from datetime import datetime as dt from datetime import datetime as dt
@@ -101,12 +102,27 @@ class RecedingHorizonControl:
def resequenceInbound(self, inbound : Inbound): def resequenceInbound(self, inbound : Inbound):
index = self.AssignedWindow[inbound.Callsign][0] index = self.AssignedWindow[inbound.Callsign][0]
if inbound.PlannedArrivalTime < self.Windows[index].StartTime or inbound.PlannedArrivalTime >= self.Windows[index].EndTime: sequenced = self.Windows[index].inbound(inbound.Callsign)
self.Windows[index].remove(inbound.Callsign) if None == sequenced:
self.AssignedWindow.pop(inbound.Callsign) return
self.insertInWindow(inbound, True)
# resynchronized the planned information
sequenced.PlannedRunway = inbound.PlannedRunway
sequenced.PlannedStar = inbound.PlannedStar
sequenced.PlannedArrivalRoute = inbound.PlannedArrivalRoute
sequenced.PlannedArrivalTime = inbound.PlannedArrivalTime
sequenced.InitialArrivalTime = inbound.InitialArrivalTime
sequenced.PlannedTrackmiles = inbound.PlannedTrackmiles
sequenced.AssignmentMode = inbound.AssignmentMode
sequenced.ExpectedRunway = inbound.ExpectedRunway
# resort the inbound
if sequenced.PlannedArrivalTime < self.Windows[index].StartTime or sequenced.PlannedArrivalTime >= self.Windows[index].EndTime:
self.Windows[index].remove(sequenced.Callsign)
self.AssignedWindow.pop(sequenced.Callsign)
self.insertInWindow(sequenced, True)
else: else:
inbound.FixedSequence = index < self.FreezedIndex sequenced.FixedSequence = index < self.FreezedIndex
self.Windows[index].Inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime) self.Windows[index].Inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime)
def latestFixedInbounds(self, configuration : Airport, sequenceConfiguration : AirportSequencing): def latestFixedInbounds(self, configuration : Airport, sequenceConfiguration : AirportSequencing):
@@ -168,7 +184,7 @@ class RecedingHorizonControl:
# check the overlapping windows # check the overlapping windows
for i in range(self.FreezedIndex + 1, len(self.Windows)): 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(copy.deepcopy(inbound))
if 20 <= len(inbounds): if 20 <= len(inbounds):
break break