From 1b2003e87932554d8add427759517c66ee68979e Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Sun, 17 Oct 2021 17:44:06 +0200 Subject: [PATCH] update the constructor --- aman/sys/Worker.py | 8 ++++---- aman/sys/aco/Configuration.py | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/aman/sys/Worker.py b/aman/sys/Worker.py index 624f674..448f188 100644 --- a/aman/sys/Worker.py +++ b/aman/sys/Worker.py @@ -116,10 +116,10 @@ class Worker(Thread): preceedingInbounds[runway.Runway.Name] = inbound # configure the ACO run - acoConfig = Configuration(earliestArrivalTime, self.sequencingConfiguration, 5 * len(relevantInbounds), 5 * len(relevantInbounds)) - if 0 != len(preceedingInbounds): - acoConfig.PreceedingInbounds = preceedingInbounds - acoConfig.Inbounds = relevantInbounds + acoConfig = Configuration(constraints = self.sequencingConfiguration, inbounds = relevantInbounds, + earliest = earliestArrivalTime, weather = self.WeatherModel, + preceeding = None if 0 == len(preceedingInbounds) else preceedingInbounds, + ants = 5 * len(relevantInbounds), generations = 5 * len(relevantInbounds)) # perform the ACO run aco = Colony(acoConfig) diff --git a/aman/sys/aco/Configuration.py b/aman/sys/aco/Configuration.py index 3406f56..af5d10e 100644 --- a/aman/sys/aco/Configuration.py +++ b/aman/sys/aco/Configuration.py @@ -5,16 +5,17 @@ from datetime import datetime from aman.config.AirportSequencing import AirportSequencing class Configuration: - def __init__(self, earliestArrivalTime : datetime, runwayInfo : AirportSequencing, antCount : int, explorationCount : int): + def __init__(self, **kwargs): # the AMAN specific information - self.RunwayConstraints = runwayInfo - self.PreceedingInbounds = None - self.Inbounds = None - self.EarliestArrivalTime = earliestArrivalTime + self.RunwayConstraints = kwargs.get('constraints', None) + self.PreceedingInbounds = kwargs.get('preceeding', None) + self.Inbounds = kwargs.get('inbounds', None) + self.EarliestArrivalTime = kwargs.get('earliest', None) + self.WeatherModel = kwargs.get('weather', None) # the ACO specific information - self.AntCount = antCount - self.ExplorationRuns = explorationCount + self.AntCount = kwargs.get('ants', 20) + self.ExplorationRuns = kwargs.get('generations', 20) self.PheromoneEvaporationRate = 0.9 self.PseudoRandomSelectionRate = 0.9 self.propagationRatio = 0.9