コード例 #1
0
        public void BitSwapMutationTest2()
        {
            Organism organism = new Organism();
            organism.Chromosomes.Add(new Chromosome(1, "01"));

            IRandom rand = new Deterministic(0);
            BitSwapMutation mutator = new BitSwapMutation(rand);
            mutator.Mutate(organism);

            Assert.AreEqual("10", organism.Chromosomes[0].ToString());
        }
コード例 #2
0
        public void BitSwapMutationTest3()
        {
            Organism organism = new Organism();
            organism.Chromosomes.Add(new Chromosome(1, "01010"));

            IRandom rand = new Deterministic(1);
            BitSwapMutation mutator = new BitSwapMutation(rand);
            mutator.Mutate(organism);

            string answer = organism.Chromosomes[0].ToString();

            Assert.AreEqual("00110", answer);
        }