Closed AmorosoLaura closed 1 week ago
Hi Laura, thanks for the review and the tips you gave me!
I have tried the changes to improve problem instances 1 and 2 and the results are really impressive.
Looking more closely at the one_cut_crossover
function you suggested, I noticed that you create the second child in a way that is quite innovative to me.
Typically, to create the second child, the first part of the second parent's genotype is concatenated with the second part of the first parent's genotype, in this order. Here it is coded:
offspring1=Individual(fitness_function, n_loci, tuple(ind1.genotype[:index]) + tuple(ind2.genotype[index:]))
offspring2=Individual(fitness_function, n_loci, tuple(ind2.genotype[:index]) + tuple(ind1.genotype[index:]))
What you do to create the second child instead is to concatenate the second part of the first parent's genotype with the first part of the second parent's genotype, in this order.
I have tried these two options and your alternative is incredibly powerful. I searched the internet and couldn't find anything related to this... really great work 💪🏻!
As for the other improvements you suggested, I will let you know what the results are when I implement them.
Good luck for the next labs to you too!
Hi Davide,
I appreciated your code, since it is very clear and full of comments and the output is well formatted. I agree with your strategies to solve the problem, and it was interesting to me your implementation of the extinction mechanism based on the genotype.
However, I have some suggestions to you.
For the problem with size 1 I tried to manipulate your code in order to reduce the number of fitness calls, and I managed to reach more or less the 4440 calls, instead of 25_000. In order to do this I lowered the Mutation probability from 0.80 to 0.15 and added to the one cut crossover a second child to preserve also the second parts of the parents genomes. Here the modififed code:
I used the same code also for problem 2 but with a mutation probability equal to 0.10 and these are the results I obtained:
Problem 1---->Number of fitness calls: 4,398
Problem 2---->Number of fitness calls: 14,272
For the complex problems you could try to implement some parameter tuning to change the mutation probability, starting from very low values like 0.01, according to the improvements of the fitness, and also add to the island model a Migration rate to be tuned instead of doing the migration at fixed generation.
In order to differentiate the islands and let them explore different parts of the landscape, you could try to use different crossovers or mutation probabilities in the different islands and, as you did, let them exchange migrants randomly or choosing the fittest according to some probability.
Unfortunately, I don't have great advices for the problems 5 and 10, since I wasn't able to reach the 1.0 fitness either and I struggled to get better results. However, I hope that you can find these little tips useful, and if you try something let me know the results.
Good luck for the next works!