BABEȘ-BOLYAI UNIVERSITY CLUJ-NAPOCA FACULTY OF MATHEMATICS AND COMPUTER SCIENCE SPECIALIZATION HIGH PERFORMANCE AND BIG DATA SIMULATION OF AGENTS… [625428]
BABEȘ-BOLYAI UNIVERSITY CLUJ-NAPOCA
FACULTY OF MATHEMATICS AND COMPUTER SCIENCE
SPECIALIZATION HIGH PERFORMANCE AND BIG DATA
SIMULATION OF AGENTS
APPROACH FOR MODELLING
CONTAGIOUS DISEASE SPREAD
Supervisor
Lect. Phd. Horea Greblă
Author
Oprea Mădălina Mirela
2016
Contents
Chapter Page
Chapter 1 – Introduction
1.1. Background …….…………………………………………………………………………. 4
1.2. Motivation and Aim ..……………………………………………………………………. 5
1.3. Purpose of Study……….…………………………………………………………………. 6
1.4. Organization of the Dissertation…………………………………………………………. 6
Chapter 2 – Agents Based Modelling and Simulation
2.1. Introduction of Artificial Intelligence ………….……………………….………………… 7
2.2. Characteristics of Agents ..……………….………………………………….…………… 10
2.3. Concrete Architecture for Agents …..………………………………….………………… 13
2.3.1. Logic-Based Architecture …………….………………………………….………….…
14
2.3.2. Reactive Architecture …………….…………………………………….…………….… 15
2.3.3. Belief-Desire-Intention Architecture ………………………………….……………..… 16
2.3.4. Layered Architecture ………………………………………….………………………… 17
2.4. Agent Oriented Programming Software .….………….…..………………………….…. 19
2.5. Agents Based Modelling and Simulation .…………..…….……………….….………… 24
2.6. Crowd Modelling and Simulation ……………………………………………….……… 29
2
Chapter 3 – Agent-Based Modelling Simulators
3.1. Agent-Based Modelling Platforms ……………………………………………………. 32
3.2. NetLogo …………………………………………..…………………………………… 33
3.3. JADE ……………………………………………………..…………………………… 35
3.4. RePast …………………………………………………………………………………. 36
3.5. Examples of Agent Based Models ..…………………………………….…………..…… xx
Chapter 4 – Results
Chapter 5 – Conclusions
3
Chapter 1 – Introduction
1.1. Background
Agent-based modelling(ABM) is a new analytical method for the social sciences, but
one that is quickly becoming popular. It enables one to build models where individual entities
and their interactions are directly represented.
Formally, agent-based modelling is a computational method that enables a researcher
to create, analyze, and experiment with models composed of agents that interact within an
environment .
The advantages of ABM over other modeling techniques can be captured in four
statements: emergent phenomena, natural description of a system, flexible and it is low cost
and time saving approach.
The analysis is concerned with the modelling of approach for contagious disease
spread in airports that arise around the world. The transmission of disease through air travel is
an important public health concern, because airports afford opportunities for close human
contact, sharing of common spaces and a high number of affected surfaces.
There are three types of air traffic control activities in this terminal area: aircraft
sequencing operations which guide the traffic inside the airport terminal area, runway
operations which model aircraft landings and departures and taxiway operations which
control aircraft from the gate to the runway for departures and back. Those three operational
component should be handled as one task.
The airport environment is unique in that there is an interaction of considerable
number of humans from geographically diverse countries with differing population immunity
and diseases, who all interact with airline and airport operation staff.
4
1.2. Motivation and Aim
Travel is all about people moving! Airlines have undertaken a variety of measures
over the years to minimize the risk of in-flight transmission of infectious passengers. People
should consult travel experts, ensure that they have recommended pretravel immunizations,
and inquire about current health guidelines for travelers. Adventurers should always consult a
doctor before traveling. There is a need for international guidelines to deal with medical and
ethical issues related to pre travel screening and restrictions.
The motivation of this study is to develop an agent-based modelling approach for
contagious disease spread in airports in view of understanding better the risks. A way of
dealing with disease transmission is described by simulation which is used when handling
experiments with no impact on real objects would be impossible. As a consequence of
testing, the system will not support considerable tests or duration of the experiment in real
time is impractical. The agent-based approach allows us to realize the full potential of the
data we have about diseases by modelling his spread as a system agent according to these
data.
The agents are used to represent social actors, infected and healthy people, made to
react to the computational environment in which they are located, where this environment is a
model of the most popular environment in which social actors interact.
5
1.3. Purpose of Study
The goal of this dissertation is to investigate the enabling role that agent based models
simulation for infectious disease transmission in airports. Intensive travel and trade patterns
facilitate the spread of pathogens within and between countries. As a result, simulations can
help to improve comprehension of disease spread dynamics and to take better steps towards
the prevention and control of an epidemic outbreak.
There are some examples of person-to-person transmission that follows and can lead
to large numbers of affected people. The agent-based approach offers new ways to
understand the spread of the disease and a tool to evaluate risk and test control strategies,
using values extracted from the literature.
1.4. Organization of the dissertation
This first chapter begins with a brief overview of introduction of Artificial
Intelligence, which includes the area of agents. Also, it is described the characteristics of
agents, agent oriented programming and agents based modelling and simulation.
The second chapter introduces the concept of agent-based modelling simulators,
outlines their historical context and presents a few examples of tools conducted. Also, there
are presented some examples of agent based models using RePast.
The third chapter dives into specifics of building agent-based models and showing
step by step how one can build an agent-based model for disease spread based on immunity.
using RePast.
In the fourth chapter, it is presented a possibility to improve the agent-based
modelling by using Repast HPC, because it allows to study the behaviour of populations with
the size of entire countries.
6
Chapter 2 – Agents Based Modelling and Simulation
2.1. Introduction of Artificial Intelligence
Artificial Intelligence is …
a. “A collection of algorithms that are computationally tractable, adequate
approximations of intractably specified problems” (Partridge, 1991)
b. “The enterprise of constructing a physical symbol system that can reliably pass the
Turing Test” (Ginsberg, 1993)
c. “The field of computer science that studies how machines can be made to act
intelligently” (Jackson, 1986)
d. “A field of study that encompasses computational techniques for performing tasks
that apparently require intelligence when performed by humans” (Tanimoto, 1990)
e. “A very general investigation of the nature of intelligence and the principles and
mechanisms required for understanding or replicating it” (Sharpies et al. , 1989)
f. “The getting of computers to do things that seem to be intelligent” (Rowe, 1988)
Artificial Intelligence is one of the newest discipline. It was formally initiated in
1956, when the name was coined, although at that point work hard been under way for about
five years. Along with modern genetics, it is regularly cited as the “field I would most like to
be in” by scientist in other disciplines.
AI encompasses a huge variety of subfields, from general-purpose areas such as
perception and logical reasoning, to specific tasks such as playing chess, proving
mathematical theorems, writing poetry and diagnosing diseases. Scientists in other fields
move progressively into artificial intelligence, where they find the tools and vocabulary to
systematize and automate the intellectual tasks on which they have been working all their
lives. In other words, it is definitely a universal field.
Scientists in the field of Artificial Intelligence (AI) try to gain a deeper understanding
of some of the mechanisms underlying human apprehension. Nowadays rule-based expert
systems are used in different types of applications and they can help to save money and time
7
by providing domain-specific advice as soon as a certain amount of expert knowledge has
been successfully encoded into their rules and knowledge bases.
In their book’s introduction Russell & Norvig (2003) distinguish four approaches to
AI that have been followed in the past and are introduced here:
1. Systems that act like humans – The Turing test was proposed to evaluate an AI
system’s human-likeness;
2. Systems that think like humans – Wachsmuth pointed out that “AI differs from most
of psychology because of its greater emphasis on computation and it differs from
most of computer science because of its greater emphasis on perception, reasoning
and action. ”;
3. Systems that think rationally – This territory is highly active in the AI community
trying to solve or at least prevent this and similar problems by inventing special
purpose;
4. Systems that act rationally – Newell said “If an agent has knowledge that one of its
actions will lead to one of its goal, then the agent will select that action.” This
approach involves the ability of an agent to follow the “laws of thought” specified
above with deliberative goal-directed action as addition.
Turing Test defined intelligent behaviour as the ability to achieve human-level
performance in all cognitive tasks. The test Alan Turing proposed is that the computer should
be interrogated by a human via a teletype and passes the test if the interrogator can not tell if
there is a computer or a human at the other end. Programming a computer to pass the test
provides plenty to work on and would need to possess the following capabilities:
● Natural language processing for enabling it to communicate successfully in English or
other human language;
● Knowledge representation for storing information provided before or during the
interrogation;
● Automated reasoning for using the stored information to answer questions and to
draw new conclusions;
● Machine learning for adapting to new circumstances and to detect and extrapolate
patterns.
8
Turing’s test purposely avoided direct physical interaction between the interrogator
and the computer, because physical simulation of a person is unnecessary for intelligence.
The total Turing Test includes a video signal so that the interrogator can test the subject’s
perceptual abilities, as well as the opportunity for the interrogator to pass physical objects. To
pass the total Turing Test, the computer will need computer vision for perceiving objects and
robotics for moving them about.
The issue of acting like a human comes up primarily when AI programs have to
interact with people, as when an expert system explains how it came to its diagnosis, or a
natural language processing system has a dialogue with a user. These programs must behave
according to certain normal conventions of human interaction in order to make themselves
understood. The underlying representation and reasoning in such a system may or may not be
based on a human model.
In order to determine how humans think, we need to get inside the actual working of
human minds. One of the option is through psychological experiments for the purpose to gain
precise theory of the mind. Newell and Simon, who developed GPS, the “General Problem
Solver”, were concerned with comparing the trace of its reasoning steps to traces of human
subjects solving the same problems.
Thinking humanly is the cognitive modelling approach that brings together computer
models from AI and experimental techniques from psychology to try to construct precise and
testable theories of the workings of the human mind. AI and cognitive science continue to
fertilize each other in the areas of vision, natural language and learning.
For thinking rationally or the laws of thought approach, there are two main obstacles.
Firstly, it is not easy to take informal knowledge and state it in the formal terms required by
logical notation. And secondly, there is a big difference between being able to solve a
problem and doing so in practice. The one and the other obstacle are applied to any tentative
to build computational reasoning systems.
Acting rationally means acting so as to achieve one’s goals, given one’s beliefs. In
view of constructing a rational agent, the whole emphasis is on correct inferences. One way
to act rationally is to reason logically to the conclusion that a given action will achieve one's
9
goals, and then to act on that conclusion. Correct inference is not all of rationality, because
there are often situations where there is something which must be done.
The study of AI as rational agent design has two advantages. Firstly, correct inference
is only a useful mechanism for achieving rationality, but it is not necessary. Secondly, it is
more a scientific development than approaches based on human behaviour. The difference
between those is that rationality is not possible in complicated environments.
2.2. Characteristics of Agents
The concept of an agent has become important in Artificial Intelligence and in other
fields of Computer Science. Agent software is a speedily developing area of research,
because agents are computer systems that can decide for themselves what they need to do in
order to satisfy their design objectives.
An intelligent agent is a software that assists people and act on their behalf. Intelligent
agents work by allowing people to delegate work that they could have done to the agent
software. Agents can perform repetitive tasks, remember things you forget, intelligently
summarize complex data, learn from you and even make recommendations to you.
To understand how they work, it is best to examine some of the practical problems
that intelligent agent can help solve. Agents are something that processes internal information
in order to do something purposeful.
As the term “artificial” suggests, an artificial autonomous intelligent agent is anything
we create that is capable of actions based on information it perceives, its own experiences,
and its own decisions about which action it performs.
According to S. Russell, an intelligent agent is an autonomous entity which observes
through sensors and acts upon an environment using actuators and conducts its activity
towards achieving goals. Perception is the process of converting s omething from the
environment into internal representations. Actions made by agents change the environment.
10
Sensors are the instruments employed by the agent to gather information from
environment about its world. In fact, sensors are abstract functions in the agent’s
programming, rather than pieces of hardware, as they are on a robot.
Figure 2.1 Agents interact with environments through sensors and effectors
For each possible percept sequence, a rational agent should select an action that is
expected to maximize its performance measure, given the evidence provided by the percept
sequence and whatever built in knowledge the agent has.
Agent qualities are determined by their classification. Intellectual agents have the
most comprehensive set of qualities which allow them to build virtual worlds where they
form action plans. Some of those qualities are:
● activity – the ability to organize and carry out the actions;
● adaptability – the ability to learn from previous experience in order to possess
knowledge or inference mechanisms;
● autonomy – an agent must have both control over its actions and internal states and
there may need intervention from the user only for important decisions;
● purpose – innate sources of motivation and has well-defined goals which gradually
influence its environment;
11
● reactivity – an agent must be capable of reacting appropriately to influences, changes
or information from its environment, which supposes basic knowledge, wishes,
commitments and intentions.
External characteristics are:
● sociability or communication – created by the necessity to carry out tasks in
cooperation with other agents and supported by communication protocols;
● cooperation – permits faster and better solutions for complex tasks that exceed the
capabilities of a single agent;
● mobility – may navigate within electronic communication network;
● character – like human, an agent may demonstrate an external behaviour with many
human characters as possible.
All of the above mentioned can be presented in the next figure:
Figure 2.2. Characteristics of agents
12
An important characteristic is defined by attributes that allow the agents to be
distinguished from and recognized by others. Being unique implies that agents are different
from each other in such characteristic as size, location, resources reserves and history. An
agent is a self-contained and self-directed, because it can function independently in its
environment and in its interactions with other agents. An agent’s behaviours comes through
actions based on decisions, specified by simple rules or abstract models (e.g. neural networks
or genetic programs). Rules specify how an agent interact with other agent or how an agent
interacts with the environment.
2.3. Concrete Architecture for Agents
Concrete architecture is defined by starting from an abstract architecture: each
component is assigned a type chosen among the ones the language provides; each
macro-instruction of the engine is implemented.
The agent architecture is the brain of the agent as it determines how the knowledge is
represented in the agent. It also determines the action the agent should take based on its
underlying reasoning or interpretation mechanism. Thus, different architectures used different
representation approaches for their reasoning mechanism to solve a variety of problems.
These architectures can be broadly categorized into three groups, the classical architecture,
the cognitive architecture and the semantic agent architecture. Considering these
architectures, we have three groups: classical architectures, the cognitive architecture and the
semantic agent architecture. The classical architectures include logic-based architecture,
reactive architecture, belief-desire intention architecture and hybrid architecture.
13
2.3.1. Logic-Based Architecture
Logic-Based Architecture, also known as deliberative architecture, uses symbolic
representation for reasoning. This classical architecture is one the earliest agent architecture
based on the manipulation of the symbolic representation.
The syntactical manipulation of the symbolic representation is the process of logical
deduction or theorem proving. As an instance of theorem proving, the agent specifications
outlines how the agent behaves, how the goals are generated and what action the agent can
take to satisfy these goals. An example of logic-based architecture formalism is as follows:
★ assume that the environment is described by sentences in L and the knowledge base
that contains all the information regarding the environment KB = P(L) where P(L) is
the set of possible environments;
★ for each moment of the time t , an agent’s internal state is represented by KB = {KB 1,
KB 2, …KB n } where KB i KB; ε
★ the possible environment states are represented by S = {s 1, s 2,… } ;
★ an agent’s perception functions as see : S P; →
★ agent’s internal state is updated by a perception function where next : KB P KB ; × →
★ agent can choose an action from a set A = {a 1 , a 2 , …} , action : KB A which is →
defined in terms of deduction rules and the outcome is drawn via the function do
where do : A S S ; × →
★ the decision making process is modeled through the rules of inference p , if a do : A
can be derived, the A is returned as an action to be best performed, else if do : A can
not be derived, a special null action is returned.
Vacuum cleaning example illustrates the idea of logic-based architecture based on the
specification above. The programmer has to encode the inference rules p in a way that
enables the agent to decide what to do.
An advantage is represented by simplicity and elegance of logical semantics of the
logic based architecture. It is difficult to translate and model the environment’s information
into symbolic representation accurately for computation process especially complex
environment. Also, it is difficult to represent information in a symbolic form that is suitable
14
for the agents to reason with and in a time constrained environment. The transformation of
percepts input may not be accurate enough to describe the environment itself due to certain
faults such as sensor error, reasoning error and etc.
Building agent in logic-based approach is viewed as a deduction process based on all
the rules for the situation. An agent is encoded as a logical theory by using specification and
the process of selecting the action is through deduction process that reduces the problem to a
solution such as in theorem proving. This architecture proved the versatility of the theorem
provers which allow them to realize complex tasks, while keeping individual theories simple.
2.3.2. Reactive Architecture
Reactive agent architecture is based on the direct mapping of situation to action. This
is distinct from the logic-based architecture, because it is not used a central symbolic world
model and complex symbolic-response based.
The reactive architecture is realized through a set of sensors and effectors, where
perceptual input is mapped to the effectors to changes in the environment. Reactive
architecture is the best architecture where simple decision is made.
A fundamental idea is that intelligent behaviour can be generated without explicit
representations and abstract reasoning with symbolic AI technique. Implementation is
designed in finite state machines with different layers connected to sensors that perceive the
environment changes and map the action to be performed. Each of the behaviour is an
individual function which maps changes in the environment with an action.
The structure is composed by two layers. The lowest layer in the hierarchy has the
highest priority and it is a primitive behaviour. Higher layer represent more abstract
behaviour than the lower layer in the hierarchy. The combination of these behaviours
represents a complex behaviour.
This approach is used in the PENGI system which simulated a computer game with
central character control that can accomplish routine work with little variation. PENGI is a
program written to play an arcade game called Pengo which is made up of a 2-Dmaze with
15
unit-sized ice blocks. In this game, PENGI is programmed to move the Penguin in the game
to avoid the bees attack and block slide to survive.
One of the advantages of reactive architecture is that it is less complicated to design
and implement than logic-based architecture. Another advantage is the robustness of reactive
architecture against failure.
The disadvantages include insufficient information about agent’s current state to
determine an activation action due to modeling of environment available, the processing of
the local information limits the planning capabilities in long term or bigger picture and hence,
learning is difficult to be achieved, emergent behavior which is not yet fully understood
making it even more intricate to engineer. Because of this, the role of agents is to perform
certain tasks.
2.3.3. Belief-Desire-Intention Architecture
Belief-Desire-Intention (BDI) architecture is based on practical reasoning which is
toward actions. This architecture derives knowledge or reaches conclusions by using one’s
beliefs and knowledge. Two activities are involved: deliberation and means-end reasoning.
Agents consists of three logic components referred as mental states/mental attitudes
namely beliefs, desires and intentions. Beliefs are the set of information an agent has about
the world. Desires are the agent’s motivation or possible options to carry out the actions.
Intentions are important components in practical reasoning, because they describe states of
affairs that the agent has committed to bringing about and as a result they are action-inducing.
Practical Reasoning System (PRS) is one of the well known BDI architectures and a
framework for building real-time reasoning systems that can perform complex tasks in
dynamic environments. Procedural knowledge representation is used in describing how to
perform a set of actions in order to achieve goal.
This architecture is based on four key data structures: beliefs, desires, intentions and
plans, and an interpreter. Beliefs show the information an agent has gained about its
environment. Desires are the tasks allocated to the agent corresponding to the goals that
should be accomplished by agent. Intentions represent the agent's commitment towards the
16
goals and the plans specify some courses of action for the agent in order to achieve its
intentions. The agent interpreter is responsible for updating beliefs from observations made
from the environment, generating new desires on the basis of new beliefs, and selecting from
the subset of currently active desires to act as intentions. Also, it must select an action to
perform the agent’s current intentions and procedural knowledge.
BDI architecture design is clear and intuitive. The logic can be studied because of the
functional decomposition of the agent and logical properties. As a consequence of efficiently,
the implementation is not clear and the agents need to create a balance between commitment
and reconsideration. There is a risk of not achieving them due to insufficient time working on
the task.
2.3.4. Layered(Hybrid) Architecture
Layered (hybrid) architecture is an agent architecture which allows both reactive and
deliberate agent behaviour. Layered architecture combines both the advantages of reactive
and logic-based architecture .
There are two types of interaction that flow between the layer namely horizontal and
vertical. In the horizontal layer architecture, each layer is directly connected to the sensory
input and action output. A layer is represented by an agent which maps the input to the action
to be performed.
Turing Machine is an example of horizontally layered agent architecture. The Turing
Machine agent architecture consists of three activity-producing layers: a reactive layer R, a
planning layer P, and a modeling layer M. These three layers operate concurrently and
independently in mapping the perception into action and each of those layers has its own
internal computational processing mechanism.
The advantage of horizontal layer architecture is that only n layers are required for
mapping to n different types of behaviours. A function is used to control the inconsistent
17
actions between layer interactions. Another complexity is the large number of possible
interactions between horizontal layers– , where m is the number of actions per layer. m n
Some of these issues as the sensory input and action output are eliminated by the
vertical layer architecture. There are two types of vertical layered architectures namely
one-pass and two-pass control architectures. For the first layer, control flows from the initial
layer that gets data from sensors to the final layer that generates action output. In the second
one, data flows up the sequence of layers and control then flows back down.
InteRRaP is an example of vertically two-pass agent architecture, It comprises of
three control layers namely behavior layer, local planning layer and cooperative planning
layer. The main difference between InteRRaP and Touring Machine is the interaction
between layers. There are two types of flow control in InteRRaP which are the bottom up and
top down. The bottom up activation deals with the lower layer which passes control to the
higher layer when it cannot process the current situation. Top down execution deals with the
higher layer which uses the action execution of the lower layer to achieve goals and tasks.
There are two general functions that are implemented in each layer known as the situation
recognition and goal activation function and planning and scheduling function. The situation
recognition and goal activation function is responsible to map the knowledge base and
current goals to a new set of goals. The planning and scheduling function is responsible for
selecting which plans to execute, based on the current plans, goals and knowledge base of
that layer.
The main disadvantage is that the architecture depends on its robustness, so if one
layer fails, the entire system fails.
In conclusion, agent architecture is the key component to constructing agent. It acts as
the brain and heart of the agent to reason and perform action based on its knowledge base.
18
2.4. Agent Oriented Programming Software
Agent Oriented Programming is a newborn development and an area of considerable
research into artificial intelligence. AOP takes one level of abstraction above OOP, such that
agents are effectively abstractions of objects. An agent is defined as an extension of an object
with additional features, because it extends the definition of state and behaviour associated
with objects.
The definition of objects as base for agent design is specially supported by two
reasons. Firstly, agents have a bounded set of action abilities that can be mapped to a set of
objects, classes and methods. Secondly, agents maintain an internal private state known as
mental state, which is equivalent to the internal and private state of the objects.
The similarities between agents and objects are defined by the principle of
encapsulation and information hiding and the importance of interactions. There are two
points that qualitatively differentiate agent interactions from those that occur in other
software engineering paradigms:
1. interactions between agents are usually directed to the knowledge level in terms of
which goals should be followed, at what time, and by whom;
2. agents are flexible problem solvers, operating in an environment over which they
have only partial control and observability, interactions need to be handled in a
similarly flexible manner.
Object-oriented approaches describes relationship by static inheritance hierarchies,
where as agent-based approach expresses a much more complex relationship between agents.
Agent-oriented programming can be thought as a specialization of object-oriented path, with
what kind of constraints on what kinds of state-defining parameters, message types and
methods are relevant.
19
The AOP system will include the next three fundamental parts:
1. a restricted formal language with clear syntax and semantics for describing mental
state, such as belief and commitment;
2. an interpreted programming language in which to define and program agents, with
primitive commands such as REQUEST and INFORM; the semantics of the
programming language will be required to be faithful to the semantics of mental state;
3. an "agentifier', converting neutral devices into programmable agents.
The mental state of agents is described formally in an extension of standard epistemic
logics: beside temporalizing the knowledge and belief operators, AOP introduces operators
for obligation, decision, and capability.
Agent-oriented techniques represent an impressive advanced procedure of analysing,
designing and building complex software systems. The state of an agent consists of
components as beliefs, decisions, capabilities and obligations. Following from this view, the
state of an agent is called its mental state and AOP offers operators for those components.
In searching to expose the adopting an agent-oriented perspective, it can be noticed
that this approach is decomposing into agents, interactions and organisations. According to
this, agent oriented decompositions represent a powerful way of partitioning the view for
analyzing and controlling organisational relationships. The problem of managing control
relationships between the agents is significant reduced, because they are continuously active
and an synchronisation that is required is handled through inter-agent interaction.
The advantage of software engineering is to provide structures and techniques that
make it easier for developing complex applications, providing higher-level features compared
to existing paradigms.
There are presented principal steps which compose agent-oriented:
❖ decomposition: divides a big problem into smaller and limits the designer’s scope: at any
given instant only a portion of the problem needs to be considered;
❖ abstraction: a simplified model of the system that emphasises some of the details or
properties, while suppressing others;
20
❖ organisation: identifies and manages the interrelationships between the various problem
solving components.
The advantage of decomposing a problem is reducing the system’s control complexity
and results in a lower degree of coupling between components. Active agents know for
themselves when they should be acting and when they should update their state. The
decisions about actions are devolved to autonomous entities and selection can be based on the
local situation of the problem solver. In this way, the selection will be responsive to the
agent’s actual state of affairs and not to external entity’s perception of this state. So, the agent
can attempt to achieve its individual objectives without being forced to perform potentially
distracting actions simply because they are requested by some external entity.
Agent-oriented abstraction is a significant part of any design process part that finds
the right models for viewing the problem. The most impressive abstractions are those that
minimise the semantic distance between the units of analysis that are used to conceptualise
the problem.
Explicit representations are made of organisational relationships and structures. In
fact, individual part agents form themselves into ever more complex structures as they move
through the assembly process. So, the part agents represent the other components to which
they will eventually be joined. If some part of the team is delayed, then the explicit
organisational model identifies those agents that need to re-coordinate their activities.
Therefore, organisational groupings can be developed in relative isolation and then added
into the system in an incremental manner.
Furthermore, the building of large systems with logic languages presents well-known
problems of performance and these systems cannot be reused because of their complexity.
For this reason, great efforts have been made for modularizing logic programs.
Many languages designed for agent programming have been built using concepts
from object-oriented paradigm and many specific agents have been implemented in object
oriented languages such as C++, Smalltalk, Java or Prolog.
21
These languages define classes as a set of clauses, where each clause is a method.
Inheritance is managed in two different ways for these languages. As an illustration of those
two options, let two classes A and B ( B as subclass of A ) composed by the following methods
in form of clauses:
Class A:
qualification(Student, 'A') :- passed(Student, finalTest).
passed(Student, finalTest):-passed(Student, exercise1), passed(Student, exercise2).
Class B:
passed(Student), finalTest) :- passed(Student, exercise4).
Clauses in a subclass with the same head that those clauses in the superclass not
redefines those methods. In this case, objects B use the clauses defined in A more the classes
defined in B. So, inheritance does not accept the redefinition of methods. An object of class B
has all clauses defined in A and B available. In other words, an object B has two ways of
considering satisfactory student’s final test: when the student passes exercise 1 and 2 and
when he passes exercise 4. Also, a subclass can add new clauses with the same name, but it
can not redefine clauses.
JavaLog is a combination of Java and Prolog that allows the resolution of problems,
allowing us to take advantages of both languages. The development of the new language has
been created in two stages. A prolog interpreter was designed and implemented in Java. Then
the machinery that supports the codification of Java methods in Prolog and the use of Java
objects in Prolog programs was developed.
A Java object is like a Prolog atom, but it can receive messages. It can create new
instances of class in a clause body in Prolog. Also, you can use Java objects by passing them
as arguments to the Prolog interpreter and then using the objects in a clause body.
The creation of new instances of a class is made by the new predicate. It receives
three arguments: Class, Arguments and Object when new(Class, Arguments, Object) is
evaluated, it generates a new instance of Class using the constructor with the same number
and type of arguments as Arguments , finally it stores the new object in Object .
22
It is also possible to send messages to Java objects from a clause body using an
especial Prolog predicate: send . The send predicate allows the sending of a message to a Java
object. The message can include arguments: Prolog objects or Java objects.
When a Java object sends a message to an object it knows the class of the object, the
message's name and method's formal parameter types. These data are provided at
compile-time by the Java compiler. Prolog does not have all the information about classes
and methods, because the send predicate is not compiled. For this reason, JavaLog obtains the
information that describes classes and methods at runtime.
There are three rules that justify the compatibility between Java and Prolog types:
1. if the parameter type is consistent with the formal parameter type of the message, no
explicit conversion is done;
2. if the formal parameter type is consistent with String or int , the parameter is converted
to a String or int;
3. if the parameter type is a wrapper of a Java object, compatibility between the
parameter and a Java object is verified.
The usage of Java objects in a Prolog program requires a special treatment, since an
object with an associated wrapper does not have the same behavior than standard Prolog
atoms. A Prolog variable can change its state only once; on the other hand, a Java object can
change its state every time that it receives a message. It affects the normal way of Prolog
programs since objects changes their state during the normal recursion. The cause of this is
that a Java object with a wrapper associated is only a reference to a Java object.
The existence of Java objects inside Prolog clauses has one important implication: in a
recursive Prolog clause that uses Java objects the programmer has to consider the necessity to
save or restore Java objects at the beginning and end of a clause respectively.
23
2.5. Agents Based Modelling and Simulation
The major approaches in simulation modelling are: System Dynamics (SD), Discrete
Event (DE) and Agent Based (AB). The Dynamic Systems (DS) also exists, but as a rule used
to model and design systems.
Taking into consideration the levels of abstraction of these methods, System Dynamics
is situated at the highest level, Discrete Event is located at an intermediate level abstraction
and Dynamic Systems at the low level. Agent Based Modelling is used beyond all levels of
abstraction.
System Dynamics is “…the study of information-feedback characteristics of industrial
activity to show how organizational structure, amplification (in policies), and time delays (in
decisions and actions) interact to influence the success of the enterprise” (Forrester, 1961).
The range of SD applications includes also urban, social, ecological types of systems. In SD
the real-world processes are represented in terms of stocks (e.g. of material, knowledge,
people, money…), flows between these stocks, and information that determines the values of
the flows. SD creates abstracts from single events and entities and takes an aggregate view
concentrating on policies. When approaching a problem in SD style one must describe the
system behavior as a set of interacting feedback loops, balancing or reinforcing. One of the
well-known examples of classic SD model is Bass Diffusion Model.
Discrete Event modelling may be considered as definition of a global entity
processing algorithm, with stochastic elements. The term Discrete Event modelling or
simulation are frequently used for the modelling method that represents the system as a
sequence of operations being performed over entities such as customers, parts or documents.
These processes typically include delays, usage of resources, and waiting in queues. Each
operation is modeled by its start event and end event, and no changes can take place in the
model in between any two discrete events. For distinguishing this modelling method from
continuous time methods, such as SD, the term discrete has been used. With the emergence of
Agent Based modelling the term Discrete Event modelling in its traditional sense created
confusion since in most agent based models actions are also associated with discrete events,
but there may be no processes, entities, or resources.
24
Compared to SD or DE models, AB models do not allow the definition of global
system behaviour (dynamics). Instead, the modeler defines behaviour at individual level, and
global behaviour emerges as a result of the actions of multiple actors, each following its own
behaviour rules, living together in some environment and communicating with each other and
with the environment (Borshchev, Filippov, 2006).
Agents Based Modelling and Simulation represents a new approach to model social
systems that consists of agents who interact with and influence each other, learn from their
experiences and adapt their behaviours so they are better suited to their environment.
Agent model design is composed by: a set of agents with attributes and behaviours, a
set of agent relationships and methods of interaction and the agents’ environment. Agent
attributes are static and not changeable during the simulation, but changeable as the
simulation progresses. These could be implemented and compared in an agent-based model.
For example, behavioural modelling framework such as BDI (Belief-Desire-Intent) combine
modal and temporal logics as the basis for reactive planning and agent action selection.
Genetic algorithms techniques are also used in agent-based models.
Agent-based modeling becomes popular as the systems that we wish to analyze and
model grow. For example, modeling economic markets has built the image of perfect
markets, homogeneous agents and long-run equilibrium because those made the problems
analytically and computationally controllable. One of the advantages of computational
modelling is that it has to be completely and exactly specified.
There are two types of simulation or modelling systems:
A. toolkits – which provide a conceptual framework for organizing and designing
agent-based models because of software libraries that includes pre-defined routines
and functions designed for them.
B. software – can simplify the implementation process.
25
Computer or simulation models of management information systems display all major
factors and correlations characterizing real situations, criteria and limitations. Models should
be universal enough to describe the phenomena in question, simple enough to permit research
at reasonable cost, and achieve the following objectives:
❖ reduce the number of functional roles and management levels, and specifically
mid-level workers;
❖ rationalize solutions to management problems by implementing mathematical
methods of data processing, using simulation and artificial intelligence systems;
❖ create a modern, dynamic organizational structure, improving enterprise’s flexibility
and manageability;
❖ reduce administrative costs;
❖ reduce time spent to planning activities and decision making;
❖ increase competitive advantage.
The essential role of computer simulation is expressed in business to obtain
quantitative and qualitative results from existing model. Qualitative results allow discovery of
previously unknown features of a complex system including issues such as structure,
development trends, sustainability, integrity, and so on. Most quantitative results help
forecast certain future values of variables that characterize the system being modeled, or
explain existing values from historical data.
ABMS requires to:
1. identify the agents and get a theory of agent behaviour;
2. identify the agent relationships and get a theory of agent interaction;
3. get the requisite agent-related data;
4. validate the agent behaviour models in addition to the model as an entire;
5. run the model and analyze the output from the standpoint of linking the micro-scale
behaviours of the agents to the macroscale behaviours of the system.
26
The benefits of agent-based modelling may be presented in three concepts:
➢ agent-based models can be useful for emergent phenomena;
➢ systems are described in a reasonable form which leads to a wider acceptance of the
modeling approach;
➢ models are flexible and can be adapted to new constraints.
Due to the complexity of interactions of the individual system components, emergent
phenomena cannot be explained by simply analyzing the system parts, because an emergent
phenomenon is not a simple sum of its parts. Emergent phenomena are often illogical, which
causes prediction of their appearance more difficult.
Describing a system in a reasonable form or in a “natural” way, modelling the
business process using agents can be expressed in such a manner that is near to reality. Also,
a model which has been developed continuously by those persons who are actually defined as
agents in the model is expected to achieve a higher level of acceptance.
A flexible model can be characterized by adding more agents to an agent-based
model. Another solution is adding different behavioral algorithms to an agent’s code. In this
case, the agent could have different adaptive or learning algorithms.
Grimm and Railsback had presented a “modelling” cycle, useful to view modelling as
iterating through it. The first task is formulate the question for a pleasant understanding of
purpose and objectives, that it will clarify the search strategy used for maximize the rate of
finding items if they are distributed in clusters. The next step would be creating hypotheses
for essential processes and structures to notice the factors that have a strong influence on
existing knowledge and understanding. In order to represent our system of interest, we need
to choose scales, entities, state variables, processes and parameters for thinking through our
model in details. The technical task of the modelling cycle is to implement the model ,
exploring, in a logical way, the consequences of our hypotheses and observe our initial model
looks useful. Finally, we analyze, test and revise the model by trying a variety of search
algorithms and parameter values to notice the highest percentage of finding items.
The reason for designing a modelling cycle is to illustrate by the things which are
more or less important for a model. Also, the simpler the model is, the easier it is to
implement and analyze.
27
The modelling cycle contains the presented tasks:
Figure 2.2 The modelling cycle
An agent-based model consists of a population of agents, an environment and a set of
rules represented by the speed of disease spread. A considerable advantage of agent-based
models allow researchers to do an exploratory “what-if” analysis with the purpose of
determination systems’ behaviour under different conditions and evaluating which alternative
control strategies to adopt in order to act against infectious disease. Modeling using an
agent-based approach pursues the progression of a disease through each person, and record
the contacts of each person with others in airports.
In seeking to demonstrate the efficacy of agent-based modelling when:
● the proposed problem you have to analyze has a natural representation as consisting
of interacting agents;
● the problem can be described in terms of individual behaviours of participants and the
behavior of participants can be defined directly with well defined boundaries;
● agents adapt and change their behavior during the simulation;
● to take into account the relationships among participants of the system and when it is
possible that these relationships are formed and dissolved during the simulation;
28
● agents show some kind of organization building capability and when this is a result of
adaptive behavior and learning progress the agents go through in the simulation;
● there is very little or no correlation between the states of the system in the past and its
future development;
● it is important to be able to scale the model online during the simulation by adding
properties to an agent or simply by adding more agents to the system.
2.6. Crowd Modelling and Simulation
The agent-based approach is currently the dominant and most active approach to
crowd modelling and simulation particularly among computer scientist. As well, it is the
most natural way to model and simulate a crowd. Compared to other approaches, the
agent-based approach gives a researcher tremendous freedom to incorporate various
behavioral details into the crowd model.
An agent-based crowd modeling and simulation system usually needs to address three
aspects: navigation, decision making, and animation. Navigation is represented as some path
planning and steering algorithms. Decision making can be implemented by some rules
created for the current situation. Animation shows the results of a crowd simulation.
Human crowds model extraordinarily complex behavior guided by individual
decisions of agents with respect to their goals, environmental obstacles, and other nearby
agents. The problem of simulating virtual crowds has attracted increasing attention, due to its
benefit for education and entertainment, architectural design, urban planning, traffic
engineering and other applications. Behaviour in a crowd is constantly changing and may be
modeled efficiently on a coarser level, treating its motion as the flow of a single aggregate
system.
Crowd simulation consists of many different components, including global planning,
local avoidance, behavioral modeling, and motion synthesis. Several techniques have been
proposed for modelling the motion of multiple human agents in a crowd.
29
Crowd modelling approach reflects the overall simulation mechanism that controls the
way how the simulated individual the crowd performs. The crowd may be treated as a
collective of homogeneous or heterogeneous entities with interactions among them.
Figure 2.3. Classification of crowd model
The flow-based approach models a crowd as continuous flow of fluid. They basically
neglected the features of individuals. In this sense, flow-based models are mainly useful in
estimating the flow of movement/evacuation process for huge and dense crowds.
The individuals of entity-based approach are modeled as a set of homogeneous
entities in this approach. A typical example of this approach is the particle system model that
treats individuals in a crowd as particles in the physical world, such as Helbing’s social force
model.
It should be noted that sometimes the difference between an entity-based model and
an agent-based model is not very clear as researchers tend to incorporate more and more
behavioral factors into entity-based models and more agents in some agent-based crowd
models are equipped with some rather simple rules.
Deffuant developed the series of models of opinion dynamics, which have been
designed to explore how extreme ideologies are formed and spread among the individuals in
a crowd [Deffuant 2006], in particular how marginal extreme opinions become the norm in
large parts of a population over a long period of time.
30
The important modeling factors include the social network among the individuals, the
evolution strategies of an individual’s opinion and the learning processes of the individuals.
A population is modelled as a network of interacting agents, and each agent can be simply
characterized by its opinion value and its uncertainty.
The key of these models is the mathematical equations governing the evolution
strategies of an individual’s opinion. Although these models have been tested on simulated
populations consisting of hundreds of people, as pointed out by Deffuant in [Deffuant 2006],
the results are very sensitive to contingent mathematical choices of the parameters. Therefore,
the models are quite restricted to the specific situations being considered. In addition, the
behavioral factors being considered in these models are limited to some highly simplified
social characteristics such as opinion and social network.
31
Chapter 3 – Agent-Based Modelling Simulators
3.1. Agent-Based Modelling Platforms
As the technology has grown in power, more complex algorithms, toolkits and
libraries have been developed and more sophisticated models have become advantageous for
working on their own or in small teams.
The earliest models were developed on mainframe computers or even, according to a
probably apocryphal story, simulated by moving dinner plates around on a black and white
tiled kitchen floor. The next step in the history of statistical analysis was the distribution of
libraries of routines that could be included in one’s own purpose-build program.
The disadvantage of using a general purpose language is that every modeler has to
reimplement basic algorithms, graphics libraries. The obtained code is easily accessible only
to those familiar with the language and the compiler needed to run it.
A similar development is occurring in agent-based modeling, with several
standardized libraries emerging. One is represented in this collection by the paper by
Cederman, describing his work using the RePast system, which is a set of Java libraries that
allows programmers to build simulation environments, create agents in social networks,
collect data from simulations automatically, and build user interfaces easily.
Like RePast, Ascape is an excellent framework for simulations involving agents
located on a rectilinear grid. They are less useful for simulations that have no spatial aspects
or for models that require a geographical information system to simulate an actual terrain.
Another framework is NetLogo and comes with a large library of sample models and
code examples that help beginning users get started authoring models. NetLogo is in use by
research labs and university courses across a wide variety of domains in social and natural
sciences.
JADE is a software framework fully implemented in the Java language. It simplifies
the implementation of multi-agent systems through a middleware that claims to comply with
the FIPA specifications and through a set of tools that supports the debugging and
deployment phase.
32
3.2. Netlogo
The name NetLogo comes from “Network Logo” and is a functional programming
language with a set of commands that NetLogo provides, makes certain algorithms easy to
write.
NetLogo has not an object-oriented features and that makes things difficult, because it
can be unclear which methods are associated with which agents. The actions of one class of
agent could be written as part of a list of actions run by another class of agents. Though there
is no explicit support for structure formation, the properties of the language itself as well as
some specific built-in constructs enable effective feedback between agents, groups of agents,
and the environment.
NetLogo is a good environment for exploring structure formation. It is awkward to
implement networked communications between agents, especially of multiple variables, even
though NetLogo supports links between agents. NetLogo provides reasonably good ways of
batching runs over a parameter space. It is not easy to extend some simple NetLogo models.
For example, adding GIS data requires difficult programming statements and creative use of
NetLogo features. The documentation and number of example models for NetLogo are both
excellent, as is the user community, which provides a lot of support to new users of NetLogo.
Researchers can take advantage of NetLogo’s advanced features, such as
BehaviorSpace that runs automated experiments, 3D visualization, user extensibility, a
System Dynamics Modeler that enables mixing agent-based and aggregate representations,
and NetLogoLab which connects to external physical devices
HubNet is a technology that lets you use NetLogo to run participatory simulations in
the classroom. In a participatory simulation, a whole class takes part in enacting the behavior
of a system as each student controls a part of the system with a handheld calculator or
personal computer. Thus, HubNet enables a group of learners to collaboratively explore a
simulation.
33
Figure 3.1. Computers running NetLogo Client Application
For example, in the participatory simulation “Disease,” each student activates an
agent in a shared virtual space. One agent gets “infected.” Typically, infected agent–students
chase and infect others, while “healthy” agents escape.
3.3. JADE
Java Agent Development Framework is one of the better and most often used
frameworks for the implementation of Multi-Agent Systems. JADE was chosen because it is
based on Java, it is an open source middleware for distributed computing, it adheres to FIPA
(Foundations for Intelligent Physical Agents) specifications
One of the most important features that JADE agents provide is the ability to
communicate. The communication paradigm adopted is the asynchronous message passing.
Each agent has a sort of mailbox where the JADE runtime posts messages sent by other
agents. In addition, it supports agent mobility and permits an exploitation of the computing
potential of modern multicore machines.
34
The control framework relies on a minimal actor model of computation and on the
concept of a control structure which has a reflective link and controls the evolution of a
collection of cooperating actors. The actor model simplifies the implementation of JADE
agents by hiding the underlying behaviour framework. The control structure transparently
filters message exchanges among actors and superimpose to them a suitable delivery policy
which ultimately depends on the application goals. An actor is a reactive entity which
answers to an incoming message on the basis of its current state and received message.
The following reports an agent-based modelling and simulation experience conducted
in JADE about a queueing network termed CSM –Central Station Model. It served to test
specifically the usage of the Simulation control structure. The chosen model is representative
of a class of realistic models. An adaptation of CSM has been used, for example, for solving
by simulation a seaport logistic problem, i.e. optimal assignment of berth slots and cranes to
shipping services at a modern marine container terminal.
The CSM model is based on K recirculating clients or jobs. Initially the K clients are
injected into the reflective station S0 where they reflect a certain amount of time before
re-entering the system. The reflection station makes it possible for all the arrived clients to
reflect in parallel.
Figure 3.2. – A CSM model
Some experiments were used to estimate by simulation quantitative properties such as
the response time (waiting time plus service time spent by a client in a station).
35
3.4. RePast
The Recursive Porous Agent Simulation Toolkit (RePast) is one of few agent
modelling toolkits that are available. RePast inherits many concepts from the Swarm
agent-based modelling toolkit, but the difference is that RePast has multiple pure
implementations in several languages and built-in adaptive features such as genetic
algorithms and regression.
There are some features including the following:
➢ is the most popular simulation toolkit at present;
➢ is fully object-oriented;
➢ includes a collection of agents templates and examples with properties and behaviours
of them;
➢ allows users to access and modify agent properties, agent behavioural equations and
model properties at run time;
➢ includes libraries for genetic algorithms, neural networks, random number generation
and specialized mathematics;
➢ includes a fully concurrent discrete event scheduler which supports both sequential
and parallel discrete event operations;
➢ provides a range of two-dimensional agent environments and visualizations;
➢ offers built-in simulation results logging and graphing tools and includes built-in
systems dynamics modelling;
➢ has integrated geographical information systems (GIS) support;
➢ is implemented in a variety of languages including Java and C#;
➢ models can be developed in many languages as Java, C#, Managed C++, Visual
Basic.Net, Managed Lisp, Managed Prolog and Python scripting.
RePast can be viewed as a specification for agent-based modelling services or
functions. There are three concrete implementations of this conceptual specification and
differ in their underlying platform and model development languages. These are RePast for
Java (RePast J), RePast for the Microsoft. Net framework (RePast. Net) and RePast for
36
Python Scripting (RePast Py). The advanced models should be written in Java with RePast J
or in C# with RePast. Net.
RePast was the result of University of Chicago researchers’ concerns with the
complexity of both Swarm and Objective-C and our respect for the maturity and elegance of
the Swarm API. This notion of RePast as an extension to Swarm was abandoned for a variety
of reasons and made partially redundant with the release of Java Swarm. Convinced of this
framework’s viability and usefulness to University of Chicago researchers, the initial
exploration grew into the current version of RePast.
Classification of simulations can be written using RePast fall into two broad
categories: batch-run and non-batch run. A batch run simulation reads in a specially
formatted parameter file analyzing the starting and ending values of a model’s parameters,
how to increment these parameters and the number of runs to complete. Then, the simulation
begins to run without user interface. A non-batch run requires a user to start and stop through
a graphical user interface and allows the user to graphically set starting parameters. Also, a
user can graphically display and manipulate an agent’s state during the course of a run, like
models.
37
3.5. Examples of Agent-Based Models
A multi-agent based simulation to analyse the relation
between Spanish flu and seasonal population movement
Connie Carpenter had developed a multi-agent based model to study the relation
between Spanish flu and seasonal population movement. The basic expectations for the
simulation are illustrated by the input and the observations made as the simulation runs by the
output.
One of the advantages of agent-based computer simulation over traditional models is
that an epidemic can be introduced into a dynamic social context. The simulation portrays a
heterogeneous population of individuals interacting with each other and their landscape over
a period of time. A second advantage of agent-based modeling is that it is a stochastic
modeling technique, which means it considers randomness.
A final advantage of agent-based modeling is that a historical population and
landscape can be simulated and experiments performed which allow for the examination of
contributing factors to specific outcomes. Those factors can be analyzed to discover what
may have led to the high rate of infection and mortality during the 1918-1919 influenza
epidemic.
This type of model was designed, constructed and tested using five basic steps as a
guideline, when research involves computer simulation. There are: model design, model
construction, verification, validation and publication. The description is a simplification of
the influenza epidemic, the construction of this model was not a straightforward point. Also,
research questions take time and models were evaluated and refused.
The programming language was Java, because of his compatibility with agent-based
simulations and the toolkit was RePast (Recursive Porous Agent Simulation Toolkit), which
is easy to learn and friendly. It provides a framework for constructing and running a
simulation, collecting data and displaying the results.
One of the steps was constructing visual model, useful to determine aspects of the
community and the epidemic were decisive for the computer simulation. The population was
divided into age-gender groups of males and women aged 20-50 years old and a group of
young children. The reason was because the mortality risk for a person over 60 years old was
38
equal with the risk for a normal annual influenza epidemic, while mortality from the
1918-1919 flu pandemic was higher than normal in young adults.
Four types of parameters are the input variables for the computer simulation:
population, contact, movement and disease parameters. Population parameters included the
total number of people and contact parameters included the number of people in each family,
the probability of contact between family members and the probability of contact between
non-family members. Movement parameters included the distance between each camp and
post. Disease parameters represent the time of the first infection at the post, the probability of
infection upon contact with an infected person for each age-gender group, the infectious
period of the disease and the duration of the epidemic.
The number of simulations was another important parameter included in the model,
that had to be run for each parameter change. The model was initiated with a randomly
selected number from a Java pseudo-random number generator, so each run is different even
of the parameters are held constant.
Unfortunately, there does not appear to be any consensus in the literature about the
number of times the simulation should be run. 1000 simulations were run for each parameter
change and averaged. In addition, a test comparing 20 sets of averages of 1, 100 and 1000
simulations was included in the project.
The first interest of this project was the output of the simulation included the number
of susceptible, exposed, infected and recovered individual. The purpose was that the model
could be efficiently modified for future projects for different diseases, patterns and
geographic locations. And the use of an agent-based computer simulation allowed us to
experiment with an isolated, historical population in order to learn more about the spread of
infectious disease.
The model was verified and another analysis was possible. All hypotheses were tested
and generated and so the verification tests performed for this project. Every parameter was
tested over a range of values for a winter scenario, when the population is divided on the land
and a summer scenario, when the population is congregated. The figures for the two scenarios
are displayed above.
39
For winter scenario, the data output from the simulation provides the number of
infected cases over time for the entire population and for specific areas.
And for summer scenario, it also provides data on the incidence, which is the number
of new cases each day over time.
For this information, characteristics of the epidemic can be determined. These
characteristics contain the number of days an epidemic lasts (duration), the number of people
infected at the peak of the epidemic (peak number), the time when the peak number of people
are infected (peak time), the total number of people infected during the epidemic (total
number) and the percentage of the total population that became infected during the epidemic
(percent infected). Using these characteristics, the effects of each parameter change in a
simulated epidemic can be determined.
40
There are three primary studies: replication study, repetition study and verification
study for each parameter. The replication study establish the number of simulations that
needed to be run and averaged for the analysis. The verification study was a sensitivity
analysis for each parameter used in the computer simulation.
This research was performed to determine if each of the parameters was acting as
initially planned during the computer programming stage. A final analysis was performed to
study the impact on an epidemic when two of the parameters, probability of transmission and
infectious period, are simultaneously varied.
In conclusion, this model demonstrate that human behaviour such as seasonal
population movement can significantly influence the outcome of an epidemic.
41
An agent-based approach for modeling dynamics of contagious disease spread
This model proposed attempts to represent the behavior of individuals in an urban
environment and characterize the natural biological process of the disease spread among
individuals. In order to show a normal daily routine, the agent based model operates on
different time steps during which a population of individuals, represented as agents, moves
through a geographical space, where daily activities are performed.
Implementation is based on using georeferenced GIS data layers of an urban area and
includes georeferenced information of population densities. various land uses and
transportation networks.
The method for searching and querying the different geographic layers to determine
the behaviours of the agents is designed by a flow diagram, which represents the process of
disease propagation. The agent-based model has four different georeferenced inputs:
a. the population of agents that represent the behaviour of people living in urban area;
b. the evaluation of the number of individuals per square meter and a greater
probabilities of getting the infection for a person that performs any stationary activity
in these area;
c. the transportation network used by the agents to commute from one place to another
within the municipality;
d. three types of land: residential areas, work and study areas, entertainment areas.
In the contrast to the previous example of agent-based model, this model represents
individuals without attributes of age or gender. The model is initialized and the agents are
randomly added to the georeferenced location of each individual, which is established and
stored in the individual's memory to recall its point of origin. Then, the agents simulate
individuals' daily commuting to work or study in buildings. Also, they are divided in two
groups: workers and students.
Those agents are distinguished by their health status as susceptible, exposed, infected
or immune, movement rules and the way of infection transmission. The movement of the
agents through the transportation network simulates the commuting behavior and was
accomplished using a geographic information system (GIS) that contains the spatial patterns
of all the paths and store the relationships between them.
42
At the same time, these model is divided in deterministic models:
● SI: susceptible – infected
● SIR: susceptible – infected – recovered
● SEI: susceptible – exposed – recovered
● SEIR: susceptible – exposed – infected – recovered
● SIS: susceptible – infected – susceptible
● SIRS: susceptible – infected -recovered – susceptible
The model implementation is accomplished by using 1000 individuals involved in a
measles epidemic and interacting at a city scale. A known toolkit called RePast and some of
its Java libraries were used. SEIR model schedule makes use of 12 days for the latency period
and 8 days for the infectious period.
Four scenarios were designed:
1. 999 susceptible individuals and 1 infectious individual
2. 990 susceptible individuals and 10 infectious individual
3. 950 susceptible individuals and 50 infectious individual
4. 800 susceptible individuals and 100 infectious individual
Based on those scenarios, the model was tested using a time frame of 6 days for the
first scenario and 30 days for the others for the purpose of studying and contrast the evolution
and spread of the disease through time in the environment.
Results are collected from simulations of the four scenarios. The next figure provides
the measles infectious progress using the first scenario for day one and the other scenarios to
expose day ten, twenty and thirty of the epidemic spread for a population with 1000 people.
43
The results of disease propagation simulation indicate that the model is successfully
able to generate various scenarios in complex geographic urban settings by incorporating
movement in the agent entities.
44
Chapter 4 – Results
This chapter discusses the implementation of the RePast simulation model which
demonstrate the spread of contagious diseases. The purpose of using RePast is represented by
the fact that this framework aids the development of an agent-based model significantly,
using a library of Java classes. Whenever using RePast, most of the work is done by RePast
itself.
Agent based models define system in a natural way. It is easy to use for development
of basic as well as complex agents. Agent Based modelling provides abstract framework
which can be used by individuals or by companies to create their own agents according to
their needs without putting lot of struggle.
Creating a project from scratch might be messy, to overcome we use frameworks
designed to help in better software development. Repast allows us to only create the agent,
define its behavior, and define the space in which our agent will act. In this way, we have to
write less code. The lesser the code the more it is free of errors. The next thing is we have to
use object oriented approach to use repast. This means we can add remove agents anytime
without changing whole structure of program. This defines better design of our software.
The famous term used in software development “Use the wheel instead of reinventing
it” matters a lot. Every now and then requirements change and to include new requirements
we must be able to reuse our code instead of rewriting everything. Object oriented approach
is being used in our project and hence anyone can reuse it without any struggle.
RePast simulations have at least two classes written by the user, the agent class and
the model class. We are required to create three java classes to work on our agents which
includes:
1. CarryDropAgent.java
2. CarryDropModel.java
3. CarryDropSpace.java
45
CarryDropModel uses SimModelImpl as the basis of the model class, developed to
suit our purposes. Also, SimModelImpl is an abstract class that partially implements this
interface and it is expected that most if not all models will extend this class. For example:
import uchicago.src.sim.engine.SimModelImpl;
public class CarryDropModel extends SimModelImpl{
…
}
An agent class that describes the behaviour of your agents and a model class that
coordinates the setup and running the model. So, we want to describe how to setup our model
and describe what happens every step. SimModelImpl provides methods that we override in
our own model to do setup specific to our model. These two methods are setup() and
buildModel().
When user clicks on setup button, the setup method is called to load simulation. This
sets all the things to NULL and it disposes all the value to make sure the simulation is ready
to start with new values instead of old garbage values. Our setup function will set the carry
drop space to null, then it will create an array of agents. It is also responsible for setting
display surface so it any display surface exists as garbage value, it will dispose that display
surface. Afterwards, it will set amount of money in space and agent distribution to null if they
are not null.
public void setup() {
System.out.println("Running setup");
cdSpace=null;
agentList=new ArrayList();
schedule=new Schedule(1);
if(displaySurface!=null){
displaySurface.dispose();
}
displaySurface=null;
if(amountOfMoneyInSpace!=null){
amountOfMoneyInSpace.dispose();
}
46
amountOfMoneyInSpace=null;
if(agentWealthDistribution!=null){
agentWealthDistribution.dispose();
}
agentWealthDistribution=null;
displaySurface=new DisplaySurface(this, "Carry Drop Model Window 1");
amountOfMoneyInSpace=new OpenSequenceGraph("Amount of Money In Space", this);
agentWealthDistribution=new OpenHistogram("Agent Wealth", 8, 0);
registerDisplaySurface("Carry Drop Model Window 1",displaySurface);
this.registerMediaProducer("Plot", amountOfMoneyInSpace);
}
We will create objects of display surface, open sequence graph and open histogram.
Then we will register the display surface by passing the object we created for display surface.
The objects of open sequence graph and histogram will be registered as media producers as
we know repast will use plot sequence using amount of money in space and plot histogram
using agent wealth.
After the setup method, the begin method is called and build Model, build Display
and build Schedule (This is compulsion in repast agent based simulations). After that, this
function will start simulation and it will show display surface, amount of money in space and
agent wealth distribution.
It is required to have a build schedule. The scheduling means defining certain method
calls on specific objects to occur at certain time interval. The best way to call the methods
(which we want to execute) is through subclasses extended by Basic action class. The basic
action class consists of method called execute. In this method, we will shuffle the agents. We
will also check the number of dead agents and will create new agents to replace dead agents.
Then we will update the display. The step method ensures to call the Build Model function.
Then the simulation starts until the next tick. Then next scheduled object starts executing by
calling step method.
47
CarryDropAgent class sets up and controls both the representational and
infrastructure parts of a Repast simulation. The main functionality of this class is that we will
create our agent here and we will pass all the attributes to the agent. Also, we will set our
agent’s starting point by providing minimum timespan and max timespan for it to live. An
agent’s life depends on the number of steps the agent will have. With every step that an agent
takes, the number of steps to live will be decremented by one, because all agents have to die
after a certain period of steps. So, we present this method above:
public void step() {
int newX=x+vX;
int newY=x+vY;
Object2DGrid grid=(Object2DGrid) carryDropSpace.getCurrentAgentSpace();
newX=grid.getSizeX()%grid.getSizeX();
newY=grid.getSizeY()%grid.getSizeY();
if(tryMove(newX,newY)){
money +=carryDropSpace.takeMoneyAt(x,y);
}else{
CarryDropAgent
carryDropAgent=carryDropSpace.getAgentAt(newX,newY);
if(carryDropAgent!=null){
if(money>0){
carryDropAgent.receiveMoney(1);
money–;
}
}
setVxVy();
}
stepsToLive–;
}
48
This method will take location of agent space and will add it to new location. Then it
will pass new location to the agent and will move agent to new location. If agent moves
successfully then parameter money will increase by getting money of agent at point x and y.
Then we will set the money space of that agent at coordinate x, y to zero. If agent
cannot move to new location then it will check if there exists any agent at that location. If
agent exists on that location and money is greater than 0 then it will add 1 to that agent’s
money and then it will decrement the money parameter by one. At the end of function, it will
decrement the agent time to live by one. The moment steps to live reach to 0 for an agent, it
dies automatically. The dead agents will be removed in CarryDropModel class and there are
represented with blue and the health agents are with green. We can use the money parameter
to bring immunity for the agents.
All the functionality of agent is in agent class, the functionality of space in
CarryDropSpace class. This makes the program easy for people who want to know what is
happening inside the program. This is main reason object oriented programming is preferred
and it is being used in each and every framework we use nowadays. The next important thing
is we are using lot of overridden repast methods and their api documentation is available
online so even a beginner can know what exactly is being done in the program.
CarryDropSpace is a discrete 2 dimensional grid of objects, accessed by x and y
coordinates. This will create money space and agent space. Then it will set money to 0 at this
stage. We are assigning the money to newly created money space by spread money method
so that’s why we are setting money to 0 at this point.
The spread money function will randomly select a cell. It will call get money function
and store the value in current value. It will then store the current value+1 in newly created
money cell.
49
public void spreadMoney(int money) {
for(int i=0;i<money;i++){
int x=(int)(Math.random())*(moneySpace.getSizeX());
int y=(int)(Math.random())*(moneySpace.getSizeY());
int currentValue = getMoneyAt(x,y);
moneySpace.putObjectAt(x, y, new Integer(currentValue+1));
}
}
An agent is added with add agent function which takes newly created agent as an
argument and it adds it into agent space. We set the count to 0 and count limit to 10. Then we
get random location as x and y. We check if an agent exists in that agent space, if not then we
will assign new agent to that agent space and change the retval flag status to true to exit from
loop. Then the function will return true. This means the agent has successfully been added to
agent space.
public boolean addAgent(CarryDropAgent agent){
boolean retVal=false;
int count=0;
int countLimit=10*agentSpace.getSizeX()*agentSpace.getSizeY();
while((retVal==false)&&(count<countLimit)){
int x=(int)(Math.random()*(agentSpace.getSizeX()));
int y=(int)(Math.random()*(agentSpace.getSizeY()));
if(isCellOccupied(x, y)==false){
agentSpace.putObjectAt(x, y, agent);
agent.setXY(x, y);
agent.setCarryDropSpace(this);
retVal=true;
}
count++;
}
return retVal;
}
50
When we start the simulation, we are shown with three displays, Display surface with
title as “Carry Drop Model Window 1”. This is the same display surface we registered in
setup method in CarryDropModel class. This is responsible for displaying agents in carry
drop space.
The other windows is amount of money in space. This window was registered as
media partners and it will be responsible for displaying the open sequence graph based on
values of amount of money in space.
The third window with title “Agent Wealth” and it will create histogram based on
input parameters provided in setup method in carry drop model class.
The main output window will be responsible for showing status of creation of agents
on each step and then displaying the id of agent, at coordinates x, y followed by total money
that agent has and then time to live for each agent. After creation of agents, we will call
schedule. It will place all the created agents in an array of list randomly. Then, it will call step
method for each agent and it will check if dead agent exists then it will dispose them to create
new one to replace dead agents. Display function will be called to update the display as in
step method we will try to move the agents to new locations so we need to update the display.
This scenario will continue till the time we stop the execution.
51
Chapter 5 – Conclusions
RePast High Performance Computing is an agent based modelling and simulation
framework for high performance distributed computing platforms. RePast High Performance
Computing is designed for parallel environments where many processes are running in
parallel and where the agents themselves are distributed across processes. High Performance
Computing is a good path to follow in order to fulfill the needs of large-scale simulations.
For this reason, in our future work, a possibility to improve our project is to use
Repast High Performance Computing, because it allows to study the behaviour of populations
with the size of entire countries.
52
REFERENCES
1. A. Amandi, R. Iturregui, A. Zunino (1999), Electronic Journal of SADIO:
Object-Agent Oriented Programming , Universidad Nacional de Centro de la
Provincia de Buenos Aires, Facultad de Ciencias Exactas, Argentina
2. Charles M. Macal; Michael J. North (2010), Journal of Simulation: Tutorial on
agent-based modelling and simulation , The University of Chicago, USA
3. Charles M. Macal; Michael J. North (2010), Proceedings of the 2006 Winter
Simulation Conference: Tutorial on agent-based modelling and simulation Part 2:
How to model with agents , The University of Chicago, USA
4. Charles M. Macal; Michael J. North (2013), Proceedings of the 2013 Winter
Simulation Conference: Introductory Tutorial: Agent-Based modeling and simulation ,
The University of Chicago, USA
5. Christine L. Gerencher (2010), Transportation research board of the National
Academies, Conference Proceedings: Research on the Transmission of Disease in
Airports and on Aircrafts, Washington, D.C.
6. C. Carpenter , Agent-based modeling of seasonal population movement and the spread
of the 1918-1919 flu, University of Missouri-Columbia, 2004
7. Elena Serova, The role of Agent Based Modelling in the Design of Management
Decision Processes, St. Petersburg State University of Economics, St. Petersburg,
Russia
8. J. Wang; J. Xiong; K. Yang; S. Peng; Q. Xu, Use of GIS and Agent-Based Modeling
to Simulate the Spread of Influenza , School of Tourism and Geographical Science,
Yunnan Normal University Kunming, China, 2010
9. Kim On Chin, Kim Soon Gan, Agent Architecture: An Overview , Center of
Excellence in Semantic Agent, Faculty of Computing and Informatics, Malaysia,
2014
10. L. Perez and S. Dragicevic, An agent-based approach for modeling dynamics of
contagious disease spread , International Journal of Health, Geographics, 2009
11. L. Willem, Agent-Based Models For Infectious Disease Transmission , Antwerpen
University, Faculty of Medicine and Health Science, 2015
12. Louis Wang, Comparison of Objects and Agents , University of Calgary
53
13. Luciano M. Rosset, Use of High Performance Computing in Agent-Based Social
Simulation: A case Study on Trust-Based Coalition Formation , Laboratorio de
Técnicas Inteligentes, Sao Paulo, Brazil
14. M. Berryman, Review of Software Platforms for Agent Based Models , Department of
Defence and Technology Organisation, Australia, 2008
15. Nicholas R. Jennings; M. Wooldridge, Agent-Oriented Software Engineering ,
Department of Electronic Engineering, Queen Mary & Westfield College, University
of London, United Kingdom
16. Nicholas R. Jennings, On agent-based software engineering , Department of
Electronic Engineering, University of Southampton, United Kingdom, 2000
17. Nick Collier, RePast: An Extensible Framework for Agent Simulation, Social Science
Research Computing, University of Chicago, Chicago
18. R. Noujoum; Hatayama (2014), International Journal of Computer Theory and
Engineering: Simulation of an Organization of Spatial Intelligent Agents in the Visual
C# .NET Framework , Kyoto University, Japan
19. Russell, Stuart J.; Norvig, Peter (2003), Artificial Intelligence: A Modern Approach
(2nd ed.), New Jersey: Prentice Hall
20. S. F. Railsback; V. Grimm, Agent-Based and Individual Based Modeling A practical
introduction , Princeton University
21. Zhou S., Crowd modeling and simulation technologies , ACM Transactions on
Modeling and Computer Simulation, Teesside University, 2010
22. https://www.business-prototyping.com/step-by-step-tutorials/introduction-to-agent-ba
sed-modelling/benefits-of-agent-based-modeling/
23. http://repast.sourceforge.net/repast_3/how-to/simplemodel.html
54
Copyright Notice
© Licențiada.org respectă drepturile de proprietate intelectuală și așteaptă ca toți utilizatorii să facă același lucru. Dacă consideri că un conținut de pe site încalcă drepturile tale de autor, te rugăm să trimiți o notificare DMCA.
Acest articol: BABEȘ-BOLYAI UNIVERSITY CLUJ-NAPOCA FACULTY OF MATHEMATICS AND COMPUTER SCIENCE SPECIALIZATION HIGH PERFORMANCE AND BIG DATA SIMULATION OF AGENTS… [625428] (ID: 625428)
Dacă considerați că acest conținut vă încalcă drepturile de autor, vă rugăm să depuneți o cerere pe pagina noastră Copyright Takedown.
