• No results found

Practical Frameworks Implementing BDI agents

2.1 Agent Orientation

2.1.1 Practical Reasoning in Agents

2.1.1.2 Practical Frameworks Implementing BDI agents

Modern implementations of the BDI agent architecture include GOAL [Hindriks, 2009], Jason [Bordini and H ¨ubner,2006], JACK [Winikoff,2005], Jadex [Braubach et al., 2005], 2APL [Dastani,2008] and 2OPL [Dastani et al.,2009a]. All the frameworks share several features, common in the BDI agent architecture and they all (with the excep- tion of Jadex which uses a hybrid approach) provide an agent-oriented language in which the agent’s reasoning elements are defined. Further to this, they implement a basic execution (reasoning) cycle, through which they apply rules and update their knowledge bases. Below we present the details and particularities of each one of the frameworks.

Goal-Oriented Agent Language (GOAL) [Hindriks, 2009] is a high-level language to design BDI agents. It provides programming constructs to represent beliefs and goals in a declarative manner (the term declarative goals is used to indicate goals that specify a state or set of states of the environment that the agent wants to achieve, rather than actions or procedures on how to achieve such states). GOAL supports various types of actions such as user defined actions, built-in actions, and communication actions. It also includes action selection rules to support the action selection mechanism by providing action selection strategies. A particularity of GOAL is the absence of plans. In addition to the work described, Hindriks et al. research on how goals that can be expressed in temporal logic, called temporally extended goals and how these can be managed within an agent’s reasoning process [Hindriks et al.,2009]. They use GOAL as basis for the semantics and the elements they use. They distinguish between two types of goals, achievement goals and maintenance goals and focus on the “bounded” goals, meaning goals that have a finite time horizon to be achieved, in contrast to “unbounded” that can have infinite horizon to be achieved. In their semantics they allow the expression of goals and beliefs in terms of LTL formulas and they define the mental state of the agent in terms of beliefs and goals of the agent. An agent is able to update through a progression process (i.e. a computational process) its belief and goal base after the execution of some action. In possession of a set of actions and a set of action rules specifying under what conditions to perform an action, they perform reasoning over which actions to select and execute based on the action rules. Additionally, they develop a method to select those actions that will result in minimum violations of goals (that is, goals not accomplished until the maximum lookahead horizon).

Jason on the other hand [Bordini and H ¨ubner,2006] interprets and implements the op- erational semantics of an extension of AgentSpeak (previously AgentSpeak(L)) [Rao, 1996], a logic-based programming language inspired by the PRS model (see Sec- tion 2.1.1.1) for building rational agents, developed by Rao. Jason is a platform for the development of multi-agent systems, with many additional features. The per- formatives that are currently available for agent communication in Jason are largely inspired by the Knowledge Query and Manipulation Language (KQML)1[Finin et al., 1995]. Additionally, the conduct of the agent within the environment is specified in AgentSpeak(L), a restricted first-order logic language supporting events and actions. The language includes a set of plans which compose its plan library. The current belief state of the agent (seen as the current state of the agent, that is, the state of itself, the environment and other agents) is a set of beliefs and initially it comprises a set of base beliefs. The states that the agent, influenced by internal or external situations, wishes to bring about can be seen as its desires. The AgentSpeak interpreter also manages a set of triggering events (changes in the agent’s beliefs or goals) and a set of intentions which are the adopted plans to react to such stimuli. Plans consist of a head (contain- ing a triggering event - the addition or deletion of beliefs or goals - which initiates the execution of the plan) and a body (containing a sequence of goals that should be achieved or tested and actions that should be executed). Whenever a triggering event occurs, AgentSpeak reacts to it by executing the plan that contain it in its head con- dition. As the creators claim, “[...] this shift in perspective of taking a simple specification language as the execution model of an agent and then ascribing the mental attitudes of beliefs, desires, and intentions, from an external viewpoint is likely to have a better chance of unifying theory and practice” [Rao,1996].

Jadex [Braubach et al., 2005] is a BDI-inspired reasoning engine that allows for pro- gramming intelligent software agents in XML and Java. The reasoning engine can be used on top of different middleware infrastructures such as JADE [Bellifemine et al., 1999]. Jadex supports a practical reasoning cycle including goal deliberation as well as means-ends reasoning. The first is responsible for deciding which of the existing goals are currently pursued and the latter has the task to find means for realising a specific goal by applying suitable plans. Unlike other BDI agent systems (e.g. Jason) where beliefs are represented in some kind of first-order predicate logic or using rela- tional models, in Jadex a hybrid language approach is used, where declarative agent information is separated from procedural plan knowledge. In the XML based agent definition file (ADF) the beliefs, goals and plans (static specifications) of an agent type are defined, whereas Java classes are used for encoding the plan bodies (dynamic be- haviour). An object-oriented representation of beliefs is used, where random objects

1KQML is a language designed to support interaction among agents. It contains information con-

cerning various levels of communication, such as the parties involved, the actual content exchanged and the language in which the content is expressed. The performatives, being the core of KQML, define the permissible interactions which agents may use. Performatives contain arguments which specify the pro- tocol used to exchange messages and the speech act that the sender attaches to the content of the message and optionally the sender and receiver. Performatives can be a query, command, assertion or any other other speech acts agreed upon.

can be represented as named facts (beliefs) or named sets of facts (belief sets). Further to this, goals are represented as explicit objects contained in a goalbase, which is ac- cessible to the reasoning component as well as to plans if they need to know or want to change the current goals of the agent. Four different goal types that refine the ba- sic goal lifecycle in different ways are distinguished (perform, achieve, maintain and query goals). The framework does not expect all adopted goals to be consistent with each other, as long as only consistent subsets of these are aimed at, at any point in time. The plan head specification is similar to other BDI systems and mainly specifies the circumstances under which a plan may be selected, e.g. by defining preconditions for the execution of the plan and events or goals managed by it. A special feature of Jadex is that it can support both sequential and parallel execution of plans and it can also allow for a plan execution to wait for (pause and resume after) the execution of an action or the reception of some message.

JACK Intelligent Agents [Winikoff,2005] is an agent framework developed on ideas of other reactive planning systems and can be, in this respect, considered quite similar to Jason, 2APL and Jadex. JACK is an extension of Java, based on logic, with a number of syntactic constructs allowing to create, select and execute plans and belief bases in a graphical manner. In JACK, like in Jason, goals are represented a as special type of event (goal-event). The way the agents are implemented in both frameworks is that the agent is not aware of the pursuing goals, but instead executes a plan as a response to the occurrence of an event. JACK, like Jadex, lacks formal semantics of beliefs and goals, however, being a commercial platform it provides many supporting tools and is being used extensively in industrial applications.

2APL [Dastani, 2008] (preceded by 3APL) is a Prolog-based agent programming lan- guage based on the BDI model. Briefly it is composed of beliefs, goals, belief updates (actions), plans, events and three different types of procedural rules. The environ- ments in 2APL are implemented as Java objects. Beliefs and goals are expressed in a declarative way as Prolog facts and form, respectively, belief and goal bases. Any Prolog construction can be used in the belief base. Belief updates update the belief base of an agent when executed. Such an action is specified in terms of preconditions and post- conditions (effects). An agent can execute a belief update action if the precondition of the action is derivable from its belief base and its execution modifies the belief base so that the effect of the action is derivable from the belief base after. Procedural rules are complex Prolog statements that might instantiate plans for the agent to execute. These serve as practical reasoning rules that can be used to implement the creation of plans during an agent’s execution. In particular, they consist of: planning goal rules, procedure call rules, and plan repair rules. The first type generates plans for reaching goals, the second type handles (internal and external) events and received messages, and the third type handles and repairs plans that might fail. A plan is a program to be executed. It might consist of belief updates as well as external actions, i.e. actions that affect the environment. According to the creators, the use of declarative goals (in

contrast, for example, to implicit goals originating from the execution of plans trig- gered by events as in, for example, Jason) in the language adds flexibility in handling failures. If following a plan does not end up reaching its corresponding declarative goal, then the goal remains in the goal base and can be used to trigger a different plan. An distinguishing feature of 2APL, like Jadex, is that it provides a programming module to implement non-interleaving execution of plans.

2OPL (Organisation Oriented Programming Language) [Dastani et al., 2009a] sees a multi-agent system as a system where “agents’ behaviours are regulated by an organi- sational artefact”. In 2OPL a logical representation structure to keep the organisational specification apart from an environment is used. The language allows the programmer to model the organisation under four sections namely Facts, Effects, Counts-As Rules and Sanction Rules. In addition, actions have constraints and can cause violations and be sanctioned. Violations can be handled in two ways. Regimentation2 [Jones and Sergot, 1993] is making the violation of norms impossible for agents. It means block- ing the action that causes a regimented violation completely. Enforcement [Jones and Sergot, 1993] is allowing the violation of norms first and then sanctioning the actors of the violation. An interpreter for the 2OPL language is explained in [Adal,2010].