Пример #1
0
        public void ByteInitialization_RegularConstructorTest()
        {
            int howMany = 5;
            int size    = 4;
            ByteInitialization_Regular target = new ByteInitialization_Regular(howMany, size);

            Assert.AreEqual(target.Type, OperatorType.Byte);
        }
        public void InitializationTest()
        {
            EvaluationIF     e        = new ByteEvaluation_Ones();
            GeneticAlgorithm target   = new GeneticAlgorithm(e);
            InitializationIF expected = new ByteInitialization_Regular(10, 5);
            InitializationIF actual;

            target.Initialization = expected;
            actual = target.Initialization;
            Assert.AreEqual(expected, actual);
        }
Пример #3
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);
        }
Пример #4
0
        public void CreateTest()
        {
            int howMany = 5;
            int size    = 4; // TODO: Initialize to an appropriate value
            ByteInitialization_Regular target = new ByteInitialization_Regular(howMany, size);

            BytePoint p1       = new BytePoint(new byte[] { 1, 2, 3, 4 });
            BytePoint p2       = new BytePoint(new byte[] { 2, 2, 3, 46 });
            BytePoint p3       = new BytePoint(new byte[] { 3, 2, 36, 4 });
            BytePoint p4       = new BytePoint(new byte[] { 4, 26, 3, 4 });
            BytePoint p5       = new BytePoint(new byte[] { 5, 2, 33, 4 });
            PointSet  expected = new PointSet(new HashSet <Point>()
            {
                p1, p2, p3, p4, p5
            });
            PointSet actual;

            actual = target.Create();
            Assert.AreEqual(expected.Set.Count, actual.Set.Count);
            //sprawdzic StringReprezentation jednego punktu
        }