Keywords

1 Introduction

It is widely known that emotions can change crowd behaviour from rational to emotional. Modelling of artificial emotions in multi-agent systems (MAS) is challenging by itself, let alone the fact that emotions are affected by a number of other features, such as mood, appraisal, personality, emotion contagion, etc. The definition of emotion has always been accompanied by disagreement, with dominating “movements” in Psychology having different definitions [2]. For the purposes of this work, the most suitable definition of emotions is “passions–as defined as event-instigated or object-instigated states of action readiness with control precedence” [7]. The dimensional approach of emotion [15] attracts considerable interest and is widely used for measuring emotion.

Mood is a long-lasting emotion, which affects and is affected by personality traits. As an emotion, it can also be represented and measured in two dimensions. In its extremes High Positive Affect is characterised by positivity, full energy, concentration, and engagement, while Low Negative Affect can be described as a negative and passive state, potentially involving anger, fear, guilt and nervousness [19].

Personality traits determine the way individuals emotionally react to particular circumstances. Ideas about the connection between emotion, mood and particular personality traits have reached a point of convergence, placing all three components in direct relation to the dimensional approach.

There are several attempts to model emotion in MAS. A number of computational models, logically formalised around BDI have been proposed [8, 14], and a number of applications reported on emergency evacuation [13, 18, 21], context-aware decision support systems [11], negotiation [17], interconnection with socials norms [5], teamwork and cooperation between agents [12], etc. Unlike any of the related approaches, we attempt to formally model the dimensional theory of emotions including mood and other aspects that affect emotions in MAS.

The aim of this paper is to present a formal model of artificial agents infused with artificial emotions based on the dimensional theory as well as to demonstrate in practice that the model can result into believable simulations that take into account different mood distributions over a crowd. The main contribution is a new formal model for emotions that includes the interaction of emotions, perception, mood, personality and emotion contagion. This is an enhancement of an already reported approach [10] that used basic emotion theory as a first step towards the modelling and simulation of emotional agents.

The paper is organised as follows: Sect. 2 presents the dimensional approach theory to emotions as described in Psychology. In Sect. 3, we discuss how artificial emotions and mood can be formally represented in an agent. Section 4 briefly discusses the Netlogo simulation of a MAS derived from a formal state-based model, and results that demonstrate how mood affects the behaviour of the crowd in a well-known example, namely the El Farol problem. Finally, Sect. 5 concludes the paper and suggests directions for future work.

2 Emotions and Moods: The Dimensional Approach

In Psychology there are many theories of emotion. The main issue is that emotions are extremely hard to measure. The dimensional approach is based on the idea that emotion can be represented and measured in two dimensions: (a) valence, representing how pleasurable it is for the individual to experience this state (feeling “good” or “bad”); and arousal, representing how likely the person is to take some action due to their particular state (feeling “energized” or “down”). These two dimensions represent what has also been called as “core affect”, and can be either free floating (mood) or it can be caused by some stimulus initiating an emotional episode. Core affect is always consciously present. It is closely linked to emotion: feeling happy leads to perceiving objects in a congruent way and overestimating their pleasantness as more pleasant than real. The more positive the core affect is, the most pleasant the stimuli are going to be perceived and vice versa.

Fig. 1.
figure 1

(a) The circumplex of the dimensional theory of emotions with example emotions located in the two dimensions: arousal and valence. (b) Emotions and moods as vectors.

The dimensional approach was mainly used as an alternative to the discrete emotions theory, according to which there are 5–7 basic emotions [4]. There were several problems associated with the basic emotion theory, among which were difficulties in measuring changes in the emotion in a continuous way. Also, there are several emotional episodes involving more than the basic emotions, which therefore cannot be measured with the basic terms. In contrast, the dimensional theory uses a circumplex to depict emotions (Fig. 1a). The circular space of the circumplex both adequately and reliably represents the emotional space on two dimensions: pleasure and arousal [15]. The circumplex is intended for measuring the dominant emotions and not all emotions experienced concurrently. It is agreed that this model is practical and easy to use for capturing every day natural emotion, and also suitable for measuring both object-less (i.e. mood or core affect) emotions as well as object-directed (basic emotions) states. Despite the controversies and theoretical arguments doubting the suitability of the dimensional approach, it is nowadays widely used, mainly because it allows collection of unambiguous, culturally- and linguistically-free data, and most importantly because it can capture the development of an emotional episode over time. Researchers have occasionally used more than two dimensions by adding a new one, for instance control [6], but such approaches are not widely accepted in contemporary psychological research.

3 A Formal Model for Emotions and Emotional Agents with Mood

Emotions can be represented as a vector \(\overrightarrow{e}=(\hat{\omega },\mid \overrightarrow{e} \mid )\) in the two-dimensional space, i.e. with the angle and the magnitude of the emotion vector within the circumplex, with \(\hat{\omega }\in [0,360)\) and \(\mid \overrightarrow{e}\mid \,\in [0,1]\). Alternatively, emotions are coordinates in the circumplex determined by the tuple \((v_e,a_e)\), where \(v_e\) is the valence measure and \(a_e\) the arousal measure, respectively, with \(v_e, a_e \in [-1,1]\) and \(\sqrt{v_e^2 + a_e^2} \le 1\) (Fig. 1b). Moods can be considered as medium term emotions and, for the purpose of this study, will not change over time. Moods can also be seen as vectors \(\overrightarrow{m}\) within the circumplex, or equivalently as tuples \((v_m,a_m)\), where \(v_m\) is the valence measure and \(a_m\) the arousal measure of the mood, respectively, with \(v_m,a_m \in [-1,1] \) and \(\sqrt{v_m^2 + a_m^2} \le 1\) (Fig. 1b).

Fig. 2.
figure 2

Emotion updates. (a) Change in current emotion \(e_c\), in the presence of an emotional percept \(e_{prc}\). (b) Change in \(e_c\) for two different personality traits.

Agents’ emotions change over time through stimuli perceived in the environment or other agents. A perceived stimulus may be positive or negative in the sense that it shifts the emotion vector towards positive or negative valence, high or low arousal. Each input is associated with an emotional percept \(e_{prc}\) affecting the agent’s emotional state. The personality trait \(f_p\) also plays an important role in the emotion update process. Thus, the higher the value of the latter is, the more “perceptive” the agent is to emotional percepts.

However, according to the theory, the new emotion vector has to remain within the circumplex. Thus, given a stimulus and an associated emotional percept \(e_{prc}\) in terms of valence and arousal \((v_{prc},a_{prc})\), the personality trait \(f_p\) with \(f_p \in (0,1]\), and the current emotion \(\overrightarrow{e_c} = (v_e,a_e)\) of the agent, the updated emotion vector \(\overrightarrow{e_c}' = (v_e',a_e')\) is given by the following two equations:

$$\begin{aligned} v_e' = v_e + \frac{f_p \cdot \varDelta v}{1 + e^{-f_p \cdot (\varDelta v)}} \quad \text{ where } \varDelta v = v_{prc} - v_e \end{aligned}$$
(1)
$$\begin{aligned} a_e' = a_e + \frac{f_p \cdot \varDelta a}{1 + e^{-f_p \cdot (\varDelta a)}} \quad \text{ where } \varDelta a = a_{prc} - a_e \end{aligned}$$
(2)

The use of a logistic function allows for a shift of the current emotion vector closer to the emotional percept vector, while preserving the properties imposed by the circumplex. If the specific input persists in the subsequent time points, then the emotion vector will eventually align with the corresponding emotional percept vector. In Fig. 2a, \(\overrightarrow{e_{t_1}}' \dots \overrightarrow{e_{t_3}}'\) are the updated emotion vectors if the stimulus persists in the time points that follow.

The personality trait value determines how quickly the emotion vector converges to the emotional percept. In Fig. 2b, \(\overrightarrow{e_{t_0}}'(0.3)\) is the updated emotion under \(f_p=0.3\), whereas \(\overrightarrow{e_{t_0}}'(0.9)\) is the updated emotion under \(f_p=0.9\).

Fig. 3.
figure 3

The role of mood and personality in the change of emotional state.

Mood, \(\overrightarrow{e_m}=(v_m,a_m)\), also affects the current agent emotion \(\overrightarrow{e_c}\), though to a lesser extent, in each iteration. Following the same approach, the updated \(\overrightarrow{e_c}'=(v_e',a_e')\) is given by the following equations:

$$\begin{aligned} v_e' = v_e + \frac{f_p \cdot \varDelta v_{me}}{1 + e^{2 \cdot (\varDelta v_{me})}} \quad \text{ where } \varDelta v_{me} = v_m - v_e \end{aligned}$$
(3)
$$\begin{aligned} a_e' = a_e + \frac{f_p \cdot \varDelta a_{me}}{1 + e^{2 \cdot (\varDelta a_{me})}} \quad \text{ where } \varDelta a_{me} = a_m - a_e \end{aligned}$$
(4)

The two pairs of logistic functions defined differ in the steepness of the curve. This reflects the different impact of the two updates on the current emotion vector. In the absence of stimuli, the agent emotion vector will align with its mood vector after a number of iterations. This number is again determined by the personality trait of the agent. Figure 3 depicts the change of the emotion vector \(\overrightarrow{e_c}\) under the influence of the mood \(\overrightarrow{e_m}\).

Our main research theme is on formal modelling and simulation of crowd behaviour. We have been successfully using a formal method, namely X-machines, which are state-based machines extended with a memory structure, an n-tuple of values. This makes the formal model more compact as compared to memory-less state machines. Transitions between states are triggered by functions, which accept inputs and memory values and produce an output and new memory values. In a previous work, we have made an initial attempt to integrate artificial emotions as plug-ins within X-machines [9]. For the purposes of this work, an emotions X-machine is defined as: \(^e\mathcal {X} = ( \varSigma ,\, {\varGamma },\, Q,\, M,\, {\varPhi },\, F,\, q_0,\, m_0,\, E)\) where:

  • \( \varSigma \) and \({\varGamma }\) are the input and output alphabets, respectively;

  • Q is the finite set of states;

  • M is the (possibly) infinite set called memory;

  • \({\varPhi }\) is a set of partial functions \( \varphi \); each such function maps an input, a memory value and an emotional structure to an output and a possibly different memory value, \( \varphi : \varSigma \times M \times E \rightarrow {\varGamma }\times M\);

  • F is the next state partial function, \(F: Q\times {\varPhi }\rightarrow 2^Q\);

  • \(q_0\) and \(m_0\) are the initial state and initial memory respectively;

  • \(E=({^e\varSigma },\, {^eQ},\, \mathcal {M}, \, P,\, C,\, {^e{\varPhi }}, \, \rho _\sigma , \, \overrightarrow{e_0}, \, \overrightarrow{m_0})\) is an emotional structure formalisation with:

  • \(^e\varSigma \) is a set of emotion percepts, i.e. inputs \(\sigma \in \varSigma \) which have an emotional valence and arousal \((v_{prc},a_{prc})\) attached to them;

  • \(^eQ\) is a set of representations of emotions (emotional state);

  • \(\mathcal {M}\) is a set of moods;

  • P is a personality trait type;

  • C is a contagion model type;

  • \({^e{\varPhi }}: \, ^eQ\times \mathcal {M}\times P\times C\times M\times \varSigma \rightarrow \, ^eQ\) is the set of emotions revision functions \(^e \varphi \), that given an emotional state \(\overrightarrow{e} \in {^eQ}\), a mood \(\overrightarrow{m} \in \mathcal {M}\), a contagion model \(c \in C\), a personality trait \(p \in P\) and a memory tuple \(m \in M\) returns a new emotional state \(\overrightarrow{e}' \in {^eQ}\);

  • \(\rho _\sigma \) is an input revision function, which given an input \(\sigma \) transforms it into an emotional percept taking into account the current emotional state, the mood and the personality, that is, \(\rho _\sigma : \varSigma \times \, ^eQ \times P\times \mathcal {M} \rightarrow \, ^{e}\varSigma \);

  • \(\overrightarrow{e_0}\) is the initial emotional state and \(\overrightarrow{m_0}\) is the initial mood.

With regards to previous definitions of \(^e\mathcal {X}\) [9], in this work we attempt to use the dimensional model of emotions instead of a set of basic emotions. In addition, we integrate mood \(\mathcal {M}\) into the emotional structure formalisation E in order to investigate the role that it plays in the rate of change of the emotion state \(^eQ\). Emotional Contagion, C, is a result of interaction between agents, which can also affect their emotions. The personality trait of an agent P is defined by the Big Five [3]: (OCEAN), values for the different personality factors of Openness, Consciousness, Extraversion, Agreeableness, Neuroticism. Both contagion and personality trait types were studied extensively in [13].

4 Feel Like Going to the Bar?

The El Farol problem was originally introduced as a problem in game theory [1]. The El Farol bar in Santa Fe hosts Irish music sessions on Thursday nights. However, since the bar is rather small, attracting a large crowd results in visitors not having a good time. The population consists of N individuals, and if more than 60 % attend, then they would all be better off if they had stayed at home. In the case that less attend, then their decision for going to the bar pays off. Unfortunately, individuals have to decide without knowing the intentions of others, knowing, however, the attendance of previous weeks. The problem is introduced as an example of reasoning based on patterns in “ill-defined situations” [1].

The approaches so far attempt to find strategies that predict the current week’s attendance based on historical data. We adopt a different approach, where each individual agent bases its decision on its current emotional state. Since the emotional state of the agent is expressed in terms of valence (pleasure) and arousal (how likely the agent is to take action), an agent decides to visit the bar if both components of the emotion vector exceed a threshold, i.e. \(v_e> 0.3\; \wedge \; a_e > 0.3\). The intuition behind the approach is that, in order to decide to attend, they have to be in a “pleasurable state” towards the visit and willing to take action (visit). On the contrary, if they are in a negative valence towards visiting and unwilling to take action, it is clear that they will not decide to go (Fig. 4).

Fig. 4.
figure 4

Threshold for deciding to visit El Farol. Vector \((v_g,a_g)\) is well in the visiting area, whereas an agent with an emotional state \((v_{ng},a_{ng})\) will decide to stay at home.

As such, decision is based only on the agents’s current emotional state. What motivates people to visit El Farol is mood, which reflects the long term tendency to visit the bar. The population is initially given a random mood that lies in the visit area depicted in Fig. 4, invariant during the course of the experiment. Since the emotional state converges to the mood in the absence of emotional percepts, all agents would decide to visit El Farol, if they did not perceive their environment. However, during a crowded evening, visiting agents receive negative emotional percept, whereas in a non crowded night a positive one. If they decide to stay at home and the bar is crowded, then, although their emotional state does not change with respect to the valence component, their attitude towards action is affected. For instance, if the agent stayed at home and the bar was crowded, then the valence component of the stimulus remains unaffected (value 0), but it is less willing to take the action of visiting the bar, and thus the arousal component of the stimulus is −0.2. This reduction in arousal is less than the one received if the agent had actually visited the bar on a crowded night (−0.4), i.e. the impact of experiencing a crowded night is more significant than that of hearing about it. Thus, we formulated emotional percept as depicted in Table 1.

Table 1. Agent input and the associated emotional percepts.

In this simple scenario, the \(^e\mathcal {X}\) model that describes the agent behaviour is rather simple with the functions and the state diagram as depicted in Fig. 5.

Fig. 5.
figure 5

The State Diagram of the agent in the El Farol prolem.

Fig. 6.
figure 6

Attendance in the El Farol prolem.

The \(^e\mathcal {X}\) model was implemented in NetLogo [20], a well-established platform for MAS simulation, extensively used by the research community. The implementation was based on the TXStates DSL [16] that allows easily encoding \(^e\mathcal {X}\) agents in the platform. Although the experimentation is preliminary, the results obtained seem to support the use of emotions as an alternative to other solutions provided to the problem. In all experiments reported in this work, agents start with a random emotional state and have a random personality trait. As stated, to represent the tendency agents have to visit the bar, agents have a random mood that lies within the “Visit Area” (Fig. 4).

The evolution of bar attendance with respect to time in a random single run of the experiment is shown in Fig. 6. Initially, since agents have a random emotional state, but a positive mood toward attending the bar, the number of bar visitors increases steadily, until it reaches the 60 % threshold. When the attendance reaches the latter, a negative emotional percept is generated, that “lowers” the emotional state of the agents: this negative stimulus has an effect on the agent’s decision regarding visiting the bar in the next round. Since agents have different personality traits and different moods, the negative percept pushes only a percentage of them not to visit the bar.

Agents do not “recall” historical data on attendance, this is encoded in their emotional state. The behaviour described is common in all experiments. The average attendance of several runs of the simulation is 56.9 with a standard deviation of 4.4. What affects attendance is the distributions of mood and personality traits. The relation between these and the evolution of attendance over time needs to be more carefully investigated, however such a task is outside the scope of this paper. These preliminary results are an indication of how emotions can play a significant role in regulating MAS societies.

5 Conclusions and Further Work

Without doubt emotions affect agent action in real societies. Consequently, modelling emotional agents has attracted significant attention. We introduced a formal model of emotional agents based on the well-established dimensional theory. The model does not only deal with short term agent emotion change due to agent input (percepts) but hosts medium term agent emotional states (moods), and their effect in the agent decision process.

Such a formal model leads to the development of interesting MAS. The El-Farol problem served as an initial example application to show how emotions can affect agent actions and even regulate societies. Preliminary results show that directly modelling the problem description as to what the agents “feel”, and not introducing a utility that describes that, can lead to an agent action pattern that seems to be self-regulated. These results have to be investigated in depth and associated to the initial emotion, personality trait and mood distributions.

The El Farol model can act as a testbed for testing a number of issues that have not been discussed, such as emotion contagion, i.e. the change in the emotion caused by the emotional state of other agents. This aspect has not been investigated in this work and could be interesting; for instance, since agents “live” in specific neighbourhoods, the emotional states of agents living close by could play a role in their decision process, i.e. modelling a common social reputation mechanism.