예제 #1
0
        public void PartiallyMatchedCrossoverTest2()
        {
            Organism parent1 = new Organism();
            Organism parent2 = new Organism();

            parent1.Chromosomes.Add(new Chromosome(3, "001110"));
            parent2.Chromosomes.Add(new Chromosome(3, "110001"));

            IRandom rand = new Deterministic(1, 0);
            PartiallyMatchedCrossover linker = new PartiallyMatchedCrossover(rand, 1);
            var children = linker.CrossLink(parent1, parent2);

            Assert.AreEqual("110001", children.Item1.ToString());
            Assert.AreEqual("001110", children.Item2.ToString());
        }