Illustrative Example

Understanding the activation process as described above may not be easy. However, providing a complete illustrative example will hopefully help to clear any doubts and answer possible questions about the activation process. The example chosen corresponds to one of the most generic and at the same time easy to understand goals defined so far. It clearly illustrates how one generic goal can cover a wide range of situations. This goal defines the bully assistant’s behaviour of reinforcing the bully when he says something to the victim. Moreover, this goal covers every situation where the bully assistant can reinforce the bully:

<ActivePursuitGoal name=”AssistBully([bully],[victim],[type])”>


<Property name=”[bully](Role)” operator=”=” value=”Bully”/>

<!– can only reinforce the Bully  –>

<Property name=”[victim](Role)” operator=”=” value=”Victim”/>

<!– can only reinforce anything towards the Victim  –>

<!– only reinforce if i don’t like the victim –>

<Property name=”Like([SELF],[victim])” operator=”LesserThan” value=”0″/>

<!– the bully must say something to the victim  –>

<RecentEvent occurred=”True” subject=”[bully]” target=”[victim]” action=”[anySpeech]“        parameters=”[type]“/>

<!– the assistant or character that has the goal must be able to reinforce the speech act –>

<Property name=”[SELF](canReinforce,[type])” operator=”=” value=”True”/>

<!– and it hasn’t already reinforced that speech act –>

<RecentEvent occurred=”False” subject=”[SELF]” target=”[victim]” action=”Reinforce”           parameters=”[type]“/>



<!– goal succeeds, if i can reinforce the bully –>

<RecentEvent occurred=”True” subject=”[SELF]” target=”[victim]” action=”Reinforce”            parameters=”[type]“/>



<RecentEvent occurred=”True” subject=”[victim]” action=”Reply” target=”[bully]”      parameters=”[type],*”/>



By analysing the goal definition, it’s possible to realize that the bully assistant only tries to reinforce a bully’s speech act that is directed to a victim. Furthermore, the bully assistant must dislike the victim, the bully must have said something recently that the bully assistant can in fact reinforce, and the bully assistant must not have already reinforced the speech act. The goal’s success condition obviously consists in reinforcing the performed speech act.


Suppose that: there is only one bully, which is Luke; there is only one victim, which is John; the bully assistant doesn’t like John; the bully has insulted, mocked and threatened John; the bully assistant can reinforce insults and mocks (among others) but not threats; and the bully assistant hasn’t reinforced anything yet. In this situation the goal’s activation tree will be:

When the first precondition is tested, there is only one substitution, which is {[bully]/Luke}, thus there is only child for the first node. The above substitution is then applied to the second precondition, but since the variable [bully] is not used in that condition, nothing changes.

Once more, there is only one substitution that satisfies the second precondition, which is {[victim]/John}, and Θ*(n3) contains this substitution but also the substitution that resulted from the previous precondition. However, when Θ*(n3) is applied to the third precondition, it will result in the precondition “Like(Paul,John) < 0” (remember that [SELF] is a reserved variable that contains the agent’s name, in this case Paul).

When the relation “Like(Paul,John)” is tested, there will be no substitutions returned because the condition does not have any variables at all. In these cases, the condition will just be either true or false. If the condition is true, as in this situation, there will only be one possible substitution list returned that corresponds to an empty list. If the condition is false, the failure will be detected and the activation stops in the current path. The condition “Speech(Luke,John,[type])” is a simplification, for illustration purposes,  of the corresponding recent event condition. Actually, the condition should be “[anySpeech](Luke,John,[type])” in order to represent that the performed speech can be of any type such as a question, a reply, a speech act, etc. For our example, we’ll assume that we’re only interested in regular speech acts.

For the first time in this example, testing the precondition “Speech(Luke,John,[type])” returns three possible substitutions, which results in three children for the node n4.   One for each possible type of speech performed by Luke to John.

The last figure shows the rest of the activation tree. Since Paul can reinforce insult and mocks but not threats, the nodes and n5 and n6 are successfully tested, but the node n7 fails. The last preconditions tested, corresponding to nodes n8 and n9 are easily verified (“!Reinforce(Paul,John,insult)” represents that Paul hasn’t reinforced an insult towards John yet – this is a simplification of the negative recent event condition for illustration purposes). Since all preconditions are satisfied, there are two resulting leaf nodes (n10 and n11) that correspond to the intentions that are created in the goal activation process. Therefore the intentions created are AssistBully(Luke,John,insult) that tries to establish the success condition Reinforce(Paul, John,insult) (once more, this is a syntactic simplification), and AssistBully(Luke,John,mock) that tries to establish the success condition Reinforce(Paul,John,mock).


Taking into account this activation process, it’s straightforward to acknowledge that the order in which the goal’s preconditions are defined and thus tested it’s important. In order to make the goal activation more efficient, the conditions that reduce more drastically the number of possible substitutions should be tested first. In the above example, there was only one possibility for the first two preconditions (only one bully and one victim), so they were tested first.  For instance, if we would test in first place the condition “Speech([bully],[victim],[type])” , it would return all the speech acts performed recently by all characters to all characters, because [bully] and [victim]  are just variables with mnemonic names that can be matched with any character. We then would have to test for each possibility (there can be a lot of them) if the [bully] character corresponded to a bully and the [victim] character corresponded to a victim.


However, there is another reason why the preconditions order is extremely important. There are some restrictions when using negative conditions that imply restrictions in the order that one should specify those preconditions. These restrictions and corresponding implications in the preconditions’ order will be described in the next section.


One more important point to mention, is that although an intention cannot be added more than once to the deliberative layer for execution at the same time, nothing prevents that after the intention is achieved and removed from the intention structure, the same goal will create the intention again  Therefore, it’s up to the author to write preconditions so that the intention is not activated anymore after being achieved. This was the reason to put the precondition “!Reinforce([SELF],[victim], [type])” in the example above. This condition makes sure that the intention is not created more than once, and that the bully assistant doesn’t repeatedly reinforce the same speech act.


Actually, in FAtiMA’s previous versions, there was a mechanism that prevented multiple activations of the same intention, making sure that an intention would be created only once for episode. However, after talking with Sandy and Michael, we decided that there are some situations were you do want the same intention to possibly become active more than once. For this reason, the mechanism was removed and the liberty of deciding where to allow it or not was left to the author. Nevertheless, at the moment I’m reconsidering this decision, because although its good to leave the author the possibility of having cyclic activation intentions, on the other hand this puts in the author’s hands the burden of always having to define these type of preconditions, which as you will experience is not always that easy. And furthermore, the number of situations where you do require cyclic activation is rather small.