In genetic algorithms, we have a function called "mutation". Before we call this function, we choose parents.
In my version of the algorithm, when i mutate the child, i don't change the bits which are the same as the given input.
By that, I mean : Imagine we want to reach the string "ABCDE".
The algorithm first generates 5 strings randomly :
The fitness function says that the first two strings, have better quality to survive. So, we select them.
So we have "ADDDE","ABDIO" as parents.
Then we choose a random number between 0 & 4. Assume that 1 is chosen.
We take "AD" from the first string and "DIO" from the second one.
The child we made is : "ADDIO"

Now, The part which makes me confused :
When i mutate this child, I say "A" is in the same place of "ADDIO" as "ABCDE". So, I don't change "A". I mutate the other characters . For example i make "AQWERT","ARTYUI" , ...

Is this correct? Any idea? Any improvement ?


No, that does not make sense.

What you have there is a toy example. In any application, the algorithm will not know the goal -- otherwise you wouldn't need it! That is, you don't have any way of known whether a mutation is benefitial before executing it.

What's more, mutating away from the optimum is an essential part of the algorithm, and can be shown to be necessary for it to work well (otherwise you get stuck in local optima more easily).

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.