+ 3
Genetic Algorithm [Code related query]
I made a genetic algorithm to see if sum of 5 numbers is equal to our target. So for selecting the fittest member - //Ga.cpp// if(abs(gene_sum-target) <= abs(fit_sum-target)) Where fit_sum is our current fit member and gene_sum is one of the individual. In the if statement is it the correct way to select the fittest member? https://code.sololearn.com/ceKfyzBU6hFl/?ref=app
1 Odpowiedź
+ 2
It has been 7 days forgive me if you have already figured it out, but it's seems the code is working correctly. The method you have is correct as there are many ways of finding the fittest member.