call the optimization

This commit is contained in:
Sven Czarnian
2021-10-17 17:12:40 +02:00
parent 061eb7eac6
commit fec26a6d6d

View File

@@ -6,6 +6,7 @@ import time
from aman.com import Weather from aman.com import Weather
from aman.config.Airport import Airport from aman.config.Airport import Airport
from aman.sys.aco.Colony import Colony
from aman.sys.aco.Configuration import Configuration from aman.sys.aco.Configuration import Configuration
from aman.sys.WeatherModel import WeatherModel from aman.sys.WeatherModel import WeatherModel
from aman.sys.RecedingHorizonControl import RecedingHorizonControl from aman.sys.RecedingHorizonControl import RecedingHorizonControl
@@ -101,12 +102,6 @@ class Worker(Thread):
self.ReportQueue.clear() self.ReportQueue.clear()
if 0 != len(self.RecedingHorizonControl.Windows):
print('FCFS run:')
for window in self.RecedingHorizonControl.Windows:
for inbound in window.Inbounds:
print(' ' + inbound.Report.aircraft.callsign + ': ' + str(inbound.InitialArrivalTime) + '; ' + str(inbound.EarliestArrivalTime))
# search the ACO relevant aircrafts # search the ACO relevant aircrafts
relevantInbounds, earliestArrivalTime = self.RecedingHorizonControl.optimizationRelevantInbounds() relevantInbounds, earliestArrivalTime = self.RecedingHorizonControl.optimizationRelevantInbounds()
if None != relevantInbounds: if None != relevantInbounds:
@@ -125,8 +120,17 @@ class Worker(Thread):
if 0 != len(preceedingInbounds): if 0 != len(preceedingInbounds):
acoConfig.PreceedingInbounds = preceedingInbounds acoConfig.PreceedingInbounds = preceedingInbounds
acoConfig.Inbounds = relevantInbounds acoConfig.Inbounds = relevantInbounds
# TODO perform the ACO run
# TODO update the RHC stages based on the ACO run result # perform the ACO run
aco = Colony(acoConfig)
aco.optimize()
if None != aco.Result:
print('ACO-Sequence:')
for inbound in aco.Result:
print(' ' + inbound.Report.aircraft.callsign + ': ' + inbound.PlannedRunway.Name + ' @ ' + str(inbound.PlannedArrivalTime) +
' dt=' + str((inbound.PlannedArrivalTime - inbound.InitialArrivalTime).total_seconds()))
print('Delays: FCFS=' + str(aco.FcfsDelay.total_seconds()) + ', ACO=' + str(aco.ResultDelay.total_seconds()))
else: else:
print('No relevant inbounds found for the optimization in ' + self.Icao) print('No relevant inbounds found for the optimization in ' + self.Icao)