Simulating Collective Behavior in Natural Disaster Situations: A Multi-Agent Approach

The study of earthquakes plays a key role in order to minimize human and material losses when they inevitably occur. Chapters in this book will be devoted to various aspects of earthquake research and analysis. The different sections present in the book span from statistical seismology studies, the latest techniques and advances on earthquake precursors and forecasting, as well as, new methods for early detection, data acquisition and interpretation. The topics are tackled from theoretical advances to practical applications.


Introduction
The usage of simulations has been improved for quite some time. From mechanical artifacts that attempt to mimic a certain dynamic event using known physical properties up to complete representations of virtual worlds based on real life events which were augmented by concepts in order to prove a theory or to test a specific scenario. The key words here are "modeling", "constructing a simulacrum", "experimentation" and "evaluation". Simulations allow any researcher to explore, try out new ideas, check some theories in a controlled environment before testing in real life, and so forth. Psychology deals with individuals, Sociology with the study of human groups and the formation of institutions, both, individually, were not enough to study the humanŠs social behavior. All human sciences tried to create theories about reality, searching for well-defined and established patterns. The non-conformity with such patterns is considered a mistake, or even a wrongdoing. Taking a whole new approach, the field of Collective Behavior deals with human groups and collectivities that contradict or reinterpret societyŠs norms and standards. Crowd behavior has been studied by many researchers. Theoretical models have been established to understand them. This chapter will present a simulation model for panic in crowds phenomena based on the symbolic interactionism approach. Section 2 will present a review of the main concepts of Sociology and Collective behavior and establish a framework to be used in the model of crowd to be simulated. Section 3 will present a computation model and a simulation model of panic in crowd phenomenon, both in its theoretical aspects and its practical issues. The collective behavior studied in the previous section will be used as basis for the simulation model. Also, the main concepts regarding multi-agent based simulations will be presented. The model simulated have been applied to a fire incident and validated. Section 4 presents a generalization of the model proposed and delineates a future application for other kind of disasters as earthquakes. Section 5 shows some conclusions about the study here presented. 20 www.intechopen.com

Sociology and collective behavior
Sociology deals with the study of human groups and the formation of institutions (dos Santos França, 2010;Merton, 1968). Its origin came from Comte, Spencer and other 19 th century researchers' need for a distinct perspective of the human behavior that derived from the individualistic studies that had been performed previously. For instance, Comte stood out that the human mind could only develop in a social environment. Thus, following this premise, Psychology was not enough to study the human' social behavior (Turner & Killian, 1957).
At first, Sociology was focused on culturally-oriented groups or social groups which behavior follows established rules. Because of such interpretation, some spontaneous and unorthodox social actions were perceived as abnormal and unstable or as exceptions that did not draw further attention. Sociology, as a science, attempted to "frame" reality into well-defined and established patterns. If a certain social action could not fit into any of such patterns, the action was considered a mistake or even a wrongdoing until society accepts the new behavior and embraces it. Such acceptance could take decades or never happen.
Taking a whole new approach, the field of Collective Behavior deals with human groups and collectivities that contradict or reinterpret society's norms and standards. These collectivities' behavior is not entirely detached from the socially accepted behavior discussed earlier. However, collective behavior deals with social groups that deny or reinterpret society norms and standards. Ralph Turner and Lewis Killian at (Turner & Killian, 1957) defined collective behavior as "the set of social behaviors which the usual conventions stop driving the actions and the individuals transcend, exceed or collectively subvert the standards and the institutionalized structures" (dos Santos França et al., 2009). This definition implies that the individuals engaged in a collective behavior are no longer bound to the rules and norms of society and they are free to act the way they intended even if such behavior is not socially accepted. At first, their actions are related to the institutionalized and established actions found in Society. But, as soon their need for socially unaccepted actions is reached, they start to bend and to overrule the norms that were built by society, creating their own. This sort of human group might happen due to many reasons, including by hazardous events, whether they are natural or human-induced. Also, their structure and formation follow a pattern that was mapped by some researchers. Finally, such mapped patterns could be used to understand disasters by a distinct perspective: how people react in a hazardous event and how this could be simulated in order to decrease material and human losses. The simulation model presented in Section 3 deeply applies the information described in this section.

Crowd simulation: Theoretical elements
The understanding of the panic in crowds' phenomenon relies on the study of the collective behavior phenomenon. Thus, a historical overview is presented in the following sections, along with modern studies about panic and disasters, especially how people behave under such conditions. The following subsections show a historical overview of some studies of the collective behavior field and the theories that will be employed in Section 3 to build the simulation model.

Historical abstract
The collective behavior was studied in distinct ways through the ages. Initially researchers such as Tarde and Durkheim developed social theories in order to justify the actions performed by offenders or as a mean of explaining how an isolated individual could have a socially accepted behavior and the very same individual could be able to participate in criminal acts when he is in a collectivity.
Emile Durkheim claimed that the group was important to understand the individual's behavior. Culture would be formed by the combination of personal minds instead of a chain of imitations from one subject by the other members of the group. This was one of the early conceptions of the group mind, a supra-personal entity which has an autonomous existence from the composing members of the group (Durkheim, 1895). In other words, the individuals engaged in a collective behavior unconsciously help to form the group mind that guides their actions.
Following an opposite direction, Gabriel Tarde considered that the social behaviors happen due to man's natural inclination to mimic others. For Tarde, the interactions among individuals worked only to spread the mimic's individual results and the interactions were not responsible by their formation. According to Tarde's approach, collective behavior describes the person's socially anomalous behavior into a group and collective context and in situations not induced by criminal activities, such as the tulip mania (Mackay & Baruch, 1932) or the great social movements, such as the fall of the Bastille (Tarde, 1890; Turner & Killian, 1957).

Collective behavior development
After a criminal approach for the collective behavior, some researchers analyzed the collective behavior phenomenon in an individualized and superficial way, such as Sigmund Freud (Freud, 1955). However, some other researchers such as William McDougall and Gustave Le Bon developed the collective behavior studies further by creating an early classification of the phenomena, as well as a detailed profile of each member of the collectivity, but also taking into consideration that the collectivity itself has its own specific features. This second attempt to understand the collective behavior phenomenon followed a psychological standpoint (dos Santos França, 2010).
Le Bon is considered one of the founders of the collective behavior studies and he was one of the firsts to use the term crowd to describe the collectivities, developing the Crowd Psychology and treating the crowd as the prototype of all group behaviors. The focus of his studies was the social behavior by using the "the crowd mind" theory. For Le Bon, the main features of the crowds were: • The decreasing of the conscious personality along with the prominence of the unconscious one; • The ideas and feelings of the members of the crowd are guided by suggestion and contagion; • The trend to put suggested ideas into action.

437
Simulating Collective Behavior in Natural Disaster Situations: A Multi-Agent Approach www.intechopen.com A rough classification of the crowds was also proposed by Le Bon. Such classification was based on how the crowd was conceived and its main actions, and it can be summarized as follows: Active crowd Crowds that act together with a strong sense of coordination. Examples include mutinies, lynching mobs and rebellions; Casual crowd A crowd formed with no specific goal and coordination, acting at the same time and place for a short period. For instance, a crowd watching a display window being decorated; Conventional crowd When a group of people gather themselves for a specific goal, sharing feelings that drive the actions of the whole group, such as what happens in an audience for a soccer game or any other recreational activity; Expressive crowd A group of people gathered to move, make gestures together but for individual achievements, such as the dancing crowds at carnaval and some religious groups; Panic crowd A panic crowd is formed when people are exposed to a dangerous situation and that leads them to create the perception of need to stay away from danger in a social and shared way, such as earthquakes and fires (dos Santos França, 2010;dos Santos França et al., 2009).
The psychological approach for the collective behavior emphasizes the lost of personality, the liability being empowered by the collectivity and the fact that such collectivity is guided by some kind of collective mind (similar to Durkheim's). Le Bon's vision also had the collective (or mass) psychology and the phenomenon of contagion in a primitive form (Le Bon, 1896).
The mass psychology was important for the development of the collective behavior studies because it was the first attempt to establish, classify and broaden such studies. However, the followers of this particular approach still treated the members of the crowds as society outcasts due to gender, race or civilization level. That implies that the only the civilized western individuals were considered truly civilized. Women, children, the mentally impaired and the individuals that belonged to a race other than white were marginalized and the mass psychology theories were used to justify and amplify such condition, as tools to "domesticate" and to "civilize" such groups, so they could act under the control of a leader such as Napoleon or Alexander, the Great (dos Santos França, 2010).

Symbolic interactionism and emergent norm theory
The criminal and psychological approaches for collective behavior used the abnormal, the unusual, the uncommon to establish a line, a threshold between the socially accepted behavior and groups (studied by Sociology) and the socially unaccepted behavior and the human groups that engaged in such behavior. Some researchers at the University of Chicago developed a distinct way to see and understand the collective behavior.
Robert Park and Ernest Burgess wrote a whole chapter about collective behavior in their book Introduction to the Science of Sociology. In that chapter, the concept of social contagion was described as an element to spread a cultural matter, being compared to the fashion phenomenon and inducing people's feelings. Thanks to Park and Burgess' work (and similar works released almost at the same time) collective behavior was related to social phenomena 438 Earthquake Research and Analysis -Statistical Studies, Observations and Planning www.intechopen.com other than criminal activities and psychological issues. Also, the individual engaged in collective behavior could belong to any social group, according to certain social-cultural contexts (dos Santos França, 2010;Park, 1939).
Park also introduced the concept of "milling": a collective movement that represents fear or discomfort. The social unrest can amplify the fear which, in turn, leads the group to a tension state. Such unrest, even if it is merely mentioned, amplifies the fear. Thus, the milling and the social unrest make a vicious circle and their interaction becomes a circular reaction that increases the tension in the group and creates an expectation that mobilizes the group members for the collective act (Park, 1939).
Herbert Blumer was a student of Robert Park and carried on his research. George Herbert Mead was also Blumer's teacher and developed the social act, a noticeable external behavior.
With that theoretical basis, Blumer coined the Symbolic Interactionism, which society is built by the interaction among people that, when they are about to act, take into consideration the actions and features of the other individuals, a symbolic interaction driven by each individual meaning developed during the interaction process (Borgatta & Montgomery, 2000).
According to Blumer, Symbolic Interactionism is based on three premises: 1. The persons interact by the meaning of their world's objects (tangible, abstract or social), both individually and collectively; 2. The meaning of the objects is built from the interactions among individuals; 3. During the interaction, individuals use an interpretative process to change such meanings.
The Emergent Norm theory was proposed by Lewis Killian and Ralph Turner and it was presented in (Turner & Killian, 1957). Based on Blumer's Symbolic Interactionism, it also considered that the collective behavior was the outcome of the interactions among persons able to assess the received information which leads to an interactive cognition. This approach analyzes the agents' features that aided in the formation of the social systems in a micro level, as well as the behavioral patterns in a group level. Therefore, the emergent norm approach deals with the formation of the collective behavior by the micro level interactions of the collectivity members and the advent of patterns and norms triggered by these interactions. Although there is no emphasis in the definition of the social systems (as seen in (Luhmann, 1996)), the interactions and the complex behaviors formed by them allow the collective behavior to be seen as a complex system because from its micro-level interactions -simple by nature -complex behavioral patterns emerge, and such patterns cannot be noticed by just analyzing each individual alone (dos Santos França, 2010).

Other approaches for collective behavior
Due to the need of creating a symbol and meaning system, Blumer' symbolic interactionism has some unclear basic points related to social interaction: 1. How individuals relate to each other in spite of their differences; 2. How the social relation comes from the orientation to the other in each attendant (Vanderstraeten, 2002).
These points were addressed by Talcott Parsons in his studies about social groups, which led to the Structuralism Approach for the collective behavior phenomenon.
The Structuralism Approach turns over the concept described in the previous section by highlighting the social structures' studies and their impact on the individuals. The focus lies on the social structures that triggered the phenomenon and the structures affected by the members of the collectivity, using the macro level elements to think about the micro level elements and behavior. Therefore, the social structure is analyzed as deep as possible. Any behavior that subverts the established social order is reviewed by observing how the social structure and the collectivity respond to that (dos Santos França, 2010).
Neil Smelser was a researcher at the Oxford University, and he was Talcott Parsons' student at the time. Enhancing Parsons' collective behavior studies (Parsons, 1937), Smelser pointed out that, although rumors, panic or lunatic conditions, commotion and revolution are unexpected and surprising, they happen regularly (Smelser, 1963). He also stated that as much institutionalized the behavior is, it will become less distinguishable in a social point of view. The purpose of collective behavior, according to Smelser, is the resettlement of the social order that was shook by a tension on the elements that make the social structure. The resettlement induces people to act in a collective and rational way. After that, social norms and institutions are crystallized due to the comeback of the social order or by the formation of a new one. This shows Smelser's top-down approach for the collective behavior phenomenon (Smelser, 1963).

Panic in crowds
Panic in crowds can be triggered by various factors, such as natural threats (floods, earthquakes, volcanic eruptions), threats induced by man (terrorist attacks, lost of the social control by State), among others. In a panic situation there is always an imminent risk and the urge to act by the individuals (dos Santos França et al., 2009).
Killian and Turner also studied the behavior of individuals during crisis. In (Turner & Killian, 1957) the micro interactions are the key elements for the changes in the society. The same would happen with culture that changes thanks to each person, even if that happens in an unusual and unconscious way. According to Killian and Turner, it is in the reaction of the individuals in critical and unstructured situations that the basis of the collective behavior can be found. Such personal responses should be accepted as a required background for the study of the development of new norms and social structures.
Three kinds of individual reactions were found by Killian and Turner. The first kind of reaction is Defense: people act in a limited fashion, unable to comprehend what happened and to deal with new situations, and some of them will be in shock, even with no physical damage. On the other hand, there will be others that become more suggestible and readily accept commands from somebody else (Turner & Killian, 1957).
The second kind of reaction that usually happens after the shock from a violent accident is an impulsive and apparently irrational action. The individual acts apart from the environment and the other individuals, with actions entirely out of his normal self, in some kind of "super focus". Even though that individual is aware of what happens in the environment, his actions are directed towards a specific spot inside the event, acting in a conscious way. It seems that in such behavior there is an attention strain. Thus, the individual does not think about the consequences of his acts in the same degree of his actions in ordinary conditions (Turner & Killian, 1957).
The final kind of individual reaction found by Killian and Turner is the fear. A critical situation is known to pose as a threat to the individual's life or values. Thus, fear is the most common reaction in panic situations, even if such situation is not real.
Fear can be shown in many ways, from internal changes in the emotional and psychological state up to despair, whimper and foray, and it increases whenever the danger is unknown. Uncertainty leads to insecurity since the person does not have enough information to take the right decision in the new context. A person is less afraid of a dangerous situation than the lack of information of the present condition and its uncertainty (Turner & Killian, 1957).
Panic in Crowds phenomenon has been studied by many researchers, mostly to understand its inner workings and specially to prevent the dangerous events to start it or to alleviate its effects if it is unpredictable. Enrico Quarantelli is a researcher that provided some essays about disasters and panic in crowds' phenomena.
In (Quarantelli, 1975) Quarantelli identified a certain set of prejudgments related to how people observe the crowds' behavior in panic situations: • People would behave "irrationally", out of control; • Thanks to media and films, panic is associated with despair, paralysis (shock) and an instinctive behavior caused by the panic itself, forcing a subtle mind changing similar to the one found in "Strange Case of Dr. Jekyll and Mr. Hyde" by Robert Louis Stevenson.
These prejudgments are passed to the safety and damage control personnel, such as firefighters, police officers, public managers, among others. For example, the fear of inducing panic just by informing people about the hazardous event could be more dangerous than the life-threatening event itself. Even with relevant and crucial information for crowd control and to minimize material and human losses, the fear of generate more panic could block the right actions at the appropriate time, which in a panic situation could be disastrous. For Quarantelli, the mere mention of a dangerous situation does not trigger or amplify the crowd's panic state (Quarantelli, 1975).
In spite of what was proposed by the early researchers of collective behavior such as Gustave Le Bon, the human behavior during crisis is controlled instead of impulsive, it uses the right means to achieve its goals and it is organized and functional most of the time. However, that does not mean that an irrational behavior is avoided during the crisis; the incidence of such behavior is lower than what was intuitively observed.
Just like the other collective behavior and panic researchers, Quarantelli also provided the panic's main features, based on his studies and the analysis of other studies from Japan, France and England, and they are the following: • A person in a panic in crowds' situation deals with fear instead of anxiety; • The future is more important in such situations than the past; • There is a trend to focus in a specific dangerous spot instead of a general threat; • The members of the collectivity define the situation as dangerous and identify a direct threat for their survival (Quarantelli, 1975).
Quarantelli stressed that individuals keep their rationality and sociability during their escape from hazardous places: they avoid obstacles and other people as much as possible. The individual still can force his way over the others, but that will happen only in extreme conditions (Quarantelli, 1975).
This chapter will present a simulation model for panic in crowds phenomena based on the symbolic interactionism approach. The panic phenomenon works as follows.
Initially, people are in an ordinary condition. In that condition, social structures and norms are lined up to what is accepted by society. At the moment disarray in the established social structure is noticed, individuals start feeling uneasy and apprehensive, trying to understand the ambiguous situation that occurred. A disturb is an event that shows itself as an imminent threat to the individual's life, such as a fire alarm, a smoke cloud or objects falling from the shelves, and such event calls up the person and compels him to act, leading to a social unrest.
After that, the persons search information that could help them in redefining the present context. They become more likely to rumors because of the feeling of uncertain and insecurity. The conventional behavior starts to break down. The need to comprehend the situation increases, so they engage in a milling process, watching the other individuals' reactions and comparing those reactions with your own set of expectations. Also, a need for a sanctioned and socially-built meaning arises into a relatively non-structured situation (Turner & Killian, 1957). Milling is substantial since it makes the individual focused to the situation and the actions performed by the collectivity, removing the focus out of him. Due to the fact that the focus now lies on them, the individuals reply faster and directly to each other, setting up the environment for the shaping of a shared knowledge of what is happening. From that point, the collective enters the collective excitement stage, when the group blends and synthesizes the personal representations, helping in the formation of a collective representation/image of the situation. The individual's susceptibility is enhanced by this shared representation, which also decreases his capability of making distinct impressions from the collectivity.
Thus, the individual could follow a socially forbidden line of conduct that he could not conceive and perform, such as pushing and running over people. Social contagion starts as an intense form of collective excitement, it starts fomenting a fast propagation of the collectively formed representation, strengthens the social cohesion and prepares the crowd for a collective action. Finally, after a collective representation of the situation is built by the individuals, it is possible to pick an action and execute it. Up to this moment, the collective crisis started by a struggle for survival comes to an apex, and the collective panic is installed. Considering that the crowd members do not share conventional expectations about how they are supposed to behave, the outcomes are uncertain. Figure 1 shows an overview of these stages.

Multi-agent based simulation: Usage and features
A simulation is the representation of a contextualized system into another context. This description applies to any kind of simulation, not just computer simulations. The Apollo space mission had applied simulations to evaluate techniques and devices before the real mission was performed. Since the mission posed a great risk and there was no much room for on-the-fly modifications, everything must be tested and checked beforehand.
In Ruas et al. (2011) simulation (especially multi-agent based simulation) is regarded as a third way of doing science. While induction studies the whole by a sample, deduction does the opposite. Simulations get the best of induction and deduction at the same time: the general and macro-level of a process provides the framework, while the interactions among simulation elements show the micro-to-macro transition and the emergence of behavioral patterns, as in the induction process.
Throughout this section, the simulation process is described. The focus will be on the multi-agent based simulation, which will be applied in the model presented in the next section.

How a simulation is designed
The design of a simulation is the building of a model that will be able to mimic the operational and dynamic features of a real system. This model allows a deeper study of the system in a controlled and isolated context Zeigler et al. (2000). This usually poses as a requirement for some systems since the analysis and observation of certain phenomena and their activities can be impossible, impractical or hazardous.
There are two major approaches for computer simulations. The first approach uses differential equations and other mathematical formulas to build the simulation model. The simulation execution becomes the evaluation of such formulas and the iterative resolution of the differential equations. Such approach is named analytic and it has its value and it is quite practical and useful for certain applications. However, it usually lacks a detailed vision of what happened, working as a "black box". For some simulations, this is not an issue because the only thing that matters is the final result and not the mid-steps required to achieve it. Also, this sort of simulation usually deals with a continuous stream of time. Since there is no need to observe the simulation's inner steps, a continuous approach is more logical.
On the other hand, a second approach for simulations uses a set of autonomous modules (programs) called agents. The resemblance of agent based technologies and a realistic social system model has created a new scientific field with a strong emphasis on the interdisciplinary called Multi-Agent Based Simulation (MABS) Cohen & Felson (1979). It is a collective effort to integrate scientific areas and the usage of computational technologies that were previously applied to other tasks, such as networking. The main purpose of MABS researchers is to create and study computational models for simulation taking the technical and theoretical infrastructure of the Distributed Artificial Intelligence into consideration.
Based on such approach, the simulation model represents a specific target system that allows (i)the observation and study of the global behavior of the modeled system under certain criteria and (ii) the analysis of the consequences of the changes in the system's internal components Gilbert & Terna (2000), which implies that MABS can be used to detect emergent patterns and how changes interfere on the agents' behavior. Ruas et al. (2011).

Agent and multi-agent based simulations
A specific definition of Agent describes it as a discreet entity with its own goals and behaviors, and also internal states and behavior rules that allow the interaction with the other agents and with the environment. Another definition can be found in Russell & Norvig (2004), and states that "An agent is anything able to perceive the environment through sensors and to act upon the environment by actuators". Once more, the emphasis lies on the agent, the environment and the relationship between them. Whatever entity that needs to be considered in the simulation by its autonomy, by its independence in the decision making and by its ability to interact in the environment can be seen as a simulation agent dos Santos França (2010).
Agents must have autonomous actions, and such actions must happen synchronously with an event-based time scheduler, that will serve as an observer and a time and step manager along with the agents.
The main concept behind a Multi-agent simulation model is to simulate an artificial world which is made of computational interactive entities. Simulation is then created by the transposition of entities (or sets of entities) and the interaction among such entities from the target system to the artificial world Dimitrov & Eriksen (2006).
The multi-agent based simulations have an adequate infrastructure for modeling, studying and understanding the process related to complex social interactions such as coordination, collaboration, group formation, conflict solving, among others. Thanks to the relationship between local and global behaviors and the analysis of the agents' influence over themselves and the environment, it is possible to analyze the social interactions, which leads to cause-effect relations of how agents' components affect their behavior, how such behavior affect the group and, likewise, how the group itself affect these components. The analysis of the situation implies the analysis of the environment where the agents are located, the decisions taken by those agents, how such decisions affect the environment and the other agents and how the groups of agents can affect the agents' internal attributes dos Santos França (2010).
The multi-agent model for the panic in crowds phenomenon described in Section 3 belongs to the social-cognitive model class David et al. (2004) because such models have their focus on formalization and testing of theories, models and hypothesis related to theoretical-structural aspects of social systems. The main concern in this class of simulation models is the dynamic behavior of the simulation instead of an exact and perfect outcome analysis. For this class, the straight comparison of the simulation outcome and some empirical data could render pointless because the target system cannot be fully represented in any form, especially if the system is complex. Therefore, the subject of study of the panic model described in Section 3 matches the structural logic of the target system and it works in two dimensions:

Conceptual model
The multi-agent based simulation models share some common features. The model has autonomous and heterogeneous, they are not under a central authority's orders because they are built to be self-organized and with local interaction rules.
The agents are in an environment that encourages the interaction among agents so that the model can fulfill its main goal: to be open to the emergency of phenomena due to the interaction among agents and the environment, which makes the multi-agent based simulations work as complex systems. A system is said to be "complex" if its overall behavior cannot be described by just looking at its inner elements' behaviors. In order to understand a complex system's behavior, the observation of the emerging patterns created by the agents' interactions is required.
The following list has some situations which the agent-based models are more suitable for watching the emergent behavior da Silva et al. (2008): 1. When there is a substantial need to design heterogeneous agents populations, and such heterogeneity enables the modeling of agents with rationality and clear and distinct behaviors; 2. Every time the agents' interactions are discontinuous, non-linear such as the individuals' complex behavior, which make the process harder for classical analytic ways; 3. Whether the agents' interactions' topology presents itself as heterogeneous and complex, such as the social processes, in specific the inherent complexity of the physical and social networks.

Computational model
The Computation Model is the representation of the Conceptual Model in a programming language or simulation tool so that model can be evaluated and analyzed. The process of building the computation model is similar to application software development. Usually, the same tools are employed, such as text editors, integrated development environments (IDE's), testing tools, graphics libraries and so on.
The usage of a simulation framework allows the developer to keep her focus on the model and the simulation details instead of the programming language and running environment details. There are many simulation frameworks available, such as Repast, NetLogo and Swarm.
Most of these frameworks can be combined with other tools and libraries. For instance, the Swarm Framework SwarmTeam (2008) is written in Objective-C and it also supports Java for simulation building. Since a simulation could be written in Java, it would be possible to use Java-based libraries -such as JESS Friedman-Hill (2009) -to enhance Swarm agents and the simulation as a whole.
Usually, the simulation developer must create objects that represent her agents. The agents' variables become the objects' fields. Likewise, the agents' actions become methods.
The simulation developer may face some challenges, such as: • The choice of a random number generator or the creation of a customized one. Some frameworks provide a generator. However, for some specific situations, a generator created from scratch must be required. Although they are called "random", in reality they are pseudo-random, and that happens for a reason: a simulation (even multi-agent based) usually requires numbers that set the simulation up and could be fed during the simulation process. The developer must be in control of the numbers' generator to avoid an excessively predictable behavior and a fully random behavior; • The usage of supplementary tools that might aid the simulation process and the post-process. These tools include databases, graphical viewers and network facilities, among others. Just like the random number generator, some frameworks provide these tools. It is up to the developer to choose either the tools found in the framework or to create them on her own , or even mix the best tools from both sides;

Verification and validation
An aspect of great relevance in simulations is how accurately the conceptual model and the computational model depict the target system. Two processes can be used to check such confidence.
The first process is called validation. Its main purpose is to make sure that the conceptual model represents the target system in a certain (and desirable) level of precision and to show whether the simulation's results match the target system Ruas et al. (2011).
Verification goal is to certify if the conceptual model was rightfully implemented (translated) in the computation environment. Since a computer simulation works as a software application, it is possible to use software engineering tools, such as unit tests, to certify that the behavior designed for the simulation (found in the conceptual model) really happens in the software execution.
The validation process aims to certify that the conceptual model represents the target system in an acceptable degree of adherence. Thus, the validation processes fundamentally addresses a specific question: Does the simulation outcomes correspond to those from the target system? On the other hand, the verification process' main purpose is to assure that the conceptual model was correctly translated to the computational environment. Specifically, a multi-agent simulation model is based on the concept that it is feasible to simulate an artificial world inhabited by interactive computational entities. Such simulation can be achieved by transposing the population from a target system to its artificial counterpart. In that sense, an agent is similar to an entity or a group of entities of the target system. Moreover, agents can be of distinct natures and granularities, such as human beings, robots, computer algorithms, inanimate objects and organizations. (Ruas et al., 2011)

From theory to practice: Conceptual model
In order to build a conceptual model for the panic in crowds' phenomenon the following elements will be discussed: 1. The architecture of the agent that represents a person in a panic situation; 2. Three environments (General, Physical, Communication) where the interactions' main aspects happen; 3. A socially built system -Collective Mind -that describes how individual representations are transformed and synthesized by the group so they form a shared context (dos Santos França et al., 2009).
This model proposes the interactionism approach presented by authors such as Blumer (Section 2.1.3). A generalized flow based on that theory is shown in Figure 2. It is worth noticing that the exhibition of the steps is in a sequential order for didactical purposes. However, it is possible that a person follows a distinct order, not performing some steps or repeating others.

General environment
This element represents a general overview of the environment where all the interactions among agents will happen, and it has the Physical Environment, the Communication Environment and the Collective Mind. Its purpose is defining the boundaries of the other environments and their linking points. Figure 3 shows the proposed diagram for the relationship of these elements.

Physical environment
The Physical Environment describes the space where the physical interactions among agents occur, as well as the interactions between the agents and the other objects such as obstacles and walls. There are specific spots for the threat and the exits. Figure 4 shows this environment   This environment, along with the Person agent, also has the Obstacle, Threat, Exit, Milestones and Fire Spot agents. An Obstacle blocks people's passage, forcing them to dodge. In the model described in (Helbing et al., 2002), the building structures (walls and pillars) and the wounded and immobilized individuals are treated as obstacles.
The Threat agent is the element that triggers the exciting event in a panic situation. For the model described in (dos Santos França, 2010) in particular, it is a fire incident modeled by a structure that represents the environment's heat as a 2D grid. Such structure is responsible for heat diffusion between cells.
The Exit is the physical environment's safe haven. When the Person agent arrives on that place, he does not feel threatened and he gets disengaged from the collective behavior, which makes him no longer relevant for the simulation.
Milestones bound Threat's influence zones and they serve as reference to the emergent behavior analysis. Fire Spots are fire's control points that establish how far the fire went through the environment. Along with the Milestones, the Spots can help in outlining potentially safe or dangerous zones, working as if buzzers and visual alarms were triggered by a smoke detector. However they do not exist physically; they are just the representation of the agents' response to such elements.

Communication environment
The Communication Environment manages and serves as medium for the three communication forms among the agents: through the environment (physical perception), directly (sender/receiver model) and indirectly (dissipation/perturbation). In this third form, whenever an agent wants to communicate with another, it places the message on the environment (dissipate) and if another agent may be disturbed by that message or not. That occurs because it is not possible to control the expectations and actions from the other agents and assures that the communication will happen a priori Figure 5 shows the Communication Environment. Fig. 5. Communication Environment.
A Blackboard system (Rich, 1988) was used for the direct and indirect messages. Physical information was gathered directly from the environment.

Collective mind
The Collective Mind manages expectation networks that are socially built. These expectations arise because the agents look forward to certain behaviors from other agents, as well as the knowledge found in the agents themselves that their actions can also be part of the expectations of the other agents. The Collective Mind also makes abstractions, generalizations and schemes from the individual expectations, taking control of the emergent process of a current context shared representation (dos Santos França, 2010).

Person agent architecture
The Person agent portrays an individual that will have a behavior related to the collective panic situation. Such behavior is directed by the Symbolic Interactionism and Norm Emergent theories described in Section 2.1.3. An overview of the agent's architecture can be found in Figure 6.

Reception and Data Gathering Module
The main function of the Reception and Data Gathering Module (RDGM) is listening to the environment, gathering relevant information, establishing the nature of such information and storing it in the Information Storage. This module has two cores: the Data Selector that scans data for the creation of a current situation portrayal, and the Information Analyzer that checks the information integrity in terms of syntax and semantics and passes the information to the correct information base: Knowledge Base of Belief Base. Physical information is always treated as knowledge and information provided by other agents is accepted as a belief until it is confirmed. The Social-Cognitive Module can also request data gathering on the environment if the agent needs some information from the other agents (dos Santos França, 2010).

Hybrid Belief-Knowledge Management Module
The module that manages the information bases and the rule set of the Person agent is the Hybrid Belief-Knowledge Management Module (HBKMM). The information can be modeled by a stochastic, logical or a fuzzy approach that is used because some information kept by the HBKMM is imprecise and incomplete by nature. Since there is fuzzy information, a Fuzzy Process is also required so the information can be fuzzified and de-fuzzified according to the agent's demand (dos Santos França, 2010).
The Rules and Information Repository groups the Information Store that keeps the beliefs, knowledge and the micro collective representation, and the Rule Set which holds the Person agent's general behavioral rules.
The Information Storage holds deterministic (analyzed using equations or algorithms), probabilistic (that follows a stochastic uncertainty that defines whether it is truth or notor fuzzy information -that deals with the possibility of the information being truth or not in a scale. The Knowledge Base stores the information that are treated as secure and confirmed by the agent. In model shown in (dos Santos França, 2010), if the information requires physical evidences, but the agent could not be able to get the evidences using its own perception, then the information is treated as a belief. Thus, the agent's variables can do a status change (from belief to knowledge) during the simulation.
The agent' personal features define the state of the agent. They are variables that change their value according to the information gathered by the agent and the agent's actions and processing. There are also constant features that were defined before the simulation started and their values do not change during the simulation.
An example of the agent's variable is the Dangerousness. It is a complex variable that relies on other variables of the agent, such as distance from the threat, health, the agent's experience on this kind of hazardous phenomenon, among others. Considering that this variable has fuzzy information, in order to be fuzzified and de-fuzzified a fuzzification table (Table 1 is used. Figure 7 shows how a graphical view of such  The Rule Set has all the rules that the Person agent may perform during the simulation. An example of rule is "Establish the Agents' Pressure Limit" that updates how much pressure the agents can hold based on their individual size. Listing 1 describes how this rule is performed. The CogC stands in continuous processing, managing information and guiding actions so the agent can pursue its goals. As long as the individual is in a situation that does not pose as a threat to its life (see Fig 2, item 1), the CogC leads the agent to a certain behavior that it accepts the rules and roles established in the society. However, if an event that poses a threat is triggered, the CogC passes his duties to the CBC. This replacement makes the agent act in a collective way, engaging in the collective behavior. Also, the CBC deals with the agent's collective behavior state machine.
In order to quantify the threat, the agent checks his experience and the hazardous level he assigned for the current situation. Up to that moment, the functional rules remain strong, and the reactive ones still remain weak. The individual does not have enough information to go to a specific line of action. Thus, in order to go to the next step (social unrest), the uncertainty level assigned for the situation must be higher than a certain threshold, which implies that the agent doesn't know what is happening, so he feels that he needs more information about the event (dos Santos França, 2010;dos Santos França et al., 2009).
When the agent goes to the social unrest state (Fig. 2, item 2), he looks for information that helps him to analyze what is going on. Its uncertainty level rises since it is unable to understand the event by himself. Thus, he , so it engages in the milling process (Fig. 2, item  3). At this point, the agent increases his communication with the others, trying to build his own MICRO COLLECTIVE REPRESENTATION (Fig. 2, item 4). At the same time the personal value variable is affected, increasing the agent's acceptance for external thoughts. The agents become less aware of themselves as individuals and more aware of the others. The dynamic rules (e.g. learning how to perform an operational task) become weaker because the sense of urgency is stronger in a dangerous situation than in an ordinary condition dos Santos França Collective excitement (Fig. 2, item 5) begins when the permissiveness starts to interfere on the agent's choices. At this point the agents can choose socially unacceptable actions, such as running over people. Functional rules lose their strength (mostly because permissiveness is rising) and reactive rules get stronger.
When the agents define a goal and an object for action, the macro collective representation starts to develop and to establish.
This step is called social contagion (Fig. 2, item 6) because the communication and interaction among agents are in such condition that some individuals -not yet engaged in collective behavior -are attracted by the group, and they are induced to be part of this process. The reactive rules become the strongest rules for the agent. Since the permissiveness is high, the agents can choose actions treated as socially improper. Dynamic rules, such as learning how to escape are limited (dos Santos França, 2010;dos Santos França et al., 2009).
Finally, the collective panic behavior (Fig. 2, item 7) is installed when the agents choose a line of action to be followed by the collectivity. The agents are fully engaged in the collective behavior, and they will stay on that condition until they do not feel threatened.
The ComC receives all requests for communication from the CogC and the CBC and puts those requests in a queue for being dispatched by the MESSAGE SENDER MODULE.

Message Sender Module (MSM)
Whenever the agent needs to send a message to the other agents, this module is requested. The MSM receives the message from the COMMUNICATION CORE. Inside the MSM the MESSAGE FORMATTER prepares the message to be dissipated on the environment by encoding, adding other relevant data, such as the message format (using an ACL) and how it should be expressed in the environment: if it is a gesture or a speech and how the message mood is (lovely, cold, etc.) dos Santos França (2010).

Bring the concept to life: Computational model
The computation model is the transposition of the conceptual model to the computational realm. In order to achieve such transition, there are two major choices. The first choice is building the whole simulation program and framework by hand. In other words, the developer could write all the elements of the simulation and a framework to manage the simulation.

Implementation details
This simulation was entirely written in the Java programming language. As it was described in Section 2.2, each agent (Person, Exit, Threat and Obstacle) was modeled as a Java class.
The framework used to implement this model was the Swarm Framework, found at (SwarmTeam, 2008). The database engine used to store the simulation statistical data was the HSQLDB (Hsqldb Development Group, 2009), a free and open-source database engine written in Java.
A simple log system was also designed and it could be set up to store step-by-step state data for all agents or just for a set of them. The log data was stored using the YAML standard for better human readability than CSV or XML.

Fig. 8. Simulation Screen Shot
The Swarm Framework does not provide an Expert Systems' support, so the JESS (Friedman-Hill, 2009) (Java Expert Systems Shell) library was applied. FuzzyJ (Brown, 2009) was used for the fuzzy logic rules.
In order to keep the simulation "random" and controlled at the same time, a set of ten random seeds were chosen. Since the simulation was run ten times, for each simulation run a specific random seed was used to keep the simulation analysis consistent.
The usage of a multi-agent simulation framework as Swarm allows the developer to think more about the simulation itself rather than the crosscut concerns, such as graphics. Figure  8 shows a screen shot of the simulation. All the graphical elements were drawn by Swarm Framework. Each colorful dot represents an agent, while the red area on the left is the threat (fire in this example).
Since the model is social-cognitive, the best validation approach is by analyzing the dynamic behavior of the simulation and checking if such behavior is coherent with the theory. The data gathered during the simulation combined with its dynamic behavior is used to validate the conceptual model. Swarm displays the physical environment as an animated 2D grid (lattice), and such animation provides the dynamic aspects of the simulation.

Earthquake simulation model: A proposal for future works
The previous sections described the panic in crowds' phenomenon, both in its theoretical aspects and its practical issues. The collective behavior studies shown earlier were used as basis for the simulation model proposed in Section 3. Also, the main concepts regarding multi-agent based simulations were also presented. The computational model was tuned for a fire incident. Could it be feasible to do the same thing for earthquakes?
In order to answer this question, a discussion about the definition of disaster must happen. Once again, Quarantelli provided a study about disasters and earthquakes in (Quarantelli, 1981). The first part of the aforementioned paper pondered about the definition of disaster and how researchers usually face the matter.
According to Quarantelli, some researchers have a biased and habitual view of disasters which partially blinds them from other possibilities. There would be two ways of analyzing disasters: focusing in the agents that caused the disaster or taking a more generic approach.
Quarantelli identified seven conceptions of disaster. Each conception analyzes disaster events through different approaches. Some of these approaches are related, but they are focused in distinct elements of the disaster: Physical Agents This conception accepts a disaster whenever its primary cause is identified.
And it seems natural that the cause for an earthquake is different from the cause of fire. The focus is pointed at the physical agent that caused the disaster. Such agent (the cause) must be described in detail, and the knowledge about one agent does not help in analyzing another one. Distinct agents require completely distinct studies; Physical Impact of the Physical Agent Whenever there is a noticeable physical impact in some part of the environment, the disaster is identified. The physical agent is no longer relevant, but how this agent affects the environment. Instead, how the physical agent's features in the geological, biological and social-technical spheres of the environment affect the impact becomes more relevant than the agent itself; Assessment of Physical Impacts While the first conception deals with the physical cause alone and the second conception analyzes the impact of such agent in the environment, this conception understands the disaster by the assessment performed on the physical impact. Thus, an event can only be called a disaster if the physical impact crosses a certain benchmark or threshold defined in an assessment. For instance, an earthquake could only be called a disaster if its strength -measured in the Mercalli and Richter scales -goes beyond an established level and it becomes notable;

Social Disruptions Caused by an Event with Physical Impact
For this disaster conception, if the physical impact also causes a social disruption of the social life -represented by dead bodies and wrecked buildings, for example -the event is treated as a disaster. Following this conception, in order to identify a disaster, a social disruption (disorganization) must happen due to some physical impact, and the disaster will be graded by the social disruption;

Social Construction of Reality in Perceived Crisis
The previous concepts take the physical element into consideration for defining a disaster. It is assumed that some physical event happened and that triggered the disaster, be it directly, by its impact, by an assessment or by the resulting social disruption caused by the impact. The physical component takes distinct roles in each definition, but it must always be present. The conception of disaster as a social construction of reality takes the people's perception as the key element to identify some event as a disaster. There is no need for physical evidence. If people believe that the situation is dangerous and poses as a threat to life, property, well-being or social order, the event is accepted as a disaster. Quarantelli stated that this approach makes the disaster a relativistic term rather than an absolutist one. Different groups may interpret the same event as a disaster or not;

Political Definition
Being slightly similar to the previous conception, the political definition claims that the disaster definition comes from a political standpoint, even if the event could be accepted as a disaster for the other conceptions. On the other hand, by political demand, a situation that could not be portrayed as disaster may be addressed as such. Quarantelli stated that for those who define disasters by this definition "the formal designation can make a difference in everything from mitigation and prevention, to response and recovery activities." (Quarantelli, 1981). Therefore, a political decision on the matter of disasters can make all the difference between prevention, fast response / recovery and further damage control; Unbalance in the Demand-Capacity This final conception takes a disaster as a type of crisis situation or a social occasion. An event is considered a disaster if the demands for urgent actions due to a threat to high priority values and the resources available do not meet such demands. Quarantelli recalls Erwin Goffman when he used the term occasion, which is related to "non-routine and emergent collective behavior". Thus, if the situation requires an unusual and new social behavior to balance the needs and the resources found in the occasion, that situation leads to a disaster.
These concepts ranged from a purely physical approach to social related approaches and a social behavior approach. However, the concepts can be analyzed on a second point of view: the first concepts are more physical-specific centric, which means the physical component is relevant and in order to study the event a very specific look is required. A diverse physical agent implies a diverse analysis.
In turn, the final concepts are more social-generic centric, which lead to more generalized perception of disasters, an attempt to find common elements between disasters caused by different physical agents.
In a science committee which discussed the similarities between different types of disasters, Quarantelli pointed out that "The comparisons attempted clearly showed a conscious belief that trying to perceive phenomena which are not usually grouped together within the same framework, might prevent us from being partially blind in the way it was stated at the beginning of this paper" (Quarantelli, 1981).
In other words, when the researcher sees disasters in a generalized perspective it is possible to notice certain elements that could not be seen if the focus was just in a specific kind of disaster. Quarantelli's statement key word is framework. If a framework is designed for disasters in general, that means it could be applied to any sort of disaster with minimal effort.
Quarantelli endorsed a social-generic centric view for disasters, especially when "the problems are divided by time stage, by functions or levels of response" (Quarantelli, 1981). He mentioned Ralph Turner (from the Emergent Norm Theory) who stated "that much of what we know about how people respond to threats and warnings for other dangerous possibilities, is equally applicable to prediction scenarios for earthquakes". On the other hand, that does not imply that the specific study of earthquakes is unnecessary; seismologists still need to analyze earthquakes as much detailed as possible, treating earthquakes as disaster agents. For social and behavioral scientists, though, the best approach is accepting earthquake as members of a more generic class.
The answer for the question proposed at the beginning of this chapter is yes, it is possible to apply the model presented in Section 3 for other types of disasters. However some minor changes must be done in order to use the model properly for an earthquake disaster: • The threat in a fire incident has physical properties that can be modeled in a simulation as if it was a physical object. Therefore, the fire can be seen, smelled and even heard which implies that the agents can get these physical properties right from the environment and make assumptions on them. An earthquake disaster cannot be turned to a physical object: the whole environment can be felt by the agents. Also, the agent does not measure how dangerous the situation is by looking at the basic physical properties in the same way for a fire incident and an earthquake; • Although the earthquake is no longer "visible" as an object of its own, it is still visible and noticeable by objects falling and structures crumbling. Also, people still can talk about and discuss their feelings and impressions about the event they are going through, keeping the threat into the communication domain; • Some basic attributes used by the agents for decision making, such as distance from the threat, are no longer relevant. New attributes and variables must be created, such as the tremor perception. On the other hand, some variables, such as the agent's experience in panic situations, become stronger and even more relevant for the decision making process. Dangerousness and nervosism keep their relevance and usefulness for this simulation; • The definition of exit as a safe haven remains valid up to a certain level: some buildings have regions that may be used as a safe haven, such as a pillar or under a table. For simplification purposes, the best choice for safety could be remained as the exit of the building; • Finally, a fire incident could last from minutes up to hours. The simulation presented previously showed a fire incident that last 5 to 6 minutes. An earthquake incident usually lasts only a few minutes not taking the aftershocks into consideration (Bolt, 1973).
The changes mentioned earlier do not imply a physical approach to earthquake disasters because all the collective behavior and panic in crowds' elements (such as the collective behavior stages, the collective mind and so on) remain the same. Besides, these changes can be described as parameters of the simulation and hence the model described in this chapter could be accepted as a framework for panic events.

Conclusions
The panic in crowds' phenomenon has been studied for decades by many researchers. Such study is important for predicting and evaluating human behavior patterns in disasters. Although natural disasters are becoming more predictable, their outcomes cannot be easily foreseen. Panic in crowds works as a complex system, which implies that analyzing each individual and element alone does not provide the big picture required to understand the event as a whole. A broader view can notice the behavioral patterns that emerge from the interactions among individuals and it is more suitable for studying hazardous events, such as floods and earthquakes.
Simulating a disaster in real-life is dangerous and unethical. The usage of computer simulations allows the disaster event to happen in a controlled environment with no human loss of any kind. If modeled right, behavioral patterns can be extracted from the panic situation described by the simulation model. Such patterns might help disaster control groups to train people which it will minimize human and material losses. Also, it helps architects, technicians and engineers in designing buildings, rooms and other tools so they have a lower impact on the evacuation procedures during a crisis. Finally, simulations can be used to check and validate new ideas and to propose and check "what-if" scenarios that could be unfeasible to replicate in real-life.
Since panic in crowds is a complex system, a multi-agent based simulation is the best choice to model this kind of phenomenon. This chapter did a historical overview of the collective behavior's studies, since their early ages when collective behavior had a sense of wrongdoing and error up to common, still not institutionalized, social behaviors and the panic in crowds' theories. Everything was bound so further studies could be accomplished and a deeper discussion about the social elements of panic situations could happen.
After that, a simulation model based on the symbolic interactionism and the emergent norm approaches was presented. The model strictly followed the collective behavior formation steps analyzed by the aforementioned approaches and expanded it with computational tools such as expert systems and fuzzy logic. The conceptual model was tailored for fire incidents and a computation model was built, showing that the model can be applied and the fire incident simulation is possible.
Then, a key question was addressed: if it would be possible to use the same model for disasters such as earthquakes. The definition of disaster itself was put into question. As it said earlier, by looking the panic situations as complex systems, a broader view achieves better results than a physical agent focused analysis. Henceforth, the model presented by this chapter could be used for any kind of panic situation, including earthquakes, with minimal adjustments required.
Thanks to the theory and the simulation presented here, new lines of research could be derived. For instance, it would be possible to analyze composite panic situations, such as fire caused by an earthquake, as well as to identify the hazardous and complexity levels of such phenomena which are great pieces of information for authorities and damage control groups so they might create better procedures and allocate resources in critical situations. The study of earthquakes plays a key role in order to minimize human and material losses when they inevitably occur. Chapters in this book will be devoted to various aspects of earthquake research and analysis. The different sections present in the book span from statistical seismology studies, the latest techniques and advances on earthquake precursors and forecasting, as well as, new methods for early detection, data acquisition and interpretation. The topics are tackled from theoretical advances to practical applications.