Пример #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);
        }
Пример #2
0
 public Breeder(IMutater mutater, ISolutionFactory solutionFactory)
 {
     this.mutater         = mutater;
     this.solutionFactory = solutionFactory;
 }
Пример #3
0
 public IBreeder CreateBreeder(IMutater mutater, ISolutionFactory solutionFactory)
 {
     return(new Breeder(mutater, solutionFactory));
 }