12
NetLogo an introduction Vladimir Batagelj University of Ljubljana Slovenia The Age of Simulation 2006 Linz, January 12-14, 2006 version: 14. Jan 2006 / 09 : 12

NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

Embed Size (px)

Citation preview

Page 1: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

'

&

$

%

NetLogoan introduction

Vladimir Batagelj

University of LjubljanaSlovenia

The Age of Simulation 2006Linz, January 12-14, 2006

version: 14. Jan 2006 / 09 : 12

Page 2: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 1'

&

$

%

Outline1 StarLogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 NetLogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

3 Installing NetLogo . . . . . . . . . . . . . . . . . . . . . . . . 3

4 Basic NetLogo interface elements . . . . . . . . . . . . . . . . 4

5 NetLogo operation . . . . . . . . . . . . . . . . . . . . . . . . 5

6 Use of the existing models . . . . . . . . . . . . . . . . . . . . 6

7 Models on the web . . . . . . . . . . . . . . . . . . . . . . . . 7

8 Graphs and networks in NetLogo . . . . . . . . . . . . . . . . . 8

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 3: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 1'

&

$

%

StarLogo

NetLogo is a logo-like language. It enables learners to give (simple) rules toindividual ”agents”in a simulation and observe the collective result of all theagents’ behavior. Netlogo is a dialect of StarLogo, which was developed in1989-90 by Mitchel Resnick from MIT Media Lab for a supercomputer TheConnection Machine that was able to execute several processes in parallel.

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 4: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 2'

&

$

%

NetLogoLater, in 1994 StarLogo was implemented as MacStarLogo on Macs – theparallel processes were simulated.

On the basis of MacStarLogo in 1997 at CCL (Center for ConnectedLearning and Computer-Based Modeling) developed StarLogoT – theirown version of StarLogo. Around 1999 StarLogoT evolved in NetLogo.

After 2000 both StarLogo and NetLogo were implemented in Java – we canuse them on most computers.

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 5: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 3'

&

$

%

Installing NetLogoNetLogo is free software. It canbe downloaded from NetLogo homepage. For Windows it is recom-mended to download the version withbuilt-in Java machine. The installationprocedure is easy ind straightforward.We run NetLogo and selectingFile/Models Library we enterthe Models library – a collectionof existing models included in theinstallation package.

We select some model. For example:

/Art/Fireworks.nlogo

then we double-click it and the model is loaded. Clicking the buttons setup and

go we start the execution of the model. It works!

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 6: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 4'

&

$

%

Basic NetLogo interface elementsThe model can be controled usinginterface elements:control buttons: Buttons can be ei-ther once-only buttons or foreverbuttons. When you click on a oncebutton, it executes its instructionsonce. The forever button executesthe instructions over and over, untilyou click on the button again to stopthe action.sliders and switches: They are usedin models as a quick way to changea numerical/logical variable.

displays and reports: graphical or textual displays of results: 2D and 3D view,

monitors, plots, output areas.

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 7: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 5'

&

$

%

NetLogo operationThe NetLogo world is a two dimensional world that is made up of turtles, an×m grid of patches, and an observer. The patches can’t move and createthe ground in which the turtles can move around on and the observer is abeing that oversee everything that is going on in the world.

We can program the behavior and interactions of turtles and patches – thusdetermining the micro-level functioning (rules) of the model. Executing themodel a macro-level patterns (emergent properties) appear in the displayedresults.

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 8: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 6'

&

$

%

Use of the existing modelsThere are several ready-made models. Besides the models included in theNetlogo distribution there is additional collection of contributed modelsbut also other collections: NetLogo Learning Lab, MAS Netlogo Models,Cellular Automata, Geosimulation, , . . .

The next step is changing the existing models.

To adapt models for non-english speakers communities we have to changethe labels of control elements. It can be done by right-click on theelement and selecting the option edit and changing the display name.When changing a name of a variable we have to change it also in all itsappearances in the procedures.

For changing rules or development of our own models we have to learnNetlogo programming language.

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 9: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 7'

&

$

%

Models on the webUsing the option File/Save as Applet we can save the modelin a form that can be published on the web. NetLogo creates the filemodel.html which has to be put on the server. On the same directory wehave to put also the source file model.nlogo and the NetLogo runtimeNetLogoLite.jar – you can get it in the main directory of yourNetLogo installation.

Fireworks in Slovene.

If you know HTML you can put files also in other directories but you haveto properly adjust parameters in the applet tag.

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 11: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 9'

&

$

%

Resources

[1] Batagelj, Vladimir (2001). Posnemanje v naravoslovnem izobrazevanju. 3.srecanje uciteljev naravoslovnih predmetov, Radenci, 18. december 2001.HTML.

[2] Batagelj, Vladimir and Zaversnik, Matjaz (2003). NetLogo. MIRK, Piran, 11.maj 2003. HTML

[3] Resnick, Mitchel (1994). Turtles, Termites, and Traffic Jams: Explorations inMassively Parallel Microworlds. Cambridge, MA: MIT Press.

[4] Wilensky, Uri (2001). Modeling Nature’s Emergent Patterns with Multi-agentLanguages. Proceedings of EuroLogo 2001. Linz, Austria.

[5] Wikipedia: NetLogo.

The web version of the slides is available athttp://www.educa.fmf.uni-lj.si/logo/NetLogo/.

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6

Page 12: NetLogo an introduction - University of Ljubljanavlado.fmf.uni-lj.si/pub/networks/doc/ae/netlogo.pdf · V. Batagelj: NetLogo an introduction 5 NetLogo operation The NetLogo world

V. Batagelj: NetLogo an introduction 10'

&

$

%

NetLogo

http://ccl.northwestern.edu/netlogo/

The Age of Simulation 2006, Linz, January 12-14, 2006 s s y s l s y ss * 6