public void CrossTest()
        {
            ByteCrossover_RandomOR target = new ByteCrossover_RandomOR();
            Point point1   = new BytePoint(new byte[] { 0, 2, 3 });
            Point point2   = new BytePoint(new byte[] { 0, 2, 3 });
            Point expected = new BytePoint(new byte[] { 0, 2, 3 });
            Point actual;

            actual = target.Cross(point1, point2);
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
示例#2
0
        private void SetByteDefaults()
        {
            Initialization = new ByteInitialization_Regular(10, 5);
            SelectionIF S  = new Selection_Tournament();
            CrossoverIF C  = new ByteCrossover_RandomOR();
            MutationIF  M1 = new ByteMutation_Shifts(1);
            MutationIF  M2 = new ByteMutation_ValueAdded(2);

            Operations.Add(S);
            Operations.Add(C);
            Operations.Add(M1);
            Operations.Add(M2);
        }
        public void OperateTest()
        {
            ByteCrossover_RandomOR target = new ByteCrossover_RandomOR();
            Point point1 = new BytePoint(new byte[] { 0, 4, 5 });
            Point point2 = new BytePoint(new byte[] { 0, 2, 3 });
            Point point3 = new BytePoint(new byte[] { 6, 2, 7 });


            PointSet expected = new PointSet(new HashSet <Point>()
            {
                point1, point2, point3
            });

            PointSet pointSet = new PointSet(new HashSet <Point>()
            {
                point1, point2
            });
            PointSet actual;

            actual = target.Operate(pointSet);
            Assert.AreEqual(expected.Set.Count, actual.Set.Count);
        }
        public void ByteCrossover_RandomORConstructorTest()
        {
            ByteCrossover_RandomOR target = new ByteCrossover_RandomOR();

            Assert.AreEqual(target.Type, OperatorType.Byte);
        }