background preloader

NETLOGO

Facebook Twitter

Soccer. Zombie0. NetLogo 5.0.5 User Manual: Tutorial #3: Procedures. NetLogo 5.0.5 User Manual This tutorial leads you through the process of building a complete model, built up in stages, with every step explained along the way. Agents and procedures In Tutorial #2, you learned how to use the command center and agent monitors to inspect and modify agents and make them do things. Now you're ready to learn about the real heart of a NetLogo model: the Code tab. You've seen that agents in NetLogo are divided into patches, turtles, links, and the observer. All four types of agents can run NetLogo commands. You will now learn to write procedures that make turtles move, eat, reproduce, and die. Making the setup button To start a new model, select "New" from the File menu. Click the "Add" icon in the toolbar at the top of the Interface tab. Now you have a setup button. If you want to see the actual error message, click the button.

Now we'll create the "setup" procedure, so the error message will go away: Switch to the Code tab. Note that some lines are indented. NetLogo 5.2-RC2 User Manual: Tutorial #2: Commands. NetLogo 5.2-RC2 User Manual So far you've successfully navigated your way through opening and running models, pressing buttons, changing sliders and switches, and gathering information from a model using plots and monitors. In this section, the focus will start to shift from observing models to manipulating models. You will start to see the inner workings of the models and be able to change how they look. Sample Model: Traffic Basic Open the Models Library (from the File menu). Open Traffic Basic, found in the "Social Science" section. In this model, you will notice one red car in a stream of blue cars. You may alter the settings and observe a few runs to get a fuller understanding of the model.

As you are using the Traffic Basic model, have you noticed any additions you would like to make to the model? Looking at the Traffic Basic model, you may notice the environment is fairly simple; a black background with a white street and number of blue cars and one red car. Command Center What's Next? NetLogo 5.2-RC2 User Manual: Tutorial #1: Models.

NetLogo 5.2-RC2 User Manual If you read the Sample Model: Party section, you got a brief introduction to what it's like to explore a NetLogo model. This section will go into more depth about the features that are available while you're exploring the models in the Models Library. Throughout all of the tutorials, we'll be asking you to make predictions about what the effects of making changes to the models will be. Keep in mind that the effects are often surprising. You may want to print out the tutorials to make them easier to refer to while you're using NetLogo. Sample Model: Wolf Sheep Predation We'll open one of the Sample Models and explore it in detail. Open the Models Library from the File menu. Choose "Wolf Sheep Predation" from the Biology section and press "Open".

The Interface tab will fill up with lots of buttons, switches, sliders and monitors. If you'd like to make the window larger so that everything is easier to see, you can use the Zoom menu. Press the "setup" button. Plots. Zombieland.1.4. Zombieland.1.3. Zombieland.1.2. Zombieland.1.0. Download NetLogo. MCB 419: Homework.

NetLogo 5.0.5 User Manual: Tutorial #3: Procedures. Common Netlogo Commands. Setxy x y The turtle sets its x-coordinate to x and its y-coordinate to y. Equivalent to set xcor x set ycor y, except it happens in one time step instead of two. If x or y is outside the world, NetLogo will throw a runtime error. setxy 0 0;; turtle moves to the middle of the center patchsetxy random-xcor random-ycor;; turtle moves to a random pointsetxy random-pxcor random-pycor;; turtle moves to the center of a random patch ask agentset [commands] ask agent [commands] The specified agent or agentset runs the given commands. ask turtles [ fd 1 ] ;; all turtles move forward one step ask patches [ set pcolor red ] ;; all patches turn red ask turtle 4 [ rt 90 ] ;; only the turtle with id 4 turns right Note: only the observer can ask all turtles or all patches.

Note: Only the agents that are in the agentset at the time the ask begins run the commands. clear-turtles Kills all turtles. Also resets the who numbering, so the next turtle created will be turtle 0. die The turtle or link dies. show n-of if. NetLogo-4-0-QuickGuide. Agents. We have already seen that the procedures tab of a NetLogo program has two sections: attribute and global definitions procedure and reporter definitions We also saw that a typical NetLogo agent-based model has two important top level procedures: to init-model ; ... end to update-model ; ... end The first one is invoked by pressing the INIT button, while the second one is iterated by pressing the UPDATE button.

We now look at some more complicated definitions from the Sugarscape model. Turtle and Patch Attributes patches-own [ sugar grow-back rfp-queue ] turtles-own [ energy metabolism proposal-queue broadcast-range hasProposal target ] Here's how we can display the value of the energy attribute of the turtle with id number 12: print [energy] of turtle 12 Turtle and Patch Procedures (Methods) Some procedures can be viewed as turtle methods while other procedures can be viewed as patch methods.

Ask turtle 12 [consume-sugar patch 3 4] Here are some things to note about this procedure. Lists. 4.3. Programming with NetLogo(1) | Open Agent Based Modeling Consortium. Learning to program in a NetLogo package is mainly a process by learning-by-doing. By working through tutorials and example models, you will become familiar with the basics of the language and where you have to look for solutions to the problems you encounter. A few basic elements of the NetLogo language are discussed in the following paragraphs.

Agents are called turtles in NetLogo. NetLogo has been based on follow up languages of Logo, a procedural programming language developed in the 1960s. The idea in the development of Logo (link is external) is to have a simple language to steer an agent or robot, the turtle. For example, a turtle with a pen strapped to it can be instructed to do simple things like move forward 100 spaces or turn around. The figure below shows you can create a square by having the following sequence of commands: Forward 50 Right 90 Forward 50 Right 90 Forward 50 Right 90 Forward 50 Right 90 Where Right 90 means that the turtle will turn right 90 degrees. or or patch. NetLogo 5.0.5 User Manual: Programming Guide.

NetLogo 5.0.5 User Manual This section describes the NetLogo programming language in detail. The Code Example models mentioned throughout can be found in the Code Examples section of the Models Library. Agents The NetLogo world is made up of agents. In NetLogo, there are four types of agents: turtles, patches, links, and the observer. Turtles are agents that move around in the world. The observer doesn't observe passively -- it gives instructions to the other agents. When NetLogo starts up, there are no turtles. Patches have coordinates. The total number of patches is determined by the settings min-pxcor, max-pxcor, min-pycor, and max-pycor When NetLogo starts up, min-pxcor, max-pxcor, min-pycor, and max-pycor are -16, 16, -16, and 16 respectively.

Turtles have coordinates too: xcor and ycor. Links do not have coordinates. Procedures In NetLogo, commands and reporters tell agents what to do. Typically, a command name begins with a verb, such as "create", "die", "jump", "inspect", or "clear". NetLogo 5.0.5 User Manual. ISME: Tools. HubNet is a Classroom-based Network of Handheld Devices and Up- front Computer. HubNet is designed specifically with the goal of creating a fully participatory, networked, classroom learning space. The core features of this space include: The eventual goal is to release HubNet as a widely distributed commercial product with a rich array of classroom tested functionality and activity designs.

For a fuller description, click here. Netlogo is a programmable modeling environment for simulating natural and social phenomena. NetLogo is particularly well suited for modeling complex systems developing over time. There is extensive documentation and a tutorial. NetLogo is the next generation of the series of multi-agent modeling languages that started with StarLogo. NetLogo can also power a classroom participatory-simulation tool called HubNet. ISME: Purpose. The importance of students understanding complexity has been recognized in various national standards documents, such as the Benchmarks for Science Literacy and AAAS. The ISME project is conducting an in-depth study of the learning of secondary students engaged in making sense of complex systems through participating in classroom simulations. To those ends, we design, develop, and implement Participatory Simulations that use the HubNet technology.

The HubNet technology constitutes an extension of the NetLogo environment, enabling multiple participants to interact simultaneously with NetLogo models. In the Participatory Simulations environment, all the students in a classroom are networked into a single hands-on simulated experiment that all can plan, collaboratively run, view, and discuss. ISME is funded by an NSF ROLE Grant no. The rationale for ISME research rests on three pillars: Complex systems: the importance of understanding systems and complexity; Complex Systems.