Beispiel #1
0
        public void doWork(string[] args)
        {
            GeneticAPI.JsonFileReader<City> importer = new GeneticAPI.JsonFileReader<City>();
            List<City> lo_data = importer.Import(args[0]);

            for (int i = 0; i < lo_data.Count; i++)
            {
                Console.WriteLine(lo_data[i].id);
            }

            Processor<City> lo_processor = new Processor<City>();
            lo_processor.Changed += new ChangedEventHandler(Changed);
            lo_processor.Execute(lo_data, 30, 200000, 0.001, 0.5, GeneticAPI.Selection.Selectors.Tournament,GeneticAPI.Recombination.Recombinators.TwoPointCrossoverPMX, GeneticAPI.Shared.Util.Randoms.Advanced, 2, 4);
        }
Beispiel #2
0
        public void StartGA()
        {
            string[] args = new string[1];
            args[0] = ii_path;
            //Imports data from JSON file and adds it to list.
            GeneticAPI.JsonFileReader<City> importer = new GeneticAPI.JsonFileReader<City>();
            List<City> lo_data = importer.Import(args[0]);

            for (int i = 0; i < lo_data.Count; i++)
            {
                Console.WriteLine(lo_data[i].id);
            }

            Processor<City> lo_processor = new Processor<City>();
            //Subscribe to GA.
            lo_processor.Changed += new ChangedEventHandler(Changed);
            //Start GA.
            lo_processor.Execute(lo_data, ii_poolsize, ii_generations, id_modifyprob, id_recomprob, ien_selector, ien_recomb, ien_random, ii_elites, ii_ts_contestants, ib_adaptivemut, ib_rog, ib_lrog);
        }