Exemplo n.º 1
0
        public void ItCanRun()
        {
            var config   = GATestHelper.GetPhraseConfiguration();
            var solution = new PhraseSolution();

            var run = solution.Run(config);

            Assert.AreEqual(24, run.BestChromosome.FitnessScore);
        }
Exemplo n.º 2
0
        public void ItCanDetermineAFitnessScore()
        {
            var random     = new Random(22);
            var length     = PhraseSolution.Shakespeare.Length;
            var chromosome = new UnorderedChromosome(length, typeof(PhraseGene), random);

            var solution = new PhraseSolution();

            var distance = solution.GetFitnessScoreFor(chromosome);

            Assert.AreNotEqual(0, distance);
        }