• No results found

BDI Agent Structure

3.1 Requirements Analysis

3.3.2 BDI Agent Structure

In Section2.1.1 the BDI (Belief-Desire-Intention) agent model was described. In this section we explain how we adopt and extend it in order to incorporate the normative reasoning process. According to Bratman [Bratman,1987], the structure of a BDI agent comprises of:

• A set of (B)eliefs

• A set of (D)esires (or goals)

• A set of (I)ntentions - a subset of the goals • A set of perceptions (or events)

• A plan library as a (static) component or a planning mechanism which produces plans.

• Perceptions are represented as new belief and new goal events (when agent observes something, is told something or is asked to do something)

On each cycle (see Algorithm3.1) the set of perceptions is added to the set of internal events (plan generated sub-goal notifications) to give the events for that cycle. Then the process that takes place can be summarised as follows:

• The perceptions are what the agent reacts to taking into account its current be- liefs, desires and intentions.

• The agent selects one pending perception.

• It responds by updating its beliefs, desires and intentions - it reconsiders existing goals and intentions.

• It reconsiders the plan to be followed.

• It then selects the next step in the plan being followed and, keeps executing the plan’s actions, while revisiting the beliefs. An agent will maintain this process committing to its intention(s) until either a plan is completely executed, or the

Algorithm 3.1BDI cycle [Wooldridge,2001] 1: B=B0

2: I=I0

3: whiletrue do

4: get next percept ρ 5: B=br fa(B, ρ)

6: D=optionsb(B, I)

7: I = f ilterc(B, D, I) 8: πd=plane(B, I)

9: whilenot (empty(π)or succeed(I, B)or impossible(I, B)) do

10: α=hdf(π)

11: executeg(α)

12: π=tailh(π)

13: get next percept ρ 14: B=br f(B, ρ)

15: if reconsideri(I, B)then

16: D=options(B, I) 17: I = f ilter(B, D, I)

18: end if

19: ifnot soundj(π, I, B)then

20: π=plan(B, I)

21: end if

22: end while

23: end while

abrf(B, ρ)indicates a belief revision function. It revises its beliefs and updates them.

boptions(B, I)is a function that generates a set of possible desires for the agent through its beliefs and

intentions.

cfilter(B, D, I)is a function that chooses between competing alternative intentions. d

πindicates a plan. It is be a sequence of actions (a1, . . . , an).

ethe plan(B, I)function requires the agent to engage in a plan generation process. The plan generated

(or selected in the case of using predefined plan libraries) satisfies the intention(s).

fthe hd(π)function returns the first action of a plan. gexecute(α) is a function that executes an action in a plan. htail(π) function returns the plan minus the head of the plan.

iwhile an agent needs to stop and reconsider its intentions, reconsideration might prove costly. There-

fore, the meta-level control component reconsider(I, B) is used to indicate whether or not to revisit the intentions of the agent.

agent believes it has achieved its current intention(s) or that its current inten- tion(s) are no longer possible. If after revisiting its reconsidering its intention(s) a plan is not sound anymore, then the planning process comes up with a new plan to be followed.

• The agent then repeats the process to select another perception (if any).

Some theorists have suggested that obligation norms can be seen as a form of belief, and act within the process of generating (candidate) desires [Tufis and Ganascia,2012] or can emphasise the importance of a desire in advance or define some priorities or precedence between desires (lines 6 and 16 in Algorithm 3.1). In a similar way, prohibitions might be considered to be another form of beliefs and should influence the process of filtering the desires in order to generate intentions (lines 7 and 17 in Algorithm3.1).

In practice, the strategic selection of desires versus obligations and prohibitions is not as easy to do as it sounds in theory. While humans intuitively deliberate by projecting and assessing the options into the future and taking into account the obligations/pro- hibitions and their effects throughout the execution of the planning process, there is no such fixed way in which obligations and prohibitions can interfere with the selection of desires and intentions in a computing environment.

In [Meneguzzi et al., 2010], Meneguzzi et al. describe mechanisms that enable spe- cific plan instantiations in order to restrict behaviour, support compliance and avoid violating plans. [Meneguzzi and Luck,2009b] proposes a complex mechanism which, at runtime, reacts to newly accepted norms and constructs plans accordingly taking into consideration the intentions modified by the norms. Moreover, [Meneguzzi et al., 2012] evaluates plans with a preprocessing mechanism and annotates them depending on their degree of compliance to norms. Additionally, [Dignum et al., 2000] modifies the BDI cycle to incorporate again a preprocessing step for sophisticated plan selec- tion, accommodating norms and obligations. Plans are explicitly expressed by the process of generating (candidate) intentions. Other researchers [Alechina et al.,2012; Dybalova et al.,2013] build on existing agent frameworks and allow the agent’s delib- eration cycle to be affected by the norms by adopting obligations as goals. However, while they calculate the normative state of the agent with respect to the norms dur- ing the cycle, they do not consider a planning methodology. Instead, they define preferences between obligations, prohibitions and goals, and they calculate algorith- mically the optimal set of pre-fabricated plans (i.e. that are preference-maximal) to be executed.

The above works present good examples of the views of many theorists concerning the influence norms should have in the agent’s deliberation cycle. They suggest that norms should influence the creation of intentions and/or modify the construction of the plans, based primarily on existing plan templates. An observation that can be made is that a lot of this research is also based on the preprocessing of possible plans in order to “speculate” to which extent the plan outcome will be compatible with

existing norms (or norms that might occur) and to decide whether an agent should or should not adopt it, even making comparisons between multiple possible plans in order to decide the course of action.

We, on the other hand, suggest that norms should be directly part of the planning pro- cess. That is, we think that norms should not interfere with the agent’s objectives. On the other hand, they should act as restrictive constraints during the planning process, allowing to break some of those constraints in cases of conflict or whenever the agent sees fit for personal benefit. We believe this is better because, from a computational perspective, the preprocessing of partially exploring possible outcomes to select/pri- oritise intentions would consist of a similar mechanism to the one used during the means-ends reasoning, and thus, it makes little sense to do this exploration twice. The main effect of our approach is that the intention selection occurs during the planning process, in a way that: 1) candidate intentions which are infeasible are automatically discarded (until an opportunity makes them feasible again), 2) candidate intentions supported by obligations are more likely to be selected, and 3) candidate intentions hindered by prohibitions are less likely to be selected. Also, this approach provides a clear semantic distinction between the agent’s objectives and the normative influence over these objectives during intention selection.

Algorithm 3.2Modified norm-aware BDI cycle 1: B=B0

2: I=I0

3: whiletrue do

4: get next percept ρ 5: B=br f(B, ρ) 6: D=options(B, D) 7: I = f ilter(B, D, I)

8: π=plan(B,D,Ns,Pref)

9: whilenot (empty(π)or forall d in D: [succeeded(d,B) or impossible(d,B)]) do

10: α=hd(π)

11: execute(α)

12: π=tail(π)

13: get next percept ρ 14: B=br f(B, ρ)

15: ifreconsider(D,B) then

16: D=options(B, D) 17: I = f ilter(B, D, I)

18: end if

19: ifnotsound(π,D,B)then

20: π=plan(B,D,Ns,Pref)

21: end if

22: end while

23: end while

The normative reasoning BDI agent used in our architecture includes the traditional components of a BDI agent, Beliefs and Desires, but leaves out the Intentions. Desires

are considered to be the objectives (goals) of the agent and the filtering process of the intentions is therefore eliminated (lines 2, 7 and 17 in Algorithm 3.2), leaving the means-ends reasoner free to consider all desires as goals to be achieved at some stage. The reasoner is integrated into the agent’s BDI cycle as follows. Initially the reasoner produces a plan to be followed in order to achieve the objectives (line 8 in Algorithm 3.2). In our modified cycle, the planning process takes indirectly into account the existing norms and the agent’s preferences, that are modelled as costs within the planning domain. While there is no external disturbance or information that changes the environment (perceptions) the agent executes actions of the plan. The norms’ status is derived here from the current set of beliefs (lines 5 and 14 in Algorithm3.2).

As explained, in the original BDI cycle of Algorithm 3.1 an agent gets to reconsider its intentions when either a plan is completely executed, or the agent believes it has achieved its current intention(s) or that its current intention(s) are no longer possible. Since in our suggested modification intentions no longer exist, the agent’s commit- ment now is towards each of its desire(s) (line 9 of Algorithm 3.2), which are now directly considered as the agent’s objectives to be accomplished.

The belief revision process in the agent is additionally affected by the execution of actions and the combination of their effects. Whenever there is a modification of the environment, the reasoner reproduces a plan according to the new state of affairs and passes it to the agent. Thus, the reasoner is applied in the BDI cycle whenever new planning is required. The main extension of the BDI process in our case lies in the fact that the planning process takes into consideration not only the beliefs but the norms that affect the agent as well. That is, norm influence is directly explored during the planning process (lines 8 and 20 in Algorithm 3.2). How this is done will be thoroughly explained in the rest of the thesis.