Keywords

1 Motivation

When building an agent-based model, a critical part is how interactions between agents as well as between agents and other entities in their environment are captured. In this paper, we present the concept of affordance schemata, which we introduce as a mean to explicitly model the selection of interaction partner which is often otherwise hidden in the implementation of the agents’ action implementation.

Designing and implementing agent-based simulations is challenging due to its bottom-up nature. A modeller formulates the behaviour of agents situated in their environment; during a simulation run the agents take decisions and change their environment and hereby generate intended aggregate structures and dynamics. All actions and interactions need to be formulated from the participating agents’ perspective. For example, in an agent-based simulation model of how humans use park space, the central part of the model contains that the agent enters the park, looks around and decides about to take a seat. In many existing agent-based simulation frameworks, the modeller formulates this behaviour only from the point of view of the agent. In SeSAm [12], this happens in activity graphs, in GAML/GAMA [26] a modeller formulates “reflexes” as collections of actions, in MesaFootnote 1, the modeller implements a step function. There is no additional perspective that supports grouping multiple agent and environmental entities for interactions. Yet, this would be highly relevant for transparently explain why particular structures and overall system behaviour is produced. We believe that affordances and affordance schemata can provide a basis for explicitly formulating the first step creating the connection between two interacting agents.

The idea of affordance forms an attractive means to connect agents and environmental entities in a dynamic way. Conceptually, they are emerging while the agent behaves, e.g. moves around, in its local environment encounters potential interaction partners. Thus, an affordance forms an inherently dynamic relation. We propose affordance schemata as an explicit part of agent-based simulation models from which affordances can be generated during simulation. This work is a full revision of [14], clarifying the concept and streamlining the formalisation, based on experiences gained from a proof of concept implementation.

After a short background on the notion of affordances in the next section, we continue by analysing the process of agent-entity interaction and introduce our specific take on affordances as guidance for interaction modelling. This is followed by introducing the concept of affordance schemata as framework for modelling agent-entity interactions. Section 5 presents a small proof-of-concept implementation of an example, while in Sect. 6 we discuss interaction as a fist-class concept in agent-based modelling. Section 7 places our work into relation of the state-of-art. The paper ends with a short summary and presentation of future work.

2 Affordances in Modelling

The notion of affordance was introduced in ecological psychology by J.J. Gibson [5] about 40 years ago. Gibson defined affordances as action potentials provided by the environment: “The affordances of the environment are what it offers the animal, what it provides or furnishes, whether for good or ill”. For example, a bench affords sitting to a human. The potential action of “sitting” depends on properties of the bench in relation to properties of the human, and on the current activity the human is engaged in. Gibson put special emphasis on this reciprocity between animal and environment, insisting that affordances are neither objective nor subjective. Thus, Stoffregen [25] defined affordances as “properties of the animal-environment system [...] that do not inhere in either the environment or the animal”. This definition comes close to stating affordances as a concept emerging from the potential interaction between agent and environmental entity. However, it remains unclear how to model this concept with the flexibility inherent in the definition.

In man-machine interaction the most influential work [18] interpreted affordances as cues that tell humans how to use a specific (virtual) object. Modelling the user interface using affordances helped support usability of a specific piece of software. This notion relates to “perceived affordances”, i.e., the actions the user perceives as being possible based on how an object is presented. A similar point of view can be found in robotics where object affordances enable a robot to reason about what can be done with a perceived object. The usual process hereby is a sequence of classifications: recognising the object, recognise attributes and/or associate affordances with it – the interesting part for robotic research is hereby to learn or determine what recognisable features enable an object to be filled, to be grasped, etc. [6, 16].

In agent-based modelling emergence is produced though interaction - but how can we model interaction such that the emerging phenomenon is preserved? Our solution is to model interaction in a reproducible way using a more abstract structure called affordance schema. Affordance schemata allow for the required flexibility in matching agents’ capabilities with the properties of environmental objects thus producing a collection of emerging interactions.

3 Agent-Entity Interaction

Current modelling approaches in agent-based simulation focus on modelling agents and entities as well as their behaviour and properties, as those are stable concepts. By contrast, interaction may change with the location of the entity within the environment. It may take very different forms depending on the level of abstraction at which the model is formulated. We aim at creating a framework for modelling interaction that is sufficiently flexible for changing interaction partners, but does not hide this part of overall interactive behaviour within the details of an activity implementation.

Before we can introduce affordances and affordance schemata, first some concepts and assumptions need to be clarified:

3.1 Phases in the Behaviour of an Agent, Agent and Activities

We assume that the agent’s behaviour is structured into activities, which we see as explicitly represented combinations of actions (sequences, branches, loops) with a minimum of one action. In this paper, we do not consider the process of determining activities for an agent but take an activity as a given input for the course of the simulation. Therefore, we do not make assumptions about how the agent decides which activity to do next or which cognitive model or reasoning process it follows for generating behaviour. An activity is formulated to produce simulated cohesive behaviour at the individual agent layer. The actions within an activity may also be connected by the idea that each action is executed with the same interaction partner. In the current version of the framework, we assume that only one interaction partner is needed; if not, activities can be split to generate such a situation.

The activity of the agent is explicitly represented, and can be denoted by a label or a symbol that can be used for pointing to this particular activity when fully specifying an affordance. The search for an interaction partner is connected to the activity, not to a single action That means also that the necessity for selecting an interaction is triggered by an activity that the agent wants to carry out. This motivation of the agent for selecting the interaction is important because it defines the need for an interaction partner and also the constraints that limit or guide on the selection. The interaction partner needs to be an “entity”, i.e. another agent, an environmental entity or any identifiable spatial element.

The agent has an internal state that can be also used for determining preferences. In case, there are multiple potential interaction partners for the same activity, the agents will need to select one of them. This selection is not random, but influenced by preferences and capabilities based on the agent’s current situation and state; of course in relation to some properties of the potential interaction partner.

3.2 The Interaction Perspective

An interaction is initiated by one agent. This agent intentionally scans its (perceivable or remembered) environment for potential interaction partners, be they active agents or passive environmental objects (that are also agents called resources). The interaction partners are selected and a non-trivial activity is performed together or with the passive environmental object.

Intentional interaction starts with the selection of an interaction partner/object to interact with. Thus, it is coupled with agent activity and/or individual goal fulfilment. In the following, we will present our idea of using affordances for formulating the selection of an interaction partner for intentional interaction.

3.3 Affordances as Guidance for Interactions

Our aim is to support agent-based modelling and simulation by introducing the idea of an affordance schema that serves as a kind of template for generating an affordance during simulation run-time time. An affordance connects a particular type of entity that the agents may perceive with a particular agent activity that realises an interaction with such an entity. Thus an affordance “emerges” in the current situation the agent is in, both in terms of environmental configuration and internal behaviour/motivational state. When we create a model of the agent, the question is how we may enable this emergence, which should not be pre-defined per definition. Our idea is to introduce the notion of an affordance schema that captures information about the circumstances under which the affordance is generated. So, technically an affordance schema can be seen as a kind of template that a modeller can explicitly handle to capture situation-dependent affordances and thus interactions. Therefore, while an affordance itself is a concept at the simulation run-time level, an affordance schema is part of the agent-based model.

4 Affordance Schemata as Framework for Modelling Agent-Entity Interactions

Based on the concept of affordance as a linking element between environmental entity and agent with its activity, we aim at creating a framework for modelling interaction which is sufficiently flexible for changing interaction partners, but does not hide this part of overall interactive behaviour within the details of an activity implementation or selection. We suggest to use affordances specifically in the part of the process that concerns the selection of the entity to interact with. In the following, we first present our specific definition of what an “affordance” means and introduce “affordance schemata” that can represent all information to generate affordances as they emerge.

4.1 Affordance and Affordance Schema

The central concept of our approach to model the decision making about interactions and interaction partners is based on the following formalisation of an Affordances as a 4-tuple:

$$\begin{aligned} \left\langle a, e, act, p \right\rangle \end{aligned}$$
(1)

As in the original concept by Gibson, we conceive an affordance as a particular link between an agent a that intends to perform an activity act. An activity is hereby seen as a kind of behaviour program consisting of at least one atomic action. This activity cannot be done alone, but needs an interaction partner – like a sitting activity needs something to sit on. This is the third element in the 4-tuple, the environmental object e that makes it possible to perform the activity. Thus, an affordance can be seen as a relation between an agent a and an environmental object as interaction partner e with respect to an activity act. The fourth element p cannot be found in other formulations. This represents a preference or priority \(p \in [0,1]\) that allows to compare different, concurrently active affordance relations. For example, when the agent looking for an interaction partner for its intended activity sitting finds multiple benches with different properties. We intentionally widen the perspective on the environmental object using the term interaction partner as we also want to include situations in which the presence of an agent enables activities.

In the original concept, an affordance “emerges” between agent and environmental object. As a consequence, it is a dynamic element that must be generated during a simulation run. It cannot exist independent from a dynamic simulation in which agents move and act on the environment. For explicitly handling the choice of interaction partners in the agents’ activity a concept is needed that makes the prerequisites for the generation of affordances explicit.

We suggest to capture these conditions in a structure that we call “affordance schema”. An affordance schema expresses which properties an environmental entity needs to possess as well as the overall conditions for the creation of an affordance. We define an affordance schema as a 3-tuple:

$$\begin{aligned} \left\langle EType, condition, fpriority \right\rangle \end{aligned}$$
(2)

Every agent possesses a list of affordance schemata \(AS_{a,act}\) for each of the activities it has in its activity repertoire \(act \in ACT_A\). Each affordance schema combines information about the type of the environmental entity EType with two functions, condition and fpriority:

  • EType forms a kind of class label for kind of interaction partner the affordance schemata is relevant for. Different schemata for the same activity can concern different types of entities, e.g. benches or walls for an agents who wants to sit down.

  • \(condition: A \times E \rightarrow \{True, False\}\) expresses constraints under which the affordance between an agent \(a \in A\) and an entity \(e \in E\) can be generated. A is hereby the set of all agentsFootnote 2 and E the set of all entities who can serve as interaction partner. For reasons of efficiency, E only contains entities of type ETypeFootnote 3

  • \(fpriority: A \times E \rightarrow [0,1]\) maps the combination of agent \(a \in A\) and its candidates for interaction partners \(e \in E\) to a priority scaled to [0, 1]. From this function the fourth entry in the affordance 4-tuple is calculated.

Explicitly modelling affordance schemata gives a mean to clearly express, what a suitable interaction partner is for an agent performing a particular activity. Affordance schemata can be formulated by a modeller. The decision about who interacts with whom is not hidden in the operational implementation of the agent activity, but made explicit in the agent-based model. The definition must be accompanied with a clear process of selecting the interaction partner in the agent architecture. In the following, we describe our suggestion for this process.

4.2 Decision Making About Interactions Based on Affordances

The simple generic process with which an agent reasons about interaction and action in an integrated way is sketched in Fig. 1.

Fig. 1.
figure 1

Processes for overall behaviour generation with explicit interaction partner selection based on affordance schemata and affordances.

Starting point of the generation process for interactive behaviour is that the agent updates its state based on perception and the previous state and determines an activity that it intends to perform. The decision about the activity is not part of the framework and does not need to be fixed on a generic level. One can image a goal-based reasoning in which an activity defines what needs to be done to achieve the goal; or the agent uses some rule-based selection related to a particular perception. This is depending on the particular application. The only assumption is that the activity is explicitly represented as a unit of behaviour. It needs to be identifiable by the agent at this level that the activity needs an interaction partner or not.

If the activity cannot be performed alone, the agent selects the affordance schemata associated with the activity. Technically, the activity can be used to index a set of affordance schemata.

The next step is to map each relevant affordance schemata onto the environment to test possible entities in the environment for their suitability as interaction partners. The function condition is used to filter the entities of the given EType type as interaction partners. After applying this matching process, the agent has a list of potential interaction partners associated with affordance schemata. For each of the potential interaction partner, the agent generates an affordance including a numeric priority value.

The last step uses these priorities to setup a preference relationship between affordances and as a consequence between potential interaction partners. The agent selects the entity with the highest priority and eventually starts to perform the activity with the entity as interaction partner.

If no affordance for the selected activity can be found, the activity cannot be performed and this is fed back into the state update and activity selection. This process is repeated until the agent actually performs an action. It is important to remember, that this is a process for an agent in a simulation setup; the modeller defines the affordance schemata. If an interaction does not work or results in a dangerous situation for the agent then this should happen as it would happen in the original system.

5 Proof of Concept

5.1 Conceptual Example

To illustrate the definition of this framework, consider the following element in a larger simulation about usage of park space: An agent of the type “Person” may intend an activity of eating - e.g. using a park for spending its lunch break. The affordance schema list contains for example the following entries: two for entities of the type “bench”, with table (3), and without (4) and a third one for a low wall (5)

$$\begin{aligned}&\langle Bench, \ \ \text {clean, free bench with table}, \nonumber \\&\qquad \qquad \text {the nearer the better}, \text {better in shadow} \, \rangle \end{aligned}$$
(3)
$$\begin{aligned}&\langle Bench, \ \ \text {clean, free bench without table}, \nonumber \\&\qquad \qquad \text {the nearer the better}, \text {better in shadow} \, \rangle \end{aligned}$$
(4)
$$\begin{aligned}&\langle Wall, \ \ \text {clean, free wall patch with right height}, \nonumber \\&\qquad \qquad \text {the nearer the better}, \text {better in shadow} \, \rangle \end{aligned}$$
(5)

These affordance schemata should be defined by the modeller. During a simulation run, a particular agent A enters the park with the activity eating in mind. For this activity, the agent needs an interaction partner, in this case an entity to sit on (necessary condition for performing the eating activity). Figure 2 shows the example scenario. The agent A enters from the top and observes the situation. A perceives four different benches B1, B2, B3 and B4 that are visible from the entrance. It is a sunny, hot day; B1 and B2 are in the shadow of large trees, B3 in full sun. B2 and B4 have a table; B4 is in the sun and dirty. There is also a low wall, which is partially shadowed, slightly dirty and still a little bit wet after the last rain.

Fig. 2.
figure 2

Example park scenario with different environmental entities that afford “eating” - an activity at which the agents sits down and eats lunch

The schema 3 matches only B2, as cleanliness is not just nice to have, but a required part of the condition. Benches B1 and B3 match schema 4. No schema matches B4: it is a bench with a table, so the agent would look deeper into schema 3, but the necessary requirement of cleanness is violated, thus general acceptability is not given. B1 matches the affordance schema (4). None of the wall elements is further considered due to being wet. Eventually, the following affordances are generated from mapping the schemata to the environmental situation: \(\left\langle A, B2, eating, 0.75 \right\rangle , \left\langle A, B1, eating, 0.80\right\rangle \) and \(\left\langle A, B3, eating, 0.5 \right\rangle \).

5.2 Implementation

We implemented and tested the conceptual example above using SeSAm [12] as a platform. SeSAm is a visual programming, fast prototyping platform for developing and running agent-based simulations. The agent behaviour is formulated based on a UML-inspired activity graph. Activities consist of a sequence of actions that link to Java code.

Environmental Model. The environment consists of a continuous map on which discrete environmental entities are placed to form the situation as shown in Fig. 2. Environmental entities hereby have a type (class), such as GroundTile, Tree, Bench or WallElement. Those objects have different attributes describing relevant properties, such as which share of the Bench is in the shades, etc.

Affordance-Enabled Agent. We define a park-visitor agent class with attributes that describe how important a shadowy environment or walking distance is for an individual agent. The agents also possess basic knowledge structures that contain

  • a list of activities that the agent might want to perform in a park, such as \(\{HaveLunch, SunBath, ...\}\). These activities are associated with small behaviour programs in which the agent interacts with a given entity.

  • a list of affordance schemata

Hereby, an affordance schema is implemented as a composed data structure that consists of the following elements:

  1. 1.

    Agent class for which the affordance schema is relevant.

  2. 2.

    Name of the associated activity

  3. 3.

    Class of the entity that the affordance establishes a relation during simulation

  4. 4.

    Constraints in the form of a function call that returns a boolean - true, if the entity is suitable, false if not.

  5. 5.

    Priority function that has the agent and the entity as arguments and returns a number

The entry 1) is relevant just because we associate the set of affordance schemata with the overall – in SeSAm explicitly represented – environment. The environment is responsible to generate new agents and thus provide them with an initial list of affordance schemata. Individual priorities are part of the individual agents’ state.

Thus, an agent knows about its potential activities and has a number of affordance schemata so that for every interactive activity there is at least one affordance schema in the behaviour definition of the agent. When the agent enters the park, it makes a pre-decision about what it could do in the park. A second step consists of that the agent selects the affordance schema that fits to its intended activity and uses it to generate affordances connecting suitable environmental entities to the activity. If there is no affordance generated, the agent needs to find an alternative activity to do in the park. Affordances Schemata also contain functionality to calculate priorities, etc. So, the activity SunBath may be done on a bench, on a wall element or on a GroundTile of type meadow. The agent can use the schema definition to generate affordances as well as a ranking of generated affordances. This ranking is then used to decide which is the best available interaction partner.

6 Discussion: Interaction as First-Class Concept

Emergence in agent-based models is produced though interaction. Therefore, it is important to model interactions, especially the selection with whom to interact, in a transparent way. In the approach presented above interactions between agents and environmental entity are not hidden within the implementation details but lifted to the level of modelling and thus made visible and explicit for the modeller.

We use “affordance” as a technical term capturing something that would be not be capture-able otherwise. We do no claim to formalise the psychological, cognitive-science view on how humans actually reason about affordances. Our focus is on helping the modeller understand and think about interactions between agent and environment. Affordance shall make the potential for interaction between an agent and its environment explicit. So, we let the affordance stand per se for a potential interaction independent of how an agent selects its actions during simulation run-time. One can see it as a “shortcut” or abstraction for representing what the agent perceives as relevant for selecting an entity as an interaction partner, without explicitly listing relevant features.

7 Related Work

[14] introduce a first version of these ideas at a rather conceptual level. In that paper the relation to other interaction-based development methodologies for developing agent-based simulation, i.e. IODA and MAIA, are discussed more deeply. When implementing our framework, we noticed that concepts presented in [14] were neither concise enough nor complete. For example, interaction was conceptualised as being with a constellation of environmental objects, yet no mean for capturing such a constellation was provided. However, defining a language for describing what is a suitable set of objects in particular relations to each other and in a particular state, is not easy. One has to compromise between expressiveness and usability of that language. We decided to simplify this into requesting the actual interaction partners’ type and a function that filters out those objects which are not suitable at all. In that function all relevant features also of the immediate environment of the potential partner – that means the constellation the entity is in – can be captured. Another aspect that was missing, was the explicit handling of priorities and how to select between different affordances.

Using the concept of affordances as a tool to formulate interactions in agent-based simulation is not new. There have been a number of works that are directly related to the proposed research here. In the following, we describe those works and point to the differences to what we described above.

There are a number of models that aim at reproducing how a human reasons about its environment for achieving more realism. These models are highly motivated by notions from cognitive science. The basic assumption is that the model can achieve a higher degree of structural validity when following hypotheses how humans really think. Examples for those models are [20,21,22] or [7]. A formalisation focusing on affordances as an emergent property is based on a detailed model of a spatially explicit environment as well as on actions and relations found in that environment [2].

Other works interpret the notion of affordances more freely: Joo et al. [8] propose affordance-based Finite State Automata. They use affordance-effect pairs to structure the transitions between states of a simulated human. Kapadia et al. ([9]) use “affordance fields” for representing the suitability of possible actions in a simulation of pedestrian steering and path-planning behaviour. An affordance is hereby a potential steering action. The affordance field is calculated from a combination of multiple fields filled with different kinds of perception data. The agent selects the action with the best value in the affordance field. A particular interesting approach is suggested by Ksontini et al. ([15]). They use affordances in traffic simulation denoting virtual lanes as an occupy-able space. Agents reason about what behaviour is enabled by the environmental situation. The affordances offered by the environment are explicitly represented by those virtual objects that offer driving on them. [13] labelled environmental entities with “affordances” such as “provides medication” as counterparts of agent needs enabling the agents to flexibly search for interaction partners or destinations.

[27]’s model of individual behaviour in a park uses affordances as a flexible way of connecting agents with resources in the environment. What we describe here can be seen as a generalisation of how the selection of environmental objects for interactions is formulated there. Some examples used here are inspired by this model.

In these approaches, affordances are used more as rules, for representing constraints or for identifying options. They serve as a tool for flexibly connecting an agent to interaction partners. There is no intention to advance research in cognitive science.

Approaches from Agent-based Software Engineering are also relevant for agent-based simulation [23]. Agent architectures form a mean for formulating how agent generate behaviour, so they can also be used in simulation settings. A rather old discussion of classical agent architectures and their relevance for simulation can be found already in [10]. Especially, BDI Architectures have been used in simulations as they allow formulating complex goal-driven behaviour (see [1] for a survey, [24] about integration or [17] for an example). While most BDI agents in simulation are based on PRS-type architectures, an alternative architecture, the IRMA architecture [3], has some similarities with our general approach which could integrate very well. An IRMA agent’s behaviour is based on partial plans that the agents commits to and needs to complete, e.g. with an appropriate interaction partner. A so called“opportunity analyser” continuously checks the environment for opportunities to complete the partial plan or to revise what the agent currently attempts to do. The here proposed affordance schemata could be used to support this opportunity analyser component of the overall architecture. During the last years, the so called “Agents & Artifacts” framework and meta-model received a lot of attention [19]. The basic idea is that in an explicitly modelled environment in which the agents in a multi-agent system reside, passive objects as resources can be used to support coordination between agent and decision making of agents. In [4], the authors discuss a wider view on environments for Multi-Agent Systems bridging physical, virtual and simulated environments. The simulated environment hereby is part of the agent-based model, passive objects or resources are part of it, if and only if they play an important role for the simulated agents’ behaviour [11].

8 Summary and Future Work

In this research we are aiming at creating a framework for modelling interactions of agents with environmental entities where interactions are treated as first-class concept in the modelling process. That is, we are interested in making it easier for the modeller to change interaction partners without having to re-model activities of agents and structures of environmental entities. This was accomplished by using the notion of affordance from ecological psychology as a concept that lets interactions emerge from agent’s activities and properties of environmental entities. Capturing the conditions for this emergence leads to affordance schemata that are the patterns that generate affordances during simulation. In this fashion, affordances add an additional layer of abstraction in models in order to make agents’ reasoning about interaction partners explicit and transparent. We provided an example to clarify the notions of affordance, affordance schema, and interaction. In addition we implemented and tested these ideas in SeSAm as a proof of concept. The results of our implementation are highly encouraging.

We are currently exploring the notion of affordance schemata for more geospatial activities and different example scenarios in order to prove the applicability of the schemata. One part of future work is to formally define activities and their actions as well as the needed properties for an activity to be carried out successfully. Another part of future work is to transfer the formulation of affordance schemata to the platform level, so that classes are provided and the modeller just needs to instantiate affordance schemata in order to generate affordances.