Exemple #1
0
        public void Test()
        {
            Firefly       fire = new Firefly();
            IOptiTestFunc f    = new Weierstrass();

            fire.dimension   = 10;
            fire.searchSpace = f.SearchSpace;
            double[] res = fire.Opti(f.Func);
            double   val = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);

            fire             = new Firefly();
            f                = new SumSquares();
            fire.dimension   = 10;
            fire.searchSpace = f.SearchSpace;
            res              = fire.Opti(f.Func);
            val              = f.Func(res);
            Assert.AreEqual(f.MinimumValue, val, 5);
        }
Exemple #2
0
        public void Test()
        {
            Genetic       g = new Genetic();
            IOptiTestFunc f = new Weierstrass();

            g.dimension   = 10;
            g.searchSpace = f.SearchSpace;
            double[] res = g.Opti(f.Func);
            double   val = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);

            g             = new Genetic();
            f             = new SumSquares();
            g.dimension   = 10;
            g.searchSpace = f.SearchSpace;
            res           = g.Opti(f.Func);
            val           = f.Func(res);
            Assert.AreEqual(f.MinimumValue, val, 5);
        }
Exemple #3
0
        public void Test()
        {
            Bats          b = new Bats();
            IOptiTestFunc f = new Weierstrass();

            b.dimension   = 10;
            b.searchSpace = f.SearchSpace;
            double[] res = b.Opti(f.Func);
            double   val = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);

            b             = new Bats();
            f             = new SumSquares();
            b.dimension   = 10;
            b.searchSpace = f.SearchSpace;
            res           = b.Opti(f.Func);
            val           = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);
        }
Exemple #4
0
        public void Test()
        {
            Differential  d = new Differential();
            IOptiTestFunc f = new SumSquares();

            d.dimension   = 10;
            d.searchSpace = f.SearchSpace;
            double[] res = d.Opti(f.Func);
            double   val = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);

            d             = new Differential();
            f             = new Weierstrass();
            d.dimension   = 10;
            d.searchSpace = f.SearchSpace;
            res           = d.Opti(f.Func);
            val           = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);
        }
Exemple #5
0
        public void Test()
        {
            Cuckoo        c = new Cuckoo();
            IOptiTestFunc f = new Weierstrass();

            c.dimension   = 10;
            c.searchSpace = f.SearchSpace;
            double[] res = c.Opti(f.Func);
            double   val = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);


            c = new Cuckoo();
            f = new SumSquares();

            c.dimension   = 10;
            c.searchSpace = f.SearchSpace;
            res           = c.Opti(f.Func);
            val           = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);
        }
Exemple #6
0
        public void Test()
        {
            Annealing a = new Annealing(10000, 1000);

            a.dimensions = 10;
            IOptiTestFunc f = new SumSquares();

            a.searchSpace = f.SearchSpace;
            a.minVal      = f.MinimumValue;
            double[] res = a.Opti(f.Func);
            double   val = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);

            a             = new Annealing(10000, 1000);
            a.dimensions  = 10;
            f             = new Weierstrass();
            a.searchSpace = f.SearchSpace;
            a.minVal      = f.MinimumValue;
            res           = a.Opti(f.Func);
            val           = f.Func(res);

            Assert.AreEqual(f.MinimumValue, val, 5);
        }