Dear all , I still need an answer
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear Patrik thank you very much, that's really quick, but I see that the numbers have changed and the total number to every number is not 11, I'm going to be more precise, I need to have before the point four positions for example
[0011741667, 0003913892,0014488700,0008746350,0000349066] so the final string should be
00117416670003913892001448870000087463500000349066
while we got 1174173913914488787463034907 and I tried to change the { } to [] but it gave me error, in the end I have matrix [20,5] to convert in the same way , could you help me to overcome this problem. thanks
I will write my question again.
Dear all, I'm going to write my problem again, I need to convert the vector [11.741667 3.913892 14.488700 8.746350 0.349066] to integer numbers
[11741667 3913892 14488700 8746350 0349066] without the point, then join them to be string like 00117416670003913892001448870000087463500000349066
thanks in advance, I really appreciate your help.
2 commentaires
Geoff Hayes
le 7 Août 2014
Imola - are you using your own genetic algorithm code to optimize a problem, or are you using that from the (MATLAB) Global Optimization Toolbox. I think I understand what you are doing (please correct me if I'm wrong) - you have five floating point variables that you wish to concatenate into a single string of integer values. This will be the "genetic" data from one parent which you will crossover with that from another parent, creating the child genetic data. This combined string will then be broken down back into the five variables (genes?) which will be used to evaluate the child's fitness via the fitness function.
Is this correct? Are you using just one crossover point or multiple? Why not use a heuristic approach on each gene/variable which allows you to maintain the floating point data?
Geoff Hayes
le 7 Août 2014
Imola - the heuristic approach just takes the two equivalent genes/variables from the two parents and creates the child gene according to the equation
childVarX = parent2VarX + R * (parent1VarX - parent2VarX);
where parent1 has the better fitness value, and R determines how far the child variable value should be from the better parent. Just Google GA "heuristic crossover" and a couple of papers should appear.
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Genetic Algorithm dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!