Reputation: 3587
I have a GA of population X.
After I run the gene and get the result for each gene I do some weighted multiply for the genes(so the better ranked genes get multiplied the most)
I get either x*2 or x*2+(x*100/10) genes. The 10% is random new genes it may or may not trigger depending on the mutation rate.
The problem is, I don' know what is the best approach to reduce the population to X again.
If the gene is a List should I just use list[::2] (or get every even index item from list)
What is a common practice when crossing genes?
EDIT:
Example of my GA with a population of 100;
What I want to know is: How should I do the last step? Currently I have a list with 5778 items and I take one every '58' or expressed as len(list)/startpopulation-1
Or should I use a 'while True' with a random.delete until len(list) == 100?
The new random genes should be added before or after the crossover?
Is there a way to make a gausian multiplication of the top-to-lowest rated items?
e.g: the top rated are multiplied by n, the second best by (n-1), the third by (n-2) ..., the worst rated multiplied by (n-n).
Upvotes: 0
Views: 348
Reputation: 1257
I do not really know why you are performing GA like that, could you give some references?
In any case here goes my typical solution for implementing a functional GA method:
Run the the 100 genes in the fitness function and get the result.
Randomly choose 2 genes based on the normalized fitness function (consider this the probability of each gene to be chosen from the pool) and cross-over. Repeat this step until you have 90 new genes (45 times for this case). Save the top 5 without modification and duplicate. Total genes: 100.
For the 90 new genes and the 5 duplicates on the new pool allow them to mutate based on your mutation probability (typically 1%). Total genes: 100.
Repeat from 1) to 3) until convergence, or X number of iterations.
Note: You always want to keep unchanged the best genes such as you always get a better solution in each iteration.
Good luck!
Upvotes: 2