I want to use a GA to determine the optimal path from A to B, satisfying certain conditions (length, number of turns, etc.)
An example of a path is: Up 4, Left 8, Down 3, Right 3, Down 1, Left 10, Up 4, Left 1, Up 3
The problem is, I don't really know a good way to represent information such as this in a good way for use in a GA, especially because paths have a variable length.
Does anyone have a good idea how to do something like this?
I'm not sure exactly what your representation problem is, so I suspect you have this question from a misunderstanding of a GA's chromosome string. Theoretically speaking, the chromosome string does not have to be recombined explicitly on integer boundaries if you take the extra step of demarcating your individual genes, which would allow you to recombine on a gene-by-gene basis. This solves the problem of a variable-length gene, such as your "path". Recombining variable-length genes is just a matter of adding another variant to the mutation method, specifically "use this element or nuke this element" in addition to the standard "use element from A or element from B" if your gene is breakable into discrete elements, as your path is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With