perché simulare ?
DESCRIPTION
Perché simulare ?. Introduzione Concetti Applicazioni Metodologie Strumenti. Contenuto della Presentazione. 1 – Introduzione 2 – Modelli di Dinamica dei Sistemi Epidemie Strategie 3 – Modelli Discreti Progettazione di servizi in un ospedale - PowerPoint PPT PresentationTRANSCRIPT
Alessandria 9.11.2005 Preparato da Roberto Berchi 1
Perché simulare ?
Introduzione•Concetti•Applicazioni•Metodologie •Strumenti
Alessandria 9.11.2005 Preparato da Roberto Berchi 2
1 – Introduzione
2 – Modelli di Dinamica dei Sistemi Epidemie Strategie
3 – Modelli Discreti Progettazione di servizi in un ospedale Analisi di processi organizzativi
4 – Modelli ad agenti
5 – Discussione - Indirizzi
Contenuto della Presentazione
Alessandria 9.11.2005 Preparato da Roberto Berchi 3
la nostra percezione della dinamica
• Esercizi introduttivi• Obiettivi • Storia
1- Introduzione
Alessandria 9.11.2005 Preparato da Roberto Berchi 4
Alessandria 9.11.2005 Preparato da Roberto Berchi 5
Percezione
Effetto serraAzioni per
diminuire emissionegas O
Modello reale
Effetto serra
Gas effettoserra
nell'atmosfera
Azioni perdiminuire emissione
gas
Gas emessi. assorbimentoGas
Il Trattato di Kyoto
Alessandria 9.11.2005 Preparato da Roberto Berchi 6
stockvenduto
domandain spedizione
tempo dispedizione
ricevimento
12
4
Il magazzino
Alessandria 9.11.2005 Preparato da Roberto Berchi 7
• Perché Simulare ?• Ruoli e conoscenze?• Quanto costa ?• In quali casi ?
• Esempi• Metodologie disponibili• Strumenti attuali e futuri
Obiettivi
Alessandria 9.11.2005 Preparato da Roberto Berchi 8c Klaus G. Troitzsch.
Hystory
Alessandria 9.11.2005 Preparato da Roberto Berchi 9
Modelli come mezzi di comunicazione • Definizione• Learning Organizations• Gli Strumenti
– Diagrammi causa effetto– Archetipi
– Modelli Stock Flow– Controllo, SIR
• Esempi applicativi– Controlli – “Zanzara tigre” e Febbri Emorragiche
2 – La Dinamica dei Sistemi
Alessandria 9.11.2005 Preparato da Roberto Berchi 10
• Nasce con la cibernetica : teoria del controllo• Due strumenti di analisi
– Diagrammi Causa-Effetto– Modelli Flussi – Livelli
• Il sistema è modellabile come un insieme di variabili continue. – Equazioni differenziali– Analogia a modelli idraulici
• Molti modelli disponibili (dal 1956)• Semplice e comunemente accettato anche come strumento di
comunicazione e condivisione• Tempi e costi di sviluppo limitati
System Dynamics (SD)
Alessandria 9.11.2005 Preparato da Roberto Berchi 11
Soluzione di un problema
1 - ‘Problem Space’ :Definizione di Elementi fisici e non fisici che determinano il problema2 - ‘Solution Space’ :Identificare alternative che possono cambiare o evitare aspetti del problem space
Sintomi
Cause
Risultatidesiderati
Effetti positiviRisorsenecessarie
Azioni Effetti negativiPer ottenere
Per scoprire
Dati storici ed esperienze
Passi (metodologia)
Alessandria 9.11.2005 Preparato da Roberto Berchi 12
Situazionedesiderata
Situazioneattuale
Azione
GAP-
+
+
Archetipi
Controllo (Balancing Loop)
http://www.systems-thinking.org/theWay
Alessandria 9.11.2005 Preparato da Roberto Berchi 13
R
Capacitàproduttivadisponibile
Investimenti
Percezionedella necessità
di investire
ritardo mediodi mercatoRitardo di
spedizione
Ordini deiclienti
Marketing
S S
S
S
O
O
SS
S
Come uscire dalla situazione pericolosa ?
Crescita e sottoinvestimento
Alessandria 9.11.2005 Preparato da Roberto Berchi 14
Escalation
If Tom and Anne's results are the same then better results of Anne relative to Tom will be zero and nothing happens. Yet if we consider the case where Anne's results are actually better than Tom's results these will interact in such a way that the better results of Anne relative to Tom, because of Tom's insecurity, adds to the perceived threat to Tom. This perceived threat to Tom adds to the actions by Tom to add to Tom's results. Tom's results then subtract from the better results of Anne relative to Tom.Now that Tom's results have decreased the better results of Anne relative to Tom this subtracts less from the threat to Anne. This is actually a double negative which Anne perceives as an increases threat. The threat to Anne adds more to the action by Anne to add more to Anne's results. This finally adds more to the better results of Anne relative to Tom, which adds to the threat to Tom and we're going round the first loop again.
Alessandria 9.11.2005 Preparato da Roberto Berchi 15
Managing the Structure
One approach is to disconnect the two loops so Anne and Tom are no longer competing with each other but competing with themselves. This produces two reinforcing loops.
The second approach is to to begin evaluating the composite of Anne and Tom's actions rather than their individual actions. In this way they begin to see the value of cooperation rather than competition and the structure turns into two synergistic reinforcing loops.
Alessandria 9.11.2005 Preparato da Roberto Berchi 16
x : Suscettibili
y : infetti
w : nuoviinfetti
-
+
Contatti +
INCONTRI /GIORNO +
PopolazionePROBABILITA'INFEZIONE PER
CONTATTO
Contatti consuscettibili
+
+
+
++
Modello Causa effetto : DiffusioneMalattie / Passa Parola
Alessandria 9.11.2005 Preparato da Roberto Berchi 17
stockvenduto
domandain spedizione
tempo dispedizione
ricevimento
Magazzino : soluzione
stock20
15
10
5
00 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Time (Month)
stock : xxstock : Current
Alessandria 9.11.2005 Preparato da Roberto Berchi 18
MaterialTravelling
stock
Transportation Delay
MaterialShipped
Materialreceived
Sold
Delayedorders orders
shippedIncomingOrders
Transmission Delay
init stock
init delayedorders
orders
init MaterialTravelling
Demand
INDEX
Inventory game No backlog
Alessandria 9.11.2005 Preparato da Roberto Berchi 19
set point g
livello g
misura del livello g
ritardorilevazione g
delta g
effetto azione g
azione g
tempo effetto g
intensità azione g
intensità azione g
livello set point60
29
-20 9 18 27 36 45 54
Time (Week)
livello g : ccset point g : cc
init livello (50)
(20)
Game controllo
Alessandria 9.11.2005 Preparato da Roberto Berchi 20
livello1effetto azione1
set point1delta1azione1
intensità azione1
ritardo effetto
set point 0
livello 0
misura del livello 0
ritardorilevazione 0
delta 0
effetto azione 0
azione 0
tempo effetto 0
intensità azione 0
Policy : Ritardo effetto / rilevazione
Alessandria 9.11.2005 Preparato da Roberto Berchi 21
Giovani mezza età anziani
nascite giovani che diventanodi mezza età
mezza età chediventano anziani
decessi da giovane decessi di mezzaetà
decessi anziani
tasso mortalitàgiovani
tasso natalità
tempo di permanenzanella mezza età
tasso mortalitàmezza età
tasso mortalitàanziani
init giovani init mezza init anziani
tempo di permanenzanei giovani
20
300 400
30
250
0.06
0.005 0.002 0.03
Alessandria 9.11.2005 Preparato da Roberto Berchi 22
Modello SIR (Susceptible, Infected, Retired)
Suscettibili Infetti Ritirati
Contatti/gg
infettività/contatto
nuovi infetti+
+
+
++
-
DurataInfezione
+-
Alessandria 9.11.2005 Preparato da Roberto Berchi 23
SuscettibiliS .
Infetti .nuovi infetti .
CONTATTI/GGC .Contatti .
Contatti consuscettibili .
INFETTIVITA' I .Init pop N .
Init infetti .
Immuninuovi ritirati .
Durata mediadell'infettività D .
popolazione
nuovi mortiTASSO
MORTALITA'
morti
SIR m10,000
5,000
00 10 20 30 40 50 60 70 80 90 100
Time (Month)
"Suscettibili S ." : current"Infetti ." : currentImmuni : currentmorti : current
<Immuni>
<Infetti .>
tempo di permanenzanell'immunità
perdono immunità
Cosa succedeSe :Infett altaMortalità altaMorte immediata
Alessandria 9.11.2005 Preparato da Roberto Berchi 24
Public ground
MosquitosLife cycle
Human infection
Prevention RepressionStrategies
Feeding infection/ process
-
DIsinfection1 Information
-
Healthy mosquitos
+
Infected Mosquitos
+ +
-
Healthy persons
+
+ -
Infected Persons
Weather data :teperature,
Rain Umidity
Infected personFromoutside
immuneinfecteddead
Social costs
Subsystems
Season
Disinfection 2
Private grounfInitial susceptibles
City Hall
Public Health
Weather ctl authorities
ISS insects
Public ground
MosquitosLife cycle
Human infection
Prevention RepressionStrategies
Feeding infection/ process
-
DIsinfection1 Information
-
Healthy mosquitos
+
Infected Mosquitos
+ +
-
Healthy persons
+
+ -
Infected Persons
Weather data :teperature,
Rain Umidity
Infected personFromoutside
immuneinfecteddead
Social costs
Subsystems
Season
Disinfection 2
Private grounfInitial susceptibles
City Hall
Public Health
Weather ctl authorities
ISS insects
Epidemie da Insetti
Alessandria 9.11.2005 Preparato da Roberto Berchi 25
parametri
personesuscettibili persone InI persone II immuni
nuove personeInI
zanzare nuoveinfette
numero infettiarrivati
numero mediopunture per persona
probabilità dipasto
totalepopolazione
efficacia dellatrasmissione a
zanzara
efficacia dellatrasmissione a
persona
zanzare infette numero punture perpasto base
maxpunture/(day*persona)
nuovepersone II
nuove personeimmuni
tempo eliminazionevirus
tempo diesplicitazione
InI = Infetti nonInfettanti
II = InfettiInfettanti
tempo arrivoinfetti
arrivi infetti
Processo di Infezione
Alessandria 9.11.2005 Preparato da Roberto Berchi 26
Possibili Azioni
1. Comunicazione alla popolazione : riduzione
focolai larvali
2. Interventi larvicidi periodici
3. Interventi larvicidi dopo una certa soglia di
pioggia
Leve : quando e quanto investire?
Alessandria 9.11.2005 Preparato da Roberto Berchi 27
Fattori climatici per gli anni 2001 e 2002 a confronto
currentlook pioggia 2001
403020100
7 186 364-X-
currentlook pioggia 2002
100755025
07 186 364
-X-
currentlook temperatura 2001
403020100
7 186 364-X-
currentlook temperatura 2002
40302010
07 186 364
-X-
Alessandria 9.11.2005 Preparato da Roberto Berchi 28
VALIDAZIONE DEL MODELLO PER GLI ANNI 2001 E 2002
confronto uova osservate e calcolate40
6 M
00
0 2 4 6 8 10 12base mese
uova viste : currenttot uova : current
confronto uova osservate e calcolate60
6 M
00
0 2 4 6 8 10 12base mese
uova viste : currenttot uova : current
Alessandria 9.11.2005 Preparato da Roberto Berchi 29
Maggiore diffusione della dengue nel 2002 imputabile alla maggiore piovosità estiva di quest’anno rispetto al precedente.
Numero massimo di malati rilevato in entrambi i casi tra agosto e settembre per un totale di 406 nel 2001 e di 4.477 nel 2002.
I costi per spese mediche: 101.624 € per il 2001, 1.119.000 € per il 2002 .
persone suscettibili10,000
7,000
4,0000 2 4 6 8 10 12
base mese
persone suscettibili : senza azioni 2001persone suscettibili : senza azioni 2002
persone Infette Infettanti800
400
00 2 4 6 8 10 12
base mese
persone Infette Infettanti : senza azioni 2001persone Infette Infettanti : senza azioni 2002
persone immunizzate6,000
3,000
00 2 4 6 8 10 12
base mese
persone immunizzate : senza azioni 2001persone immunizzate : senza azioni 2002
totale costi2 M
1 M
00 2 4 6 8 10 12
base mese
totale costi : senza azioni 2001totale costi : senza azioni 2002
Alessandria 9.11.2005 Preparato da Roberto Berchi 30
Modelli discreti
Alessandria 9.11.2005 Preparato da Roberto Berchi 31
Sistema Aperto
Sorgente Coda Servizio Pozzo
Entità
= Numero unità in codap() = prob t= tempo di attesaE(tq) = tempo medio attesa
.ta= Tempo interarrivo
Var. aleatoria
Ta= E(ta ) Tempo medio i.a.
= 1/Ta frequenza media arrivi
.f(ta) = funzione densità
.ts = tempo servizio
Var. aleatoria
Ts= E(ts) Tempo medio servizio
=1/ Ts frequenza media di serviziof(ts) = funzione densità
= / = Ts = Ts/ Ta
Fattore di utilizzazione
q = Numero unità nel sistemat q= tempo nel sistema
E(tq )= E(tq) + E(ts) t q= t + ts
Notazione teoria code
Alessandria 9.11.2005 Preparato da Roberto Berchi 32
Entità
.f(ta) esponenziale negativa
.f(ts) “ “
1 servente
.m/m/1 (arrivi Markovian
servizi ,Markovian,
1 servente)
P(0) = (1- ) P(t> t) = e -( - ).t
P(n) = n (1- )
E(q) = /(1- ) P(tq > t) = e -( - ).t
E() = E(q)
E(t) = /( - )
E(tq) =1/( - )
Risultati analitici
Modello m/m/1
Alessandria 9.11.2005 Preparato da Roberto Berchi 33
2 V1 A PD
#u
RR
P
L W P
#
989
Genera/
entrataCoda Servizio Pozzo /
Uscita
Parametri
Risultati
La struttura del modello EXTEND (Libreria BPR)
Alessandria 9.11.2005 Preparato da Roberto Berchi 34
• Contesto : Giubileo 2000• Disponibilità dei dati giornalieri
– Domanda : Numero chiamate , loro distribuzione giornaliera e triage– Risorse :
• Numero di ALS e BLS• Numero operatori alla centrale• Numero di canali radio
– Servizio• Tempi di arrivo al luogo delle chiamate• Azioni necessarie• Tempi di servizio al pronto soccorso
Il modello DE del 118 di Roma
Alessandria 9.11.2005 Preparato da Roberto Berchi 35
Rappresentazione dei processi 118. Risultati utilizzati per il modello strategico .Vincolo di legge (8 minutes arrivo al chiamante per codici rossi) (x118.mox)
Centrale operativa
ChiamateAmbulanze
I processi del 118 (1998)
Alessandria 9.11.2005 Preparato da Roberto Berchi 36
linea e operato evado telef.
riposo
ifsi
no
IF
Soccorso
statistica
statistica
Con1InCon1In Con2OutCon2Out
fineoutfineout
localizza completa scheda
Con1InCon1In Con2OutCon2Out
csegna schedaN
Release
Alessandria 9.11.2005 Preparato da Roberto Berchi 37
tipo intervento alloca ambul attiva ambul
Throwritorno
viaggio
?
si
nointervento rich
Stat
Value Probability0 0 0.251 1 0.75234
Catch
#ritorno
Throwritorno
Throwritorno
decesso ?
deceduto
Pickup paziente trasporto accettazione
ritorno statistiche
Con2OutCon2Out
0.05
Alessandria 9.11.2005 Preparato da Roberto Berchi 38
118 Alcuni risultati
Alessandria 9.11.2005 Preparato da Roberto Berchi 39
4 - Agent Based Simulation
• Principi• Strumenti
Alessandria 9.11.2005 Preparato da Roberto Berchi 40
Agent Based
• What is an Agent?• · An agent is any entity that can be viewed as perceiving its environment
through sensors and acting upon its environment through effectors Russel and Norvig, 1995]
Purposes: Understanding vs. Prediction
Alessandria 9.11.2005 Preparato da Roberto Berchi 41
Agent Based Simulation• Ambiti di sviluppo
– Artificial life • Ecologia• Sistemi sociali
– Economia• Domanda Offerta• Sistemi produttivi autoorganizzanti
– Studio del territorio (Simulazione + GIS)• Traffico• Evoluzione del territorio• Pollution, 118, commodities, ……)
Alessandria 9.11.2005 Preparato da Roberto Berchi 42
How Ants find Food ? (Netlogo-ANTS)
Alessandria 9.11.2005 Preparato da Roberto Berchi 43
Flocking
Alessandria 9.11.2005 Preparato da Roberto Berchi 44
Il libro di riferimento è : John Sterman, 2000,Business Dynamics - Systems thinking and modeling for a complex world, McGraw Hill , With CD ROMOther useful books 1 - Kauffman, Draper L., 1980. Systems 1: An Introduction to SystemsThinking. Pegasus Communications 2 -Roberts, Nancy, 1983. Introduction to Computer Simulation.Portland, Oregon: Productivity Press, 562 pp.3 - Meadows, Donella H., Dennis Meadows, Jfrgen Randers, 1992.Beyond the Limits: Confronting Global Collapse, Envisioning aSustainable Future. Post Mills, VT: Chelsea Green Publishing Co., 300 pp.Other source :In the ” help” of the VENSIM simulation environment there is a tutorial that covers all the topics of the course.Internet resourcesA complete course – Road Maps - can be downloaded from this web site sysdyn.clexchange.orgThe System Dynamics community (applications , software ) could be reached starting from the root : www.albany.edu/cpr/sds
www.idsia.ch/~andrea/simtools.html
System Dynamics
Riferimenti Bibliografici e su Web
Alessandria 9.11.2005 Preparato da Roberto Berchi 45
Simulazione discreta
Book : • Law, A.M. Kelton, D.W. Kelton, and Kelton D.M. (1999) Simulation
Modeling and Analysis. McGraw-Hill
Some Internet Resources :• Pointer to acm (association for Computery Machines) simulation interest
goup http://www.acm.org/sigsim/main/about.html• An interesting digital Book on simulation (by Prof. Fishwick , University
of Florida) http://www.cise.ufl.edu/~fishwick/book/tableofcontent2_1.html
Alessandria 9.11.2005 Preparato da Roberto Berchi 46
Agent Based Simulation
Libri- Langton C.G.(1989). Artificial life:proceedings of an interdisciplinaryWorkshop on the syntesis and simulation of living systems .Santa Fè institute studies in the science of complexity.Addison Westley .Redwood city.
-Pietro Terna (1998), Simulation Tools for Social Scientists:- Building Agent Based Models with SWARM, http://jasss.soc.surrey.ac.uk/1/2/4.html
-Agent-Based Methods in Economics and Finance: Simulations in Swarm. Dordrecht and London, Kluwer Academic. http://www.wkap.nl/book.htm/0-7923-7419-3
Other Internet ResourcesUML the official OMG page (Object Management Group) www.omg.org/technology/uml/The Unified Modeling Language Resource Center www.rational.com/uml/index.jsp
Alessandria 9.11.2005 Preparato da Roberto Berchi 47
Software System Dynamics
VENSIM : www.vensim.com Ithink/Stella : www.hps-inc.com
PowerSIm : www.powersim.comSD strutturato(simila) : www.simulistic.com
Discrete :
EXTEND : www.imaginethatinc.com Arena , Witness (distributori italiani)
Agent based ANYLOGIC:www.xjtek.comNETlogo : ccl.northwestern.edu/netlogoREPAST : repast.sourceforge.netSWARM
Alessandria 9.11.2005 Preparato da Roberto Berchi 48