+ 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

31st Aug 2019, 5:32 AM
Divij Manik
Divij Manik - avatar
1 Resposta
+ 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.
7th Sep 2019, 9:32 PM
Adam Kollgaard
Adam Kollgaard - avatar