private void CheckGroupCrossover(LinearLinkage parent1, LinearLinkage parent2, int[] expectedllee, double[] randomNumbers) { var expected = LinearLinkage.FromEndLinks(expectedllee); var random = new TestRandom() { DoubleNumbers = randomNumbers }; var child = GroupCrossover.Apply(random, parent1, parent2); Assert.IsTrue(Auxiliary.LinearLinkageIsEqualByPosition(expected, child), "Expected [{0}] but was [{1}]!", string.Join(", ", expected), string.Join(", ", child)); }
public void EqualParentsTest() { var random = new FastRandom(0); var parent = LinearLinkage.SingleElementGroups(10); var child = GroupCrossover.Apply(random, parent, parent); Assert.IsTrue(Auxiliary.LinearLinkageIsEqualByPosition(parent, child)); parent = RandomLinearLinkageCreator.Apply(random, 10); child = GroupCrossover.Apply(random, parent, parent); Assert.IsTrue(Auxiliary.LinearLinkageIsEqualByPosition(parent, child)); }