Exemplo n.º 1
0
 def test_real_gauss_grad_mutator_large_pmut(self, rand_gauss_mock,
                                             rand_mock):
     rand_mock.return_value = 0
     rand_gauss_mock.return_value = Consts.CDefRangeMin
     expected_result = [0, 2, 3]
     Mutators.G1DListMutatorRealGaussianGradient(self.genome, pmut=0.5)
     self.assertEqual(self.genome.genomeList, expected_result)
Exemplo n.º 2
0
 def test_real_gauss_grad_mutator_small_pmut(self, rand_mock,
                                             coin_flip_mock):
     coin_flip_mock.return_value = 1
     rand_mock.side_effect = [0, 2, 4]
     expected_result = [0, 4, 12]
     Mutators.G1DListMutatorRealGaussianGradient(self.genome, pmut=0.1)
     self.assertEqual(self.genome.genomeList, expected_result)