def test_works_fine(self): fa = self.algo(NP=20, alpha=0.5, betamin=0.2, gamma=1.0, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, fa, Sphere())
def test_custom_works_fine(self): ba_custom = self.algo(NP=20, A=0.5, r=0.5, Qmin=0.0, Qmax=2.0, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, ba_custom, Sphere())
def test_reulete_selection_c(self): ga_crmt = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, Selection=roulette_selection, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, ga_crmt, Sphere())
def test_custom1_works_fine(self): es1_custom = self.algo(mu=55, lam=45, k=50, c_a=1.1, c_r=0.5, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, es1_custom, Sphere())
def test_multi_point_crossover_fine_c(self): ga_mpcr = self.algo(NP=40, Ts=4, Mr=0.05, Cr=4, Crossover=multi_point_crossover, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, ga_mpcr, Sphere())
def test_creep_mutation_fine_c(self): ga_crmt = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, Mutation=creep_mutation, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, ga_crmt, Sphere())
def test_mutation_urso_c(self): ga_crmt = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, Mutation=mutation_uros, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, ga_crmt, Sphere())
def test_crossover_urso_c(self): ga_crmt = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, Crossover=crossover_uros, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, ga_crmt, Sphere())
def test_custom_works_fine(self): wvcpso_custom = self.algo(n=40, C1=2.0, C2=2.0, w=0.7, min_velocity=-4, max_velocity=4, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, wvcpso_custom, Sphere())
def test_custom_works_fine(self): pso_custom = self.algo(NP=40, C1=2.0, C2=2.0, w=0.7, vMin=-4, vMax=4, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, pso_custom, Sphere())
def test_FA_evals_fine(self): task = StoppingTask(d=10, no_fes=1000, opt_type=OptimizationType.MINIMIZATION, benchmark=Sphere()) algo = FireflyAlgorithm(n=25) algo.run_task(task) evals = task.evals() self.assertEqual(1000, evals)
def test_BA_iters_to_fes(self): task = StoppingTask(d=10, no_gen=1000, opt_type=OptimizationType.MINIMIZATION, benchmark=Sphere()) algo = BatAlgorithm(n=10) algo.run_task(task) evals = task.evals() self.assertEqual(10000, evals)
def test_BA_iters_fine(self): task = StoppingTask(d=10, no_gen=1000, opt_type=OptimizationType.MINIMIZATION, benchmark=Sphere()) algo = BatAlgorithm(n=25) algo.run_task(task) iters = task.iters() self.assertEqual(1000, iters)
def test_DE_iters_fine(self): task = StoppingTask(d=10, no_gen=1000, opt_type=OptimizationType.MINIMIZATION, benchmark=Sphere()) algo = DifferentialEvolution(n=40, CR=0.9, F=0.5) algo.run_task(task) iters = task.iters() self.assertEqual(1000, iters)
def test_custom_works_fine(self): aba_custom = AdaptiveBatAlgorithm(n=40, A=.75, epsilon=2, alpha=0.65, r=0.7, Qmin=0.0, Qmax=2.0, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, aba_custom, Sphere())
def test_works_fine_parallel(self): bea = self.algo(NP=20, m=15, e=4, nep=10, nsp=5, ngh=2, seed=self.seed) beac = self.algo(NP=20, m=15, e=4, nep=10, nsp=5, ngh=2, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, bea, beac, Sphere())
def setUp(self): self.D = 20 self.x, self.task = rnd.uniform(-2, 2, self.D), Task(self.D, nGEN=230, nFES=np.inf, benchmark=Sphere()) self.sol1, self.sol2, self.sol3 = MkeSolution( x=self.x, e=False), MkeSolution(task=self.task), MkeSolution(x=self.x, e=False)
def test_Custom_works_fine_parallel(self): es_custom = self.algo(mu=45, lam=55, k=50, c_a=1.1, c_r=0.5, seed=self.seed) es_customc = self.algo(mu=45, lam=55, k=50, c_a=1.1, c_r=0.5, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, es_custom, es_customc, Sphere())
def test_two_point_crossover_fine_c_parallel(self): ga_tpcr = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, Crossover=two_point_crossover, seed=self.seed) ga_tpcrc = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, Crossover=two_point_crossover, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, ga_tpcr, ga_tpcrc, Sphere())
def test_custom_works_fine_parallel(self): wvcpso_custom = ParticleSwarmAlgorithm(n=40, C1=2.0, C2=2.0, w=0.7, min_velocity=-4, max_velocity=4, seed=self.seed) wvcpso_customc = ParticleSwarmAlgorithm(n=40, C1=2.0, C2=2.0, w=0.7, min_velocity=-4, max_velocity=4, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, wvcpso_custom, wvcpso_customc, Sphere())
def test_custom_works_fine_parallel(self): clpso_custom = self.algo(n=40, C1=2.0, C2=2.0, w=0.7, min_velocity=-4, max_velocity=4, seed=self.seed) clpso_customc = self.algo(n=40, C1=2.0, C2=2.0, w=0.7, min_velocity=-4, max_velocity=4, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, clpso_custom, clpso_customc, Sphere())
def test_Custom_works_fine_parallel(self): hba_custom = self.algo(NP=40, A=0.5, r=0.5, F=0.5, CR=0.9, Qmin=0.0, Qmax=2.0, seed=self.seed) hba_customc = self.algo(NP=40, A=0.5, r=0.5, F=0.5, CR=0.9, Qmin=0.0, Qmax=2.0, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, hba_custom, hba_customc, Sphere())
def test_works_fine_parallel(self): mbo = self.algo(NP=20, PAR=5.0 / 12.0, PER=1.2, seed=self.seed) mboc = self.algo(NP=20, PAR=5.0 / 12.0, PER=1.2, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, mbo, mboc, Sphere())
def test_custom_works_fine_parallel(self): cs_custom = self.algo(NP=20, seed=self.seed) cs_customc = self.algo(NP=20, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, cs_custom, cs_customc, Sphere())
def test_custom_works_fine(self): cs_custom = self.algo(NP=20, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, cs_custom, Sphere())
def test_Custom_works_fine_parallel(self): ga_custom = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, seed=self.seed) ga_customc = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, ga_custom, ga_customc, Sphere())
def test_custom_works_fine(self): ga_custom = self.algo(NP=40, Ts=4, Mr=0.05, Cr=0.4, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, ga_custom, Sphere())
def test_Custom_works_fine_parallel(self): sca_custom = self.algo(NP=35, a=7, Rmin=0.1, Rmax=3, seed=self.seed) sca_customc = self.algo(NP=35, a=7, Rmin=0.1, Rmax=3, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, sca_custom, sca_customc, Sphere())
def test_custom_works_fine(self): sade_custom = self.algo(n=10, C_a=2, C_r=0.5, seed=self.seed) AlgorithmTestCase.test_algorithm_run(self, sade_custom, Sphere())
def test_custom_works_fine_parallel(self): sadev1_custom = self.algo(n=10, C_a=2, C_r=0.5, seed=self.seed) sadev1_custom_c = self.algo(n=10, C_a=2, C_r=0.5, seed=self.seed) AlgorithmTestCase.test_algorithm_run_parallel(self, sadev1_custom, sadev1_custom_c, Sphere())