コード例 #1
0
        public static FitnessCalculator getInstance()
        {
            if (_instance == null)
            {
                _instance = new FitnessCalculator();
            }

            return(_instance);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            calc   = FitnessCalculator.getInstance();
            config = ConfigClass.getInstance();
            //1. Initialize
            Population p = new Population(true);

            //4. Repeat with new generation

            while (Console.ReadKey().KeyChar != 'x')
            {
                p = GenerationStep(p);

                foreach (IReadOnlyIndividual i in p)
                {
                    Console.WriteLine(i);
                }
                Console.WriteLine("Continue to next generation? (Press x to exit)");
            }
        }