简体   繁体   English

该语言是否足够通用/强大,足以用于通用游戏AI?

[英]Is this language generic/mighty enough to be used for a generic game AI?

I want to develop a genetic program that can solve generic problems like surviving in a computer game. 我想开发一种遗传程序,可以解决通用问题,例如在计算机游戏中生存。 Since this is for fun/education I do not want to use existing libraries. 因为这是为了娱乐/教育,所以我不想使用现有的库。

I came up with the following idea: 我提出了以下想法:

The input is an array of N integers. 输入是N个整数的数组。 The genetic program consists of up to N ASTs, each of which takes input from some of the array elements and writes its output to a single specific array element. 该遗传程序最多包含N个AST,每个AST从某些数组元素中获取输入并将其输出写入单个特定的数组元素中。

The ASTs can be arbitrary complex and consist only of four arithmetic operators (+,-,*,/) and can operate on constants and fixed elements of the given array (no random access). AST可以是任意复杂的,并且仅由四个算术运算符(+,-,*,/)组成,并且可以对给定数组的常量和固定元素进行运算(无随机访问)。

So for [N=3], we have 3 ASTs, for example: 因此,对于[N = 3],我们有3个AST,例如:

a[0] = {a[0] + 1}
a[1] = {a[0] + a[1]}
a[2] = {a[0] * 123 + a[1]}

The N ASTs are executed one after another and this is repeated infinitely. N个AST一次又一次执行,并且无限重复。

Now my question, is this system "mighty" enough (turing complete?) or will it fail to solve some kinds of problems common for an game AI? 现在我的问题是,该系统是否“足够强大”(图灵完善?)还是无法解决游戏AI常见的某些问题?

From my perpective the Turing completness of the system is not the main problem here. 从我的角度来看,系统的图灵完备性不是这里的主要问题。 When using a genetic algorithm to evolve some kind of a strategy applied to some game environment one of the features of the algorithm - that would be helpful - is - I believe - that the small change in the "genome" of the solution lead to a reasonably small change in the behavior. 当使用遗传算法来进化适用于某些游戏环境的某种策略时,该算法的特征之一(可能会有所帮助)是-我认为-解决方案的“基因组”中的微小变化会导致行为上的合理变化很小。 If this is not true then every mutation or cross over can produce an entity that behaves completely different and in this kind of landscape it can be problematic for the genetic algorithm to arrive to some optima - as the landscape of the fitness function is not continuous enough. 如果这不是真的话,那么每个突变或交叉都会产生一个行为完全不同的实体,并且在这种情况下,遗传算法难以达到某个最佳值可能会遇到问题-因为适应度函数的状态不够连续。

Having said that it makes sense to me to try to somehow encode a form of decision tree in the genome and evolve that. 话虽如此,对我而言,尝试以某种方式在基因组中编码一种决策树并对其进行进化是有意义的。 However - from my experience - the genetic algorithms in AI for games works best when used to "compute" the optimal values of some parameters of some particular behavior then to "evolve" the behavior itself. 但是,根据我的经验,当用于“计算”某些特定行为的某些参数的最优值然后“演化”行为本身时,用于游戏的AI的遗传算法效果最佳。

The abstract syntax tree (AST) is equal to a program flow which is formulated in a domain specific language. 抽象语法树(AST)等于以领域特定语言制定的程序流。 If the language consists of possible commands: up, left, down, right a possible AST would be: up, up, up, left. 如果语言由可能的命令组成:上,左,下,右,则可能的AST是:上,上,上,左。 What genetic programming is trying to do is to evolve the AST, that means to figure out many different program flows for solving a game. 基因编程正试图发展AST,这意味着要找出解决游戏的许多不同程序流程。 Instead of only evolving the AST the much better idea is to evolve the grammar. 不仅发展AST,更好的主意是发展语法。 That means, to modify the domain specific language in which the AST is formulated. 这意味着,要修改制定AST的领域特定语言。 For example, by adding an additional command like “gocenter”. 例如,通过添加其他命令,例如“ gocenter”。 The new language contains now of 5 possible actions: gocenter, up, left, down, right and it is possible to test out new kind of populations. 新语言现在包含5种可能的操作:gocenter,向上,向左,向下,向右,并且可以测试新的种群。 To systematically evolve a grammar it is needed to learn the grammar by interaction. 为了系统地发展语法,需要通过交互来学习语法。 That means, we are starting with an empty grammar and add carefully new possible action commands. 这意味着,我们从一个空语法开始,并仔细添加新的可能的动作命令。 In the literature this is described as “grammar induction” and means to take an input stream from human interaction and generate the new language from scratch. 在文献中,这被称为“语法归纳”,是指从人类交互中获取输入流并从头开始生成新语言。 With this grammar it is possible to evolve possible ASTs. 通过这种语法,可以发展可能的AST。

quote: “Grammatical Evolution (GE) is a grammar-based form of Genetic programming that specifies the syntax of possible solutions through a context-free grammar” source: Perez, Diego, et al. 引用:“语法演变(GE)是遗传编程的一种基于语法的形式,它通过无上下文语法指定了可能的解决方案的语法。”资料来源:Perez,Diego等。 "Evolving behaviour trees for the mario ai competition using grammatical evolution." “使用语法进化为马里奥竞赛开发行为树。” European Conference on the Applications of Evolutionary Computation. 欧洲进化计算应用会议。 Springer, Berlin, Heidelberg, 2011. 施普林格,柏林,海德堡,2011年。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM