Netlogo and its Relatives Logo (Papert) –Language for teaching mathematics graphically –Tell turtle how to move Starlogo (Resnick) & StarlogoT (Wilensky)

Slides:



Advertisements
Similar presentations
Algorithms Sipser 3.3 (pages ). CS 311 Fall Computability Hilbert's Tenth Problem: Find a process according to which it can be determined.
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.
13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _Strumenti, seguito _______________________________________ Un modello.
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Biomedical Modeling: Introduction to the Agent-based epidemic modeling
Wurzer, Lorenz, Popov: „NetLogo Workshop (Part 1)“, in eCAADe 2012 Prague, Slide 1 „Netlogo First Steps (Artif. Societies) “, in Social Simulation Conference.
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.
Game of Life Rules and Games Linh Tran ECE 573. What is Life? Life is just one example of a cellular automaton, which is any system in which rules are.
New Mexico Computer Science for All Agent-based modeling By Irene Lee December 27, 2012.
Using Logo and Logic Please use speaker notes for additional information!
"Turtle Graphics“ for kids.
Turing Machines CS 105: Introduction to Computer Science.
Terrapin Logo "Logo is the name for a philosophy of education and a continually evolving family of programming languages that aid in its realization."
StarLogoTNG Treasure Hunt Game Unit Lesson 1: Basic Movement.
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. ,
Chapter 12: Simulation and Modeling
ABM Frameworks Dr Andy Evans With additions from Dr Nick Malleson.
NetLogo Dr. Feng Gu. NetLogo NetLogo is a programmable modeling environment for simulating natural and social phenomena, authored by Uri Wilensky in 1999.
CISC 1600 – Lecture 3.2 Simulations Complex Input & Output NetLogo.
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,
Governor’s School for the Sciences Mathematics Day 13.
Bridges To Computing General Information:  This document was created for use in the "Bridges to Computing" project of Brooklyn College.  You are invited.
An Introduction to NetLogo Gabriel Wurzer, Vienna University of Technology AnthropologischeGesellschaftWien.
Art 321 Lecture 7 Dr. J. Parker. Programming In order to ‘make things happen’ on a computer, you really have to program it. Programming is not hard and.
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.
Logo For beginners By Dali Matthews 9S What is logo?
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
CONTROL SYSTEMS Control Systems A command is a directive that performs a specific task An argument is a variable that can be used by the function reveiving.
New Mexico Computer Science For All Variables and Scope Maureen Psaila-Dombrowski.
New Mexico Computer Science For All Patches and Agent/Environment Interactions Maureen Psaila-Dombrowski.
The Northern Lights: Demonstrations. Programmability Overview A major aspect of our project is programmability- it is an interactive display medium, the.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.
StarLogoTNG 101 Treasure Hunt Game Unit Lesson 7: Coordinate System.
Copyright 2002, Tony Gauvin, UMFK
MIS 585 Special Topics in IMS Agent-Based Modeling Bertan Badur Department of Management Information Systems Boğaziçi University.
MIS 585 Special Topics in MIS: Agent-Based Modeling 2015/2016 Fall.
Capabilities of computing systems Numeric and symbolic Computations A look at Computability theory Turing Machines.
Pablo Revelo. Birds: to 3birds pu home pd lt 80 pu fd 250 pd setpensize 2 setpc "white st bird pu bk random 100 bird pu lt 90 fd random 40 bird ht.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
First of all – lets look at the window’s you are going to use. At the top you have a toolbar, with all your various tools you can use when customising.
M10 WS11:Krankenhausbedarfsplanung The World as We See It given by Gabriel Wurzer and Wolfgang E. Lorenz
Search for it on your computer
LOGO WHAT IS IT? HOW TO USE IT AND HOW USEFUL CAN IT BE?
MA/CSSE 474 Theory of Computation Universal Turing Machine Church-Turing Thesis (Winter 2016, these slides were also used for Day 33)
1 Agent-Based Tools: focus on NetLogo Ing. Cristina Ponsiglione University of Naples Federico II Laboratorio di Simulazione ad Agenti.
An Introduction to NetLogo given by Gabriel Wurzer and Wolfgang E
Management Information Systems
LOGO BY Kaotip 9S.
LOGO 32 By: Xenon 9S.
MIS 643 Agent-Based Modeling NetLogo: Summary of Manual and Dictionary.
Creating Simple Agent-Based Models
Management Information Systems
An introduction to Netlogo agent-based software
Illustrations of Simple Cellular Automata
MIS 643 Agent-Based Modeling and Simulation 2016/2017 Fall.
Learning to program with Logo
Chapter 9 TURING MACHINES.
Algorithms and Flow Charts
Decidable Languages Costas Busch - LSU.
Recall last lecture and Nondeterministic TMs
Institute for Entrepreneurship and Career Development (IECD)
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.
CSE S. Tanimoto Turing Completeness
creating a ecosystems model in net logo
Presentation transcript:

Netlogo and its Relatives Logo (Papert) –Language for teaching mathematics graphically –Tell turtle how to move Starlogo (Resnick) & StarlogoT (Wilensky) –Many turtles –Tell turtles how to interact with each other and world –Ontology: Agents (turtles) and world (patches) Netlogo –Java version of Starlogo Slightly different syntax (ask patches) Slower –Hubnet: each turtle is controlled by an actual human Turtles interact over the internet

Properties of Netlogo Nice –Concise, high-level language –Complete (Simulated) Parallelism –Makes systems graphically intuitive and concrete –Particularly appropriate for spatial systems –Useful for world-world, world-agent, and agent-agent interactions –Large installed user base –Very easy interface building: Sliders, buttons, switches –Many useful routines: plot, diffuse, scale color, count neighbors, spawn, etc. Not so Nice –Slow (particularly netlogo) –Not suitable for very large simulations –Quirks that must be programmed around –Some limitations to programming constructs –Idiosyncratic syntax

Elementary Turtle Commands ca - clear all crt 10 - Create 10 turtles Ask turtles [fd 10] - Move turtles forward 10 places. Ask turtles [set heading 90] - set heading of turtles to 90 degrees = to right. 0 = upward Ask turtles [right 90] - Turn the turtles 45 degrees to right Ask turtles [pd ] - Pen down as turtle moves. PU - Pen up Ask turtles [stamp ] - turtle leaves its image at its locations Ask turtles [set color green ] - sets color of turtle Set xcor 0 - sets x coordinate of turtle to left-right middle. Set ycor screen-edge-y - sets y coordinate of turtles to top setxy mouse-xcor mouse-ycor - places all turtles at cursor Set heading (random 360) - gives each turtle a random heading die

Elementary Patch Commands Set pcolor red - set patches all to red Set pcolor pcolor set patch’s color to whatever it was + 1 Set pcolor (random 256) - set each patch’s color randomly repeat 100 [set pcolor pcolor + 1] - repeat the color increment command 100 times Set pcolor pxcor - set patch’s color to its x-coordinate Set pcolor pxcor + pycor - set patch’s color to sum of its two coordinates Ambiguous apparent motion effect if pxcor < 0 [set pcolor red] - set patch to red if its x-coordinate < 0 if (distancexy 5 5) < 10 [set pcolor green] - turn patches close to {5,5} green if (distancexy mouse-xcor mouse-ycor) < 4 [set pcolor blue] - if patch is close to cursor, turn it blue. Can embed in repeat ifelse ycor < 0 [set pcolor red] [set pcolor blue] - if patch is on bottom, turn it red, else turn it blue. Note brackets, and spaces

Elementary Interface Buttons –To run a command –Forever option makes command continually run Sliders –To dynamically set parameters Monitors –to dynamically observe a variable or quantity Switches –To set a boolean variable Paint brushes for patches and turtles

Move Around Procedure To move ;; make this a forever button fd 1 rt angle ;; make an angle slider to vary end

Flocking Around Cursor to setup ca crt 100 set xcor (random screen-size-x) set ycor (random screen-size-y) end to flock set heading (towards mouse-xcor mouse-ycor) + (random randomness) - (random randomness) ;; randomness is a slider end

Flocking Around Cursor With Inertia turtles-own [tempangle mousedir] to flock set mousedir (towardsxy mouse-xcor mouse-ycor) set tempangle heading * inertia + (1 - inertia) * mousedir if (mousedir - heading) >180 ;; wrap around 0 degrees [set tempangle heading * inertia + (1 - inertia) * (mousedir - 360)] if (heading - mousedir) > 180 [set tempangle (heading - 360) * inertia + (1 - inertia) * mousedir] if (tempangle < 0) [set tempangle tempangle + 360] set heading tempangle + (random randomness) - (random randomness) set heading tempangle fd 1 end Randomness 0 = circles inertia controls radius of circles

Flocking Around Each Other turtles-own [neighbor] to flock set neighbor random-one-of turtles ;;randomly choose one turtle if neighbor != self [set heading towards-nowrap neighbor] rt (random randomness) - (random randomness) fd 1 end

Conway’s Game of Life Grid of cells, each with 8 neighbors Cells are either alive (1) or dead (0) If a cell is alive, then it dies if it has 3 alive neighbors (overcrowding) If a cell is dead, it comes alive if it has exactly 3 neighbors A Universal Turing Machine can be implemented in the Game of Life –Anything that can be computed can be computed in the Game of Life –Rule implement logical structures, gates, states, etc. –Multiple realizability

Conway’s Game of Life Behavior –Surprising complexity given simple rules –Rules produce higher-level structures Stable structures: 4-square Moving structures: gliders Higher-level structures interact Changing the Rules of Life –Birth if odd number of neighbors are on –Death if even number of neighbors are on –Bridging explanations Blinker Glider

The Game of Life as Turing Machine

One small part: The Outgate

Conway’s Game of Life Patches-own [state] To create if mouse-down? [ask patch-at mouse-xcor mouse-ycor [set pcolor green set state 1] To live ask patches [let total nsum state ;; find sum of variable “state” ;; for 8 neighbors, and put result in variable “total” if (total 3) [set pcolor black] if total = 3 [set pcolor green] ifelse (pcolor = green) [set state 1] [set state 0]] end

Turing Machines Turing machines –abstract computational framework –Infinite tape with 0s and 1s –read/write head that reads state at one tape location, and can write a state out to the same location –Finite set of states –State transitions: if in state W and head reads X then write out symbol Y, move to the left/right one space, and move to state Z Universal Turing machine –Every Turing machine is just a string –Can construct a universal Turing machine that take strings describing other Turing machines as input, and performs the computation the inputted Turing machine would have computed –Universal Turing machines can simulate any other Turing machine Church-Turing thesis –problems solvable by a universal Turing machine are exactly those problems solvable by an algorithm –Universal Turing Machines can compute any recursive function, decide any recursive language, and accept any recursively enumerable language

Turing Machines Old Read Wr. New Old Read Wr. New St. Sym. Sym. Mv. St. St. Sym. Sym. Mv. St s1 1 -> 0 R s2 s4 1 -> 1 L s4 s2 1 -> 1 R s2 s4 0 -> 0 L s5 s2 0 -> 0 R s3 s5 1 -> 1 L s5 s3 0 -> 1 L s4 s5 0 -> 1 R s1 s3 1 -> 1 R s3 Step State Tape Step State Tape s s s s s s s s s s s s s s s halt --

Changing the rules of Life If a cell is alive, then if it has an odd number of neighbors, it dies. If a cell is dead, then if it has an odd number of neighbors, it lives. So, a cell changes its state if it has an odd number of neighbors. to live ask patches [let total nsum state ifelse (total mod 2 = 0) [set pcolor black set state 0] [set pcolor green set state 1]] end

Other Important Netlogo commands diffuse chemical 0.8 : Each patch shares 80% of its value on the variable chemical with its 8 neighbors breeds : creates different kinds of turtles Count-turtles-with [color = red]: reports count of turtles meeting condittion downhill chemical : returns direction with minimum value of chemical plot: to create plots of any number of variables simultaneously scale-pc green grass 0 20 : turns patch a shade of green based on variable grass with a range between 0 and 20 every 2 [fd 1 wait.1]: every 2 seconds, go forward 1 and wait.1 seconds

Interactions Between Patches and Agents Random walk patches-own [steps] globals [minny maxxy] to setup ca crt 1 setsteps 0 end to random-walk seth random 360 fd 1 tsetsteps steps + 1 setminny min-of-patches [steps] setmaxxy max-of-patches [steps] scale-pc red steps minny maxxy end if pc != black [pstamp pc] ;; to have patch stamp turtle