Пример #1
0
        public void ItThrowsAnErrorIfOutOfRange()
        {
            var chromosome = GATestHelper.GetAlphabetCharacterChromosome();
            var mutation   = new InsertMutation();

            mutation.Shift(chromosome, -1, 4);
        }
Пример #2
0
        public void ItCanShift()
        {
            var chromosome = GATestHelper.GetAlphabetCharacterChromosome();
            var mutation   = new InsertMutation();

            mutation.Shift(chromosome, 1, 4);

            Assert.AreEqual("A,E,B,C,D,F,G,H,I,J", chromosome.ToString());
        }
Пример #3
0
        public void ItCanSwapGenesAndStaysWithinRange()
        {
            var chromosome = GATestHelper.GetAlphabetCharacterChromosome();
            var mutation   = new InsertMutation();

            for (int i = 0; i < 100; i++)
            {
                mutation.Mutate(chromosome, GATestHelper.GetTravelingSalesmanDefaultConfiguration());
            }
        }
 public void Setup()
 {
     insertMutation = new InsertMutation();
 }
Пример #5
0
 public string Visit(InsertMutation <char> mutation)
 => $"[i:{mutation.DesiredItem}]";