Keywords

1 Introduction

It is widely accepted that emotions can change crowd behaviour and thus, in order to simulate the latter, one has to simulate the behaviour of each individual agent by taking into account artificial emotional states. 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. All these features convert a MAS rational behaviour to an emotional one with observed differences.

The aim of this paper is to present a complete formal model of agents infused with artificial emotions based on the dimensional theory as well as to demonstrate in practice that the model can result into different crowd behaviours. The main contribution is a new formal model for emotions that includes the interaction of emotions, perception, mood, personality and emotion contagion. This work is an extension of that reported in [12], which did not include an emotions contagion mechanism and effects of personality traits.

The rest of the paper is organised as follows: Sect. 2 presents a theory of emotions and its relation to moods, personality and contagion as described in Psychology. In Sect. 3, we discuss how artificial emotions can be formally represented in an agent. Section 4 discusses how emotions change over time. The role of emotions is demonstrated through a simulation of a well-known problem in game theory in Sect. 5. Related work is discussed in Sect. 6. Finally, Sect. 7 concludes the paper and suggests directions for future work.

2 Emotion Theories

2.1 Emotions, Moods, Personality Traits and Contagion

Although every human interaction involves emotion, psychologists have used several different definitions for emotions [3]. Some focus on its components, while others on its expressive reactions or functions. For the purposes of the present work, we adopt the definition suggested by [8]: emotions are “passions—as defined as event-instigated or object-instigated states of action readiness with control precedence”. These emotional states reflect an agent’s readiness to take a particular decision in order to maintain or change the way they relate to the world. Some states may appear as activation states, such as staying apathetic, with the only aim to relate or not to relate. Others involve action tendencies, and are about approaching or moving away from a person, situation or event [8].

Mood is mistaken for an emotion but it is in fact different. Although both are classified as two different categories of affect, the main feature that distinguishes mood from emotion is that mood is long-lasting and not about something or someone. The cause of the mood is not always easy to identify.

Mood affects and is affected by personality traits. Traditional views of personality define it in two alternative ways: (a) internal factors explaining agents’ constant behaviors, which are determined by a genetic basis, and (b) interpersonal factors that agents develop to relate to the world [9]. The traditional concept of personality has now been replaced by “personality traits”—the idea that someone’s character consists of several dimensions that can be better understood not as a whole, but as separate characteristics, all of which constitute what we call personality. A trait (primarily neuroticism and extraversion) can determine the way an individual will emotionally react to particular circumstances.

Emotion can be contagious. Agents tend to mimic others by watching their facial, vocal or bodily expressions and this process is influenced by a number of psychophysiological, behavioural, cognitive and emotional factors. Emotional contagion depends, among others, on perception of emotion in others [5] and how this perception leads to imitating their expression. As perception depends on personality, mood and emotion, emotional contagion can be defined as the result of the relationship between particular personality traits, the mood they can cause on a constant basis and the intensity of emotion that they can trigger, depending on the intensity of the stimulus.

2.2 Measuring Emotions

Emotion has only recently attracted the scientific interest it deserves due to absence of reliable measurement. The dimensional approach of emotions is of interest and is widely used for measuring emotion, due to its simplicity in depicting complex emotional situations as well as the economy goals attained by using it [22]. Its two dimensions can capture the flow of an emotional episode in real time. The dimensional approach is based on the idea that emotion can be represented and measured by two dimensions in a circumplex [18] (Fig. 1a):

  • valence (or positivity), which represents how pleasurable it is for an individual to experience this state;

  • arousal (or activation), which represents how likely an agent is to take some action due to its particular state.

These two dimensions are the “property of affect” representing the “core affect” [19], which is the heart of every emotional experience. It can be described as “feeling good” or “feeling bad”, “elevated” or “discouraged”. Core affect can be either free floating or can be triggered by some stimulus and begin an emotional episode. Core affect 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 more 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 as vectors or coordinates within the circumplex.

The circumplex is intended for measuring the dominant emotions and not all emotions experienced concurrently. Despite criticism, all opinions converge to the fact that this model is practical and easy to use as well as capable of capturing every day natural emotion. It is also suitable for measuring both object-less (i.e. mood or core affect) emotions as well as object-directed (primitives or basic emotions) states. Ideas about the connection between emotion, mood and particular personality traits have reached a point of convergence, relating all three components to the dimensional approach since emotion can be influenced by mood, mood can be influenced by and can also influence personality traits and personality traits are characterised by arousal and valence.

3 A Formal Representation of Dimensional Theory

Emotions. Emotions define what we will call the emotional states of an agent \(^{e}Q\). Within the circumplex, specific emotions are characterised by areas (Fig. 1a) with fuzzy limits. However, in a computational framework specific emotions are areas of points within the circumplex. A point can be formally defined with two equivalent representations (Fig. 1b):

  • as a vector \(\overrightarrow{e}\), where \(\overrightarrow{e}=(\hat{\omega },\mid \overrightarrow{e} \mid )\), i.e. the angle and the magnitude of the emotion vector within the circumplex (\(\hat{\omega }\in [0,360)\; \wedge \mid \overrightarrow{e} \mid \in [0,1]\));

  • as coordinates in the circumplex determined by the tuple \((v_e,a_e)\), where \(v_e\) is the valence and \(a_e\) the arousal measures, with \(v_e, a_e \in [0,1] \wedge \sqrt{v_e^2 + a_e^2} \le 1\).

Moods. Moods are considered as medium term emotions and are more long lasting than emotions. Therefore, moods, denoted by \(\mathcal {M}\), can also be represented in the same way as emotions, either as \(\overrightarrow{m}=(\hat{\omega },\mid \overrightarrow{m} \mid )\) or as coordinates \((v_m,a_m)\) within the circumplex, where the same domains and constraints in values apply.

Personality. It is most common that the personality trait is defined with distinct values for the Big Five [4] basic factors that affect personality: P = (Openness, Consciousness, Extraversion, Agreeableness, Neurotism). For example, a female person whose personality is characterised by empathy is defined as \(P=(0.15,0.01,0.09,0.24,0.16)\) [6]. In our case, the value of P will be mapped to a factor \(f_p \in (0,1]\) that will play an accelerating or decelerating role in the emotion update process (Sect. 4).

Perception. Agents receive inputs \( \Sigma \) from the environment. These are processed by the agent and become percepts that can trigger actions. In the presence of emotions, the inputs are transformed to emotional percepts \(^{e}\Sigma \). More precisely, an input revision function \(\rho _\sigma \) can be defined, which given an input in \( \Sigma \) transforms it into an emotional percept taking into account the current emotional state, the mood and the personality, that is, \(\rho _\sigma : \Sigma \times \, ^{e}Q \times P\times \mathcal {M} \rightarrow \, ^{e}\Sigma \).

Emotional Contagion. Emotion contagion is the impact that emotions of others have on an agent’s emotion. By considering a small neighbourhood for each agent (contagion occurs when agents are in proximity of influence distance \(d_{inf}\)), the total emotional effect that the other n agents within this neighbourhood have on the former may be considered as one aggregate emotional percept \((v_{con},a_{con})\). We have previously reviewed and experimented with three emotional contagion models [15]. In this work, we use the ASCRIBE model [10], where the emotional effect of one agent to another generally depends on the expressiveness of the former, the openness of the latter, and the distance between the two. This model fits naturally with our current work, since Openness and Expressiveness are two of the Big Five [4] basic factors.

4 Emotional Change

Agent behaviour is characterised by the consumption of inputs \(\Sigma \) that according to some state Q that the agent currently is and its internal representation of the world W (depending on the agent type, e.g. BDI, reactive, etc.), acts in a specific way in order to transform the environment with some output \( \Gamma \), change its state and revise its internal representation of the world. Actions \(\alpha \) that a rational agent does are formally defined as a function: \(\alpha : \Sigma \times Q \times W \rightarrow \Gamma \times Q \times W\).

In an emotional agent, however, the above definition of actions can be revised as: \(^{e}\alpha : \, \rho _\sigma ( \Sigma ) \times Q \times W \times {^{e}Q} \rightarrow \Gamma \times Q \times W \times {^{e}Q}\) with the triple \((\mathcal {M}, P, C)\) determining how an emotional state \(^{e}Q\) changes over time. This triple defines a mood \(\mathcal {M}\), a personality trait P, and a contagion model C. In the \(^{e}\alpha \) signature, \(\rho _\sigma \) is an input to perception mapping (Sect. 3). A formal state-based model for emotional agents is analytically defined in [12].

The effect of change in emotions can be thought as the change of the emotion vector \(\overrightarrow{e_c}\) to an updated vector \(\overrightarrow{e_c}'=(v_e',a_e')\). This is depicted as a shift of the emotions vector towards a direction influenced by mood, percepts, personality and contagion (Fig. 2). The new values \(v_e'\) and \(a_e'\) are determined by functions which will be explained in the following subsections.

Personality trait \(f_p\) plays an important role in the emotion update process. A higher value indicates a more “perceptive” agent, thus it determines how quickly the emotion vector converges to an emotion percept or mood.

Fig. 2.
figure 2

Change of the emotion vector wrt time: case concerns updates due to mood.

Change Due to Mood. As mentioned in Sect. 3, the current agent emotional state is affected by the agent’s mood. Given the current emotion vector \(\overrightarrow{e_c} = (v_e,a_e)\), the personality trait \(f_p \in (0,1]\) and the agent’s mood \(\overrightarrow{e_m} = (v_m,a_m)\), the updated emotion \(\overrightarrow{e_c}'=(v_e',a_e')\) is given by the following equation:

$$\begin{aligned} (v_e',a_e') = \bigg (v_e + \frac{f_p^3 \cdot \varDelta v_{me}}{1 + e^{2 \cdot (\varDelta v_{me})}} { \Large {,} }\ a_e + \frac{f_p^3 \cdot \varDelta a_{me}}{1 + e^{2 \cdot (\varDelta a_{me})}} \bigg ) \end{aligned}$$
(1)

where \(\varDelta v_{me} = v_m - v_e\) and \(\varDelta a_{me} = a_m - a_e\). The use of a logistic function, allows for a shift of the current emotion vector closer to the mood vector, while preserving the properties imposed by the circumplex, i.e. the magnitude of the vector being less or equal to one. In the absence of stimuli, the agent emotion vector will align with its mood vector after a number of iterations, depending on its personality trait. Since mood has a long term effect on the current emotion, this alignment has to occur after a significant number of steps, determined by a factor \(f_p^3\) (recall that \(f_p \in (0,1])\). Obviously, other parameters can be employed in order to calibrate the model to specific modelling requirements.

Change Due to Percepts. Emotional agents receive percepts which can be characterised as positive or negative in the sense that their emotion vector should change towards positive or negative valance, high or low arousal. Each input is associated with an emotional percept that affects the emotional state. Given an emotional percept \(\overrightarrow{e_{prc}} = (v_{prc},a_{prc})\) 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:

$$\begin{aligned} (v_e',a_e') = \bigg (v_e + \frac{f_p^2 \cdot \varDelta v }{1 + e^{-f_p \cdot (\varDelta v)}} { \Large {,} }\ a_e + \frac{f_p^2 \cdot \varDelta a }{1 + e^{-f_p \cdot (\varDelta a)}} \bigg ) \end{aligned}$$
(2)

where \(\varDelta v = v_{prc} - v_e \) and \(\varDelta a = a_{prc} - a_e\). If the specific input persists in the subsequent time points, then the emotion vector will eventually align with the corresponding emotion percept vector. Note that emotion change in this case depends on \(f_p^2\) to reflect the fact that emotion change due to percepts has a greater impact than that of mood.

Change Due to Contagion. Emotional contagion is a form of perception, since agents perceive emotional stimuli that depend on the emotions of other agents in their proximity (Sect. 3). Thus, each agent is considered to have an influence-crowd (\(IC_i\)) that consists of all other agents in its sphere of influence, with the latter having a radius of \(d_{inf}\), i.e. \(IC_i = \{Agent_j : d(Pos_i,Pos_j) \le d_{inf}\}\).

The contagion model described below is inspired by the ASCRIBE model [10], although simpler, and is adapted to the new vector representation of emotions. Contagion strength \(w_{ij}\) determines the strength by which an agent j influences agent i, obviously when \(j \in IC_i\). It depends on two factors: the expressiveness of agent j, \(expr_j\), a measure of how much the agent manifests its emotions, and the channel (\(channel_{ij}\)) that models spatial characteristics of contagion:

$$\begin{aligned} w_{ij} = expr_j \cdot channel_{ij} \end{aligned}$$
(3)

Channel strength models the fact that the closer agent j is to agent i the larger the impact it has on its emotions:

$$\begin{aligned} channel_{ij} = 1 - \frac{d(Pos_i,Pos_j)}{d_{inf}} \end{aligned}$$
(4)

The overall contagion strength \(w_{i}\) of agent i by all agents in its influence is:

$$\begin{aligned} w_{i} = \sum _{j \in IC_i}{} (expr_j \cdot channel_{ij}) \end{aligned}$$
(5)

Each emotion contagion vector coordinate is defined as the sum of the corresponding emotion vector coordinates of the influence crowd by the agents’ normalised contagion strength:

$$\begin{aligned} (v_{cnt},a_{cnt}) = \bigg ( \sum _{j \in IC_i}^{} (w_{ij} / w_{i}) \cdot v_j { \Large {,} } \sum _{j \in IC_i}^{} (w_{ij} / w_{i}) \cdot a_j \bigg ) \end{aligned}$$
(6)

The vector \((v_{cnt}, a_{cnt})\) forms a new kind of percept, and thus should be treated in the same manner as other emotion percepts. However, its effect on the current emotion depends on the openness (\(opn_i\)) of the agent i, and not the personality trait \(f_p\):

$$\begin{aligned} (v_e',a_e') = \bigg (v_e + \frac{opn_{i}^2 \cdot \varDelta v_{cnt} }{1 + e^{-opn_{i} \cdot (\varDelta v_{cnt})}} { \Large {,} }\ a_e + \frac{opn_{i}^2 \cdot \varDelta a_{cnt} }{1 + e^{-opn_{i} \cdot (\varDelta a_{cnt})}} \bigg ) \end{aligned}$$
(7)

where \(\varDelta v_{cnt} = v_{cnt} - v_e\) and \(\varDelta a_{cnt} = a_{cnt} - a_e\). The computation of emotion change due to contagion, concludes the mathematical realization of the emotional theory presented in Sect. 3.

5 Decision Making Based on Emotions and Contagion

In order to demonstrate how emotions can affect agent actions, we consider an example scenario, the El Farol bar problem, in which agent behaviour will be governed only by its emotions. This is an extreme case, however it serves as an indicative example of the model’s behaviour. It should be noted that preliminary results of the same simulation scenario were presented in [12], however a different emotional perception model was used, and those experiments did not include emotion contagion, which is one of the main contributions of this work.

The El Farol problem is a well known problem in game theory, introduced originally by Arthur [1] as an example of how inductive reasoning, i.e. reasoning based on patterns, can be applied in “ill-defined situations”. The problem concerns how each individual from a population of N people will decide on visiting the famous El Farol bar on a specific night, without knowing the intentions of the rest of the population. The decision needs a prediction of the bar attendance i.e. the number of people visiting the bar on that specific night. If bar attendance is below a threshold \(\theta \) (60 %) then people have a good time, i.e. the decision to visit the bar pays off, otherwise the visitors would be better off staying at home.

The approach adopted here was to base the decision only on emotions. Thus, agents decide to visit the bar when they “feel like it”, i.e. their valence and arousal both have positive values (\(v_e> 0 \wedge a_e > 0\)). The idea is that the agents must be both in a positive emotional state (valence) and be willing to take action (arousal) in order to decide to attend. The tendency that agents have to visit the bar (not modelled explicitly in the original problem) is modelled by the agents’ mood: all agents are initially assigned a mood that lies well in the positive valence, high arousal area of the circumplex:

$$\begin{aligned} \overrightarrow{m_i}=(\hat{\omega _i},\mid \overrightarrow{m_i} \mid ) {\text { with }}\,\hat{\omega _i} \in [5,85)\; \wedge \mid \overrightarrow{m_i} \mid \in (0.1,1] \end{aligned}$$
(8)

The emotion stimuli that agents perceive depends on the current bar attendance att. If the latter is below the threshold \(\theta \), agents do not receive any stimuli, since in this case their tendency to visit the bar (mood factor) is confirmed. However, in the case that the bar is overcrowded, agents perceive a “negative” emotion, i.e. an emotional percept of negative valence, low arousal, whose magnitude depends on how crowded the bar is:

$$\begin{aligned} \overrightarrow{e_{prc}} = \bigg (\hat{\omega _{prc}} ,\frac{1 + abs(att - \theta )}{2} \bigg ) {\text { with }}\, \hat{\omega _{prc}} \in (180,270) \end{aligned}$$
(9)

In Eq. 9 the magnitude of the vector ranges between a value above 0.5, when the attendance is just above the threshold \(\theta \), to an extreme case of 1, when attendance is 100 % and the threshold 0 %. We have implemented the model in NetLogo [24], a well established platform for agent modelling and simulation. Agent behaviour was modelled using a formal X-Machine model, as in [12] and the implementation was based on the TXStates DSL [20] that allows easily encoding X-Machine agents.

5.1 Results and Discussion

In our experiments, attendance values are computed as the average of ten simulation runs with different initial conditions. Initial agent emotions are assigned to random vectors, thus in the initial steps of all simulations agent emotions converge to their mood, increasing steadily attendance, until the attendance threshold is reached. Agent mood is assigned initially (Eq. 8) and remains constant during experiments. The population was set to 100 persons and the attendance threshold was 60 %. In the simulation we adopted a three-day period (simulation week), i.e. agents get a chance to visit the bar every three days, in order to allow mood and contagion effects to take place. Personality trait is drawn from a normal distribution with a mean value of 0.5 and standard deviation of 0.1.

The first set of experiments concerns simulations that do not involve contagion. The average attendance value after convergence was 61.46 with a standard deviation of 4.52, i.e. agents did manage to coordinate bar attendance successfully under the model. In Fig. 3 the line marked “No Contagion” depicts the evolution over time of the average attendance in each simulation week.

The second set of experiments concerned agent behaviour under contagion. Agents were divided into 10 clearly separable groups and had a specific influence radius \(d_{inf}\). Clearly separable means that the groups had a distance between them such that no agent from a group could have another agent from a different group in its sphere of influence. Openness and expressiveness values were drawn from a normal distribution with a mean of 0.2 and a standard deviation 0.05. The average attendance value in this case was slightly greater, at 65.87 with a standard deviation of 4.95. Line “Contagion” in Fig. 3 shows the experimental results, as in the previous case.

Fig. 3.
figure 3

The average attendance with and without contagion.

Table 1. Average attendance wrt personality trait

These experiments indicate that the effects of contagion increase bar average attendance and standard deviation. This is attributed to the fact that emotional states of agents tend to align to the “collective” emotion of the group, i.e. the society favours visiting the bar. This is demonstrated by the higher average line.

Probably what affects simulation results the most is the personality characteristics of the crowd. In the third set of experiments, personality trait \(f_p\) is constrained around different values and openness/expressiveness are drawn from a normal distribution of 0.15 with a standard deviation of 0.05, lower than that in the previous experiments. Table 1 depicts the average attendance over 10 simulation runs for different personality traits.

It is interesting to see that as the average personality trait is increasing, the average attendance and the standard deviation increases as well. Apparently, agents converge to their mood far more quickly leading to an increased average attendance, and are more perceptible to emotion percepts, thus changing their emotional state more rapidly leading to a higher standard deviation. Another interesting observation is that in low personality trait crowds, contagion results to a smaller standard deviation (albeit a constant higher average), possibly signifying that the crowd behaves in a more “coordinated” manner. However, in all experiments agent behaviour does converge to a mean value: emotions acted as a coordination mechanism for this simple society of agents.

6 Related Work

There are several attempts to model emotion in artificial agents. A number of computational models, logically formalised as BDI agents, have been proposed in [11, 13, 16]. Not surprisingly, the role of agent emotions and personality types has been extensively studied in evacuation simulation scenarios [23, 25]. Other works involve using emotions to reduce agent communication in decision support systems [13], faster compromises in negotiation settings [21], and modelling of social aspects of emotions and its interconnection with socials norms to improve controllability in MAS [7]. Finally, emotions can be seen as a leverage to teamwork and cooperation between agents [14]. Unlike any of the related approaches, we attempt to formally model the dimensional theory of emotions including aspects like mood, emotion preception and contagion and personality trait types.

The El Farol problem has been widely studied in the literature. In the original work, attendees base their decision on past historical data of attendance and a set of k different strategies [1]. The current strategy is selected dynamically and is the one that is most accurate at the specific time point. This inductive approach leads to a mean attendance around the threshold of 60 %, with bar attendance values fluctuating around that threshold. An approach to model the problem using cognitive agents with emotions was made in [2]. The work is based on the Belief Desire Theory of Emotions (BDTE) [17] in which beliefs and desires are annotated by a degree that is updated by two operations, the Belief-Belief and the Belief-Desire comparators. The former acts as an updating mechanism of beliefs based on new percepts, while the latter updates desires according to the current newly acquired beliefs. These mechanisms act as “internal sensors” to the body, affecting perception and monitoring desire fulfilment, thus model emotions. In [2], DBTE agents model their desire to visit the bar, and update their belief, according to a strategy based on bar attendance. Strategy selection is based on their degree of belief in the adopted strategy. The main difference between our approach and the DBTE theory, is that the latter attempts to explain emotion manifestations based on belief/desire updates, whereas we consider emotions and mood as explicit parameters of the model that guide the reasoning process.

7 Conclusions and Further Work

Infusing agents with artificial emotions can be a valuable approach in order to obtain more accurate simulations of real life situations, such as evacuations, and various types of economic and social phenomena. The work described in this paper, extends our previous work [12] and presents a formal model of artificial emotions that is based on well established psychological theories (OCEAN and Dimensionality Theory) and covers important functions related to emotions, such as change to the emotional state due to percepts, the effect of mood as a long term emotional state, and the effect of social aspects such as emotion contagion. Through the El Farol example, we attempted to show the effects that the different parameters of such an emotions model have on crowd behaviour.

There is a significant number of future extensions to the current work. One of our first objectives is to experiment with different simulation scenarios that involve the economic phenomena, since those have attracted much interest in the recent years. For instance, it would be interesting to investigate the role of authoritative figures, such as government officials, news agencies, etc. in the creation or avoidance of phenomena such as bank runs. In a different direction we aim to investigate how the emotions model presented can be integrated with BDI agent architectures, leading to richer agent programming platforms.