-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi Luca, i have some advice for you. I hope that this review can help you.
-
I think that is very important to write a README. It could include some clarifications about:
- the main choses that you made in your work (e.g what algorithm you implemented)
- some motivation about the hyperparameters that you chose (e.g mutation probability, offspring size..)
- everything that is relevant to well understanding your code
-
I immediately noticed the of_over. I think this is a form of "cheating" because you shouldn't know that fitness increases if the number of 1's in the genome increases. So, don't use it to evaluate the performance of your algorithm.
-
I see that your results are obtained using a one_cut_crossover. You can try using a two_cut _crossover to increase diversity during recombination and you may get slightly better results with just this small variation. I'll leave you my implementation for the 2-cut:
def two_cut_xover(ind1: Individual, ind2: Individual) -> Individual:
while True:
cut_point_one = randint(0, GENOME_LENGTH -1)
cut_point_two = randint(0, GENOME_LENGTH -1)
if cut_point_one != cut_point_two:
break
if cut_point_one > cut_point_two:
temp = cut_point_one
cut_point_one = cut_point_two
cut_point_two = temp
offspring = Individual(
fitness=None,
genotype = ind1.genotype[:cut_point_one]
+ ind2.genotype[cut_point_one:cut_point_two]
+ ind1.genotype[cut_point_two:]
)
return offspring
- For improving you results I can advice you to try different mutation operators such as scramble_mutation, random_resetting, reverse_mutation, gaussian_mutation, swap_mutation.
Recommended reading: https://www.geeksforgeeks.org/mutation-algorithms-for-string-manipulation-ga/
Some other comments: - I really liked your implementation of uniform crossover
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels