intro to netlogo - math.la.asu.edu · netlogo is a tool to help mold and shape these variables in...
TRANSCRIPT
![Page 1: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/1.jpg)
Intro to Netlogo
Alexander Graziani, Xavier Henes, Christopher Negrich, Humberto Parra
![Page 2: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/2.jpg)
What is Netlogo?
● An agent based modeling software designed for a wide range of simulations
● Focused on the interaction between individual objects
● Designed to have low entry and no ceiling
● Easy to read and write code
● Compatible with Windows, Mac OS, Linux and usable in browser
![Page 3: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/3.jpg)
What is agent based modeling?
● A simulation to test or visualize how changes to one or multiple variables will have an
effect on a system. (Cause and effect)
● Simulates the interactions of autonomous agents.
● Integration of numerous mathematical methods.
● An agent base simulation is not solved, it is ran with observation being the end result. ○ To better understand the operation.○ To predict potential outcomes.
● Micro-scale
● Two Central Tenets:○ Simplicity○ The sum is greater than the whole
● Composition:○ Autonomous agents (agent granularity)○ Decision making heuristics○ Learning rules/adaptation processes○ Interactive topology
![Page 4: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/4.jpg)
What are agents?
● An agent is an intelligent entity that can observe and react to its surroundings.
● Agents make decisions based upon the circumstances and the end goal that it aims to
achieve.
● Agents are autonomous and take no input other than initial conditions.
● Capable of reacting flexibly to changes
● Can take goal oriented initiative. (Proactive)
● Can learn from previous choices, its interactions, and its environment.
● Can interact with its surroundings.
● May be deliberate or reactive depending on the simulation.
![Page 5: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/5.jpg)
Agent based modeling and time
● Agent based simulations operate on two seperate time scales.○ Observers time○ Agents time
Creating a simulation to predict human population by 2028 would have a 10 year time scale.
Obviously as an observer, we do not want to wait 10 years to see our prediction. This leaves two
separate time scales that can be manipulated.
● Can manipulate agent time by changing things like birth/death rate or available food and
water.
● Can manipulate how fast the simulation runs.○ 10 minute simulation showing 10 years population growth.○ 30 second simulation showing the same.
Using netlogo, these simulations can be saved using different time scales. This allows for easier
review and comparison.
![Page 6: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/6.jpg)
Netlogo and Game Theory
● What is game theory?○ The analysis of strategies for dealing with competitive situations where the outcome of a
participant's choice of action depends critically on the actions of other participants.○ Also known as theory of social situations.
● Game theory focuses mainly on how intelligent individuals interact with one another in an
effort to achieve their own goals.○ Goals can be any desired outcome○ Goals will require a series of choices to be made in order to be obtained. ○ Each outcome will effect the next decision in order to continue towards obtaining the goal.
● Netlogo lets the user define what individual variables come into play when working
towards a set goal.
● As more and more variables are included, one might see how complex the outcome could
become.
● Netlogo is a tool to help mold and shape these variables in order to help predict a system’s
reaction given a goal and set of circumstances.
![Page 7: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/7.jpg)
Getting started with Netlogo
After downloading, run the executable and follow the prompts. This program is very easy to install.
Go to: https://ccl.northwestern.edu/netlogo/
Netlogo comes with many numerous simulations that are out of the box ready to run. Many times you can adjust existing simulations to fit your needs without having to create one from scratch
![Page 8: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/8.jpg)
Using Netlogo
● Two parts:
○ Graphical Interface
■ Displays the model output over time
● Output can be the simulation, graphs, tables, etc.
■ Displays buttons, sliders, etc. for input
○ Programming Interface
■ Able to import default and custom libraries
■ Simple, but longer basic programming features
● Simple programming constructs
● Requires more effort to implement more complicated structures
![Page 9: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/9.jpg)
Netlogo User Interface
Examples of the two portions of Netlogo. The user interface portion, and the code that applies logic.
![Page 10: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/10.jpg)
Netlogo Example
to setup clear-all create-turtles 10 ask turtles [ setxy random-xcor random-ycor ]end
● to : indicates a function
● setup: function name
● clear-all: remove all agents from
previous runs of the simulation
● create-turtles: creates ‘turtles’ or
simple agents*
● ask: set a variable value
● setxy: set x and y coordinates to the
two following values
● end: indicates the end of the function
● This function can then be set to be
called from the graphical user
interface
![Page 11: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/11.jpg)
Netlogo Interface Example
1.
2.
3.
4.
1. This code creates 10 objects with a random color and at random coordinates
2-3 Creates a clickable button to display the ‘turtles’
4. ‘Turtles’ are displayed
![Page 12: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/12.jpg)
Netlogo Example 2
to setup clear-all setup-patches setup-turtles reset-ticksend
to setup-patches ask patches [ set pcolor green]end
to setup-turtles create-turtles number ask turtles [ setxy random-xcor random-ycor pendown ]end
to go ask turtles [ set pcolor brown fd random 10 rt random 360 if pcolor = brown [die] hatch 1 [ fd 2 rt random 360 ] ]
ask patches [ if pcolor = brown [ if random 5 = 1 [set pcolor green] ] ] if ticks >= 500 [stop] tickend
![Page 13: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/13.jpg)
Adding input elements
![Page 14: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/14.jpg)
Example 2 Interface
Setup: Go:
![Page 15: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/15.jpg)
Netlogo Example 3
![Page 16: Intro to Netlogo - math.la.asu.edu · Netlogo is a tool to help mold and shape these variables in order to help predict a system’s reaction given a goal and set of circumstances](https://reader031.vdocument.in/reader031/viewer/2022022803/5c822d3b09d3f295198b93a6/html5/thumbnails/16.jpg)
References
● https://www.unc.edu/~bendor/Doursay_NetLogo_Tutorial.pdf● https://ccl.northwestern.edu/netlogo/docs/● http://www2.humboldt.edu/ecomodel/documents/Grimm-Railsback05.pdf● https://web.archive.org/web/20131012005027/http://cecosm.yolasite.com/resources
/Accepted_Scientometrics_ABM_Website.pdf● https://www.sciencedirect.com/science/article/pii/S0025556410000283● http://pages.cs.wisc.edu/~dyer/cs540/notes/agents.html