Пример #1
0
# encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
import sys
sys.path.append('../')
# End of fix

import random
from NiaPy.algorithms.basic import CoralReefsOptimization
from NiaPy.util import StoppingTask, OptimizationType
from NiaPy.benchmarks import Sphere

#we will run Coral Reefs Optimization algorithm for 5 independent runs
for i in range(5):
    task = StoppingTask(D=10, nFES=1000, optType=OptimizationType.MINIMIZATION, benchmark=Sphere())
    algo = CoralReefsOptimization(NP=40)
    best = algo.run(task=task)
    print best
 
Пример #2
0
# encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
import sys
sys.path.append('../')
# End of fix

import random
from NiaPy.algorithms.basic import CoralReefsOptimization
from NiaPy.task import StoppingTask
from NiaPy.benchmarks import Sphere

#we will run Coral Reefs Optimization algorithm for 5 independent runs
for i in range(5):
    task = StoppingTask(D=10, nFES=1000, benchmark=Sphere())
    algo = CoralReefsOptimization(N=60, Fb=0.9, Fa=0.4, Fd=0.3, phi=25)
    best = algo.run(task)
    print(best)
 
Пример #3
0
	def test_custom_works_fine(self):
		cro_custom = CoralReefsOptimization(D=self.D, N=20, nFES=self.nFES, nGEN=self.nGEN, benchmark=MyBenchmark(), seed=self.seed)
		cro_customc = CoralReefsOptimization(D=self.D, N=20, nFES=self.nFES, nGEN=self.nGEN, benchmark=MyBenchmark(), seed=self.seed)
		AlgorithmTestCase.algorithm_run_test(self, cro_custom, cro_customc)
Пример #4
0
	def test_griewank_works_fine(self):
		cro_griewank = CoralReefsOptimization(N=10, D=self.D, nFES=self.nFES, nGEN=self.nGEN, benchmark='griewank', seed=self.seed)
		cro_griewankc = CoralReefsOptimization(N=10, D=self.D, nFES=self.nFES, nGEN=self.nGEN, benchmark='griewank', seed=self.seed)
		AlgorithmTestCase.algorithm_run_test(self, cro_griewank, cro_griewankc)
Пример #5
0
 def test_custom_works_fine(self):
     cro_custom = CoralReefsOptimization(N=20, seed=self.seed)
     cro_customc = CoralReefsOptimization(N=20, seed=self.seed)
     AlgorithmTestCase.algorithm_run_test(self, cro_custom, cro_customc,
                                          MyBenchmark())
Пример #6
0
 def test_griewank_works_fine(self):
     cro_griewank = CoralReefsOptimization(N=10, seed=self.seed)
     cro_griewankc = CoralReefsOptimization(N=10, seed=self.seed)
     AlgorithmTestCase.algorithm_run_test(self, cro_griewank, cro_griewankc)