问题描述
我正在攻读学位论文,并且试图创建GA以程序方式为游戏创建关卡.
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.
即使GA不是最好的技术,也是有可能的.
Even if GA isn't the best technique, is possible.
无论如何,由于我从未与他们合作过,所以我正在阅读一些有关GA入门的书籍.
Anyway, since I never worked with them I'm reading some books about introduction in GA.
问题是,有必要将染色体表示为位还是它们可以是任何类型的数据结构?我之所以这样问是因为,在我看来,使用树以程序方式创建级别并使用GA对其进行评估看起来不错,但是当我了解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.
推荐答案
绝对!如果您希望遗传算法使用比字符串或固定大小的数组更复杂的个人表示形式,则称为遗传编程(GP).
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).
在GP中,个体通常用树表示:
In GP, the individuals are usually represented as trees:
或者甚至是代码行:通过遗传算法生成代码
Or even as lines of code:Code generation by genetic algorithms
有关更多信息,请参见:遗传算法和遗传编程之间有什么区别? /a>
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 toGenetic Programming
这篇关于遗传算法-染色体可以是树吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!