We propose a design for a functional programming language for autonomous agents, built off the ideas and motivations of Behavior Trees (BTs). BTs are a popular model for designing agents behavior in robotics and AI. However, as their growth has increased dramatically, the simple model of BTs has come to be limiting. There is a growing push to increase the functionality of BTs, with the end goal of BTs evolving into a programming language in their own right, centred around the defining BT properties of modularity and reactiveness. In this paper, we examine how the BT model must be extended in order to grow into such a language. We identify some fundamental problems which must be solved: implementing `reactive' selection, 'monitoring' safety-critical conditions, and passing data between actions. We provide a variety of small examples which demonstrate that these problems are complex, and that current BT approaches do not handle them in a manner consistent with modularity. We instead provide a simple set of modular programming primitives for handling these use cases, and show how they can be combined to build complex programs. We present a full specification for our BT-inspired language, and give an implementation in the functional programming language Haskell. Finally, we demonstrate our language by translating a large and complex BT into a simple, unambiguous program.
翻译:本文提出了一种面向自主智能体的函数式编程语言设计,其构建于行为树(BTs)的核心思想与设计理念之上。行为树是机器人与人工智能领域中设计智能体行为的流行模型。然而,随着其应用规模急剧扩大,行为树的简单模型逐渐显现出局限性。当前学界日益强调增强行为树的功能性,其终极目标是使行为树演变为一种独立的编程语言,并以模块化与反应性这两个定义性特征为核心。本文探讨了行为树模型必须如何扩展才能发展为这样的语言。我们识别出若干必须解决的基础问题:实现“反应式”选择、监控安全关键条件以及在动作间传递数据。我们通过一系列小型示例证明这些问题具有复杂性,且现有行为树方法在处理这些问题时未能保持模块化的一致性。为此,我们提出了一套简洁的模块化编程原语来处理这些用例,并展示如何通过组合这些原语构建复杂程序。我们给出了这种受行为树启发的语言的完整规范,并在函数式编程语言Haskell中实现了该语言。最后,我们通过将一组庞大复杂的行为树转换为简洁明确的程序,展示了本语言的实际应用能力。