Esempio n. 1
0
        public void ItThrowsAnErrorIfOutOfRange()
        {
            var chromosome = GATestHelper.GetAlphabetCharacterChromosome();
            var mutation   = new InsertMutation();

            mutation.Shift(chromosome, -1, 4);
        }
Esempio n. 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());
        }
Esempio n. 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();
 }
Esempio n. 5
0
 public string Visit(InsertMutation <char> mutation)
 => $"[i:{mutation.DesiredItem}]";