Changeset 1290
 Timestamp:
 01/15/24 05:45:10 (6 weeks ago)
 Location:
 framspy/evolalg/numerical_example
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

framspy/evolalg/numerical_example/numerical_example.py
r1190 r1290 2 2 3 3 from ..base.experiment_abc import ExperimentABC 4 from ..structures.hall_of_fame import HallOfFame5 4 6 5 … … 11 10 save_only_best=save_only_best) 12 11 13 def mutate(self, gen 1):14 return list(gen1 + np.random.randint(10, 10, len(gen1)))12 def mutate(self, gen): 13 return gen + np.random.normal(0, 15, len(gen)) 15 14 16 15 def cross_over(self, gen1, gen2): 17 return gen1 16 a = np.random.uniform() 17 return a * gen1 + (1.0a) * gen2 18 18 19 def evaluate(self, gen otype):20 return 1/sum([x*x for x in genotype])19 def evaluate(self, gen): 20 return sum([x*x for x in gen]) 
framspy/evolalg/numerical_example/numerical_islands_example.py
r1190 r1290 13 13 save_only_best=save_only_best) 14 14 15 def mutate(self, gen 1):16 return gen 1 + np.random.randint(10, 10, len(gen1))15 def mutate(self, gen): 16 return gen + np.random.normal(0, 15, len(gen)) 17 17 18 18 def cross_over(self, gen1, gen2): 19 return gen1 19 a = np.random.uniform() 20 return a * gen1 + (1.0a) * gen2 20 21 21 def evaluate(self, gen otype):22 return 1/sum([x*x for x in genotype])22 def evaluate(self, gen): 23 return sum([x*x for x in gen])
Note: See TracChangeset
for help on using the changeset viewer.