コード例 #1
0
            public void TestMovelistLengthOne_SameLists()
            {
                var opc      = new OnePointCrossover(new ZeroRandomizer());              //Randomizer doesn't matter
                var children = opc.DoCrossover(_parentWithSizeOneA, _parentWithSizeOneB);

                Assert.That(children.Item1[0].Coordinate == CoordinateProvider.GetCoordinate('D', 3));
                Assert.That(children.Item2[0].Coordinate == CoordinateProvider.GetCoordinate('B', 6));
            }
コード例 #2
0
            public void TestMoveListLengthTwo_SwapFirstElements()
            {
                var opc      = new OnePointCrossover(new OneRandomizer());
                var children = opc.DoCrossover(_parentWithSizeTwoA, _parentWithSizeTwoB);

                Assert.That(children.Item1[0].Coordinate == CoordinateProvider.GetCoordinate('E', 1));
                Assert.That(children.Item1[1].Coordinate == CoordinateProvider.GetCoordinate('A', 2));

                Assert.That(children.Item2[0].Coordinate == CoordinateProvider.GetCoordinate('A', 1));
                Assert.That(children.Item2[1].Coordinate == CoordinateProvider.GetCoordinate('G', 2));
            }