public static int RunGAMapFinder(GAFinderOption option)
        {
            var map = _loadMap(option.MapFileName, option.Diagonal);

            if (map == null)
            {
                return(1);
            }


            var heuristic = (new HeuristicFactory()).GetImplementation(option.Heuristic);

            var mutate    = new MutateFactory().GetImplementation(option.Mutate);
            var crossover = new CrossoverFactory().GetImplementation(option.Crossover);
            var selection = new SelectionFactory().GetImplementation(option.Selection);
            var fitness   = new FitnessFactory().GetImplementation(option.Fitness);

            fitness.Heuristic = heuristic;

            var finder = FinderFactory.GetGAImplementation(
                crossover,
                mutate,
                fitness,
                selection,
                option.Population,
                option.GenerationLimit,
                option.BestToPick
                );



            return(_runFinder(finder, heuristic, map, option.Window, option.NoShowSteps, option.BlockSize, option.UISleep));
        }
Ejemplo n.º 2
0
        int ProcessChunk = 1; // quantidade de requests simultaneos

        public GeneticAlgorithmFinder(IRouteService routeService, GASettings settings)
        {
            this.routeService = routeService;

            Mutate             = MutateFactory.GetImplementation(settings.Mutation, settings);
            Crossover          = CrossoverFactory.GetImplementation(settings.Crossover, settings, routeService);
            PopulationSize     = settings.PopulationSize;
            GenerationLimit    = settings.GenerationLimit;
            BestSolutionToPick = settings.BestSolutionToPick;
            ProcessChunk       = settings.Throttle;
            Settings           = settings;
        }