Beispiel #1
0
        public static void Main(string[] args)
        {
            // If you have to remember *one* thing from this tutorial, it is the three essential players
            // 1- the tunable parameters of the optimisation problem:
            //    ISystemConfiguration, here implemented by StringSpecification for this 'Hello World' problem
            // 2- the object evaluating the score(s) for a given "system configuration" (IObjectiveEvaluator<T>)
            // 3- the optimisation algorithm, implementing IEvolutionEngine<T>
            // It is recommended that you declare variables typed as interfaces, not concrete classes,
            // whenever possible including in an 'Hello World'...
            IObjectiveEvaluator <StringSpecification> evaluator;
            IEvolutionEngine <StringSpecification>    finder;

            string strToFind = args.Length == 0 ? "Hello, World!" : args[0];

            evaluator = buildEvaluator(strToFind);
            finder    = new StringFinder(evaluator, strToFind.Length, new BasicRngFactory(0));
            var result = finder.Evolve();

            Console.WriteLine(MetaheuristicsHelper.GetHumanReadable(result));
        }