Пример #1
0
        public void OperateTest()
        {
            int shift = 1;
            ByteMutation_Shifts target = new ByteMutation_Shifts(shift);

            BytePoint p1 = new BytePoint(new byte[] { 1, 2, 3, 4 });
            BytePoint p2 = new BytePoint(new byte[] { 17, 2, 3, 46 });
            BytePoint p3 = new BytePoint(new byte[] { 4, 2, 36, 4 });
            BytePoint p4 = new BytePoint(new byte[] { 7, 26, 3, 4 });
            BytePoint p5 = new BytePoint(new byte[] { 35, 2, 33, 4 });

            PointSet expected = new PointSet(new HashSet <Point>()
            {
                p1, p2, p3, p4, p5
            });

            PointSet pointSet = new PointSet(new HashSet <Point>()
            {
                p1, p2, p3, p4, p5
            });
            PointSet actual;

            actual = target.Operate(pointSet);
            Assert.AreEqual(expected.Set.Count, actual.Set.Count);
        }
Пример #2
0
        public void ByteMutation_ShiftsConstructorTest()
        {
            int shift = 1;
            ByteMutation_Shifts target = new ByteMutation_Shifts(shift);

            Assert.AreEqual(target.Type, OperatorType.Byte);
        }
Пример #3
0
        public void MutateTest()
        {
            int shift = 1;
            ByteMutation_Shifts target = new ByteMutation_Shifts(shift);
            Point point = new BytePoint(10);
            Point actual;

            actual = target.Mutate(point);
            Assert.IsTrue(actual.StringRepresent().Equals("[5]") || actual.StringRepresent().Equals("[20]"));
        }
Пример #4
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);
        }