13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _Strumenti, seguito _______________________________________ Un modello.

Slides:



Advertisements
Similar presentations
Got Gas? Jim and Michael. Problem Statement (Weight 15%) An investigation of a gas pump queue as a function of rationing policy We modeled the queue at.
Advertisements

Netlogo! NetLogo is a programmable modeling environment for simulating complex systems. Modelers can give instructions to hundreds or thousands of independent.
Agents and Pervasive Computing Group Università di Modena e Reggio Emilia System Requirements NetLogo is designed: to run almost any type of computer.
New Mexico User Test Starlogo TNG September 16, 2006 Starlogo TNG September 16, 2006.
Netlogo and its Relatives Logo (Papert) –Language for teaching mathematics graphically –Tell turtle how to move Starlogo (Resnick) & StarlogoT (Wilensky)
Describing Quantitative Variables
IS660Z Programming Games Using Visual Basic Overview of Cannonball.
RAPTOR Syntax and Semantics By Lt Col Schorsch
Biomedical Modeling: Introduction to the Agent-based epidemic modeling
Day 1 Goal: To create a model of people hunting in the forest for mushrooms and then start working on improving their mushroom hunting ability mathematically.
Further Maths Hello 2014 Univariate Data. What is data? Data is another word for information. By studying data, we are able to display the information.
13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _Strumenti, seguito _______________________________________ Un modello.
New Mexico Computer Science For All Breeds and Shapes in NetLogo Maureen Psaila-Dombrowski.
Using Logo and Logic Please use speaker notes for additional information!
Objectives In this chapter, you will learn about:
16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _NetLogo _______________________________________ Uno strumento semplificato:
2 maggio 2005Master in economia e politica sanitaria - Simulazione per la sanità 1 _a simple example with WD, DW and WDW _______________________________________.
Displaying Data Frequency DistributionsFrequency Distributions ◦Athletic Shoe Survey Histograms ◦Capital Credit Union Joint Frequency Distributions ◦Capital.
Programing App Inventor. Variable Declaration App Inventor: Declare Variables using the “Define Variable As” Block – Find the Blocks Editor (top-left),
Teaching Contemporary Mathematics Conference January 25, 2013 Christine Belledin NC School of Science and Mathematics.
Department of Computer Science What is NetLogo UH-DMML  Multi-agent programmable modeling environment  Well suited for modeling complex systems evolving.
An Introduction to NetLogo given by Gabriel Wurzer. ,
MrsBillinghurst. net A2 Computing A2 Computing Projects Game Animation in Pascal.
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
Week 11 DO NOW QUESTIONS. An ask turtles block is a set of instructions that is issued to every turtle. Even though computers can do things very quickly,
Chapter 2 - Algorithms and Design
A Look Inside Some NetLogo Simulations Bruce Edmonds Centre for Policy Modelling Manchester Metropolitan University.
An Introduction to NetLogo Gabriel Wurzer, Vienna University of Technology AnthropologischeGesellschaftWien.
Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem.
Week 9 DO NOW QUESTIONS. Question: If the following procedure is executed after 1 turtle is created in the program, what shape is created on the NetLogo.
Models in NetLogo Day 3 COLQ 201 Multiagent modeling Harry Howard Tulane University.
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
Does white candles burn faster than color candles Yesenia Roa 018.
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
Week 10 DO NOW QUESTIONS. A programmer has created 100 turtles of random colors and randomly distributes green patches. Every time the turtles land on.
New Mexico Computer Science For All Variables and Scope Maureen Psaila-Dombrowski.
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
Loops & Graphics IP 10 Mr. Mellesmoen Recall Earlier we wrote a program listing numbers from 1 – 24 i=1 start: TextWindow.WriteLine(i) i=i+1 If.
New Mexico Computer Science For All Patches and Agent/Environment Interactions Maureen Psaila-Dombrowski.
TOPIC 10 THE IF STATEMENT 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson,
MIS 585 Special Topics in MIS: Agent-Based Modeling 2015/2016 Fall.
Getting started with the turtle Find the latest version of this document at
Decision Making and Branching (cont.)
How Tall Are You? Introducing Functions for Alice 3 By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008 Updates made.
M10 WS11:Krankenhausbedarfsplanung The World as We See It given by Gabriel Wurzer and Wolfgang E. Lorenz
Loops. About the Midterm Exam.. Exam on March 12 Monday (tentatively) Review on March 5.
Week 3 Lesson 1. Population Lesson 2 Vancouver Island Rainforest Information.
1 Agent-Based Tools: focus on NetLogo Ing. Cristina Ponsiglione University of Naples Federico II Laboratorio di Simulazione ad Agenti.
M10 WS11:Krankenhausbedarfsplanung More, More and Even-More More given by Gabriel Wurzer and Wolfgang E. Lorenz
Computer Science 1000 LOGO II. Boolean Expressions like Excel and Scratch, LOGO supports three Boolean operators less than (
An Introduction to NetLogo given by Gabriel Wurzer and Wolfgang E
AnthropologischeGesellschaftWien
Management Information Systems
Week 3 DO NOW QUESTIONS.
MIS 643 Agent-Based Modeling NetLogo: Summary of Manual and Dictionary.
Creating Simple Agent-Based Models
Management Information Systems
Hands-On given by Gabriel Wurzer and Wolfgang E. Lorenz
Intro to CS Monday, August 29
MIS 643 Agent-Based Modeling and Simulation 2016/2017 Fall.
Intro to CS Monday, August 24
Algorithms and Flow Charts
Game Loop Update & Draw.
Loop Strategies Repetition Playbook.
Using Logo and Logic This presentation uses a version of Logo called StarLogo available through MIT. It can be downloaded for free and installed on your.
creating a ecosystems model in net logo
Presentation transcript:

13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _Strumenti, seguito _______________________________________ Un modello di riferimento: cocktail party (model library, prove pt/party_pt) party_pt.nlogo, in linea a web.econ.unito.it/terna/materiale/master_ec_pol_san/ _______________________________________

13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 2 ;The 'turtles-own' keyword, like the globals, breed, -own, and patches-own keywords, ;can only be used at the beginning of a program, before any function definitions. ;It defines the variables belonging to each turtle turtles-own [man? woman? happy?] patches-own [men women people] globals [boring-groups moves number-happy group-sites] to setup ca ; 'with' takes two inputs: on the left, an agentset (usually "turtles" or "patches"). ; On the right, a boolean reporter. set group-sites patches with [group-site?] set-default-shape turtles "person" ; 'cct' create-custom-turtles cct number [ ;;blue represents male, pink represents female. No stereotypes are meant ;;to be promoted. Simply change the colors right here if you'd like.

13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 3 ;ifelse reporter [ commands1 ] [ commands2 ] ifelse (random 2 = 0) [set man? true set woman? false set color blue] [set man? false set woman? true set color pink] ifelse (random 2 = 0) [set heading 90] [set heading 270] ;; randomly face right or left set ycor 0 set xcor random world-width ] ; These reporters give the total width and height of the NetLogo world. ; Screen-size is the same as ((2 * screen-edge) + 1) ask turtles [move-into-groups] setup-patches setup-plots set moves 0 update-labels spread-people update-plots end

4 to setup-patches ask patches [ set men 0 set women 0 set people 0] ask turtles [ if man? [set men (men + 1)] if woman? [set women (women + 1)]] ask patches [ set people (men + women)] update-happiness update-boring-groups end to go if (number-happy = number) [ stop ;; stop the simulation if everyone is happy ] group-people ;; put all people on the x-axis update-happiness move-if-unhappy update-boring-groups update-labels spread-people ;; move the people into vertical columns set moves (moves + 1) update-plots if limit-speed? [ wait 0.75 ] ;; keep the spread groups on the screen for a bit end

13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 5 to update-labels ask group-sites [ set plabel count turtles-here ] ; plabel is a pattch label ; turtles-here reports an agentset containing all ; the turtles on the caller's patch (including the caller ; itself if it's a turtle). ; count agentset reports the number of agents in the given agentset end to update-happiness ask patches [ set people (men + women)] ask turtles [ ;;; you are happy if the proportion of people of the opposite sex does not exceed your tolerance if man? [ifelse (women / people) > (tolerance / 100) [set happy? false] [set happy? true]] if woman? [ifelse (men / people) > (tolerance / 100) [set happy? false] [set happy? true]] ;; if (happy? = true) [set num-happy (num-happy + 1)] ] set number-happy count turtles with [happy?] ;; update number-happy variable end

13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 6 to move-if-unhappy ask turtles [ if (not happy?) [ifelse man? [set men men - 1] ;;decrease the count in your old group [set women women - 1] ifelse (random 2 = 0) [set heading 90] [set heading 270] ;; randomly face right or left fd 1 ;; move out of your group move-into-groups ifelse man? [set men men + 1] [set women women + 1]]] ;;increase the count in your new in group end to move-into-groups ;;turtle procedure ; move forward until you hit the closest group if not group-site? [ fd 1 if limit-speed? [ wait 0.1 ] ;; slow it down so user can see it happening move-into-groups] end

13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 7 to-report group-site? ;; turtle or patch procedure ;; if your pycor is 0 and your pxcor is where a group should be located, ;; then you're a group site (patch) or on a group site (turtle) locals [group-interval] ;; first figure out how many patches apart the groups will be set group-interval floor (world-width / num-groups) report ;; first check pycor (pycor = 0) and ;; then check if the distance between groups divides evenly into ;; our distance from the right hand edge of the screen (((max-pxcor - pxcor) mod group-interval) = 0) and ;; finally, make sure we don't wind up with more groups than ;; the user asked for (floor ((max-pxcor - pxcor) / group-interval) < num-groups) end to update-boring-groups ask group-sites [ set plabel-color white if people > 0 [if ((men = 0) or (women = 0)) [set plabel-color gray]]] set boring-groups (count group-sites with [plabel-color = gray]) end

13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 8 to setup-plots set-current-plot "Happy Partygoers" set-plot-y-range 0 number end to update-plots set-current-plot "Happy Partygoers" set-current-plot-pen "Happy" plot (count turtles with [happy?]) set-current-plot "Single Sex Groups" plot boring-groups end ;; spread people out vertically to spread-people ask turtles [ifelse man? [set heading 0 fd 2] [set heading 180 fd 2] jump count other-turtles-here] ;; this trick works because of the serial ordering of turtle execution ; 'jump': turtles move forward by number units all at once, without the ; amount of time passing depending on the distance. end ;; pile people up on the x-axis to group-people ask turtles [set ycor 0] end