increase computational performance
This commit is contained in:
@@ -81,9 +81,6 @@ class AirportSequencing:
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
# search the dependency pair
|
# search the dependency pair
|
||||||
dependencies = []
|
dependencies = [self.ActiveArrivalRunways[self.RunwayDependencies[i][1]] for i in range(0, len(self.RunwayDependencies)) if index == self.RunwayDependencies[i][0]]
|
||||||
for dependency in self.RunwayDependencies:
|
|
||||||
if index == dependency[0] and not self.ActiveArrivalRunways[dependency[1]] in dependencies:
|
|
||||||
dependencies.append(self.ActiveArrivalRunways[dependency[1]])
|
|
||||||
|
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|||||||
@@ -21,23 +21,24 @@ class RecedingHorizonControl:
|
|||||||
|
|
||||||
def update(self, inbound : Inbound):
|
def update(self, inbound : Inbound):
|
||||||
# check if we need to update
|
# check if we need to update
|
||||||
if inbound.Report.aircraft.callsign in self.AssignedWindow:
|
if inbound.Callsign in self.AssignedWindow:
|
||||||
index = self.AssignedWindow[inbound.Report.aircraft.callsign][0]
|
index = self.AssignedWindow[inbound.Callsign][0]
|
||||||
self.AssignedWindow[inbound.Report.aircraft.callsign][1] = 0
|
self.AssignedWindow[inbound.Callsign][1] = 0
|
||||||
|
|
||||||
# check if we assume the scheduling as fixed
|
# check if we assume the scheduling as fixed
|
||||||
if index < self.FreezedIndex:
|
if index < self.FreezedIndex:
|
||||||
return
|
return
|
||||||
|
|
||||||
plannedInbound = self.Windows[index].inbound(inbound.Report.aircraft.callsign)
|
plannedInbound = self.Windows[index].inbound(inbound.Callsign)
|
||||||
plannedInbound.CurrentPosition = inbound.CurrentPosition
|
plannedInbound.CurrentPosition = inbound.CurrentPosition
|
||||||
plannedInbound.ArrivalCandidates = inbound.ArrivalCandidates
|
plannedInbound.ArrivalCandidates = inbound.ArrivalCandidates
|
||||||
|
plannedInbound.WTC = inbound.WTC
|
||||||
|
|
||||||
# check if we need to update the inbound
|
# check if we need to update the inbound
|
||||||
if plannedInbound.PlannedArrivalTime < inbound.EarliestArrivalTime:
|
if plannedInbound.PlannedArrivalTime < inbound.EarliestArrivalTime:
|
||||||
if inbound.EarliestArrivalTime < self.Windows[index].StartTime or inbound.EarliestArrivalTime >= self.Windows[index].EndTime:
|
if inbound.EarliestArrivalTime < self.Windows[index].StartTime or inbound.EarliestArrivalTime >= self.Windows[index].EndTime:
|
||||||
self.Windows[index].remove(inbound.Report.aircraft.callsign)
|
self.Windows[index].remove(inbound.Callsign)
|
||||||
self.AssignedWindow.pop(inbound.Report.aircraft.callsign)
|
self.AssignedWindow.pop(inbound.Callsign)
|
||||||
self.update(inbound)
|
self.update(inbound)
|
||||||
else:
|
else:
|
||||||
plannedInbound.PlannedStar = inbound.PlannedStar
|
plannedInbound.PlannedStar = inbound.PlannedStar
|
||||||
@@ -53,7 +54,7 @@ class RecedingHorizonControl:
|
|||||||
# find the correct window
|
# find the correct window
|
||||||
if window.StartTime <= inbound.EarliestArrivalTime and window.EndTime > inbound.EarliestArrivalTime:
|
if window.StartTime <= inbound.EarliestArrivalTime and window.EndTime > inbound.EarliestArrivalTime:
|
||||||
if i > self.FreezedIndex:
|
if i > self.FreezedIndex:
|
||||||
self.AssignedWindow[inbound.Report.aircraft.callsign] = [ i, 0 ]
|
self.AssignedWindow[inbound.Callsign] = [ i, 0 ]
|
||||||
inbound.PlannedArrivalTime = inbound.EarliestArrivalTime
|
inbound.PlannedArrivalTime = inbound.EarliestArrivalTime
|
||||||
window.insert(inbound)
|
window.insert(inbound)
|
||||||
inserted = True
|
inserted = True
|
||||||
@@ -70,7 +71,7 @@ class RecedingHorizonControl:
|
|||||||
while True:
|
while True:
|
||||||
self.Windows.append(RecedingHorizonWindow(lastWindowTime, lastWindowTime + timestep))
|
self.Windows.append(RecedingHorizonWindow(lastWindowTime, lastWindowTime + timestep))
|
||||||
if self.Windows[-1].EndTime > inbound.EarliestArrivalTime:
|
if self.Windows[-1].EndTime > inbound.EarliestArrivalTime:
|
||||||
self.AssignedWindow[inbound.Report.aircraft.callsign] = [ len(self.Windows) - 1, 0 ]
|
self.AssignedWindow[inbound.Callsign] = [ len(self.Windows) - 1, 0 ]
|
||||||
self.Windows[-1].insert(inbound)
|
self.Windows[-1].insert(inbound)
|
||||||
inbound.PlannedArrivalTime = max(self.Windows[-1].StartTime, inbound.EarliestArrivalTime)
|
inbound.PlannedArrivalTime = max(self.Windows[-1].StartTime, inbound.EarliestArrivalTime)
|
||||||
self.Windows[-1].Inbounds.sort(key = lambda x: x.PlannedArrivalTime)
|
self.Windows[-1].Inbounds.sort(key = lambda x: x.PlannedArrivalTime)
|
||||||
@@ -123,7 +124,7 @@ class RecedingHorizonControl:
|
|||||||
while 0 != len(self.Windows) and currentUtc > self.Windows[0].EndTime:
|
while 0 != len(self.Windows) and currentUtc > self.Windows[0].EndTime:
|
||||||
# cleanup the association table
|
# cleanup the association table
|
||||||
for inbound in self.Windows[0].Inbounds:
|
for inbound in self.Windows[0].Inbounds:
|
||||||
self.AssignedWindow.pop(inbound.Report.aircraft.callsign)
|
self.AssignedWindow.pop(inbound.Callsign)
|
||||||
|
|
||||||
offsetCorrection += 1
|
offsetCorrection += 1
|
||||||
self.Windows.pop(0)
|
self.Windows.pop(0)
|
||||||
|
|||||||
@@ -10,24 +10,24 @@ class RecedingHorizonWindow:
|
|||||||
|
|
||||||
def isInWindow(self, inbound : Inbound):
|
def isInWindow(self, inbound : Inbound):
|
||||||
for report in self.Inbounds:
|
for report in self.Inbounds:
|
||||||
if report.Report.aircraft.callsign == inbound.Report.aircraft.callsign:
|
if report.Callsign == inbound.Callsign:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def inbound(self, callsign : str):
|
def inbound(self, callsign : str):
|
||||||
for report in self.Inbounds:
|
for report in self.Inbounds:
|
||||||
if report.Report.aircraft.callsign == callsign:
|
if report.Callsign == callsign:
|
||||||
return report
|
return report
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def insert(self, inbound : Inbound):
|
def insert(self, inbound : Inbound):
|
||||||
for i in range(0, len(self.Inbounds)):
|
for i in range(0, len(self.Inbounds)):
|
||||||
if self.Inbounds[i].Report.aircraft.callsign == inbound.Report.aircraft.callsign:
|
if self.Inbounds[i].Callsign == inbound.Callsign:
|
||||||
return
|
return
|
||||||
self.Inbounds.append(inbound)
|
self.Inbounds.append(inbound)
|
||||||
|
|
||||||
def remove(self, callsign : str):
|
def remove(self, callsign : str):
|
||||||
for i in range(0, len(self.Inbounds)):
|
for i in range(0, len(self.Inbounds)):
|
||||||
if self.Inbounds[i].Report.aircraft.callsign == callsign:
|
if self.Inbounds[i].Callsign == callsign:
|
||||||
self.Inbounds.pop(i)
|
self.Inbounds.pop(i)
|
||||||
return
|
return
|
||||||
@@ -128,7 +128,7 @@ class Worker(Thread):
|
|||||||
if None != aco.Result:
|
if None != aco.Result:
|
||||||
print('ACO-Sequence:')
|
print('ACO-Sequence:')
|
||||||
for inbound in aco.Result:
|
for inbound in aco.Result:
|
||||||
print(' ' + inbound.Report.aircraft.callsign + ': ' + inbound.PlannedRunway.Name + ' @ ' + str(inbound.PlannedArrivalTime) +
|
print(' ' + inbound.Callsign + ': ' + inbound.PlannedRunway.Name + ' @ ' + str(inbound.PlannedArrivalTime) +
|
||||||
' dt=' + str((inbound.PlannedArrivalTime - inbound.InitialArrivalTime).total_seconds()))
|
' dt=' + str((inbound.PlannedArrivalTime - inbound.InitialArrivalTime).total_seconds()))
|
||||||
print('Delays: FCFS=' + str(aco.FcfsDelay.total_seconds()) + ', ACO=' + str(aco.ResultDelay.total_seconds()))
|
print('Delays: FCFS=' + str(aco.FcfsDelay.total_seconds()) + ', ACO=' + str(aco.ResultDelay.total_seconds()))
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class Colony:
|
|||||||
tmp += timedelta(seconds = 20)
|
tmp += timedelta(seconds = 20)
|
||||||
Colony.associateInbound(rwyManager, inbound, earliestArrivalTime, False)
|
Colony.associateInbound(rwyManager, inbound, earliestArrivalTime, False)
|
||||||
overallDelay += inbound.PlannedArrivalTime - inbound.InitialArrivalTime
|
overallDelay += inbound.PlannedArrivalTime - inbound.InitialArrivalTime
|
||||||
print(' ' + inbound.Report.aircraft.callsign + ': ' + inbound.PlannedRunway.Name + ' @ ' + str(inbound.PlannedArrivalTime) +
|
print(' ' + inbound.Callsign + ': ' + inbound.PlannedRunway.Name + ' @ ' + str(inbound.PlannedArrivalTime) +
|
||||||
' dt=' + str((inbound.PlannedArrivalTime - inbound.InitialArrivalTime).total_seconds()))
|
' dt=' + str((inbound.PlannedArrivalTime - inbound.InitialArrivalTime).total_seconds()))
|
||||||
|
|
||||||
return overallDelay
|
return overallDelay
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class Inbound:
|
|||||||
def __init__(self, report : AircraftReport_pb2.AircraftReport, sequencingConfig : AirportSequencing, navData : SctEseFormat,
|
def __init__(self, report : AircraftReport_pb2.AircraftReport, sequencingConfig : AirportSequencing, navData : SctEseFormat,
|
||||||
performanceData : PerformanceData, weatherModel : WeatherModel):
|
performanceData : PerformanceData, weatherModel : WeatherModel):
|
||||||
self.Report = report
|
self.Report = report
|
||||||
|
self.Callsign = report.aircraft.callsign
|
||||||
self.CurrentPosition = report.position
|
self.CurrentPosition = report.position
|
||||||
self.ReportTime = datetime.strptime(report.reportTime + '+0000', '%Y%m%d%H%M%S%z').replace(tzinfo = pytz.UTC)
|
self.ReportTime = datetime.strptime(report.reportTime + '+0000', '%Y%m%d%H%M%S%z').replace(tzinfo = pytz.UTC)
|
||||||
self.InitialArrivalTime = None
|
self.InitialArrivalTime = None
|
||||||
|
|||||||
Reference in New Issue
Block a user