Пример #1
0
 def test_runner_works_fine(self):
     runner = NiaPy.Runner(4,
                           10,
                           2,
                           useAlgorithms=self.algorithms,
                           useBenchmarks=self.benchmarks)
     runner.run()
     self.assertTrue(runner.results)
Пример #2
0
        self.Upper = 5.12

    def function(self):
        def evaluate(D, sol):
            val = 0.0
            for i in range(D):
                val = val + sol[i] * sol[i]
            return val

        return evaluate


algorithms = [
    'BatAlgorithm', 'DifferentialEvolution', 'FireflyAlgorithm',
    'FlowerPollinationAlgorithm', 'GreyWolfOptimizer',
    'ArtificialBeeColonyAlgorithm', 'GeneticAlgorithm',
    'ParticleSwarmAlgorithm', 'HybridBatAlgorithm',
    'SelfAdaptiveDifferentialEvolution'
]
benchmarks = [
    'ackley', 'alpine1', 'alpine2', 'chungReynolds', 'csendes', 'griewank',
    'happyCat', 'pinter', 'quing', 'quintic', 'rastrigin', 'ridge',
    'rosenbrock', 'salomon', 'schumerSteiglitz', 'schwefel', 'schwefel221',
    'schwefel222', 'sphere', 'step', 'step2', 'step3', 'stepint',
    'styblinskiTang', 'sumSquares', 'whitley',
    MyBenchmark()
]

NiaPy.Runner(10, 40, 1000, 3, algorithms, benchmarks).run(export='json',
                                                          verbose=True)
Пример #3
0
 def test_runner_works_fine(self):
     self.assertTrue(
         NiaPy.Runner(10, 40, 1000, 3, self.algorithms,
                      self.benchmarks).run())
Пример #4
0
 def test_runner_bad_benchmark_throws_fine(self):
     self.assertRaises(
         TypeError, lambda: NiaPy.Runner(4, 10, 2, 'EvolutionStrategy1p1',
                                         'TesterMan').run())
Пример #5
0
 def test_runner_bad_algorithm_throws_fine(self):
     self.assertRaises(
         TypeError, lambda: NiaPy.Runner(4, 10, 2, 'EvolutionStrategy', self
                                         .benchmarks).run())
Пример #6
0
	def test_runner_works_fine(self):
		self.assertTrue(NiaPy.Runner(4, 500, 10, 2, useAlgorithms=self.algorithms, useBenchmarks=self.benchmarks).run())
Пример #7
0
 def test_runner_bad_export_throws_fine(self):
     self.assertRaises(
         TypeError, lambda: NiaPy.Runner(4, 10, 3, 'GreyWolfOptimizer', self
                                         .benchmarks).run(export="pandas"))
Пример #8
0
        self.Upper = 5.12

    def function(self):
        def evaluate(D, sol):
            val = 0.0
            for i in range(D):
                val = val + sol[i] * sol[i]
            return val
        return evaluate


algorithms = ['BatAlgorithm',
              'DifferentialEvolution',
              'FireflyAlgorithm',
              'FlowerPollinationAlgorithm',
              'GreyWolfOptimizer',
              'ArtificialBeeColonyAlgorithm',
              'GeneticAlgorithm',
              'ParticleSwarmAlgorithm',
              'HybridBatAlgorithm',
              'SelfAdaptiveDifferentialEvolution']
benchmarks = ['ackley', 'alpine1', 'alpine2', 'chungReynolds',
              'csendes', 'griewank', 'happyCat', 'pinter',
              'qing', 'quintic', 'rastrigin', 'ridge',
              'rosenbrock', 'salomon', 'schumerSteiglitz', 'schwefel',
              'schwefel221', 'schwefel222', 'sphere', 'step',
              'step2', 'step3', 'stepint', 'styblinskiTang',
              'sumSquares', 'whitley', MyBenchmark()]

NiaPy.Runner(D=10, nFES=1000, nRuns=3, useAlgorithms=algorithms, useBenchmarks=benchmarks).run(export='json', verbose=True)