예제 #1
0
        public Generator(int population, int cityCount, int generations, double mutationRate, int seed)
        {
            this.logger = new GeneratorLogger();

            this.population   = population;
            this.cityCount    = cityCount;
            this.generations  = generations;
            this.mutationRate = mutationRate;
            this.seed         = seed;

            this.abstractFactory = new AbstractFactory();
            this.cityFactory     = abstractFactory.CreateCityFactory(this.seed);
            this.breedingFactory = abstractFactory.CreateBreedingFactory();
            ISolutionFactory solutionFactory = abstractFactory.CreateSolutionFactory();

            IMutater mutater = breedingFactory.CreateMutater(mutationRate);

            this.solutionFactory = solutionFactory;
            this.bestFit         = new BestFit();

            this.breeder = breedingFactory.CreateBreeder(mutater, solutionFactory);
        }
 public ControlUnit(IBestFit bestFit, double maxWeight, ILogger logger)
 {
     _bestFitAlgorithm = bestFit;
     _maxWeight        = maxWeight;
     _logger           = logger;
 }