1 Introduction

Connection or affiliation between persons often stems from experiencing some forms of emerging synchrony with each other [2, 5, 11, 15, 25]. Such synchrony can occur in different forms. Intrapersonal synchrony happens when persons synchronise different modalities with each other, such as movements, different brain regions, emotions and verbal actions. Such intrapersonal synchrony can lead to conscious emotions [8]. Interpersonal synchrony occurs when persons synchronise corresponding modalities, such as their movements, or their emotions. Intrapersonal and interpersonal synchrony are often explored separately, although they are potentially related to each other and other outcomes (e.g., [3]).

To account in more detail for the interplay between intrapersonal and interpersonal synchrony and their link to affiliation, a computational agent model with both built-in intrapersonal and interpersonal synchrony detectors was designed. These built-in detectors are one of the main innovations of this paper, along with their role in the agents’ behavioural adaptivity concerning affiliation. The intrapersonal and interpersonal synchrony covers movement, affective and verbal regions.

An experimental scenario was designed, in which two periods alternate: one with a common stochastic stimulus and one with two different stochastic stimuli for two agents. Although, this scenario was kept abstract, it was inspired by the intended application on how synchrony between therapist and client and related behavioural adaptivity within counseling or therapy sessions play an important role in appreciation and success rate of the sessions, see [13,14,17, 21, 23].

The adaptive agent model was designed using the self-modeling network modeling approach from [30, 32],this is briefly described in Sect. 3. The simulation experiments described in Sect. 5 were conducted using the available dedicated software environment. In Sect. 2 some background literature is discussed and in Sect. 4 the designed adaptive agent model is explained in more detail. Finally, Sect. 6 is a discussion.

2 Background Knowledge

It has often been found that when synchrony originates, this is accompanied with a changed connection or affiliation between persons, e.g., ([2, 11, 14, 15, 20, 25, 36, 38]. More specifically, number of experiments have analysed manipulated psychotherapy sessions whose outcome was that therapists were rated more favorably and as more empathic when they were instructed in advance to synchronise their movements with those of the client [17, 23, 33]. Additionally, a clinical study reported in [21] found that initial movement synchrony between client and therapist, was predictive of the client’s appraisal of the quality of the alliance at the end of each session. Therefore, there is much support for the idea that movement synchrony has a positive effect on the alliance, see also [15]. Furthermore, according to various researchers Feldman [7, 38, 35], synchrony in face-to-face interactions turns out to play a key role in interpersonal bonding.

If persons notice or experience synchrony and change in some way as a result, this may suggest that they possess some facility to detect it. Therefore, it does not seem strange to assume that persons do unconsciously detect in some way synchrony and from that make a stronger connection. This is indeed the first main assumption made here. Note that the relationship between synchrony and being connected works in two ways, as not only may synchrony strengthen the connection between persons, in turn for more strongly connected persons, due to a stronger social contagion it may also be easier to reach synchrony when they interact. An interplay seems to exist between synchrony and (short term) affiliation.

A subsequent question is how connecting actually occurs. For example, is it a form of mentalizing or is it a form of adaptation of behaviour? In their metareview, Prince and Brown [20], contend that the defining feature of what they call partnered interaction:

‘…is not mentalizing, but instead real-time behavioral adaptivity between the partners, as studied in a large literature devoted to joint action and joint agency (e.g., [2, 6, 12, 13, 19]).’

Here, as a second main assumption, we follow the latter position of behavioral adaptivity as a main mechanism for connecting. Therefore, in combination with the first main assumption mentioned above we analyse two persons that are connecting through synchronisation with mechanisms of circular pathways having roughly the following form: interaction patterns → synchrony patterns → detected synchrony → adaptation of connections → (changed) interaction patterns.

Notice that here ‘detected synchrony’ acts as a specific information-carrying state p mediating between (1) interaction or synchrony patterns a that occur in the past before p’s activation and (2) interaction patterns b (entailed by a) that will occur in the future after p’s activation. In [26, 27] such a state p is called a mediating state for the effect of past pattern a on future pattern b entailed by pattern a; similarly, in [34] such a (brain) state is referred to as describing ‘informational criteria’ for future activation, see also [29].

In addition to interpersonal synchrony, intrapersonal synchrony for different modalities also often occurs. It has been found that intrapersonal (response) synchrony often is at the basis of a conscious emotion, e.g., [8]. In return, from an emotion integration viewpoint, such a conscious emotion can be thought of as having an effect on responses as well. However, from the perspective of causality it might be plausible that these response effects are causally driven not by the ‘being conscious’ of the emotion, but rather the underlying mechanisms and the awareness is more like monitoring such underlying processes. These observations form the basis for our third main assumption, namely that the detected intrapersonal synchrony underlying a conscious emotion has a causal effect on the responses and the related behavioural adaptivity.

3 The Self-Modeling Network Modeling Approach Used

In this section, we briefly introduce the network-oriented modeling approach used. Following [30, 32], a temporal-causal network model is characterised by the following characteristics (with X and Y denoting nodes of the network, also called states):

  • Connectivity characteristics

    Connections from a state X to a state Y and their weights ωX,Y

  • Aggregation characteristics

    For any state Y, some combination function cY(..) defines the aggregation that is applied to the impacts ωX,YX(t) on Y from its incoming connections from states X

  • Timing characteristics

    Each state Y has a speed factor ηY defining how fast it changes for given causal impact

The following difference (or related differential) equations that are used for simulation purposes as well as for analysis of temporal-causal networks, incorporate these network characteristics ωX,Y, cY(..) and ηY in a standard numerical format:

$${{{Y(t+\Delta t) = Y(t) +{\varvec{\upeta}}}_{Y}[\mathbf{c}}_{Y}({{\varvec{\upomega}}}_{{X}_{1},Y}X}_{1}\left(t\right),\dots ,{{\varvec{\upomega}}}_{{X}_{k},Y}{X}_{k}\left(t\right)) - Y(t)]\Delta t$$
(1)

for any state Y and where \({X}_{1}\) to \({X}_{k}\) are the states from which Y gets its incoming connections. Note that (1) has a format similar to that of recurrent neural networks. Within the software environment described in Treur ([30], Ch. 9), a large number of useful basic combination functions (around 60) are included in a combination function library.

The above concepts make it possible to design network models and their dynamics in a declarative manner, based on mathematically defined functions and relations. The examples of combination functions that are applied in the model introduced here can be found in Table 1. Here, for the third and fourth function rand(1, 1) draws a random number from [0, 1] in a uniform manner and a is a persistence factor (with value 0.5 used in the simulations).

Table 1 The combination functions used in the introduced adaptive agent model

Realistic network models are usually adaptive: often not only their states but also some of their network characteristics change over time. By using a self-modeling network (also called a reified network), a similar network-oriented conceptualisation can also be applied to adaptive networks thus producing a declarative description using mathematically defined functions and relations for them as well; see [30, 32]. This process is enabled by the addition of new states to the network (called self-model states) which represent (adaptive) network characteristics. In the graphical 3D-format as shown in Sect. 4, such additional states are depicted at a next level (called self-model level or reification level), while the original network is at the base level.

As an example, the weight ωX,Y of a connection from state X to state Y can be represented (at a next self-model level) by a self-model state named WX,Y. Similarly, all other network characteristics from ωX,Y, cY(..) and ηY can be made adaptive by including self-model states for them. For example, an adaptive speed factor ηY can be represented by a self-model state named HY. Using this concept, adaptation processes can be modeled in a declarative form via specification of proper combination functions in the library that are applied to self-model states, for example, a combination function for Hebbian learning. This enables us to model adaptivity in a declarative format and not by procedural descriptions (e.g., learning algorithms) often used in the literature on learning.

As the outcome of this process of network reification is also a temporal-causal network model in itself, as has been shown in Treur ([30], Ch 10), this self-modeling network construction can easily be applied iteratively to obtain multiple orders of self-models at multiple (first-order, second-order, …) self-model levels. For example, a second-order self-model may include a second-order self-model state HWX,Y representing the speed factor ηWX,Y for the dynamics of first-order self-model state WX,Y which in turn represents the adaptation of connection weight ωX,Y.

Due to the library of combination functions, the modeling approach can also be seen as a generalised form of neural networks, as for any activation function used in neural networks a related combination function in this library can be included and used [28]. Even more, in [28] it has been shown more generally how (1) any (smooth) dynamical system can be modeled as a (temporal-causal) network model and (2) any adaptive dynamical system can be modeled as a self-modeling network model. This makes it a widely applicable modeling approach.

In the current paper, this multi-level self-modeling network perspective will be applied to obtain a second-order adaptive network architecture addressing controlled adaptation induced by detected synchrony. In this self-modeling network architecture, the first-order self-model models the adaptation of the base level network, while the second-order self-model level exerts control over this; see Fig. 1. In this picture, the upward arrows indicate how the adaptation depends on contextual circumstances at the base level and how control of the adaptation depends on the state of adaptation. The downward arrows indicate the effect of the adaptation on the mental processes and of the control on the adaptation processes.

Fig. 1
figure 1

Three-level self-modeling network architecture for controlled adaptation

As an example, the control level can be used to make the adaptation speed context-sensitive as addressed by metaplasticity literature such as [1, 22]. For instance, the metaplasticity principle ‘Adaptation accelerates with increasing stimulus exposure’ formulated by Robinson et al. [22] can easily be modeled by using second-order self-model states; this has actually been done for the introduced model, as will be discussed in Sect. 4.

4 The Introduced Adaptive Agent Model

In this section, the introduced adaptive agent model is explained in some detail. The adaptive agent design uses a self-modeling network architecture of three levels as discussed in Sect. 3: a base level, a first-order self-model level, and a second-order self-model level. Here the (middle) first-order self-model level models how connections of the base level are adapted over time, and the (upper) second-order self-model level models the control over the adaptation.

4.1 Base Level

Figure 2 shows a graphical overview of the base level of the agent model (agents are indicated by the big boxes) and Table 2 provides explanations for all its base states. This figure and table explain more details about the agent models and the interaction between the agents, such as how agents interact, which mental states they have, and the causal relations between their states.

Fig. 2
figure 2

Base level of the introduced adaptive agent model (upper picture) with three modalities and (in dark pink) six synchrony detection states for intrapersonal and interpersonal synchrony and how the agents interact (lower picture) according to the three modalities

Table 2 Base states of the adaptive agent model

For each agent, a number of interaction states were modeled: states involved in sensing (indicated by sense) are on the left-hand side of each box, and states involved in execution or expression of actions (move, exp_affect, talk) on the right-hand side. In between these interaction states, within a box are the agent’s internal mental states; outside the boxes are the world states. Note that it is assumed that each agent also senses its own actions, modeled by the arrows from right to left outside the box.

4.1.1 Internal Mental States and Their Connections

For each agent there are internal mental states such as sensory representation states (rep) and preparation states (prep) for each of the three modalities: movement m, expression of affect b, and verbal action v. These m, b, and v are kept abstract and generic in the model. Examples that can be kept in mind are moving backward or forward for movement m, a happy or sad emotion for affect b, and a verbal utterance expressing happiness for v. Furthermore, each agent has a conscious emotion state for affective response b (cons_emotion). Each of the mentioned states is depicted in Fig. 2 by a light pink circle shape.

For each modality, its representation state has an outgoing (response) connection to the corresponding preparation state and it has an incoming (prediction) connection back from the preparation state to model internal mental simulation of predicted effects of actions (Damasio 1999; Hesslow 2002).

Last but not least, there are the six synchrony detector states (depicted in Fig. 2 by the darker pink diamond shapes) which are introduced here. There are three intrapersonal synchrony detection states for the three pairs of the three modalities:

  • movement–emotion (m-b).

  • movement–verbal action (m-v).

  • emotion–verbal action (b-v).

These intrapersonal synchrony detection states have incoming connections from the two execution states for the modalities they address.

The conscious emotion state is triggered by incoming connections from the preparation state for affective response b together with the three intrapersonal synchrony detection states (following Grandjean et al. [8]). In addition, the conscious emotion state has an incoming connection from the verbal action execution state (for noticing the emotion in the verbal utterance) and an outgoing connection to the preparation of the verbal action (for emotion integration in the verbal action preparation).

There are three interpersonal synchrony detection states for the three modalities m, b, and v. Each of them has two incoming connections: from the sensing state (representing the action of the other person) and the execution state (representing the own action) of the modality addressed.

4.1.2 Interaction States and World States

All connections discussed this far are assumed to be nonadaptive. However, a few other connections are adaptive depending on detected synchrony: more synchrony detected will lead to connecting stronger to the other person, which is modeled by making the weights of such connections stronger. This applies to four types of connections, all playing an important role in the interaction between two agents:

  • Adaptive internal connections.

    1. o

      the (representing) connections from sensing to representation states for each of the three modalities.

    2. p

      the (executing) connections from preparation to execution states for each of the three modalities.

  • Adaptive external connections.

    1. o

      the (observing) connections from world states to sensing states.

    2. p

      the (effectuating) connections from execution states to world states.

So, more synchrony detected will lead to these types of connections becoming stronger; each type of them contributes in its own way to the interaction between the agents. A stronger observing connection will lead to sensing the other agent better (e.g., turning sensors in the right direction and bending or getting closer to the other), and a stronger representing connection will make the sensed signals better available and accessible for the brain. From the other side, a stronger executing connection will lead to stronger expression and acting toward the other and a stronger effectuating connection to better availability (for the other) of the action effects in the world (e.g., more visible, better hearable by directing and positioning in the right direction and bending or getting closer to the other). In Sect. 4.2, it will be discussed in more detail how this adaptivity and its control were modeled using the notion of self-modeling of the adaptive agent model.

Finally, at the base level some world states are modeled for stimuli s that are sensed by the agents. In the simulations, they have stochastic activation levels. In some episodes one common stimulus is observed by both agents (for example when they physically meet and therefore are in the same environment), but in other episodes the agents receive different stimuli.

4.2 Modeling the Adaptation and Its Control

The adaptation and control needed in this agent model were modeled by the notion of a self-modeling network from [30, 32]: by adding first-order self-model states for adaptation of the adaptive base connections discussed in Sect. 4.1 and second-order self-model states for control of the adaptation. In Fig. 3 the overall design of the network model is shown; here, the first-order self-model states are in the middle (blue) plane and the second-order self-model states in the upper (purple) plane. See Table 3 for explanations of all self-model states.

Fig. 3
figure 3

Overview of the overall adaptive agent model

Table 3 First-order self-model W-states for connection weights and second-order self-model HW-states for the adaptation speed of the W-states of the computational network model

The first-order states are all W-states representing the weights of the adaptive base connections. By changing the activation values of these W-states, the corresponding connection weights change accordingly. This change occurs due to the influences from the detected synchronies, modeled by the upward (blue) arrows in Fig. 3 from the synchrony detection states in the base plane to the W-states in the middle plane.

To keep the model a bit simpler, there are only two second-order self-model states HWA and HWB, one for each agent. They represent the adaptation speed (learning rate) for the adaptive connections for the concerning agent. They model the second-order adaptation principle ‘Adaptation accelerates with stimulus exposure’ (Robinson et al. 2016). To this end they have incoming connections (blue upward arrows from base plane to upper plane) from the stimulus representation states at the base level.

5 Simulation Results

Simulation experiments have been conducted for a scenario that was inspired by how synchrony between therapist and client within counseling or therapy sessions can occur and actually plays an important role in appreciation and success rate of such sessions, as also discussed in [13,14,17, 21, 23]. We have run 20 repetitions of the simulation scenario for our two agents. The total time duration of each simulation equaled 360 time units and the step size (Δt) regarded 0.5, meaning 720 computational steps were made in total in each of our experiments. All 20 simulations had the same structure concerning the type and duration of stochastic stimuli: an episode of 40 time units with different stimuli between the two agents, followed by an episode of equal size (40 time units) with a common stimulus for the two agents. This same cycle of 80 time units in total is repeated four times, after which a final episode of 40 time units with two different stimuli is presented. The episodes with the different stochastic stimuli reflect an environment where different influences affect each agent or the two agents concentrate on different foci, whereas the agents experience a shared environment or concentrate on the same focus in the episodes with the same stochastic stimulus. Within a therapeutical context, these episodes can be interpreted as periods in which a therapist and a client concentrate on the same focus and periods in which their foci differ. In all episodes, regardless the environment, the agents are able to interact with each other. We will discuss two illustrative simulations that displayed distinct patterns that were most often present during the 20 repetitions.

5.1 From Intrapersonal Synchrony to Conscious Emotions

Regarding the first illustrative simulation (Fig. 4), the intrapersonal synchrony between movement and affect of agents A and B (dark green solid line and light green dashed line) were steeply activated first and followed exactly the same trajectory. Thereafter, the intrapersonal synchrony of agent B’s affect and verbal actions and movement and verbal actions followed a similar pathway, and a bit slower these corresponding states of agent A. After the activation of the three types of intrapersonal synchrony, the conscious emotions of both agents B and A started to occur (blue lines).

Fig. 4
figure 4

The intrapersonal synchrony and conscious emotions activation levels from 0 to 40 time units in illustrative simulation 1

In the second example simulation (Fig. 5), the same overlaps are present as in the first illustrative simulation. Agent A reached high levels of conscious emotion before agent B reached all three intrapersonal synchronies. It also shows that within each agent, all three intrapersonal synchronies are required before the conscious emotion can elevate, independently of the intrapersonal synchrony and conscious emotion of the other agent.

Fig. 5
figure 5

The intrapersonal synchrony and conscious emotions activation levels from 0 to 40 time units in illustrative simulation 2

The patterns described above cover the first 40 time units. After this period, the agents start to interact with each other in both simulations. Then, the levels of the intrapersonal synchrony detectors and the conscious emotion remain high, although they fluctuate slightly under influence of the stochastic stimuli (Figs. 6, 7).

Fig. 6
figure 6

The intrapersonal synchrony and conscious emotions activation levels from 0 to 360 time units in illustrative simulation 1

Fig. 7
figure 7

The intrapersonal synchrony and conscious emotions activation levels from 0 to 360 time units in illustrative simulation 2

5.2 Intrapersonal Versus Interpersonal Synchrony

In Figs. 8 and 9 the intrapersonal and interpersonal synchrony detectors are compared. For the first illustrative simulation (Fig. 8), it can be seen that while the intrapersonal ones activate early and remain high (as also noticed in Sect. 5.1), the interpersonal synchrony detectors activate later and are much more sensitive to circumstances. More specifically, in Fig. 8 it is shown that the interpersonal synchrony detectors become higher (with values up to 0.8 and more) and more fluctuating in particular during the episodes where both agents receive a common stimulus (time intervals 40–80, 120–160, 200–240, 280–320). In between these episodes the levels decrease to approximately 0.4. This result suggests that the interpersonal synchrony of both agents relies more on the common stimulus (in-phase synchronisation during the common stimulus interval) than on the interactions between the two agents. This pattern is visible in the majority of the 20 simulation runs.

Fig. 8
figure 8

The intrapersonal and interpersonal synchrony activation levels from 0 to 360 time units in illustrative simulation 1

Fig. 9
figure 9

The intrapersonal and interpersonal synchrony activation levels from 0 to 360 time units in illustrative simulation 2

In the second simulation (Fig. 9), for agent B the levels of interpersonal synchrony become less dependent on a common stimulus and stay high all the time (values of at least 0.9). However, agent A shows a completely different pattern. From time point 120 on, its interpersonal synchrony detectors display lower levels of synchrony during the episodes with a common stimulus. In some of the 20 simulation runs, this type of pattern in agent A (an antiphase synchronization in episodes with the common stimulus) occurs for one of the two agents, in contrast to the pattern of the agents A and B displayed (first illustrative simulation, Fig. 8).

5.3 Raise of Affiliation After Synchronisation

A second important aim of the adaptive agent model introduced here was to study how synchrony leads to certain forms of affiliation or connecting. In Fig. 10 it is shown for the first presented simulation how the two agents connect stronger when the detected synchrony levels are higher. The type of connecting modelled here is instantaneous, which means that it reacts in a flexible way to the circumstances, in particular to the detected interpersonal synchrony, as can be seen in Fig. 10.

Fig. 10
figure 10

The intrapersonal and interpersonal synchrony and Wws-sense activation levels from 0 to 360 time units in illustrative simulation 1

Also, in Fig. 11 for agent B the connecting goes hand in hand with the synchrony. However, in this case, agent B ends up in a constant high level of both detected interpersonal synchrony and affiliation. Therefore, agent B is not acting in a regular manner in accordance with the different stimulus intervals like happened in the first simulation example. Consequently, agent A also does not behave in accordance with the different stimulus intervals, due to their interaction. Therefore, in this case some patterns occur that are counterintuitive from the perspective of the patterns for simulation example 1. From time 120 on, for all modalities the detected interpersonal synchrony of agent A becomes high in the intervals with different stimuli. The same holds for the affiliation (the Wws-sense states) concerning affective response b and verbal response v, but not for movement m. This shows that due to environmental randomness also patterns can occur that may feel unexpected. Graphs for the other W-states can be found in the Appendix section.

Fig. 11
figure 11

The intrapersonal and interpersonal synchrony and Wws-sense activation levels from 0 to 360 time units in illustrative simulation 2

6 Discussion

It has been found that synchronisation leads to more closeness, mutual coordination, alliance, or affiliation between the synchronised persons; e.g., [2, 11, 15, 16, 20, 25, 36]. This literature reveals a pathway from interpersonal interaction to interpersonal synchronisation to interpersonal affiliation or connection. If persons act on temporal patterns of synchrony, this suggests that they possess a facility to detect such patterns. Therefore, in this paper the assumption was made that persons indeed detect when temporal patterns of synchrony occur and from such detection a stronger affiliation or connection may grow. By multiple simulation experiments for stochastic stimuli from the environment, it has been found that indeed several expected types of patterns are reproduced computationally. The designed adaptive agent model can be used as a kind of engine for virtual agents that are able to synchronise with humans and to show how they can connect in a human-like manner. The introduction of the subjective synchrony detector states is one of the distinctions from earlier work, such as [910].

Postulating such synchrony detector states can actually be seen as an application of the more general philosophical principle of temporal factorisation introduced in [26, 27]. This principle describes that when some temporal pattern a in the past entails some temporal pattern b in the future, then a state p exists (called mediating state) that occurs in the present such that pattern a entails state p and state p entails pattern b. An example from [26, 29] illustrates this principle for animal behaviour. In many experiments, it has been observed that when an animal has seen food at some position in the past, it shows delayed response behaviour in the future: going to that position, even when nothing is visible. By the temporal factorisation principle, it can be postulated that some kind of memory state exists in the present. A principle similar to temporal factorisation has been formulated in a specialised form (called criterial causation) for the brain in particular in [34], see also [29]. Indeed, in the model introduced here, each synchrony detection state serves as such a mediating state p between synchrony patterns and the (adapted) future behavioural patterns they entail. In this way, the designed network model successfully exploits the temporal factorisation principle.

For the synchrony detection states, it is easy to use any desired combination function. Both heuristic and statistical functions may be selected. The specific function used here for the synchrony detection states can be considered a heuristic function. As an alternative, also any statistical function can be chosen, for example Auguste Bravais’s well known statistical correlation coefficient introduced in [4], which sometimes is attributed to Karl Pearson and accordingly termed the Pearson correlation coefficient. It can be argued, however, whether such a statistical function describes what the brain actually does. Probably even the brains of Bravais (or Pearson) never actually relied on this statistical function to detect synchronies when they interacted with others in their personal life.

Brains usually apply heuristic approximations as these are much more efficient. Therefore, to design human-like agent models, heuristic functions such as the one used here based on comparing two different signals are probably more realistic. This function actually has some similarity to the well known and often used comparator model to determine whether an action should be attributed to the self or to another person; e.g., [39, 40]. In [31], following [18, 24, 37], it has been shown how the comparator model can be remodeled more like an integration model where the two signals are not compared but aggregated over time, which makes it still more biologically plausible. This may also be done for the function used here for detection of synchrony. Another future research direction is to distinguish different types of affiliation, for example according to different time scales.

The research work on the adaptive agent model introducing synchrony detectors and related behavioural adaptivity as presented here has created a strong basis for further research. Although the simulated scenario was kept abstract here, when data on particular therapeutical sessions are acquired, the model can be used to simulate such sessions in a more specific manner. This is meant for further research, see also [13,14,17, 21, 23]. In the meantime, since the work presented here was finished, a few refinements and variations on the introduced model are being addressed. One refinement addressed in this further research is a distinction between short-term and long-term behavioural adaptivity (for example, affiliation versus bonding). Another extension addressed in further work is using more than two agents and distinguishing (1) other-person-specific behavioural adaptivity from (2) other-person-independent behavioural adaptivity. Yet two other issues addressed are considering time lags between the incoming signals for the synchrony detectors and adding detectors for switching in and out of synchrony. Thus, the adaptive agent model introducing synchrony detectors and related behavioural adaptivity as presented here is already playing a very fruitful role in further research.