Simulation Using Conditional
Computer Science, Degree Project in Simulation and Development
of Computer Games, Advanced Course, 15 Credits
Program in Simulation and Computer Games Technology, 180 Credits
Orebro, Sweden, Spring 2015
Examiner: Martin Magnusson
Pedestrian simulation is widely used in both the public and private sector for designing public spaces, when pedestrian behavior is central to the design. Re-cently, automated analysis of recorded data of actual pedestrians has emerged as a means of introducing empirical validation in the field of pedestrian simulation. Conditional Transition Maps represent dynamic elements of an environment as transition probabilities and map them to discrete floor-fields. These maps have been previously used for mobile robot navigation. This thesis constitutes an investigation into the possibilites of using a CTMap as a basis for a pedestrian simulation model. The CTMap used in the thesis has been produced by analyz-ing recorded video data of actual pedestrians. A pedestrian model based on the CTMap was developed, using SeSAm, and compared to an already established pedestrian simulation model.
Fotg¨angarsimuleringar anv¨ands frekvent vid planering av offentliga utrymmen, d¨ar fotg¨angarbeteendet ¨ar betydande f¨or ¨andam˚alet. Simuleringarna anv¨ands s˚aledes inom b˚ade den privata och den offentliga sektorn. P˚a senare tid har au-tomatiserad analys av insamlad videodata om faktiska fotg¨angare blivit allt mer vanligt som en grund f¨or validering inom forskningsomr˚adet. Conditional Tran-sition Maps utg¨or en representation av dynamiska element i en milj¨o, d¨ar varje diskret cell i kartan associeras med en sannolikhetsdistribuering f¨or ¨overg˚angar till och fr˚an cellen. CTMaps har tidigare anv¨ants inom navigering f¨or mo-bila robotar. Denna uppsats utg¨or en utredning av m¨ojligheterna att anv¨anda en CTMap som en grund f¨or en fotg¨angarmodell. CTM-datat som anv¨ants i uppsatsen har tagits fram ur insamlad videodata om faktiska fotg¨angare. En fotg¨angarmodell har tagits fram, med hj¨alp av utvecklingsmilj¨on SeSAm, och j¨amf¨orts med en redan etablerad modell f¨or fotg¨angarsimulering.
This project constitutes a Bachelor’s thesis for a three year degree with a major in computer science at ¨Orebro University, in the spring of 2015. The project was conducted over ten weeks, with the continuous support of a supervisor, Professor Franziska Kl¨ugl of the School of Science and Technology at the institution.
Contents1 Introduction 5 1.1 Background . . . 5 1.2 Project . . . 6 1.3 Objective . . . 6 1.4 Requirements . . . 6
2 Methods and tools 7 2.1 Methods . . . 7
2.2 Tools . . . 7
2.3 Resources . . . 7
3 Existing research 8 3.1 Introduction . . . 8
3.2 Models for pedestrian simulation . . . 9
3.2.1 Agent-based models . . . 9
3.2.2 The social force model . . . 9
3.2.3 Cellular automaton models . . . 11
3.3 Data-Driven pedestrian simulation . . . 12
3.4 Conditional Transition Maps . . . 12
3.4.1 Background . . . 12
3.4.2 As a model for pedestrian simulation . . . 13
4 Design 14 4.1 The data . . . 14
4.2 Social Force Model . . . 16
4.3 CTM-Based Model . . . 17
4.3.1 Variants of the model . . . 18
4.3.2 Roulette wheel . . . 18
4.3.3 Heading towards the destination . . . 18
4.3.4 Considering past movement . . . 19
4.4 Testing . . . 19
5 Implementation 20
5.1 SeSAm . . . 20
5.1.1 Plugins . . . 20
5.2 Data Import and Map Generation . . . 20
5.3 Social Force Model . . . 21
5.4 CTM-Based Models . . . 22
5.4.1 Highest Probability . . . 23
5.4.2 Roulette Wheel . . . 23
5.4.3 Adding the Destination Weight . . . 23
5.4.4 Considering past movement . . . 24
6 Results 25 6.1 Social Force Model . . . 25
6.2 CTM-Based Models . . . 26
6.2.1 Follow Highest Probability . . . 26
6.2.2 Roulette Wheel . . . 27
6.2.3 Destination Weight . . . 28
6.3 Model Comparison . . . 29
6.4 Time constraints . . . 32
7 Discussion 34 7.1 Compliance with project requirements . . . 34
7.2 Special results and conclusions . . . 34
7.3 Further development of the project . . . 35
7.4 Reflections on own learning . . . 35
7.4.1 Knowledge and comprehension . . . 35
7.4.2 Proficiency and ability . . . 35
Simulating pedestrians and their behavior is useful for many institutions and companies. When designing public spaces, when planning cities and shopping malls, or simply to decide where to best place a traffic sign, pedestrian sim-ulation provides a valuable tool. As a research field, pedestrian simsim-ulation, and specifically research in how to model pedestrian behavior, has seen a lot of progress during the last few decades. As a result, several different proposed models have emerged, attempting to solve the problem of reproducing human navigation in their environment.
One of the most well-known is the social force model, first proposed by Dirk Helbing and P´eter Moln´ar in 1995. The model assumes that the behavior of pedestrians has some similarities with the behavior of particles in gases and fluids. The model consists of a formula for calculating the movement of the pedestrian agent, based on forces that impact its behavior. A detailed review of different models will be given in section 3.2.
One of the central problems of pedestrian simulation is the validation of pedes-trian models. Validation is a term used for the analysis of the applicability of any model. Over the years of pedestrian simulation research, different ap-proaches to validation have been introduced. Observing emergent behavior in simulated pedestrians, like lane formations and oscillations at bottlenecks, is one. Recently, automated analysis of recorded data of actual pedestrians has emerged as a means of introducing empirical validation in the field of pedestrian simulation. The data can be used for calibrating variables, and as the basis for a pedestrian model.
The Center for Applied Autonomous Sensor Systems (AASS) at ¨Orebro univer-sity performs research in autonomous systems, focusing on perceptual and cog-nitive capabilities. The research conducted at the center delves into the devel-opment of autonomous systems for application in both industrial and domestic environments. Researching different ways of representing dynamic environments and modeling agent behavior therefore becomes increasingly important. Researchers Tomasz Kucner, Martin Magnusson, Jari Saarinen and Achim J. Lilienthal have proposed a model for mapping the dynamic aspects of such an en-vironment, called Conditional Transition Maps. The CTMap is a grid-based representation that captures the motion patterns of agents in an environment, by associating each cell in the grid with a probability distribution for potential exit directions, given an object’s entry direction. The CTMap has not been used in pedestrian simulation before, rather it has been an important tool in devel-oping autonomous robot navigation. However, because of current pedestrian simulation largely lacking an empirical foundation, testing to see whether us-ing CTMaps would work for informus-ing pedestrian simulation might show some interesting results.
The thesis constitutes an investigation into the possibilities of a CTMap as the basis of a model for pedestrian behavior. The comparison with an already established model for pedestrian simulation, like the social force model, shall shed light on whether the new model is feasible and can be validated as a pedestrian simulation tool. Furthermore, a theoretical background based in existing research in the field has provided a basis for developing the model and the different variants of it.
The objective of the thesis was to develop a pedestrian simulation model based on a CTMap and qualitatively assess its validity against a theoretical and prac-tical background.
• Discussing existing pedestrian simulation.
• Implementing the social force model or another prominent pedestrian sim-ulation model for a given scenario.
• Developing a pedestrian simulation where agents utilize a CTMap for mak-ing decisions on their movement direction and step, and qualitatively as-sessing its validity as a model for pedestrian simulation.
Methods and tools
For the project, an adapted form of the SCRUM-method was utilized. Using the thesis blog as the main resource for the method, each weekly sprint was documented, dividing tasks into categories, depending if they were future tasks, a work in progress, or finished tasks, respectively. At the beginning of each weekly sprint, specific tasks were set to be done during that sprint, and the time consumption for each task was estimated. At the start of the sprint, all of the tasks were categorized as ”to do”. At the start of each day, which tasks were to be undertaken during the day was decided, and moved to the ”doing”-category. Each time a task was finished, it would then finally be documented as done, by moving it to the corresponding category. In this way the working process was always documented, on a weekly and a daily basis, which enabled for easy following of the time plan set for the project.
For the implementation of the models, SeSAm 2.5.2 (Shell for Simulated Agent Systems, using Java version 7) was used, which is an environment for developing multi-agent models. The software was provided by the institution. As the format of the data set which the project is based on was unknown at the start of the project, it was unclear whether SeSAm could be used as it is, needed to be extended or replaced by some other multiagent platform.
The entire project was completed on computers running Windows 8.1 as the operative system.
The data files used in the project were provided by researchers Tomasz Kucner and Franziska Kl¨ugl of ¨Orebro University. The data consisted of .csv-files, con-taining conditional transition probabilities and pedestrian trajectories, based on analyzed video data recorded in the Forum at the University of Edinburgh on the 24th and 25th of August. The data set is described in greater detail in section 4.1.
The following chapter includes a theoretical background for pedestrian simula-tion, and goes into greater detail in specific areas relevant to the project. The basics of the Conditional Transition Map are also described.
In the following section, pedestrian simulation, its uses and different forms, will be discussed. This will form a knowledge base for designing models in later phases of the project.
Pedestrian simulation has many applications. It provides a useful tool for any area where a knowledge of pedestrian and crowd behavior is of use. For example, being able to simulate evacuation situations or testing to see how a planned change to infrastructure might affect pedestrian flow, is of interest to both a private and a public sector when designing public facilities and spaces.
Depending on the application needs, a pedestrian simulation model needs to reproduce the dynamics of a pedestrian crowd quantitatively, as well as qual-itatively. This means, that the size of a simulation is of importance, as is the amount of pedestrians being simulated. The level of decision making conducted by each pedestrian in the simulation is also central to the requirements set for the model. For a simulation to be able to provide applicable results, i e results that correspond to the real-world situation being modeled, all of these aspects need to be taken into consideration and balanced accordingly - simulating a large amount of complex pedestrians will require large amounts of computing power, or will need to accept some simplification.[5, 6]
It has also been discussed whether or not a pedestrian simulation model needs to be able to represent pedestrian behavior in a range of different situations, and not just modelled to apply in a specific setting, which would make a data-driven approach much easier. Depending on the application area, pedestrian models tend to be either very complex and precise but slow, or fast models where the level of behavior displayed by the pedestrians can be put into question. Different models for pedestrian simulation can be divided into categories, based on different levels of abstraction, i e granularity. A pedestrian model can be considered to be either microscopic, macroscopic or mesoscopic. A microscopic model entails that each pedestrian is considered a unique entity, often called an agent. Each agent has its own properties and decision making abilities, not unlike real-world pedestrians. Macroscopic models, on the other hand, capture pedestrian flow as a whole, without considering each individual pedestrian’s de-cision making and interactions with others, which can simplify the calculations needed for the simulation, and lower the computational costs. Lastly, meso-scopic models combine the two previous models, and make use of both models’
abilities, describing pedestrian behavior on a microscopic level but not consid-ering them individually. Mesoscopic models are often referred to as gas-kinetic models.[6, 5]
In addition, pedestrian models can also be categorized based on the detail of description of space. Space can either be discrete or continuous. A discrete space model divides the environment into subspaces, or sets of cells. Each cell has a cell size which discretizes the environment. In a continuous space model the resolution detail of the environment is arbitrary. When the simulation is made for a specific environment or map, often a discrete space model is used. Time in a model can also be described as either discrete or continuous. These attributes can be used to characterize existing and future pedestrian models. In the following, they will be used to describe several prominent existing models.
Models for pedestrian simulation
3.2.1 Agent-based models
Agent-based models for pedestrian simulation are grounded in the idea of an autonomous, and interacting, agent. It is therefore microscopic in nature. This kind of model is useful when a higher level of cognitive behavior and decision making is required or desired. The agents can be designed to possess a capacity for path-planning, and to adapt to a dynamic environment. In such models it is also possible to integrate interaction between agents, which can enable the simulation of pedestrian group formation. 
Artificial intelligence can be applied to agent-based models, and therefore they can become quite accurate at reproducing pedestrian behavior. A great ad-vantage of this type of model for pedestrian simulation is that the agent itself need not be modified when a change in the environment is made, but rather the agent adapts to the changes autonomously. The agent has the ability to react to changes to its environment, rather than relying on already known information about it. The agent as an abstraction of a pedestrian is also quite intuitive to understand and analyze. The disadvantage of an agent-based model lies in the potential complexity of the model, which can make them difficult to analyze. They also tend to require large amounts of computational power compared to models with simpler structures. This becomes increasingly relevant when the objective is to analyze crowd behavior and large amounts of pedestrians are included in the model.[6, 5]
3.2.2 The social force model
The social force model assumes that certain situations, when considering traffic and the movement of pedestrians, becomes routine as a result of them being
simple and mainly the result of reacting to the environment. Its basic assump-tion is that the behavior of the pedestrian can be described as a result of forces influencing it to do different things.[1, 8]
The social force model, as an agent-based model, considers each pedestrian an entity with internal motivations that guide its path, and is also microscopic in nature. The difference to other agent-based models is that the social force model describes that motivation as a function of repelling and attracting forces, rather than describing them as a result of cognitive decision making. The social force model considers both time and space continuous.
The concept is that a pedestrian is attracted to its desired destination with a certain velocity, and attempts to move towards it. This is the driving force of the pedestrian. The motion of the pedestrian is also influenced by a repelling force, keeping it from moving into other pedestrians or obstacles, like the walls of buildings. This reflects that pedestrians feel uncomfortable when too close to others, and also that they prefer not to walk too close to walls. As a third force, a pedestrian has a certain velocity towards additional objects of interest. This corresponds to a person being attracted by interesting events or familiar people in its environment. Anything behind the pedestrian is decreasing in interest and repulsive effect, as it moves further away from it. The model aims at producing a Gaussian distribution of desired walking speeds across all pedestrians. A fluc-tuation term is also introduced, to account for random behavior in ambiguous situations that might arise - e g when both directions leading around an obsta-cle are equal. Added together these forces describe the movement direction and speed of each pedestrian in the model.
Simulation using the social force model is able to reproduce pedestrian crowd behavior like lane formation, herding, and oscillation of walking directions, de-spite the pedestrian behavior being simplified. These kinds of observable crowd formations are used as a means of qualitatively validating the social force model, as it corresponds to how actual pedestrians behave in a real environment. Due to each entity calculating its forces based on many other pedestrian si-multaneously, and the model often being used for simulating larger crowds of pedestrians, the model can be quite cumbersome to simulate and requires a lot of computing power. This also makes it difficult to simulate very large crowds of pedestrians using the model. Balancing the different constants weighting the forces in the equation requires a lot of time and extensive testing, in order to produce realistic overall behavior. Even small changes to one of the variables often requires adjustments in the others. In some cases, the simplification of pedestrian behavior to social forces produces unrealistic behavior. In sections 4.2 and 5.3 the social force model is described in greater detail, as it was se-lected as the established pedestrian model for the comparison to CTM-based model.[5, 6, 8]
3.2.3 Cellular automaton models
As opposed to the above described model, the cellular automaton model repre-sents time and space as discrete. Each cell in the model is a representation of a certain area, which holds information about the environment. The cell can hold information about its neighborhood or in what direction the goal is, for example. The cell most often contains state information, i e if its occupied or not. The state is changed using rules based on the current state and the states of the neighboring cells.
A renown example of a cellular automaton is The Game of Life, created by John Conway in 1970. The model showcases emergent patterns that occur with a simple set of rules, and using different starting settings.
In CA-based pedestrian simulation models the cell state represents information about only one pedestrian. For example, the destination goal of the pedestrians can be added to the cell state information. This way, the pedestrian will be guided, cell by cell, towards its goal; and the path of the pedestrian can be observed by analyzing the changes in cell state. The size of the neighborhood, whether a Moore or a Von Neumann-neighborhood, determines the outcome of the simulation to great extent. Each pedestrian agent is updated in parallel to each other, and moves to a neighboring cell.
A model that is especially applicable to pedestrian and traffic simulation is the Blue and Adler model. It applies a multi-lane variant of agent move-ment, where each pedestrian is updated in four synchronous steps. A pedestrian chooses a lane, and performs possible change of lane. After this, each pedestrian agent determines its velocity based on the space and possible congestion in the lane it is in. In the fourth step, each pedestrian moves accordingly based on its set velocity. In this variant of the cellular automaton each pedestrian can, depending on its set velocity, move different numbers of cells for each time step, not just one a time. Pedestrians approaching each other and going in opposite directions can also exchange positions, to avoid collisions.
Another variant of the cellular automaton model is the floor-field model. One of the determining factors of pedestrian movement in the floor-field model is a virtual trace, based on chemotaxis. Chemotaxis is used by insects like ants for communication, where they leave a chemical trace guiding other ants to food and other points of interest outside the colony. Drawing inspiration from this natural phenomenon the floor-field model provides a more dynamic version of the cellular automaton model for pedestrian simulation. In it each pedestrian agent leaves a virtual trace in the environment, influencing the transition prob-abilities of the cell. In practice this means that transitions used by pedestrians more often grow stronger with time, influencing the motion of other pedestrians in turn. Each agent will at random choose its next cell based on the transition probabilities. The model also includes a formula for diffusing and decaying the trace over a period of time, so that transition probabilities become weaker if not used for a certain period of time.
Data-Driven pedestrian simulation
What has been largely lacking and very limiting in the field of pedestrian sim-ulation is empirical data. This is due to the fact that pedestrian simsim-ulation has a long history in evacuation dynamics, and trying out viable scenarios with large amounts of people in a stressful situation is both costly and potentially dangerous.
Over the past decade, the collection and usage of empirical data on pedestrian behavior has grown along with the technical advancements made in automated video processing and computational power. The availability of data provides a base to build better validated models for pedestrian simulation. Empirical data can also be used for calibrating pedestrian models for particular scenarios and application areas. With the help of motion tracking, trajectories of individual pedestrians can be determined, and used as a basis for simulation, and also as a means of validation through comparison.[2, 8]
Conditional Transition Maps
The Conditional Transition Map is a grid-based representation of the dynam-ics of an environment. The model originates in the field of robotdynam-ics as a means of navigation for mobile robots in human environments. Traditionally, occupancy grid maps have been utilized for probabilistic environment representation, ag-gregating how probable it is to encounter a human at a particular location. however, these do not account for dynamic elements in an environment. By as-suming that the motion of dynamic objects is continuous, local neighborhoods of cells in the grid map become central for the analysis of the changes in the environment. Furthermore, it can be observed that when an object enters a previously empty cell, it must have come from a neighboring cell, and will also exit into one of the neighboring cells.
Each cell in the map has an occupancy state, which holds a 1 if it is occupied by an object or a 0 if it is empty. A cell will store probabilities for all possible transitions, based on recorded trajectories of dynamic objects. This results in each cell having 8 sets of 8 variables, one for each pair of entry and exit directions. Each variable holds the probability of that particular transition occurring, as shown in figure 1 below. The probability is the result of dividing the number of exits in a certain direction by the total amount of entries to a cell from a certain direction. 
Figure 1: The probabilities for all eight exit directions given an entry direction are recorded into the CTMap data.
3.4.2 As a model for pedestrian simulation
The CTMap has a potential to provide a data-driven approach to pedestrian simulation. By letting the pedestrian agents make their movement decisions based on the CTM-data mapped to floor-fields, the idea is that the pedestrians will behave similarly to the actual pedestrians that the data is based on. The basis for this model will be a floor-field variant of a cellular automaton, like the one described in section 3.2.3, where each pedestrian influences the other pedestrians, and their movement patterns. The key difference is that all of the probabilities have been calculated based on the trajectories of the recorded pedestrians in the data and inserted into each cell of the floor. The pedestrians in the simulation will therefore move in the map based on the past behavior of actual pedestrians, not following other simulated ones. The objective of this project is to investigate whether this is possible in theory, and attempt to develop a version of such a model that can then be validated and analyzed based on the data.
This is comparable to the previously mentioned floor-field model, where pedes-trians influence each other indirectly by leaving a virtual trace in their environ-ment. In the CTM-model, however, the pedestrians do not change the values of the transition probabilities based on an inherent feedback loop. There is also no decay or diffusion factor in the CTMap data as it is used in the project.
This chapter describes the underlying design of both models, as well as the intentions for potential future additions and changes to them. Chapter 5 goes into more detail regarding the implementation process itself, and which practical steps were taken in building them.
Figure 2: A still from the original recorded video data.
The data set used in the thesis is the result of processing and analyzing video footage from an overhead camera, mounted in the ceiling of a building called The Forum at the University of Edinburgh, see figure 2. The camera recorded people passing through, entering and exiting from different parts of the building. Through image processing, the camera system was able to track moving objects and their trajectories. The data is freely available on the internet.
Additionally, trajectories of each pedestrian recorded on the 24th and 25th of August were used. In the latter mentioned data also starting and destination positions, and times, were included. From those data, it was possible to derive origin and destination points for the pedestrian agents.
Out of the information provided by the data set the resolution and cell size were set for both models, and the map was generated to resemble the actual layout of the Forum. Tomasz Kucner created a CTMap from the data on the 24 of August and provided me with it.
Below, in figures 3 and 4, the two data sets, containing the CTMap transition probabilities, the pedestrian trajectories and the origin and destination points have been visualized into a map.
The pink cells represent cells that have transition probabilities stored into them. The blue ones are cells completely without CTMap data or transition proba-bilities, which in most cases correspond to where obstacles are situated in the Forum. This means that no objects or persons moved through those areas on the 24th of August.
The different colored dots correspond to the trajectories of each pedestrian, from origin to destination point.
In figure 3 below, the trajectories recorded on the 24th have been drawn onto the CTMap from that same date. This can be seen from that the trajectories correspond to the pink cells in the map.
Figure 3: Trajectories recorded on the 24th of August.
It is notable that the trajectories for the 24th of August are quite erratic. The clusters of dots correspond to pedestrians stopping for a long period of time. There is one pedestrian who moved towards the center of the map and then decided to go back to its origin. Also, when comparing to the trajectories of the 25th the trajectories seem very widely dispersed across the area of the map. How these kinds of aspects of the trajectories, and also the transition probabilities themselves, will affect the result of the model development remains to be seen.
In figure 4 below, the trajectories from the 25th of August have been drawn onto the CTMap. As these trajectories were recorded on a different date than the CTMap data, the trajectories do not correspond to the pink cells as well as the ones in the figure above. Some trajectories can even be seen to cross some of the light blue areas, which means that those areas are not in fact obstacles but areas simply not visited by anyone on the 24th, or there was some problem in the tracking of the pedestrians.
By having two different sets of trajectories, it is possible to compare the two and the results they provide. The results can indicate how general the data is. First whether the CTMap data can be used to reproduce the movements on the 24th and also whether it is possible to reasonably expand beyond the input data set.
Figure 4: Trajectories recorded on the 25th of August.
Social Force Model
The social force model is completely agent-based, in that all of the logic of the model is performed inside the agent class. The agent’s behavior is divided into three parts - observing its environment, calculating its new direction based on its observations, and moving accordingly. As described in the previous chapter, each pedestrian agent is influenced by three different forces, which are added together to form its total force influencing the pedestrian’s direction and speed towards its goal.
The calculations for the agent’s direction are derived from the formulas in the original paper. Firstly, the force towards the goal of the pedestrian is calculated.
Each agent strives to move towards its destination point in a straight line from its origin, moving with a preferred speed υα0, defined by the equation below(1). The desired velocity is defined by υα0eα, υα defines the deviation from that
velocity due to any avoidance behavior and τα corresponds to the relaxation
time within which the agent approaches its destination. (1) F0
α= τα(υα0eα− υα)
When adding the objective force to the total force, the result from this formula is weighted using a constant parameter.
The agent will keep a certain distance to other pedestrians and any observed obstacles. It is influenced by a repulsive force for avoiding other pedestrians in its surroundings and avoiding collisions, seen in the equation below(2). rαβ
is the distance between the agent and the other pedestrian, and Vαβ is the
repulsive potential of that pedestrian. (2) fαβ(rαβ) = −∇rαβVαβ[b(rαβ)]
This is calculated by assuming that each pedestrian has a personal space around it, shaped like an ellipse and denoted by the semiminor axis of the ellipse b(rαβ).
The ellipse is elongated in front of the agent, to allow for movement. b(rαβ) is
calculated as seen in the equation below(3). υβ∆t denotes the order of the step
width of the other pedestrian.
(3) b(rαβ) =
Pedestrians will also avoid walls and other obstacles, and here the formula dif-fers from the repulsive force of other pedestrians, because it is assumed that these obstacles do not move. Therefore, the ellipse is not calculated for this force. Instead, the closest point of the wall to the agent is used to calculate the repulsive force to that obstacle, see the equation below(4). Here rαB denotes
the distance from the agent to the closest point on the obstacle. (4) FαB(rαB) = −∇rαBUαB(krαBk)
In contrast to the social force model, the CTM-based agent draws its logic from the data set. This results in an agent structure that is a lot simpler in its most basic form than the social force pedestrian. In the first variant of the CTM-model the pedestrians simply follow the highest transition probability given their entry direction. They do not attempt to head towards their respective destinations. This is mainly to see whether they would actually find their way at all simply by using the data. It was expected that this would not be enough for the pedestrians to reach their goal points, and especially not in the travel time based on the starting and destination times from the data set. This agent logic results in most of the data remaining unused.
4.3.1 Variants of the model
As described in previous chapters, the objective of the project was to develop a CTM-based, data-driven model for pedestrian simulation. This includes an investigation into what kind of behavior the data itself can produce, and what kind of logic the agent itself needs to have to produce good pedestrian behav-ior. A desired result of the model development is that the trajectories of the pedestrian agents are as similar as possible to those of the pedestrians’ recorded in the data. Another aspect to consider is to develop a model based on the data that is general enough to produce valid results even when the input data is changed. Therefore an investigation into the possibilities of further developed versions of the pedestrian agent is important for the project.
4.3.2 Roulette wheel
The first step in further developing the model is trying to incorporate all of the data into the decision-making of the pedestrian agent. This was done by choosing an exit direction randomly, based on the probabilities for its specific entry direction. This way all of the directions are a possible result, but the direction probabilities are proportionally weighted. In this variant the behavior of the pedestrians is also completely based on the data itself.
4.3.3 Heading towards the destination
The conditional transition probabilities themselves do not take into considera-tion where each pedestrian is heading, and can therefore not produce a result where all the pedestrians end up at their preferred goal points. As an actual pedestrian will always keep its destination in mind, so must the simulated agent. As seen in the social force model, the desire to head in the direction of the desti-nation should be the most driving force. Because the pedestrians recorded into the data have different destinations, a general floor-field map by itself might not be a sufficient solution.
By implementing a variant of the pedestrian agent that uses a calculation of a preferred direction based on its ultimate destination, similar to that of the social force agent, it is possible to achieve a result that resembles the pedestrians in the data set. Similar to that of the previous version, this one can, for example, use the destination as a weight for the exit directions that point in the preferred direction. Below (5) is the equation used to calculate the total probability for the exit in the direction of the agent’s destination, where α denotes the weight constant and d is the transition probability.
4.3.4 Considering past movement
While randomly choosing an exit direction works in favor of those with higher transition probabilities, it is still possible that a pedestrian will walk back and forth between two cells. This is hardly a behavior seen in actual pedestrians. To lower the likelihood of this occurring, the pedestrian can store all of its past positions in a movement history. Similarly to that of the destination weight, the pedestrian can then lower the probability of the exit direction pointing to an already visited cell, especially the one it just came from. A problem that might arise from this is that a pedestrian can get stuck in a narrow hallway or a dead end that it was lead to by the probabilities.
Validating and testing a pedestrian model is central to the investigation of its possibilities. An analysis of the parameters and variables used and how changes to them affect the outcome can provide important insight to understanding the model.
4.4.1 Model comparison
The conditional transition probabilities were generated by Tomasz Kucner from the video data recorded on the 24th of August, while the trajectories of the pedestrians, including the starting and destination positions and travel times, were available for both the 24th and the 25th of August. This facilitates a comparison between the results of pedestrians generated based on data from the same day as the CTMap-data, and from another day. This can be an indicator of how general the data-driven model is.
Trajectories for each pedestrian from start to destination were included in the pedestrian data set. These include the position, as recorded by the camera, of the pedestrian at each time step. By calculating the average distance from each position on the trajectory to the corresponding pedestrian agent’s position in the same time step, the similarity of the generated pedestrian’s trajectories to the ones of the recorded pedestrians can be analyzed. This can be done with pedestrians generated from both dates of the data set, as well as with the social force pedestrian agents.
As well as comparing trajectories it is possible to look at travel times of all of the different models, visualizing a comparison into an appropriate diagram.
The following chapter describes how the development concepts from the previous chapter were put into practice, and what functionalities within the development environment were used to implement the pedestrian models. Some visualization of the agent structures is included to further describe what was done.
For the implementation and development of the pedestrian models the devel-opment environment SeSAm (Shell for Simulated Agent Systems) was used. SeSAm provides a visual approach to programming agent-based simulations. Several models of different biological and other systems are included as model libraries.
For visualizing two-dimensional simulations, SeSAm is very intuitive to use. This was the primary reason for choosing the platform for the project. While visual validation is not in itself central to pedestrian simulation, it greatly facil-itates the development. It is intuitive to understand that a pedestrian is a circle moving in a rectangular map, and this makes it easy to see, where changes need to be made.
For implementing the CTM-based models, the data was the most central part. While the default version of SeSAm does not support importing and parsing comma-separated value-files, there are plugins available that do. The ones used in the project were FileOperations and 2DSpatial.
FileOperations adds the functionality of handling files to SeSAm. It was used for importing the relevant data files into the project model.
The high level 2DSpatial-plugin provides functions for tokenizing strings, which was needed in the project for extracting the data from the data files.
Data Import and Map Generation
All of the data handling occurs in the world-class, i e the map of the environment. Utilizing the SeSAm-plugins mentioned previously, the data files are imported, parsed and stored in global variables.
The map is then generated based on the resolution of the map in the data set, and filled with cells. By matching cells in the data with the ones in the generated map, the transition probabilities are stored in their corresponding locations.
Depending on a global boolean variable, the world-class will then generate either a social force pedestrian or a CTMap pedestrian at a set spawn rate, until every pedestrian from the imported data has been generated, see figure 5.
Figure 5: The architecture of the CTMap class and generation of the map structure.
Social Force Model
The social force model used in the project draws all its logic from the original paper, as described in chapter 4. The model is, however, adapted to the same environment the CTM-data is based upon. This is to enable comparison to the other model, built solely on the data. Because the social force model is an established and renown model for pedestrian simulation, it provides a reference point to compare the results of the CTM-based model to. What is important is whether the pedestrians arrive at their respective destinations, and how long it takes for them to do so. It is also relevant to look at the trajectories, and compare them to those in the data.
section 5.2 and placed in the same map as the CTM-pedestrians, described below. It receives a starting point and sets its goal point based on the parsed file of pedestrian data. The travel time for the recorded pedestrians in the data is also calculated and stored in the agent, to provide a point of reference for the time step the pedestrian arrives at its destination, and a base for data analysis later on in the project.
As seen in figure 6 below, the pedestrian starts by observing its surroundings, and adding any pedestrians or objects found into its internal lists. These lists will then be utilized in the calculations for making adjustments to the pedes-trian’s direction. All calculations of the social forces are done in the third step, and a new direction and speed are set. After this, the pedestrian moves accord-ingly, making a check at each loop whether it has reached its goal.
Figure 6: The basic agent behavior of the social force agent.
The pedestrian agent is created by the world-class, in the position drawn from the data. In the first step of agent reasoning, seen in figure 7, the pedestrian observes its environment for the closest cell and sets that as its starting cell. The CTM-agent utilizes a flag for setting which variant of the model it is running, which triggers the corresponding logic in the second step of the agent reasoning.
In the third step the next cell is set from the current cell’s list of neighboring cells and the calculated exit direction. After this, the pedestrian either moves to the next cell or decides that it is close enough to its goal and exits.
Figure 7: The basic agent structure for the CTM-based model.
5.4.1 Highest Probability
The agent compares the transition probabilities for its entry direction and chooses the highest one, setting the corresponding cell as its next cell.
5.4.2 Roulette Wheel
The agent chooses a random exit direction from a set, where each transition is weighted proportionally to the probability, setting the corresponding cell as its next cell.
5.4.3 Adding the Destination Weight
The agent calculates the angle towards its direction, and adds to the probability of the corresponding exit direction. After this the next cell is chosen randomly as in the roulette wheel-variant.
5.4.4 Considering past movement
In the following chapter the results of the model implementations are described and discussed. Simulations were conducted using pedestrian data from both the 24th and the 25th of August in all cases, for all the different models. By using screenshots of the pedestrian trajectories and diagrams displaying the results of the simulations numerically, the different models are compared to each other. These kinds of visualizations of the results facilitate analysis of the different variants of CTM-based models, as was evident during project development. Screenshots of the simulations provide insight into how the models work and dif-fer from each other, especially when considering the CTM-based models, where the behavior is largely unknown until the simulation is run and displayed in this manner.
Social Force Model
In this section the results of simulations of the implemented social force model are displayed using screenshots of the simulation during runtime, at 3000 time steps.
Figures 8 and 9 below show the trajectories of pedestrian agents using the social force model described in sections 4.2 and 5.3. It is evident that the avoidance forces away from obstacles and other pedestrians influence the trajectories to make them more curved than in the original trajectories found in the data, seen in section 4.1. While the trajectories in the screenshots are similar to those in the original pedestrian data, not all of the pedestrians have been generated into the simulation when the screenshot was produced. This accounts for some of the missing trajectories when comparing the two. The reason for only running the simulation for a certain amount of time was due to bugs occurring during runtime, where the simulation would crash unexpectedly. Because of this the timeframe was lowered, to produce some results.
Figure 8: Pedestrian trajectories based on pedestrian data from the 24th of August, using the social force model.
Figure 9: Pedestrian trajectories based on pedestrian data from the 25th of August, using the social force model.
In the following section the results of the simulations using the different CTM-based models are shown, using screenshots of the simulations during runtime, at 5000 time steps.
6.2.1 Follow Highest Probability
Below, in figures 10 and 11, the trajectories from the simulations using the highest probability variant of the CTM-based model are shown. What is char-acteristic about both of them is that the trajectories are straight lines, and the few turns that occur are sharp. This variant is revealing of the data itself, and how the highest probabilities are aligned.
Figure 10: Pedestrian trajectories when following the highest conditional tran-sition probability, based on the pedestrian data from the 24th of August.
Despite the destination point for each pedestrian not being used for this variant of the model, there is a difference between the two dates and the results they
produce. This could be attributed to the starting points, which define the entry directions from the start and in the end influence the entire path of the pedestrian.
Figure 11: Pedestrian trajectories when following the highest conditional tran-sition probabilities, based on the pedestrian data from the 25th of August.
6.2.2 Roulette Wheel
Figures 12 and 13 show the trajectories for the pedestrian agents using a roulette wheel logic for choosing their next step direction. Because this type of logic relies on randomly choosing an exit from a set of exits, the results show a very jagged trajectory, as opposed to the highest probability model. This indicates that the differences between the transition probabilities are not that large. While this variant of the model considers all probabilities in the data for each cell, it results in pedestrians arriving at cells in the map from unexpected directions, which are not recorded into the data.
Comparing the roulette wheel trajectories to those of the highest probability variant does show a difference between the two. It is, however, difficult to conclude whether this difference is for the better or for the worse, as neither are clearly similar to the original, recorded trajectories, shown in section 4.1.
Figure 12: Pedestrian trajectories based on pedestrian data for the 24th of August, when choosing the exit direction randomly based on the conditional transition probabilities.
Visually observing the two still images from the different dates of pedestrian data shows that there seems to be more pedestrians moving in the central parts of the map on when using pedestrian data from the 24th.
Figure 13: Pedestrian trajectories based on pedestrian data for the 25th of August, when choosing the exit direction randomly based on the conditional transition probabilities.
6.2.3 Destination Weight
Below, in figures 14 and 15, the results from running the CTM-model with a roulette wheel logic for choosing the next step with an added destination weight is shown, for both dates of pedestrian data. The images show both the trajectories of pedestrian agents with a destination weight of 0.8. Compared to the roulette wheel without a destination weight, discussed above, the trajectories are significantly more distributed over the entire map, and pedestrians seem to be moving across towards exit points of the map.
Figure 14: Pedestrian trajectories based on pedestrian data from the 24th of August, using a destination weight.
Visually there is quite a big difference between the two dates of pedestrian data. The trajectories seem to be focused around the exits in both cases, however.
Figure 15: Pedestrian trajectories based on pedestrian data from the 25th of August, using a destination weight.
The trajectories shown above, in sections 6.1 and 6.2, display the behavior of the pedestrian agents in the different models. All of them differ from each other, and none of them look clearly similar to original trajectories, shown in section 4.1. While comparing trajectories can provide a valuable tool for validation, comparing the models numerically provides another kind of perspective into the results of the simulations, more precisely analyzable.
Below follows a summary of data analysis and comparison that was conducted, using the original data set and comparing the numbers to the results of all the models. The social force model and its results have also been included, to provide a frame of reference for the CTM-based models.
The first aspect that was compared was the percentage of pedestrians reaching their destinations. The destinations were all, as described in section 4.1, based on the original data set, including both the 24th and the 25th of August. Using the logic of the different variants of models each pedestrian agent attempted to reach its set destination point that was based on an actual recorded pedestrian. The error margin for the agents reaching their destination is quite small, they have to be less than two cells away from their goal position to be considered having arrived at their destination. This applies to all models.
Each simulation for each variant of model was run ten times to produce the data shown in the diagrams below. In figures 16 and 17 below, the results are displayed.
Figure 16: Mean percentage and standard deviation of pedestrians reaching their respective destinations for the different models.
From the above figure, it is clear that the agents using the social force model and not the CTMap were more successful at reaching their destinations - for both the dates, the result was higher than 25%. There is a small difference between the two dates, which can be attributed to the fact that the obstacles in the map correspond to the gaps in the data in the CTMap, not the pedestrian data.
The second best variant was the destination weight of 0.8 based on data from the 24th at just below 5% reaching their destinations. This shows that a large portion of the pedestrians never reached their destinations.
Figure 17: Mean percentage of pedestrians reaching their respective destinations using the variants of the CTM-model.
Looking at figure 17 above, it is evident that there is a large difference between the two dates. This indicates that the CTMap greatly influences the results. On the 25th, when the pedestrian data does not match the CTMap, the results are very bad. When the destination weight is added, however, the gap between the two dates becomes smaller as the weight is increased. The weight does not increase the percentage of pedestrians reaching their destinations even for the date of which the CTMap was generated from. There is actually a very small difference between the percentages throughout the different variants. This small of a difference could be attributed to statistical differences - as the models based on the roulette wheel logic utilize a random next step, the result is different each time the simulation is run.
Figure 18: Average distances to goal and standard deviations at point of exit.
Figure 18 above shows the average distances to the goal point at the time of exit, in pixels. 125 pixels correspond to one cell, which means that a mean of around 7000 pixels corresponds to a distance of around 56 cells. This is to account for the very narrow margin of error in pedestrian agents considering having reached the destination set based on the pedestrian data, while still exiting the simulation whenever an exit on the map is reached. The data shows a smaller difference between the social force model and the different variants of the CTM-model than the previous data comparison. From the data it is clear that the average distance to the goal point at the time of exit is significantly smaller on the pedestrians generated from the pedestrian data from the 24th than the 25th, which indicates that the CTMap data is highly relevant to the pedestrians going where they should. Other than that all of the models are very similar to each other - differences can, as before, be attributed to random differences in the simulations.
The standard deviation for the distances is quite high in almost all of the cases, which indicates a wide spread throughout the set of pedestrians - some are very close to their destinations, others are very far from it. This means that the result could be very different if the simulation were run several times. It also shows that the CTMap is not a reliable guide for a pedestrian wanting to reach its destination.
Due to running out of time for the project, some aspects of the model that were described in chapter 4 were not implemented. These were particularly,
the CTM-variant utilizing a movement history and the comparison between mean travel times for the different models. As described above in sections 6.1 and 6.2, the time steps used for the social force model and the variants for the CTM-models are different. This was due to problems of the social force simulation often crashing before reaching 5000 steps, and despite attempting to solve the problem by debugging the problem persists. It was important that all ten runs of the model simulation for producing the data were run for the same amount of time.
Compliance with project requirements
All of the requirements for the project, specified in section 1.4, were met. An investigation into the possibilities of using a CTMap as a base for a pedes-trian simulation model was conducted, and compared against a theoretical back-ground of pedestrian simulation. Relevant pedestrian simulation models were implemented, using SeSAm, and the results of the simulations were analyzed, compared, and discussed.
Given a longer time frame, other variants of the model could have been imple-mented. Further analysis of the data and why the results are what they are would also had been the next step in the project.
Special results and conclusions
The results described in chapter 6 discussing whether or not basing a pedestrian model on a CTMap can be validated as a pedestrian simulation tool are incon-clusive. It is evident, based on those results, that for the behavior to be similar to actual pedestrians or even to those of another, established pedestrian simu-lation model, some aspects of the whole, i e the data and the model together, need to be adjusted and worked on.
While some of the pedestrians do reach their destinations using the CTMap, others clearly do not end up close to their goals. Considering the appearance of the trajectories of the CTM-agents based on the roulette wheel logic, described in section 6.2.2, there are large gaps in the data as pedestrians approach from unexpected directions. This will inevitably lead to them getting lost and not reaching their destinations, which the results indicate.
While taking all transition probabilities into account and randomly choosing an exit direction, as in the roulette wheel approach, does utilize all of the existing data, it leads to some of the pedestrians going in directions they do not intend to. Adding a destination weight changes the result only marginally.
What is also surprising about the results is that when looking at the distances to goal, the differences between the different variants of the CTM-based models is smaller than the standard deviations. Any differences can therefore be at-tributed to statistical errors. This indicates that the variants of the model do not necessarily produce better results at all.
Based on the result of the project, the CTMap used in the project does not provide a reliable base on which to build a pedestrian simulation model. Inves-tigating why is the natural next step in development. While the results indicate that there is still a lot left to work on for the model to produce good behavior, the potential of developing a data-driven pedestrian model is worth exploring further.
Further development of the project
The project could be further developed by exploring what results different changes to the data set can produce. The first step would be to try a dif-ferent date for the CTMap itself, and comparing the results it produces to the ones shown in the project. Additionally, it might be interesting to see if having data for all entry directions to each cell would produce different results. This could be achieved by combining data from several dates of recorded video data, for example.
Other variants to the CTM-model could also be developed, starting with the history weight for past movement. Finding a way of reducing the stochasticity of the model is central. Using the project’s results as a frame of reference for future developments can prove very useful.
Reflections on own learning
7.4.1 Knowledge and comprehension
At the start of the project I had very little insight into the field of pedestrian simulation. A large part of the project consisted of acquiring an understanding of pedestrian simulation as a research field and the theoretical background es-sential to the project. After working on the project, I have a deeper knowledge of the history of the field, and also a comprehension of what challenges the field is facing at the moment. By then applying what I had learned and implementing a model based on it, the limitations and difficulties that the field faces became very real to me.
7.4.2 Proficiency and ability
Indisputably, the biggest learning experience of the project has been working on the project independently for such a long time. Managing my time and planning tasks for each week was a challenge, but by the end of the project I had learned how long each task would take and how to allocate my resources. Being able to undertake similar projects in the future and working independently is a valuable ability.
7.4.3 Values and attitude
Another very enlightening aspect of the project is the insight gained into the work process of the faculty and researchers of the institution. Having weekly meetings and contact with my supervisor, who, at the same time, was my em-ployer for the project, was vital to the process. I also had the opportunity to meet and discuss the project and the data with the original author of the
CTMap paper, Tomasz Kucner, which gave another perspective of the pro-fessional environment at the institution.
 Helbing D, Molnar P. Social force model for pedestrian dynamics. Physical Review E. 1995;51(5):4282–4286.
 Teknomo K. Microscopic pedestrian flow characteristics: Development of an image processing data collection and simulation model [PhD Thesis]. Tohoku University; 2002.
 Kucner T, Saarinen J, Magnusson M, Lilienthal AJ. Conditional transition maps: Learning motion patterns in dynamic environments. In: Intelligent Robots and Systems (IROS), 2013 IEEE/RSJ International Conference on; 2013. p. 1196–1201.
 Majecka B. Statistical models of pedestrian behaviour in the Forum; 2009. Accessed: 2015-06-12. http://homepages.inf.ed.ac.uk/rbf/FORUM-TRACKING/.
 Johansson A. Data-driven modeling of pedestrian crowds [PhD Thesis]. Dresden University of Technology; 2008.
 Kluegl F, Rindsfueser G. Large-scale agent-based pedestrian simulation. In: Petta P, Mueller JP, Klusch M, Georgeff M, editors. Multiagent System Technologies. vol. (= LNAI 4687) of Lecture Notes in Computer Science. Springer; 2007. p. 145–156. MATES 2007.
 Duives DC, Daamen W, Hoogendoorn SP. State-of-the-art crowd motion simulation models. Transportation Research Part C: Emerging Technolo-gies. 2014;37:193–209.
 Bazzan ALC, Klugl F. Multi-Agent Systems for Traffic and Transportation Engineering. IGI Publishing; 2009.
 Bandini S, Federici ML, Vizzari G. Situated cellular agents ap-proach to crowd modeling and simulation. Cybernetics and Systems. 2007;38(7):729–753.
 Gardner M. Mathematical games: The fantastic combinations of John Con-way’s new solitaire game “life”. Scientific American. 1970;223(4):120–123.
 Blue VJ, Adler JL. Cellular automata microsimulation for modeling bi-directional pedestrian walkways. Transportation Research Part B: Method-ological. 2001;35(3):293–312.
 Burstedde C, Klauck K, Schadschneider A, Zittartz J. Simulation of pedes-trian dynamics using a two-dimensional cellular automaton. Physica A: Statistical Mechanics and its Applications. 2001;295(3-4):507–525.
 Railsback SF, Grimm V. Agent-Based and Individual-Based Modelling. Princeton University Press; 2012.