public void ItThrowsAnErrorIfOutOfRange() { var chromosome = GATestHelper.GetAlphabetCharacterChromosome(); var mutation = new InsertMutation(); mutation.Shift(chromosome, -1, 4); }
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()); }
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(); }
public string Visit(InsertMutation <char> mutation) => $"[i:{mutation.DesiredItem}]";