问题
I'm working in my degree thesis and I'm trying to create a GA to create levels for a game in a procedural way.
Even if GA isn't the best technique, is possible.
Anyway, since I never worked with them I'm reading some books about introduction in GA.
The thing is, is necessary to represent chromosomes as bits or they can be any kind of data struct? I'm asking it because in my mind, using trees to create levels in a procedural way and using GA to evaluate them looks fine, but when I read about GA they use bits in most of the examples there.
回答1:
Absolutely! If you want you Genetic Algorithm to use a more complex representation of your individuals, other than strings or fixed-size arrays, then it is called Genetic Programming (GP).
In GP, the individuals are usually represented as trees:
Or even as lines of code: Code generation by genetic algorithms
For more info see: What are the differences between genetic algorithms and genetic programming?
And above all, I highly recommend this book: A Field Guide to Genetic Programming
回答2:
If you are able to address and defend what you define to be a crossover operation, your proposal could be viable. Also, unless you are introducing asymmetry in the genetic material, the trees should be balanced, at which point a linear encoding can carry the same effective information. I would stick to either bits or a character string unless there is a very good reason not to, as such representations are the standard in both literature and existing libraries.
回答3:
Absolutely! You can use any data structure you want as long as you provide suitable fitness, mutate, and (maybe) crossover operators.
来源:https://stackoverflow.com/questions/44251580/genetic-algorithms-can-chromosomes-be-trees