/users/rlr/Courses/ICPSR-03/Handouts/netlogo-0.txt -------------------------------------------------- NetLogo is the new cross-platform agent-based parallel modeling and simulation environment from Northwestern's CCL (Center on Connected Learning). The home page for NetLogo is http://ccl.northwestern.edu/netlogo/ There are links to the online documentation, including - a nice set of introductory tutorials - a reference manual - many example models which can be downloaded, run, and modified. There is also an active user's email group. The basic parts of a NetLogo model are: - A two dimensional discrete (cellular) world of "patches" Each patch has its own attributes, and all may be changed in parallel by whatever dynamics are defined for them. (E.g., grass can grow in each patch.) - One (or more) sets of agents ("turtles") These also each have their own attributes, and they have a number of actions (procedures) then can carry out. As with other ABM, there is a schedule of activity which controls which is active when, but in the basic NetLogo models, each agent is activated once each step. - Graphical controls, e.g., buttons, sliders and so on. - Graphical displays, e.g., 2D world, graphs, monitor displays, etc. Thus at this level, NetLogo is like Swarm, RePast and other ABM packages. ----------------------------------------------------------------------- NetLogo on CSCS computers ------------------------- To run NetLogo on the CSCS machines (directly or from an xterm started on the ICPSR computers, as described in the getting-started.txt handout), I would suggest you first create a directory to contain all your NetLogo related files: cd mkdir NetLogo and make that your working directory: cd NetLogo Then start the program netlogo & After a bit of startup time, a window should pop up with the title: NetLogo: (new model) You may see some warning messages go by in the xterm in which you typed the "netlogo &" command, but you may ignore those. To exit netlogo, use File->Quit . --------------------------------------------------------------------- NetLogo run on the ICPSR computers ---------------------------------- You can also run NetLogo directly on the ICPSR computers in the East Lab, Start->All Programs->NetLogo->NetLogo 1.3 It will run as on the CSCS computers, with the same "look and feel". It probably will run faster, because you will not have so much traffic over the network to the CSCS computers, and the eXceed program will not be running. *However*... One key difference is that on the ICPSR computers, you do not have any permanent disk space to save models you create/modify. You can use File->SaveAs to save models, but you will have to a) Put them in the D:\Docs or D:\Temp directories b) Use Secure FTP to copy them to another computer (eg to your account on the CSCS Computers, or to some account at your home institution.) c) Copy the saved files to a zip drive. (Ask the ICPSR computer consultants about how to do this.) -------------------------------------------------------------------- Getting Started with NetLogo ---------------------------- To get started, I suggest you go to the netlogo documentation page: http://ccl.northwestern.edu/netlogo/docs/ follow the link named "Sample Model: Party", and follow the instructions on that page. When you click on the Sample Models -> Social Science -> Party model, you see a brief description of the model appear on the right of the selection window. So before clicking "Open" I would suggest you read that description. You will see that this is basically a non-spatial version of Schellings segregation model. You will have to excuse the somewhat patronizing tone of the instructions that come with the Party model...recall NetLogo is part of a project to introduce younger students to modeling agent-based (parallel activity) complex adaptive systems. At any rate, I suggest you go through the steps they describe for the Party model, just to begin learning how NetLogo model interfaces look and act. -------------------------------------------------------------------------- Next Steps for learning NetLogo I suggest you next go through the three tutorials pointed to from the main documenation page: http://ccl.northwestern.edu/netlogo/docs/ These will introduce you to the basic features of NetLogo, from interface building to programming the agents. Some brief observations on the tutorials: ---------------------------------------------------------------- Tutorial 1: Wolf Sheep Predation This is basically an introduction to a NetLogo model, including the look-and-feel of the interface parts (sliders, buttons, etc) and the way one runs a typical NetLogo model. * Note that the instructions for resizing the windows within netlogo (e.g., the "graphics" window) may not work: I have had a hard time being able to grab the edges and drag them to make the windows bigger. (They do seem to work to make the windows smaller.) There seems to be some bugs in the version of NetLogo, at least when run under Linux. * Note that if you do a File->Save of a model, the default folder will be /appl/netlogo1.3/ but you cannot save things there. You must save things in your own directory space. So if you are using NetLogo on the CSCS computers, and if you created a "NetLogo" directory under your home directory (as described at the start of these notes), you can save your things by entering this in the "Enter path or folder name" part of the Save window: /users/sum0300/Netlogo ^^^^^^^ where you would replace the "sum0300" with your login. Similarly, when you do File->Open to open one of your own copies of a model, you may have to change the Path/FolderName to be the one in your directory space that has your NetLogo models. See the note above about saving files on the ICPSR computers. * On Linux, its better if save-file names don't have spaces in them. For example, you might just delete those from Wolf Sheep Predation.nlogo to save such a model as Wolf-Sheep-Predation.nlogo If you do, then in the xterminal window you can enter the "list long" command ll and you will see the file with the model you saved, e.g., -rw-r--r-- 1 sum0300 users 13830 Jul 23 10:33 Wolf-Sheep-Predation.nlogo ---------------------------------------------------------------------- Tutorial 2: Commands This one is pretty straightforward. ---------------------------------------------------------------------- Tutorial 3: Procedures This tutorial is a straightforward introduction to the basic steps of creating a new NetLogo model, including creating buttons, sliders and the like, and linking them to the NetLogo procedures (program parts) that specify what the model actually does. We will cover procedures, primitives and the general NetLogo syntax in subsequent classes in more detail, but this is a very good introduction to the basic ideas. Notes: - On the CSCS machines, I open the Tutorials in my Mozilla web browser, and also have netlogo running. I can then copy/paste the program source fragments from their web pages into the Procedures window of NetLogo, to avoid re-typing all that! ======================================================================== *** *** NOTE: How to stop NetLogo if all else fails *** If for some reason you can't get a program like NetLogo to stop running on the CSCS linux machines, one approach is to use the linux "kill" command to stop the job. For example, suppose you want to kill a netlogo program you have running--then you should: 0. Find the "process id number" for that running program In your xterminal window, enter: ps aux | grep netlogo (That is the vertical bar character -- the shift-\ key usually over the Enter key, on the right of the letter keys.) You will see something like: adsl-152-TestModels$ ps aux | grep netlogo sum0300 7730 0.0 0.2 4152 644 pts/18 S 09:09 0:00 /bin/bash /common/scripts/netlogo sum0300 7840 0.0 0.2 3568 628 pts/18 S 09:40 0:00 grep netlogo (Some of those lines will be long and may be wrapped around on the screen.) The first line is the one to look at -- on the right you can see "netlogo", the program that you want to stop. The second number for the left: sum0300 7730 0.0 0.2 ... ^^^^ in this case 7730, is the process id number. 1. Enter that process id number on the kill command: kill -9 7730 You should see the netlogo window (and any windows it started) disappear. 2. If that does not kill the window, contact one of the course instructors, lab assistants, or anyone else who happens to be around! To stop other programs, you can use the same steps, just replace "netlogo" with the other program names in step 0. You can see all jobs you are running by entering: ps aux | grep sum0300 where sum0300 would be replaced by *your* login. You can also use the linux "top" command to see a profile of the programs running on the computer you are using. **Do be careful** to enter the right process id number on the kill command. You can't kill other people's jobs, but you can kill your any of own! --------------------------------------------------------------------------