Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink ()...

28
Informatica Generale II: Modellistica ambientale

Transcript of Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink ()...

Page 1: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Informatica Generale II:Modellistica ambientale

Page 2: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Obiettivi del corso

• Acquisire la capacità di analizzare in modo formale problemi reali e di costruirne modelli

• Acquisire la capacità di usare alcuni strumenti informatici per la modellazione:• fogli elettronici• pacchetti software per la System Dynamics

• Vensim PLE (www.vensim.com)• Stella - ithink (www.hps-inc.com)

Page 3: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

(Umberto Eco, “Il nome della rosa”)

(William ShakespeareThe Tragedy of Hamlet, Prince of Denmark)

There are more things in heaven and earth, Horatio,Than are dreamt of in your philosophy.

Page 4: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

• Strumenti di apprendimentola costruzione di un modello è un processo a due vie: da un lato i nostri modelli mentali e dall'altro la realtà in una continua interazione attraverso un processo di confronto. Inoltre l'apprendimento ha anche una caratteristica partecipatoria: procede attraverso il coinvolgimento di diversi attori

• Strumenti decisionaliconsentono di analizzare e proporre azioni organizzate per modificare la situazione corrente e produrre la soluzione voluta

Modelli

Page 5: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Processo di modellazione

Costruzione del modelloProblema Soluzioni

ApprendimentoPartecipazione

Page 6: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

I modelli che considereremo non sono modelli predittivi

Page 7: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Linguaggi per rappresentare modelli

• Espressività: capacità di rappresentare situazioni diverse e complesse

• Potenza: rigore e precisione nella descrizione; efficacia ed utilizzabilità del modello

Page 8: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Il sistema e i suoi confini

Sistema

Realtà esternaConfini del Sistema

Page 9: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Che cosa è?

Page 10: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

E questo?

Page 11: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Modelli

• Modelli statici

• Ci aiutano a comprendere il comportamento di un sistema in condizioni di riposo/equilibrio: ad esempio il calcolo di una struttura, oppure la determinazione del punto di equilibrio fra offerta e domanda in un mercato

• Modelli dinamici

• Ci aiutano a capire come un sistema si evolve nel tempo: ad esempio la crescita di una popolazione, oppure il diffondersi di una epidemia

Page 12: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Andamenti

0

2

4

6

8

10

12

14

0 10 20 30 40 50 60

Crescita

0

20

40

60

80

100

120

140

1 5 9 13 17 21 25 29 33 37 41 45 49 53 57

Oscillazioni

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 10 20 30 40 50 60

Decrescita

Page 13: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Passi della modellazione

• Individuazione delle variabili chiave ed analisi del loro andamento (si tratta delle variabili, spesso una sola, da cui è partita la presa di coscienza dell’esistenza di un problema)

• Individuazione degli elementi più rilevanti del sistema in esame e delle variabili che li rappresentano, o comunque ad essi associate.

• Individuazione delle relazioni fra le diverse variabili, con particolare riferimento a relazioni causali.

• Individuazione delle principali catene, o anelli, causali.

Page 14: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

• Livelli o variabili di stato

• Flussi

• Variabili ausiliarie

Dinamica dei Sistemi

Page 15: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Un semplice esempio:la dinamica di una popolazione

• livello: popolazione (numerosità)

• flussi: numero di nascite e di morti nell’unità di tempo (ad esempio all’anno)

• variabili ausiliarie: (tasso di nascita e tasso di mortalità)

Page 16: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Livelli e flussi

Popolazione

Nascite

Morti

Popolazione: P(t)Natalità: NMortalità: MNascite: NxP(t)Morti: MxP(t)

Page 17: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

dP (t)dt

= N × P (t) − M × P (t) = (N − M) × P (t)

dP (t)dt

− (N − M) × P (t) = 0

e−(N−M)t × dP (t)dt

− (N − M) × e−(N−M)t × P (t) = 0

d

dt(P (t) × e−(N−M)t) = 0

∫ t

o

d

ds(P (s) × e−(N−M)s)ds = 0

Page 18: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

∫ t

o

d

ds(P (s) × e−(N−M)s)ds = 0

(P (t) × e−(N−M)t − P (0) = 0

P (t) = P (0) × e(N−M)t

0

2

4

6

8

10

12

14

0 10 20 30 40 50 60

N > M N < M

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 10 20 30 40 50 60

Page 19: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Discretizzazione:P (t + ∆t) = P (t) + P (t)(N − M)∆t

=B4+B4*($C$4-$D$4)/1000 Crescita della popolazione

0

500

1,000

1,500

2,000

2,500

3,000

3,500

4,000

4,500

5,000

0 20 40 60 80 100 120

Page 20: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

(∆t = 1)

0 0.5 1

P (t)

P (t + 1)

P (t + 0.5)

P (t + 1)

P (t + 1) = P (t) + P (t)(N − M) = P (t)(1 + N − M)

P (t + 0.5) = P (t) + P (t)(N − M)0.5 = P (t)(1 + 0.5(N − M))

P (t + 1) = P (t + 0.5)(1 + 0.5(N − M)) = P (t)(1 + 0.5(N − M))2

Page 21: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

∆t = 1 ∆t = 0.5

Page 22: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Livelli e Flussi

Livello(t + ∆t) = Livello(t)+

(FlussoInput(t) − FlussoOutput(t))∆t

Page 23: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Il modello Preda-PredatoreIl modello Preda-Predatore è stato sviluppato dal matematico italiano Vito Volterra (1860-1940) per studiare un fenomeno che era stato evidenziato dallo zoologo Umberto D'Ancona.

Analizzando le statistiche relative alla pesca nel nord dell'Adriatico, D’Ancona aveva osservato che durante gli ultimi anni della prima guerra mondiale e negli anni immediatamente seguenti si era verificato un sostanziale aumento della percentuale dei predatori (Selaci) pescati. L’unica circostanza che appariva collegabile a questo incremento era la diminuzione dell'attività di pesca causata dalle attività belliche.

Page 24: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Le variabili di livello

Prede(t + ∆t) = Prede(t) + (Nascite Prede(t) − Morti Prede(t))∆t

Predatori(t + ∆t) = Predatori(t)+

(Nascite Predatori(t) − Morti Predatori(t))∆t

Prede

Predatori

Nascite Prede Morti Prede

Nascite Predatori Morti Predatori

Page 25: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Le variabili di flusso

Nascite Prede(t) = A · Prede(t)

Morti Predatori(t) = C · Predatori(t) + Predatori Pescati(t)

Morti Prede(t) = Prede Catturate(t) + Prede Pescate(t)

Nascite Predatori(t) = D · Incontri Prede Predatori(t)

Page 26: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Le variabili ausiliarie

Prede Catturate(t) = B · Incontri Prede Predatori(t)

Incontri Prede Predatori(t) = Prede(t) · Predatori(t)

Prede Pescate(t) = ε · Prede(t)

Predatori Pescati(t) = ε · Predatori(t)

Page 27: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Il modello completo

Prede

Predatori

Nascite Prede Morti Prede

Nascite Predatori Morti Predatori

A

B

D

Prede CatturatePrede Pescate

Predatori Pescati

Incontri Prede Predatoriepsilon

C

Page 28: Informatica Generale II: Modellistica ambientale · • Vensim PLE () • Stella - ithink () (Umberto Eco, “Il nome della rosa”) (William Shakespeare The Tragedy of Hamlet, Prince

Andamento delle popolazioni

400,000

600

300,000450

200,000300

100,000150

00

0 100 200 300 400 500 600 700 800 900 1000Time (Week)

Prede : Predatori1RKPredatori : Predatori1RK