La presentazione è in caricamento. Aspetta per favore

La presentazione è in caricamento. Aspetta per favore

16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _NetLogo _______________________________________ Impariamo ad usare.

Presentazioni simili


Presentazione sul tema: "16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _NetLogo _______________________________________ Impariamo ad usare."— Transcript della presentazione:

1 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _NetLogo _______________________________________ Impariamo ad usare NetLogo _______________________________________

2 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 2 impariamo NetLogo 1 Le basi di NetLogo Tre bottoni e un codice ripetere to cancella ca end to crea crt 15 end to muovi ask turtles [fd 5] end

3 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 3 impariamo NetLogo 2 Le basi di NetLogo Quattro bottoni e un po’ più di codice to cancella ca end to crea crt 15 end to muovi ask turtles [fd 5] end to cambia-direzione ask turtles [set heading (random 360)] end

4 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 4 impariamo NetLogo 3 Esempio del manuale esempio dal manuale A.nlogo movimenti esempio dal manuale B.nlogo terreno esempio dal manuale C.nlogo maggiore definizione del terreno esempio dal manuale D.nlogo interazione con il terreno

5 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 5 impariamo NetLogo 3A esempio dal manuale A.nlogo movimenti to setup ca crt 100 ask turtles [fd random screen-edge-x] end to go move-turtles end to move-turtles ask turtles [ set heading (random 360) fd 1 ] end

6 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 6 impariamo NetLogo 3B esempio dal manuale B.nlogo terreno patches-own [elevation] to setup ca setup-patches setup-turtles end to setup-turtles crt 100 ask turtles [ fd (random screen-edge-x) ] end ;diffuse patch-variable number ;Tells each patch to share (number * 100) percent of the value of patch-variable ;with its eight neighboring patches. number should be between 0 and 1. ;scale-color color number range1 range2 ;Reports a shade of color proportional to number to setup-patches ask patches [ set elevation (random 10000) ] diffuse elevation 1 ask patches [ set pcolor scale-color yellow elevation 1000 9000 ] end to go move-turtles end to move-turtles ask turtles [ set heading (random 360) fd 1 ] end

7 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 7 impariamo NetLogo 3C esempio dal manuale C.nlogo maggiore def. del terreno patches-own [elevation] globals [highest ;; the highest patch elevation lowest] ;; the lowest patch elevation to setup ca setup-patches setup-turtles end to setup-turtles crt 100 ask turtles [ fd (random screen-edge-x) ] end ;diffuse patch-variable number ;Tells each patch to share (number * 100) percent of the value of patch-variable ;with its eight neighboring patches. number should be between 0 and 1. ;scale-color color number range1 range2 ;Reports a shade of color proportional to number to setup-patches ask patches [ set elevation (random 10000) ] diffuse elevation 1 ;METTERE E TOGLIERE CON ; INIZIALE ask patches [ set pcolor scale-color yellow elevation 1000 9000 ] set highest max values-from patches [elevation] set lowest min values-from patches [elevation] ask patches [ if (elevation > (highest - 100)) ; SE -1000... [set pcolor white] ; SE red... if (elevation < (lowest + 100)) [set pcolor black] ] end to go move-turtles end to move-turtles ask turtles [ set heading (random 360) fd 1 ] end

8 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 8 impariamo NetLogo 3D esempio dal manuale D.nlogo interazione con il terreno patches-own [elevation] globals [highest ;; the highest patch elevation lowest] ;; the lowest patch elevation to setup ca setup-patches setup-turtles end to setup-turtles crt 100 ask turtles [ fd (random screen-edge-x) ] end ;diffuse patch-variable number ;Tells each patch to share (number * 100) percent of the value of patch-variable ;with its eight neighboring patches. number should be between 0 and 1. ;scale-color color number range1 range2 ;Reports a shade of color proportional to number to setup-patches ask patches [ set elevation (random 10000) ] diffuse elevation 1 ;METTERE E TOGLIERE CON ; INIZIALE ask patches [ set pcolor scale-color yellow elevation 1000 9000 ] set highest max values-from patches [elevation] set lowest min values-from patches [elevation] ask patches [ if (elevation > (highest - 100)) ; SE -1000... [set pcolor white] ; SE red... if (elevation < (lowest + 100)) [set pcolor black] ] end to go move-to-local-max end

9 16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 9 impariamo NetLogo 3D2 esempio dal manuale D.nlogo interazione con il terreno to move-turtles ask turtles [ set heading (random 360) fd 1 ] end ; -of ;Reports the value of the VARIABLE of the given agent. ;Can also be used to set the value of the variable. ; uphill patch-variable ;Reports the turtle heading (between 0 and 359 degrees) in the direction of the maximum value ;of the variable patch-variable, of the patches in a one-patch radius of the turtle. ;If there are multiple patches that have the same greatest value, a random one of those patches ;will be selected. ;patch-ahead distance ;Reports the single patch that is the given distance "ahead" of the calling turtle, that is, ;along the turtle's current heading ;; each turtle goes to the highest elevation in a radius of one to move-to-local-max ask turtles [ set heading uphill elevation if ( elevation-of patch-ahead 1 > elevation ) [ fd 1 ] ] end


Scaricare ppt "16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _NetLogo _______________________________________ Impariamo ad usare."

Presentazioni simili


Annunci Google