Hi @EnricoMagliano I decided to review your code about the set covering problem using Genetic Algorithm!
I hope that comments and suggestions I left below can be useful for you.
MAJOR
First of all, you use the same heuristic that I used for the fitness function in my solution. After some trials I think that is a good choice for this kind of problem.
Another thing similar to mine is the random initialization of the population genomes at the beginning. I saw different approaches in other solutions (all genes to False, all genes to False except for one, etc...), but also in this case, after some trials, I think that this idea can be considered quite good.
Mutation in this problem can be a double-edged sword, because if the rate is high we have the risk of getting away from possible solution paths. My suggestion is to lower the mutation rate and give more space to crossover. Another interesting thing can be to variate this rate so keep it higher at the beginning (exploration) and lower it during the computation (exploitation).
Instead of having a loop over the population for searching a solution, you can just check every time the new genome create after mutation or crossover and the new fitness. In this way you have fitness and genome for doing comparisons and searching a local minimum.
I would like to see more details in the README, for example, for each N the parameters used and the solution main factors (weight and steps).
MINOR
The fact that there are some comments in the code is very good, I suggest you to add a few more.
CONCLUSIONS
Your approach is quite good, you can think about playing with random parameters and checking if better solutions can be reached!
Good job ;)
SET COVERING PROBLEM WITH GENETIC ALGORITHM
Hi @EnricoMagliano I decided to review your code about the set covering problem using Genetic Algorithm! I hope that comments and suggestions I left below can be useful for you.
MAJOR
MINOR
CONCLUSIONS
Your approach is quite good, you can think about playing with random parameters and checking if better solutions can be reached! Good job ;)