simulation & multi-agent systems an introduction

64
Simulation & Multi-Agent Systems An Introduction Multiagent Systems LS Sistemi Multiagente LS Andrea Omicini & Sara Montagna {andrea.omicini, sara.montagna}@unibo.it Ingegneria Due Alma Mater Studiorum—Universit` a di Bologna a Cesena Academic Year 2007/2008

Upload: others

Post on 11-Apr-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Simulation & Multi-Agent Systems An Introduction

Simulation & Multi-Agent SystemsAn Introduction

Multiagent Systems LSSistemi Multiagente LS

Andrea Omicini & Sara Montagna{andrea.omicini, sara.montagna}@unibo.it

Ingegneria DueAlma Mater Studiorum—Universita di Bologna a Cesena

Academic Year 2007/2008

Page 2: Simulation & Multi-Agent Systems An Introduction

SimulationMeaningMotivationApplication

Type of SimulationContinue vs. Discrete SimulationDeterministic vs. StochasticMicro, Macro and Multi-level Simulation

A MethodologyDomain, Design, Computational Model

Traditional Model and SimulationGraphs and NetworksDifferential Equations: ODE, PDE, Master EquationsCritical Analysis

Computational ModelAgent Based Model and Multi-agent based SimulationMulti-agent based simulation Platforms

Page 3: Simulation & Multi-Agent Systems An Introduction

Scientific Method

Traditional science workflow

I [Parisi, 2001]I Traditional scientific method

I identification of the phenomena of interestI direct observation of the phenomenaI formulation of theories / working hypothesisI reasoning on theories and phenomena through an empirical

observationI quantitative analysis: measuring of phenomena in laboratory

under controlled conditionsI validation / invalidation of theories

Page 4: Simulation & Multi-Agent Systems An Introduction

Definition of Simulation

I A new way for describing scientific theories

[Parisi, 2001]

I Simulation is the process with which we can study thedynamic evolution of a model system, usually throughcomputational tools

[Banks, 1999]

I Simulation is the imitation of the operation of a real-worldprocess or system over time

Page 5: Simulation & Multi-Agent Systems An Introduction

Simulation Requires a Model

M. Minsky – Models, Minds, Machines

A model (M) for a system (S), and an experiment (E) is anythingto which E can be applied in order to answer questions about S.

I A model is a representation / abstraction of an actual system

I A model is a formalisation of aspects of a real process thataims to precisely and usefully describe that real process

I A model involves aggregation, simplification and omission

I The model implements theories which have to be verifiedduring the simulation

Typical questions in model construction

I How complex should be the model?

I Which assumptions should be done?

Page 6: Simulation & Multi-Agent Systems An Introduction

From Model to Simulation. . .

Computer simulation

I The models are designed to be run as processes within acomputer

I The computational model simulates the processes as they arethought to exist in the real system

I Subsequent simulations imitate the operations of the modelledprocess

I generation of an artificial evolution of the system

I The observation of the evolution carries out deductions on theactual dynamics of the real system represented

I Simulation results make it possible to evaluate theoriesconstructing the model

Page 7: Simulation & Multi-Agent Systems An Introduction

. . . and Back

Model validation [Klugl and Norling, 2006]

I If the predicted and observed behaviour do not match, andthe experimental data is considered reliable, the model mustbe revised

Page 8: Simulation & Multi-Agent Systems An Introduction

Simulation Creates a Virtual Laboratory

I A virtual laboratory makes it possible to perform experimentsI virtual phenomena observed under controlled conditionsI possibility to easily modify the components of an experiment

(variables, parameters, simulations’ part)I tools to make predictions on theoriesI tools to make inferences on simulation results

Page 9: Simulation & Multi-Agent Systems An Introduction

Why Do We Need Simulations?

I [Parisi, 2001],[Klugl and Norling, 2006]I The simulated system cannot actually be observed

I for either ethical or practical reasons

I The time scale of the real system is too small or too large forobservation

I The original system is not existing anymore or not yetI The system is complex

I simple pattern of repeated individual action can lead toextremely complex overall behaviour

I impossible to predict a-priori the evolution of the system

Page 10: Simulation & Multi-Agent Systems An Introduction

What Simulations Are Used For?

I Making prediction (look into the future) to be tested byexperiments

I Exploring questions that are not amenable to experimentalinquiry

I Obtaining a better understanding of some features of thesystem

I Describing and analysing the behaviour of a system, asking“what if” questions about real system

I rapidly analysing the effects of manipulating experimentalconditions without having to perform complex experiments

I Potentially assisting in discovery and formalisation

I Verifying hypothesis and theories underlying the model thattry to explain the systems behaviour

Page 11: Simulation & Multi-Agent Systems An Introduction

A Science for Simulation

Popper (1972)

Popper proposes as a logical necessity that scientific theories canonly be refuted

I no amount of supporting experimental evidence constitutesproof of a theory

I yet a single repeatable piece of counter-evidence can requirethat the theory is developed or replaced

Scientific hypothesis should consist only of refutable statements

Simulation can be used as a tool to validate, or better, potentiallyrefute formal models

Page 12: Simulation & Multi-Agent Systems An Introduction

Applications of Simulation

Main applicative domains

I Interdisciplinary domainI Complex Dynamical Systems

I systems too complex to be understood from observations andexperiments alone

I Predicting changes

I Observing systems evolution

Page 13: Simulation & Multi-Agent Systems An Introduction

A Brief Introduction to Complex Systems

Systems as

I Brain

I Social Systems

I Ecosystems

I Economic Systems

I Coordinating Systems (swarm, flocking)

I . . .

. . . are recognised as complex systems

Page 14: Simulation & Multi-Agent Systems An Introduction

A Brief Introduction to Complex Systems

A multi-disciplinary research field

I Maths

I Physics

I Informatics

I Biology

I Economy

I Philosophy

I . . .

Page 15: Simulation & Multi-Agent Systems An Introduction

Features of Complex Systems in a Nutshell

In general, complex systems are observed to feature

I Presence of different elements that interact

I Nonlinear dynamics

I Presence of positive and negative feed-backs

I Ability of evolution and adaptation

I Robustness

I Self-organisation

Page 16: Simulation & Multi-Agent Systems An Introduction

Complex Systems ask for Holistic Approach: Simulation

I ReductionismI belief that the behavior of a whole or system is completely

determined by the behavior of its partsI if the laws governing the behavior of the parts are known, one

should be able to deduce the laws governing the behavior ofthe whole.

I Holism – Systems theoryI anti-reductionist stance: the whole is more than the sum of

the partsI the whole has “emergent properties” which cannot be reduced

to properties of the parts

Page 17: Simulation & Multi-Agent Systems An Introduction

Continue Simulation

I [Uhrmacher et al., 2005]

I The variables of the system change continuously during time

I Series of infinite intervals and states

Main example of continue simulation

I Time-changes described by a set of differential equations

Page 18: Simulation & Multi-Agent Systems An Introduction

Critical Analysis of Continuos Simulation

Benefits

I Perfectly suited for the reproduction of measuredtime-dependent trajectories

I Easily fitting of the parameters

Drawbacks

I the underlying assumption is that the system behavescontinuously with an infinite number of close state transitionsin each time interval

Page 19: Simulation & Multi-Agent Systems An Introduction

Discrete Simulation

I [Uhrmacher et al., 2005]

I Time evolves through discrete time steps

I The number of states is finiteI Synchronous or Asynchronous simulation update

I synchronous — the state of all the components of the systemis updated at the same time

I asynchronous — the state of the system components isupdated asynchronously following predefined rules whichdepends on the components themselves

Main example of discrete simulation

I Discrete time stepped approaches: time advances inequidistant steps time-driven simulation. Clock advances byone tick in every step and all the events scheduled at thattime are simulated

I Discrete event approaches: discrete event simulation

Page 20: Simulation & Multi-Agent Systems An Introduction

Discrete Events Simulation – Event Driven Simulation

Algorithm of a discrete event simulation

I clock: this variable holds the time up to which the physicalsystem has been simulated

I event list: this is normally a data structure that maintains aset of messages, with their associated time of transmissions,that are scheduled for the future

I at each step the message with the smallest associated futuretime is removed from the event list the event list and thecorresponding message is simulated

I the list of the events is updated:I adding new messages for future eventsI canceling previously scheduled messages

I the clock is advanced to the time of the event just simulated.

Page 21: Simulation & Multi-Agent Systems An Introduction

Critical Analysis of Discrete Models

Benefits

I No continuity of behaviour needs to be assumed

Drawbacks

I Sequential SimulationI in each cycle of simulation only one item is removed from the

event list, its effects simulated and the event list, possibly,updated.

I the algorithm cannot be readily adapted for concurrentexecution on a number of processors, since the list cannot beeffectively partitioned for such execution.

Page 22: Simulation & Multi-Agent Systems An Introduction

Deterministic vs. Stochastic

Deterministic

I The simulation evolves following deterministic laws

Stochastic

I The variables are probability distribution, or the laws toupdate the variables are stochastic laws

I Stochastic processes represent one means to express theuncertainty of our knowledge

I It is possible to compute just a probability distribution of thefuture histories, rather then a single outcome

Page 23: Simulation & Multi-Agent Systems An Introduction

Granularity of Simulation Elements: Macro-simulation

I [Uhrmacher et al., 2005]

I The macro model describes the system as one entity

I The model attempts to simulate changes in the averagedcharacteristics of the whole population

I Variables and their interdependencies, which can be expressedas rules, equations, constraints... are attributed to this entity

I Modelling, simulating and observation happens on one level:the global level

I The characteristic of a population are averaged together

Main example of macro-simulation

I Differential equations

Page 24: Simulation & Multi-Agent Systems An Introduction

Granularity of Simulation Elements: Micro-simulation

I The micro model describes the system as a set of entitiesI Smaller entities with distinct state and behaviourI The system is thought as comprising huge numbers of entities

I The micro level models the behaviour of the individualsI The macro level

I exists only as it aggregates results of the activities at microlevel

I is used for reflecting emergent phenomena

Main example of micro-simulation

I Cellular automata

Page 25: Simulation & Multi-Agent Systems An Introduction

Granularity of Simulation Elements: Multi-level Simulation

I It is an intermediate form

I The multi-level model describes a system at least at twodifferent levels

I Interactions are taking place within and between the differentlevels

I The system is described at different time scales

Main example of multi-level simulation

I Multi-agent systems

Advantages of Multi-level simulation

I It facilitates taking spatial and temporal structured processesinto consideration

I It allows the description of upward and downward causation

Page 26: Simulation & Multi-Agent Systems An Introduction

Down-ward and Up-Word Causation

The whole is to some degree constrained by the parts (upwardcausation), but at the same time the parts are to some degreeconstrained by the whole (downward causation).1

1F. Heylighen. http://pespmc1.vub.ac.be/DOWNCAUS.html

Page 27: Simulation & Multi-Agent Systems An Introduction

How To Choose Between Different Approaches

Which kind of simulation?

I Modelling and simulating approaches are chosen on demandand thus address the diverse neeeds of modelling andsimulation of the systems

I Multi-level simulation is considered the most suitableapproach for studying complex systems

Page 28: Simulation & Multi-Agent Systems An Introduction

Simulation Workflow

Main steps in a simulation study

I [Klugl and Norling, 2006]I Starting with a real system analysis

I understanding its characteristics

I Building a model from the real systemI retaining aspects relevant to simulationI discarding aspects irrelevant to simulation

I Constructing a simulation of the model that can be executedon a computer

I Analysing simulation outputs

Page 29: Simulation & Multi-Agent Systems An Introduction

How to Build a Model: Methodology

Model design

I Concept model phase – Domain modelI Analysis of the real system characteristic

I Specification phase – Design modelI translation of the information from the needs’ into a formal

modelI aim: build a model independent of any tool and any software

platform

I Implementation phase – Computational modelI translation of the model resulting from the design on a

particular software platform

Page 30: Simulation & Multi-Agent Systems An Introduction

How to Perform a Simulation: Methodology

Experimentation phase – Simulation design

I Specifying the simulation goals

I Identifying of the informations needed to the simulation

I Identifying useful experiments.

I Planning a list of experiments

I Performing the experiments

Page 31: Simulation & Multi-Agent Systems An Introduction

Validation and Verification

I Analyse simulation resultsI Detailed behaviours of computer-executable models are first

compared with experimental observationI Comparing the predictions with the observed experimental

data gives an indication of the adequacy of the model

Page 32: Simulation & Multi-Agent Systems An Introduction

Graphs

Graphs as models of system network’s structure

I Static representation of pairwise relations between objects of thesystem

I nodes or vertices: entities of thesystem

I edges that connect pairs ofvertices: interaction betweenentities

Features

I Static model

I Micro-model

Page 33: Simulation & Multi-Agent Systems An Introduction

Graph Theory

Topology of a graph

I Analysis of structural properties of a network

Topological features of an N-nodes network

I The degree of a node i is the number of its connections (orneighbors), ki

I The average degree of a network is

〈k〈 =1

N

∑i

ki

I The degree distribution function P(k) which measures theproportion of nodes in the network having degree k

Page 34: Simulation & Multi-Agent Systems An Introduction

Graph Types

Random graph

I The vertices typically have 〈k〉 edges and the vertices havingsignificantly more or less edges than 〈k〉 are extremely rare

Scale-free graph

I These types of graphs are inhomogeneous, in that most of thevertices have few edges, whereas some vertices, called (hubs),have many edges

Hierarchical graphs

I These types of graphs describes modular networks, i.e. theyare formed by the repetition of nodes’ cluster.

Page 35: Simulation & Multi-Agent Systems An Introduction

Boolean Networks

I Introduced by Stuart Kaufmann asa model of gene regulationnetworks

I Directed graph with N nodes

I Nodes ↔ Boolean Function

I Node state: value of the booleanfunction (binary state)

Features

I Discrete synchronous model

I Deterministic model

I Micro-model

Page 36: Simulation & Multi-Agent Systems An Introduction

Boolean Network Dynamic

An example

t t + 1x1 x2 x3 x1 x2 x3

0 0 0 0 0 00 0 1 0 1 00 1 0 0 0 10 1 1 1 1 11 0 0 0 1 11 0 1 0 1 11 1 0 0 1 11 1 1 1 1 1

Page 37: Simulation & Multi-Agent Systems An Introduction

Differential Equations

I System described by a set of state variablesI Different types of differential equations:

I ODE: how do they vary in timeI PDE: how do they vary in time and spaceI SDE: which is the probability that the variable has a certain

value

I Time-dependent variables are assigned to different measuringor not-measurable quantities of the system

I The continuous state changes are modelled by a sum of ratesdescribing the increase and decrease of quantities amounts.

Features

I Continuos modelI Deterministic or Stochastic ModelI Macro model

Page 38: Simulation & Multi-Agent Systems An Introduction

An example of ODE

I The state variable is referenced as Xi which is a macroscopiccollective variable

I The collection of values of all these state variables{X1,X2, ...,Xn} denote a complete set of variables to definethe instantaneous state of the system X

I The time evolution of Xi (t) will take the form, through amathematical expression (ODE):

dXi

dt= Fi (X1,X2, ...,Xn; γ1, γ2, ..., γm)

I where:I Fi may be a complex function of the state variables: the

structure of the function Fi will depend in a very specific wayon the system considered

I γ1, γ2, ..., γm, are the parameters of the problem (controlparameters)

Page 39: Simulation & Multi-Agent Systems An Introduction

Simulation of Differential Equations Models

Analytical solution of differential equations

I Exact solution of a class of differential equationsI It is possible under very special circumstances

I i.e. when the function Fi is linear

I Example of analytic solution:I the solution of a set of ODEs in terms of exponential

functions, exp(λi t), and harmonic functions, sin(ωi t + φi )

Page 40: Simulation & Multi-Agent Systems An Introduction

Simulation of Differential Equations Models

Numerical solution of differential equations

I Also called numerical integration

I The exact solution of the equations is approximated bycalculating approximate values {X1,X2, ...,Xn} for X

I Time step is reduced to arbitrary small discrete intervals:values at consecutive time-points t0, t1, ..., tm

I It uses different numerical algorithms:I Euler’s method for ODEsI Taylor series method for ODEsI Runge-Kutta methodI Runge-Kutta-Fehlberg methodI Adams-Bashforth-Moulton methodI Finite Difference method for PDEsI . . .

Page 41: Simulation & Multi-Agent Systems An Introduction

Simulation of Differential Equations Models

Qualitative solution of differential equations

I It answer qualitative questions such as:I what will the system do for t →∞I under which condition the system is stable

I Definition of system attractorsI equilibrium pointsI limit cyclesI strange attractors

I Bifurcation analysisI how the system’s dynamic (solution) changes under the change

of its parameters

Page 42: Simulation & Multi-Agent Systems An Introduction

Modelling a Complex System

To remind you. . .

I Important features of a complex systemsI systems that draw their dynamics from flexible local

interactionsI systems where individuality and/or locality is importantI systems with a strong hierarchical organisationI emergent Phenomena and Self-organizing systemsI down-ward and up-ward systems dynamics

I Remind them if you wish to model a complex system

I They are important for analysing and choosing modellingapproaches and tools

Page 43: Simulation & Multi-Agent Systems An Introduction

Analysis of Differential Equations I

Advantages of ODE and PDE

I They are a really well understood and established framework

I They are relatively simple

I They have a strong formal aspect

I Where do differential equations fail?

Are they able to capture complex systems features?

Page 44: Simulation & Multi-Agent Systems An Introduction

Analysis of Differential Equations II

Tod-down approaches – Macro model

I The model is built upon the imposition of global laws

I The model loses the representation of the actors of the system

I Focusing only on the population, the model loses therepresentation of the individual and of its locality

I The model doesn’t allow the study of global dynamics asemergent phenomena from local interaction

I The model ignores the local processes performed by low-levelcomponents

I A particular entity is no longer accessible

Page 45: Simulation & Multi-Agent Systems An Introduction

Analysis of Networks

Are they able to capture complex systems features?

Bottom up approaches – Micro model

I The model is built upon the identification of systems entitiesand of the interactions between them

I The model does not allow the representation of autonomousbehaviour of the components

I The behaviour of the entire system dynamically emerges fromthe interactions between its parts

Page 46: Simulation & Multi-Agent Systems An Introduction

What is ABM

MAS provide designers and developers with...

I Agents...a way of structuring a model around autonomous andcommunicative etities

I Society...a way of representing a group of entities whose behaviouremerges from the interaction among elements

I Environment...a way of modelling the environment

MAS give methods to. . .

I Model individual structures and behaviours of different entities

I Model local interactions between entities

I Model the environment structures and dynamics

Page 47: Simulation & Multi-Agent Systems An Introduction

An Agent in ABM

Properties of agents in ABM

I Autonomous

I Heterogeneous

I Articulated internal structure

I Possibly adaptive, intelligent, mobile, . . .

Page 48: Simulation & Multi-Agent Systems An Introduction

An Agent in ABM

Defining the agents of an ABM

I Sensors & effectorsI Internal autonomous behaviour

I reactive behaviour: it defines how an agent reacts to externalstimuli

I proactive behaviour: it defines how an agent behaves in orderto reach its goals/tasks

I State

Page 49: Simulation & Multi-Agent Systems An Introduction

Environment in ABM

Defining the environment of an ABM

I Topology definition

I Complex internal dynamics

The agents can interact with the environment

Page 50: Simulation & Multi-Agent Systems An Introduction

What is ABM

Execute an ABM

I Running an ABMI Study its evolution

I observing individual and environment evolutionI observing global system properties as emergent properties from

agent-environment and inter-agent interactionI making in-silico experiment

Page 51: Simulation & Multi-Agent Systems An Introduction

Advantages of ABM

I When flexible conditional or even adaptive individualbehaviour has to be formulated

I When interactions with flexible individual participants have tobe represented

I When inhomogeneous space is relevantI When the simulation consists in mutable interacting

participantsI agents can be erasedI new agents can enter in the scenario

Page 52: Simulation & Multi-Agent Systems An Introduction

Problems of ABM

I There exists neither an unified formal framework for ABM nora widely accepted methodology for developing MABS

I Poor of formal definition of the modelling elements and rules

I Lack of conceptual language

I Increased amounts of parametersI Software development remains a significant barrier to the use

of ABMI there is a serious inconsistence and incongruence between

agents of the conceptual model and agents of thecomputational model

Page 53: Simulation & Multi-Agent Systems An Introduction

ABM and MABS Methodology in a Figure

Page 54: Simulation & Multi-Agent Systems An Introduction

Simulation Platform Issues

Standard issues [Railsback et al., 2006]

I Model structureI Discrete event simulation

I Scheduling: to control which specific actions are executed andwhen (in simulated time)

I Marsenne Twister: random number generation

I Distributed simulation

Page 55: Simulation & Multi-Agent Systems An Introduction

Swarm2

Swarm

I ObjectivesI to ensure a widespread use across scientific domainsI to implement a modelI to provide a virtual laboratory for observing and conducting

experiments

I Swarm is implemented in Objective-C

2http://www.swarm.org/

Page 56: Simulation & Multi-Agent Systems An Introduction

Repast3

Repast

I ObjectivesI to implement Swarm in JavaI to support the specific domain of social science (it includes

specific tools to that domain)I to make it easier for inexperienced users to build models

3http://repast.sourceforge.net/

Page 57: Simulation & Multi-Agent Systems An Introduction

MASON

MASON

I ObjectivesI models with many agents executed over many iterationsI to maximize execution speedI to assure complete reproducibility across hardwareI to detach or attach graphical interfacesI to be not domain specific

I Basic capabilities for graphing and random numberdistributions

Page 58: Simulation & Multi-Agent Systems An Introduction

NetLogo

I ObjectivesI to be ease of use

I Educational toolI NetLogo is recommended for models

I with short-term, local, interactions of agentsI base on grid environmentI not extremely complex

I Useful for prototyping models (quickly) and exploring designdecisions

I Provided by an own programming languageI high level structures and primitivesI all code in the same file

Page 59: Simulation & Multi-Agent Systems An Introduction

What do Existing Simulation Frameworks Miss?

I Incoherence between the design model and the computationalmodel

I computational agents 6= conceptual agentsI No first class abstraction for modelling the environment

Page 60: Simulation & Multi-Agent Systems An Introduction

ABM e MABS for Biological Systems

Modelling and simulating hematopoietic stem cells

I Cell is modelled as an agentI agent’s sensors are the cell’s membrane proteinsI agent’s state is defined as the gene expression levelI agent’s reactive behaviour models the signalling transduction

pathwaysI agent’s proactive behaviour models the gene regulation

networks

I Cell’s micro-environement is modelled as agents environmentI Cell’s interaction

I direct interaction is modelled as agent-agent communicationI indirect interaction is modelled through the liberation in the

environment of molecules

I [Montagna et al., 2007]

Page 61: Simulation & Multi-Agent Systems An Introduction

Bibliography I

Banks, J. (1999).Introduction to simulation.In Farrington, P., Nembhard, H. B., Sturrock, D. T., andEvans, G. W., editors, Proceedings of the 1999 WinterSimulation Conference, pages 7–13.

Klugl, F. and Norling, E. (2006).Agent-based simulation: Social science simulation and beyond.

Technical report, The Eighth European Agent SystemsSummer School (EASSS 2006), Annecy.

Page 62: Simulation & Multi-Agent Systems An Introduction

Bibliography II

Montagna, S., Omicini, A., Ricci, A., and d’Inverno, M.(2007).Modelling hematopoietic stem cell behaviour: An approachbased on multi-agent systems.In Allgower, F. and Reuss, M., editors, 2nd Conference“Foundations of Systems Biology in Engineering” (FOSBE2007), pages 243–248, Stuttgart, Germany. Fraunhofer IBRVerlag.

Parisi, D. (2001).Simulazioni - La realta rifatta al computer.Societa editrice il Mulino.

Railsback, S. F., Lytinen, S. L., and Jackson, S. K. (2006).Agent-based simulation platforms: Review and developmentrecommendations.Simulation, 82(9):609–623.

Page 63: Simulation & Multi-Agent Systems An Introduction

Bibliography III

Uhrmacher, A. M., Degenring, D., and Zeigler, B. (2005).Discrete Event Multi-level Models for Systems Biology.In Priami, C., editor, Principles of Organization in Organisms:Proceedings of the Workshop on Principles of Organization inOrganisms, volume 3380 of Lecture Notes in ComputerScience, pages 66–89. Springer.

Page 64: Simulation & Multi-Agent Systems An Introduction

Simulation & Multi-Agent SystemsAn Introduction

Multiagent Systems LSSistemi Multiagente LS

Andrea Omicini & Sara Montagna{andrea.omicini, sara.montagna}@unibo.it

Ingegneria DueAlma Mater Studiorum—Universita di Bologna a Cesena

Academic Year 2007/2008