...

Perché utilizzare la simulazione

by user

on
Category: Documents
18

views

Report

Comments

Transcript

Perché utilizzare la simulazione
Perché simulare ?
Introduzione
•Concetti
•Applicazioni
•Metodologie
•Strumenti
Alessandria 9.11.2005
Preparato da Roberto Berchi
1
Contenuto della Presentazione
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
Alessandria 9.11.2005
Preparato da Roberto Berchi
2
1- Introduzione
la nostra percezione della dinamica
• Esercizi introduttivi
• Obiettivi
• Storia
Alessandria 9.11.2005
Preparato da Roberto Berchi
3
Alessandria 9.11.2005
Preparato da Roberto Berchi
4
Il Trattato di Kyoto
Percezione
Azioni per
diminuire emissione
gas
O
Effetto serra
Modello reale
Gas emessi.
Gas effetto
serra
nell'atmosfera
assorbimento
Gas
Azioni per
diminuire emissione
gas
Effetto serra
Alessandria 9.11.2005
Preparato da Roberto Berchi
5
Il magazzino
12
stock
4
ricevimento
venduto
in spedizione
domanda
tempo di
spedizione
Alessandria 9.11.2005
Preparato da Roberto Berchi
6
Obiettivi
•
•
•
•
Perché Simulare ?
Ruoli e conoscenze?
Quanto costa ?
In quali casi ?
• Esempi
• Metodologie disponibili
• Strumenti attuali e futuri
Alessandria 9.11.2005
Preparato da Roberto Berchi
7
Hystory
c Klaus G. Troitzsch.
Alessandria 9.11.2005
Preparato da Roberto Berchi
8
2 – La Dinamica dei Sistemi
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
Alessandria 9.11.2005
Preparato da Roberto Berchi
9
System Dynamics (SD)
• 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
Alessandria 9.11.2005
Preparato da Roberto Berchi
10
Passi (metodologia)
Soluzione di un problema
1 - ‘Problem Space’ :Definizione di Elementi fisici e non fisici che determinano il problema
2 - ‘Solution Space’ :Identificare alternative che possono cambiare o evitare aspetti del problem space
Sintomi
Dati storici ed
esperienze
Cause
Per scoprire
Risultati
desiderati
Per ottenere
Azioni
Risorse
necessarie
Alessandria 9.11.2005
Effetti negativi
Effetti positivi
Preparato da Roberto Berchi
11
Archetipi
http://www.systems-thinking.org/theWay
Controllo (Balancing Loop)
+
Situazione
desiderata
Azione
GAP
-
Situazione
attuale
Alessandria 9.11.2005
+
Preparato da Roberto Berchi
12
Crescita e sottoinvestimento
S
O
Ordini dei
clienti
Marketing
S
ritardo medio
di mercato
Ritardo di
spedizione
S
S
O
Capacità
produttiva
disponibile
S
Percezione
della necessità
di investire
S
S
R
Investimenti
Come uscire dalla situazione pericolosa ?
Alessandria 9.11.2005
Preparato da Roberto Berchi
13
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
14
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.
Alessandria 9.11.2005
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.
Preparato da Roberto Berchi
15
Modello Causa effetto : Diffusione
Malattie / Passa Parola
-
x : Suscettibili
+
PROBABILITA'
INFEZIONE PER
CONTATTO
w : nuovi
infetti
+
Contatti con +
suscettibili
+
+
INCONTRI /
GIORNO
+
Alessandria 9.11.2005
Popolazione
Contatti
+ +
y : infetti
Preparato da Roberto Berchi
16
Magazzino : soluzione
stock
venduto
ricevimento
domanda
in spedizione
stock
tempo di
spedizione
20
15
10
5
0
0
2
4
6
8
10
12
14 16 18
Time (Month)
20
22
24
26
28
30
stock : xx
stock : Current
Alessandria 9.11.2005
Preparato da Roberto Berchi
17
Inventory game No backlog
init Material
Travelling
Material
Shipped
Material
Travelling
init stock
stock
Sold
Material
received
Transportation Delay
Demand
init delayed
orders
Incoming
Orders
Delayed
orders
orders
shipped
orders
Transmission Delay
Alessandria 9.11.2005
Preparato da Roberto Berchi
INDEX
18
Game controllo
tempo effetto g
init livello
livello set point
(50)
60
ritardo
rilevazione g
livello g
effetto azione g
misura del livello g
azione g
29
-2
0
9
18 27 36
Time (Week)
45
54
delta g
intensità azione g
set point g
(20)
livello g : cc
set point g : cc
intensità azione g
Alessandria 9.11.2005
Preparato da Roberto Berchi
19
Policy : Ritardo effetto / rilevazione
ritardo effetto
tempo effetto 0
effetto azione1
livello1
azione1
delta1
set point1
misura del livello 0
azione 0
intensità azione1
delta 0
intensità azione 0
Alessandria 9.11.2005
ritardo
rilevazione 0
livello 0
effetto azione 0
Preparato da Roberto Berchi
set point 0
20
20
tempo di permanenza
nei giovani
300
init giovani
30
400
init mezza
Giovani
nascite
tasso natalità
0.06
mezza età
giovani che diventano
di mezza età
decessi da giovane
tasso mortalità
giovani
0.005
Alessandria 9.11.2005
tempo di permanenza
nella mezza età
250
init anziani
anziani
mezza età che
diventano anziani
decessi di mezza
età
decessi anziani
tasso mortalità
mezza età
0.002
tasso mortalità
anziani
0.03
Preparato da Roberto Berchi
21
Modello SIR (Susceptible, Infected, Retired)
infettività
/contatto
+
Suscettibili
+
nuovi infetti
+ +
Contatti/gg
Alessandria 9.11.2005
Preparato da Roberto Berchi
Infetti
+
+ Ritirati
-
Durata
Infezione
22
Contatti con
suscettibili .
<Immuni>
CONTATTI/GG
C.
Contatti .
popolazione
<Infetti .>
Durata media
dell'infettività D .
Init infetti .
Suscettibili
S.
Immuni
Infetti .
nuovi ritirati .
nuovi infetti .
Init pop N .
TASSO
MORTALITA'
INFETTIVITA' I .
nuovi morti
morti
Cosa succede
Se :
perdono immunità
tempo di permanenza
nell'immunità
Infett alta
Mortalità alta
Morte immediata
SIR m
10,000
5,000
0
0
10
20
30
40
50
60
Time (Month)
70
80
90
100
"Suscettibili S ." : current
"Infetti ." : current
Immuni : current
morti : current
Alessandria 9.11.2005
Preparato da Roberto Berchi
23
Weather ctl authorities
Season
Weather data :
teperature,
Rain
Umidity
Epidemie
da
Insetti
Subsystems
Healthy mosquitos
Healthy persons
Infected Mosquitos Infected Persons
Public ground
Mosquitos
Life cycle
-
Infected person
From
outside
Public Health
+
-
-
+
+
Feeding
infection
/ process
+
Private grounf
immune
infected
dead
Human infection
+
-
Initial susceptibles
ISS insects
Prevention
Repression
Strategies
DIsinfection1
Social costs
City Hall
Information
Disinfection 2
Alessandria 9.11.2005
Preparato da Roberto Berchi
24
Processo di Infezione
parametri
totale
popolazione
tempo arrivo
infetti
efficacia della
trasmissione a
persona
persone
suscettibili
nuove persone
InI
tempo di
esplicitazione
persone InI
arrivi infetti
nuove
persone II
zanzare infette
Alessandria 9.11.2005
II = Infetti
Infettanti
tempo eliminazione
virus
persone II
probabilità di
pasto
numero medio
punture per persona
InI = Infetti non
Infettanti
numero infetti
arrivati
numero punture per
pasto base
Preparato da Roberto Berchi
nuove persone
immuni
immuni
zanzare nuove
infette
max
punture/(day*persona)
efficacia della
trasmissione a
zanzara
25
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
26
Fattori climatici per gli anni 2001 e
2002 a confronto
current
current
look pioggia 2001
40
30
look pioggia 2002
100
75
20
10
0
50
25
7
186
-X-
364
0
7
186
-X-
current
current
look temperatura 2001
40
30
look temperatura 2002
40
30
20
10
0
364
20
10
7
Alessandria 9.11.2005
186
-X-
364
0
Preparato da Roberto Berchi
7
186
-X-
364
27
VALIDAZIONE DEL MODELLO PER GLI
ANNI 2001 E 2002
confronto uova osservate e calcolate
confronto uova osservate e calcolate
60
6M
40
6M
0
0
0
0
0
2
4
uova viste : current
tot uova : current
Alessandria 9.11.2005
6
8
base mese
10
12
0
2
4
6 8
base mese
10
12
uova viste : current
tot uova : current
Preparato da Roberto Berchi
28
persone suscettibili
persone Infette Infettanti
persone immunizzate
10,000
800
6,000
7,000
400
3,000
4,000
0
0
2
4
6
8
base mese
persone suscettibili : senza azioni 2001
persone suscettibili : senza azioni 2002
10
12
0
0
2
4
6
8
base mese
10
12
persone Infette Infettanti : senza azioni 2001
persone Infette Infettanti : senza azioni 2002
0
2
4
6
8
base mese
10
12
persone immunizzate : senza azioni 2001
persone immunizzate : senza azioni 2002
totale costi
2M
1M
0
0
2
4
6
8
base mese
10
12
totale costi : senza azioni 2001
totale costi : senza azioni 2002
 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 .
Alessandria 9.11.2005
Preparato da Roberto Berchi
29
Modelli discreti
Alessandria 9.11.2005
Preparato da Roberto Berchi
30
Notazione teoria code
Sistema Aperto
Entità
 =  /  =  Ts = Ts/ Ta
Fattore di utilizzazione
Sorgente
.ta= Tempo interarrivo
Var. aleatoria
Ta= E(ta ) Tempo medio i.a.
= 1/Ta frequenza media
arrivi
.f(ta) = funzione densità
Alessandria 9.11.2005
Coda
Servizio
 = Numero unità
in coda
p() = prob 
t= tempo di
attesa
E(tq) = tempo
medio attesa
Pozzo
.ts = tempo servizio
Var. aleatoria
Ts= E(ts) Tempo medio
servizio
 =1/ Ts frequenza media
di servizio
f(ts) = funzione densità
Preparato da Roberto Berchi
q = Numero unità nel sistema
t q= tempo nel sistema
E(tq )= E(tq) + E(ts)
t q= t + ts
31
Modello m/m/1
Entità
.m/m/1 (arrivi Markovian
.f(ta) esponenziale negativa
.f(ts)
“
“
servizi ,Markovian,
1 servente
1 servente)
Risultati analitici
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/( - )
Alessandria 9.11.2005
Preparato da Roberto Berchi
32
La struttura del modello EXTEND (Libreria BPR)
Genera/
Servizio
Coda
entrata
Pozzo /
Uscita
Risultati
u
#
L
W
#
P
989
R
1
2
A
P
V
D
P
Parametri
Alessandria 9.11.2005
Preparato da Roberto Berchi
33
Il modello DE del 118 di Roma
• 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
Alessandria 9.11.2005
Preparato da Roberto Berchi
34
I processi del 118 (1998)
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
Ambulanze
Chiamate
Alessandria 9.11.2005
Preparato da Roberto Berchi
35
if
IF
Con1In
Con2Out
si
linea e operato
ev ado telef .
no
Soccorso
statistica
fineout
riposo
statistica
Release
Con1In
localizza
Alessandria 9.11.2005
completa scheda
csegna scheda
Preparato da Roberto Berchi
Con2Out
N
36
Value
0
1
2
3
4
Probability
0.25
0.75
0
1
si
?
tipo interv ento
alloca ambul
attiv a ambul
no
interv ento rich
v iaggio
Stat
Throw
Throw
ritorno
ritorno
deceduto
Catch
Con2Out
#
ritorno
statistiche
ritorno
0.05
Throw
ritorno
decesso ?
Pickup paziente
Alessandria 9.11.2005
trasporto
accettazione
Preparato da Roberto Berchi
37
118 Alcuni risultati
Alessandria 9.11.2005
Preparato da Roberto Berchi
38
4 - Agent Based Simulation
• Principi
• Strumenti
Alessandria 9.11.2005
Preparato da Roberto Berchi
39
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
40
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
41
How Ants find Food ? (Netlogo-ANTS)
Alessandria 9.11.2005
Preparato da Roberto Berchi
42
Flocking
Alessandria 9.11.2005
Preparato da Roberto Berchi
43
Riferimenti Bibliografici e su Web
www.idsia.ch/~andrea/simtools.html
System Dynamics
Il libro di riferimento è :
John Sterman, 2000,Business Dynamics - Systems thinking and modeling for a
complex world, McGraw Hill , With CD ROM
Other useful books
1 - Kauffman, Draper L., 1980. Systems 1: An Introduction to Systems
Thinking. 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 a
Sustainable 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 resources
A complete course – Road Maps - can be downloaded from this web site
sysdyn.clexchange.org
The System Dynamics community (applications , software ) could be reached
starting from the root : www.albany.edu/cpr/sds
Alessandria 9.11.2005
Preparato da Roberto Berchi
44
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
45
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 Resources
UML 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
46
Software
System Dynamics
VENSIM : www.vensim.com
Ithink/Stella : www.hps-inc.com
PowerSIm : www.powersim.com
SD strutturato(simila) : www.simulistic.com
Discrete :
EXTEND : www.imaginethatinc.com
Arena , Witness (distributori italiani)
Agent based
NETlogo : ccl.northwestern.edu/netlogo
REPAST : repast.sourceforge.net
SWARM
Alessandria 9.11.2005
ANYLOGIC:www.xjtek.com
Preparato da Roberto Berchi
47
Alessandria 9.11.2005
Preparato da Roberto Berchi
48
Fly UP