use deep copies for the optimization to avoid the visualization of intermediate sequences
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import copy
|
||||
import time
|
||||
|
||||
from datetime import datetime as dt
|
||||
@@ -101,12 +102,27 @@ class RecedingHorizonControl:
|
||||
|
||||
def resequenceInbound(self, inbound : Inbound):
|
||||
index = self.AssignedWindow[inbound.Callsign][0]
|
||||
if inbound.PlannedArrivalTime < self.Windows[index].StartTime or inbound.PlannedArrivalTime >= self.Windows[index].EndTime:
|
||||
self.Windows[index].remove(inbound.Callsign)
|
||||
self.AssignedWindow.pop(inbound.Callsign)
|
||||
self.insertInWindow(inbound, True)
|
||||
sequenced = self.Windows[index].inbound(inbound.Callsign)
|
||||
if None == sequenced:
|
||||
return
|
||||
|
||||
# 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:
|
||||
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)
|
||||
|
||||
def latestFixedInbounds(self, configuration : Airport, sequenceConfiguration : AirportSequencing):
|
||||
@@ -168,7 +184,7 @@ class RecedingHorizonControl:
|
||||
# check the overlapping windows
|
||||
for i in range(self.FreezedIndex + 1, len(self.Windows)):
|
||||
for inbound in self.Windows[i].Inbounds:
|
||||
inbounds.append(inbound)
|
||||
inbounds.append(copy.deepcopy(inbound))
|
||||
|
||||
if 20 <= len(inbounds):
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user