Aplib: Tactical Programming of Intelligent Agents

Aplib: Tactical Programming of Intelligent Agents

Aplib: Tactical Programming of Intelligent Agents I. S. W. B. Prasetya1 a 1Utrecht University, the Netherlands [email protected] Keywords: intelligent agent, agent programming, BDI agent, agents tactical programming. Abstract: This paper presents aplib, a Java library for programming intelligent agents, featuring BDI and multi agency, but adding on top of it a novel layer of tactical programming inspired by the domain of theorem proving. Aplib is also implemented in such a way to provide the fluency of a Domain Specific Language (DSL). Compared to dedicated BDI agent programming languages such as JASON, 2APL, or GOAL, aplib’s embedded DSL approach does mean that aplib programmers will still be limited by Java syntax, but on other hand they get all the advantages that Java programmers get: rich language features (object orientation, static type checking, l-expression, libraries, etc), a whole array of development tools, integration with other technologies, large community, etc. 1 INTRODUCTION driks, 2018), JACK (Winikoff, 2005), FATIMA (Dias et al., 2014), and PROFETA (Fichera et al., 2017), Software agents are generally considered as a dif- that allow the rules to be declaratively formulated, but ferent type of programs than e.g. procedures and ob- this does not necessarily mean that it is easy for agent jects as they are naturally autonomous, reactive as programmers to develop these rules, especially if the well as pro-active, and ’social’ (they interact with problem to solve is complex. each other) (Wooldridge and Jennings, 1995; Meyer, This paper presents aplib1: a BDI agent program- 2008). As such, they are considered as highly suit- ming framework that adds as novelty a layer of tac- able building blocks to build complex software sys- tical programming over the rule based programming tems that require multiple and decentralized loci of typical in BDI agent programming. Tactics allow control (Jennings, 2001). Applications of software agents to strategically choose and prioritize their short agents include computer games, health care, traffic term plans. This is inspired by proof programming in control system (Jennings et al., 1998), smart electrical LCF theorem provers like Coq and HOL (Delahaye, power grid control (Merabet et al., 2014), and manu- 2000; Gordon and Melham, 1993). These theorem facturing control system (Leitao,˜ 2009). provers come with a whole range of proof rules. How- In a stronger concept of agency (Wooldridge and ever, having plenty of rules does not in itself make Jennings, 1995), agents can also posses artificial intel- proving formulas easy. In fact, proving a complex ligence. The most popular type of intelligent agents is goal formula often involves interactively trying out probably that of the BDI (Belief-Desire-Intent) family different steps, searching for the right sequence that (Herzig et al., 2017). Such an agent maintains a set of would solve the goal. To help users, these theorem human-inspired mental states, such as belief, desire, provers provide tactical combinators to compose tac- and intention, and is able to reason over these states arXiv:1911.04710v1 [cs.AI] 12 Nov 2019 tics from proof rules, hence users can write proofs by when deciding its actions. While adding AI would sequencing tactics rather than proof rules. There is greatly enhance agents, it is not something that we some analogy with agents, which also have to solve get for free as the AI would need some programming non-trivial goals, hence inspiring aplib to provide a in the first place. In the case of BDI agents, someone similar tactical approach to program agents. would need to produce the set of inference rules that While tactics are good to capture bottom-up control their actions. There are indeed programming strategies to solve a goal2, sometimes it is also useful languages to program BDI agents, e.g. JASON (Bor- dini et al., 2007), 2APL (Dastani, 2008), GOAL (Hin- 1https://iv4xr-project.github.io/aplib/ 2With respect to the previously mentioned concept a https://orcid.org/0000000234214635 of ’tactic’ in LCF theorem provers, aplib tactics express to have top-down strategies. This can be expressed 2 Preliminary by a way to break down a goal into subgoals. Aplib Notation. Since aplib is implemented in Java, facilitates this through the concept of goal structure, most of its concepts are implemented as objects. Ob- that allows a goal to be hierarchically formulated from jects can be structured hierarchically. We use the no- subgoals through a number of strategy combinators, tation u7!v to denote that the object v is linked from u e.g. to express fall backs (alternate goals if the orig- through a reference inside u (and therefore its state is inal goal fails). While it is true that tactics and goal also reachable from u). This is useful for abstraction, structures can be programmed inside BDI agents’ rea- as sometimes it is convenient to talk about the struc- soning rules, we would argue that tactical program- ture u7!v in terms of its parent u while being implicit ming involves a different mental process for program- about the subobject v. mers. Aplib allows them to be programmed sepa- Java functions. Since Java 8, functions can be rately and more abstractly, rather than forcing the pro- conveniently formulated using so-called lambda ex- gramers to encode them inside reasoning rules. pressions. E.g. the Java expression: Unlike JASON, 2APL, or GOAL, which offer a x ! x+1 native/dedicated BDI agent programming, aplib of- fers a Domain Specific Language (DSL) to program constructs a nameless function that takes one parame- agents, embedded in Java. This means that aplib pro- ter, x, and returns the value of x+1. Aplib relies heav- grammers will program in Java, but they will get a set ily on functions. Traditionally, to add behavior to an of APIs that give the fluent appearance of a DSL. In object we do that by defining a method, say m(), in principle, having a native programming language is a the class C to which the object belongs to. But then huge benefit, but only if the language is mature and all objects of C will have the same behavior. If we scalable. On the other hand, using an embedded DSL want to assign a different behavior to some of them 0 means that the programmers have direct access to all we have to first create a subclass C of C where we the benefit the host language, in this case Java: its ex- override m() with the new behavior, and then instan- 0 pressiveness (OO, lambda expression etc), static typ- tiate C to obtain new objects with the new behavior. ing, rich libraries, and wealth of development tools. If we expect to do this often, this approach will clut- These are things that JASON, 2APL, nor GOAL can- ter the code. Instead, in aplib we often apply a de- not offer. It is also worth noting that elsewhere, the sign pattern similar to the Strategy Pattern (Gamma rapidly growing popularity of AI and data science li- et al., 1994), where we implement m as a field of type braries like TensorFlow, NumPy, and Java-ML can be Function. If we have an object u : C, and we want to seen as evidence that developers are quite willing to change the behavior of its m, we can simply assign a sacrifice the convenience of having a native language new function to it, as in u:m = x!x+1. There is no in exchange for strength. overhead of having to create a subclass. Unlike in a pure functional language like Haskell, Paper structure. Section 2 first introduces some Java functions can be either pure (has no side ef- notation and concepts from OO programming that fect) or impure/effectful. An effectful function of type might be non-standard. Related work will be dis- C!D takes an object u : C and returns some object cussed later, namely in Section 7. Section 3 explains v : D, and may also alter the state of u. the basic concepts of aplib agents and shows exam- ples of how to create an agent with aplib and how to write some simple tactics. The section also presents 3 Aplib Agency aplib’s deliberation algorithm, which necessarily has Figure 1 illustrates the typical way aplib agents to extend the standard BDI deliberation algorithm. are deployed. As common with software agents, aplib Section 4 presents aplib’s tactical programming. Sec- agents are intended to be used in conjunction with an tion 5 discusses aplib’s reasoning backend, and Sec- environment (the ’real environment’ in Fig. 1), which tion 6 presents aplib’s goal structuring mechanism and is assumed to run autonomously for its own purpose. also discusses budgeting as a means to control agent’s This environment can be e.g. a computer game, a sim- commitment to goals. Finally Section 8 concludes ulator, a trading system, or a manufacturing system and mentions some future work. as in (Leitao,˜ 2009). Each agent would have its own goal, which can be to simply monitor the environ- ment, or to influence it in a certain way. Some agents bottom-up strategies, whereas LCF tactics are top-down. may work together towards a collective goal, whereas Aside from the directions, both concepts intend to express others might be competitors. A group of agents that strategical composition of the underlying basic steps. wish to collaborate can register to a ’communication Figure 2: A GoMoku game on a 12×12 board. Cross wins Figure 1: Typical deployment of aplib agents. In the picture, the game with a winning diagonal (yellow). Ai are agents. ”Com. nodes” allow connected agents to send messages to each other.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us