Browse Source

call the optimization

Sven Czarnian 3 years ago
parent
commit
fec26a6d6d
1 changed files with 12 additions and 8 deletions
  1. 12 8
      aman/sys/Worker.py

+ 12 - 8
aman/sys/Worker.py

@@ -6,6 +6,7 @@ import time
 
 from aman.com import Weather
 from aman.config.Airport import Airport
+from aman.sys.aco.Colony import Colony
 from aman.sys.aco.Configuration import Configuration
 from aman.sys.WeatherModel import WeatherModel
 from aman.sys.RecedingHorizonControl import RecedingHorizonControl
@@ -101,12 +102,6 @@ class Worker(Thread):
 
             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
             relevantInbounds, earliestArrivalTime = self.RecedingHorizonControl.optimizationRelevantInbounds()
             if None != relevantInbounds:
@@ -125,8 +120,17 @@ class Worker(Thread):
                 if 0 != len(preceedingInbounds):
                     acoConfig.PreceedingInbounds = preceedingInbounds
                 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:
                 print('No relevant inbounds found for the optimization in ' + self.Icao)