行为树与状态机
我想实现一个复杂的分支逻辑 Android 业务应用程序,用作营销问卷工具,其中有很多问题,并根据用户的响应在问题之间进行分支。 我很困惑是将对话逻辑实现为 FSM 还是行为树。作者使用树来实现状态机。例如,在 Ian Millington 等人的Artificial Intelligence for Games 中,作者建议使用决策树来构建 FSM。然而,我认为 FSM 可以有闭包,例如在“发出警报”和“防御”之间进行转换将使其成为图形而不是树。我的第一个问题是树和状态机有什么区别?第二个问题是什么对我的应用程序来说是一个好的实现,管理高水平的分支复杂性?
I want to implement a complex branching logic Android business application to be used as a marketing questionaire tool with lots of questions and branching among them according to what the user responds.
I'm confused whether to implement the dialog logic as a FSM or a behavior tree. Authors have used trees to implement state machines. For example in Artificial Intelligence for Games By Ian Millington et al, the author suggests using decision tree for a FSM. However, I think that a FSM can have closures, for example having a transition between "raise alarm" and "defend" will make it a graph rather than a tree. My first question is what is the difference between a tree and a state machine ? The second one is what will be a good implementation for my app, manage the high level of branching complexity?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为根据定义,FSM 只有一个入口点,而行为树可以有多个输入。树是图,但图不是树。树是一种非循环图,其中叶子永远不会有多个父代。所以从这方面来说,该树更适合FSM。
无论如何,我想这种类型的模拟超出了 android api 的范围。因此,我会更多地关注 Java 中有哪些可用的工具。我曾经用Java做过一个机器学习研究项目。我最终实现了自定义树数据结构以促进多线程。
我希望这有帮助!
I think by definition, FSM have only one entry point, while behavior trees can have multiple inputs. A tree is a graph, but a graph is not a tree. A tree is an acyclic graph where leaves never have multiple parents. So in this regard, the tree is better suited for the FSM.
Anyways, I would imagine that this type of simulation is outside the scope of android api. Hence, I would be looking more at what kind of tools are available in Java. I once did a machine learning research project in Java. I ended up implementing a custom Tree data structure in order to facilitate multithreading.
I hope that helps!
行为树和决策树是两个不同的东西。行为树是面向目标和反应性的(更适合在类似游戏的环境中模拟代理或智能实体的决策),决策树是一个很好的工具,用于根据某个动作的效用来规范(和存储)决策。给定状态。
主要是,在第一种方法中,执行更加有状态(执行与树中的状态相关),而在后者中,执行更加无状态(整个树从根到叶进行评估,以便到达结论)。
也就是说,从您的描述来看,您似乎正在寻找一个基于规则的专家系统。
Behavior trees and Decision trees are two different things. Behavior trees are a goal oriented and reactive (suite more for simulating agents or smart entities decisions in a game like environment), and decision trees are a great tool for the specification (and storage) of decisions based on the utility of an action for a given state.
Mainly, in first approach the execution is more state-full ( the execution is tied to the state you are in the tree) and in the later is more state-less (the whole tree is evaluated root to leaf in order to arrive to a conclusion).
That said, from your description it seems that what you are looking is for an expert system, rule based.
FSM 是通过转换链接的状态图。对于复杂的fsm,由于复杂的转换而很难扩展。
对于行为树,每个节点都由其父节点管理,转换实际上隐式地存在于父/子关系中,因此更容易扩展现有的行为树。
源码和设计器可以参考https://github.com/TencentOpen/behaviac
FSM is a graph of states linked by transitions. for a complex fsm, it is difficult to extend due to complex transitions.
For behavior trees, each node is managed by its parent, the transition is in fact implicitly in the parent/child relationship, so it easier to extend an existing behavior tree.
you can refer to https://github.com/TencentOpen/behaviac for the source code and designer.