This is an old version of the library - we recommend you use the up-to-date library instead.

Micro-behaviours authored by the Modelling4All Team

Sample models

Movement micro-behaviours

MOVE-FORWARD -- I move forward at a speed

JUMP FORWARD -- I move forward once

TURN-RANDOMLY -- I repeatedly turn randomly

TURN-REPEATEDLY -- I rotate at a speed

TURN -- I turn once

TURN-TOWARDS-GOAL -- I turn towards a goal

TURN-TOWARDS-ANOTHER -- I turn towards another individual

SET-RANDOM-HEADING -- I set my heading to a random angle.

MOVE-TOWARDS-ANOTHER - I move once  towards another.

REPEATEDLY-MOVE-TOWARDS-ANOTHER - I move repeatedly towards another.

WANDER-RANDOMLY-BY-TURNING -- I repeatedly turn randomly and move forward

WANDER-RANDOMLY-IN-COMPASS-DIRECTIONS -- I repeatedly move up, down, left, or right one step

WANDER-TO-AN-UNOCCUPIED-LOCATION -- I repeatedly move to a nearby location but not if someone is already there

WANDER-TO-RANDOM-LOCATION-UNTIL-EMPTY -- I repeatedly move to a random nearby location and try again if it is already occupied

WANDER-HORIZONTALLY -- I repeatedly move left or right one step

WANDER-VERTICALLY -- I repeatedly move up or down one step

SET-RANDOM-POSITION -- I jump to a random position

SET-RANDOM-UNOCCUPIED-POSITION -- I jump to a random position that is not occupied

SET-POSITION-ON-A-CIRCLE -- I jump to a position on a circle

Appearance micro-behaviours

SET-SHAPE -- Sets my appearance to be a fish (easily changed to another shape)

SET-COLOR -- Sets my colour to red (easily changed to other colours)

SET-PATCH-COLOR -- Sets the colour of my patch of the environment

SET-SIZE -- Sets my size so I appear bigger or smaller

HIDE -- I become invisible

SHOW -- I become visible again

Defining and updating model parameters

DEFINE-PARAMETER -- I define a global parameter of the entire model as either a slider, input box, or editable field.

DEFINE-BOOLEAN-PARAMETER -- I define a global parameter of the entire model whose value can only be 'true' or 'false'. Can be either a switch, input box, or editable field.

UPDATE-PARAMETER -- I set a global parameter to a new value once.

UPDATE-PARAMETER-REPEATEDLY -- I set a global parameter to new values repeatedly.

Creating and setting attributes of agents

UPDATE-ATTRIBUTE -- Sets (and creates if needed) one of my attributes to a value

UPDATE-ATTRIBUTE-REPEATEDLY -- Updates one of my attributes repeatedly

COPY-ATTRIBUTE -- Copies the value of one of my attributes to the attribute of another.

Here are some examples using these micro-behaviours:

AGE-IS-ZERO -- My age starts off at zero

GROW-OLDER -- My age increases repeatedly

DIE-WHEN-TOO-OLD -- I die when I'm very old

SET-MAXIMUM-LIFE -- I initialise my maximum lifespan

UPDATE-MINIMUM-REPRODUCTION-AGE -- Increase my minimum age before I can reproduce

SET-SPECIES -- Initialises the name of my species

Scheduling

Some of the following micro-behaviours are now provided directly from the BehaviourComposer by clicking on the button on micro-behaviour pages and selecting the Enhance pop-up sub-menu. These include modifications to a behaviour to do repeatedly, do later, do at a specified time, do conditionally, do probabilistically, do once when a condition is true, and do every time a condition is true. The following provide access to the scheduling primitives added to NetLogo by the BehaviourComposer.

ADD-BEHAVIOURS -- I add behaviours immediately

ADD-BEHAVIOURS-TO -- I add behaviours immediately to a specified agent or set of agents

REMOVE-BEHAVIOURS -- I remove behaviours previously added

REMOVE-BEHAVIOURS-FROM -- I remove specified behaviours from an agent or set of agents

REMOVE-ALL-BEHAVIOURS -- I remove all behaviours previously added

REMOVE-ALL-BEHAVIOURS-FROM -- I remove all behaviours from a specified agent or set of agents

DO-WITH-PROBABILITIES -- I choose which set of behaviours to add probabilistically

DO-AFTER-SETUP  -- I delay the execution of a list of micro-behaviours until after setup completes

DO-IF-ELSE -- I add different lists of micro-behaviours depending upon whether condition is true or false now

The following functionality is provided more effectively by using the Enhance pop up sub-menu on the micro-behaviour page one wants to schedule.

REPEATEDLY-DO-BEHAVIOURS -- I add behaviours repeatedly

DO-AFTER -- I delay the execution of a list of micro-behaviours

DO-AT-TIME -- I schedule the addition of a list of micro-behaviours

DO-WITH-PROBABILITY -- I add behaviours probabilistically

DO-IF -- I add micro-behaviours if condition is true now

WHEN -- I add and remove micro-behaviours the first time that conditions are true

WHENEVER -- I add and remove micro-behaviours every time conditions are true

Interacting with other agents

INTERACT-WITH-ANOTHER -- I interact with anyone who meets my conditions

TURN-TOWARDS-OTHERS  -- I update my desired heading to face others.

TURN-AWAY-FROM-OTHERS -- I update my desired heading to face away from others.

Linking with other agents

These micro-behaviours are for creating and removing links between agents.

ADD-UNDIRECTED-LINK - I create an undirected link to another

ADD-DIRECTED-LINK-FROM - I create a directed link from another to me

ADD-DIRECTED-LINK - I create a directed link to another

REMOVE-LINK - I remove a link with another

ADD-UNDIRECTED-LINKS-TO-ALL-OTHERS -- I add undirected links to all others

ADD-DIRECTED-LINKS-TO-ALL-OTHERS -- I add directed links to all others

ADD-BEHAVIOURS-TO-LINKS -- I add micro-behaviours to links (rather than agents)

ALL-REACHABLE-NODES -- I report all the nodes reachable from an initial list of node

Agent Layout

The following control the spatial layout of sets of agents.

LAYOUT-CIRCLE -- I place a set of agents in a circle

LAYOUT-GRID -- I place a set of agents in a rectangular grid

LAYOUT-SPRING -- I layout a set of agents where the agents repel each other and the links between them act like springs

Copying micro-behaviours

ADD-COPIES -- I make copies of myself and add them to the model

ADD-COPY-OF-ANOTHER -- I make a copy of another individual

Create Agents -- I make a number of instances of the specified kind

Here are some examples using these micro-behaviours:

ADD-SOME-OFFSPRING -- I create a random number of offspring whose age is set to zero

REPRODUCE -- I make a few copies of myself when I meet the right mate

Removal micro-behaviours

DIE -- Removes me from model

KILL -- Removes other from model

REMOVE-THIS-LINK -- Remove the receiving link from the model

Social Network

The following should be associated with a single agent, e.g. the world or observer.

INITIALISE-SOCIAL-NETWORK-CONSTANT-SYMMETRIC -- Initialises the subset of other agents that I "know" (everyone knows the same number of people). Everyone I know knows me.

INITIALISE-SOCIAL-NETWORK-NORMAL-DISTRIBUTION-SYMMETRIC -- Initialises the subset of other agents that I "know" (the number of people each person knows is normally distributed). Everyone I know knows me.

INITIALISE-SOCIAL-NETWORK-POWER-LAW-DISTRIBUTION-SYMMETRIC -- Initialises the subset of other agents that I "know" (the number of people each person knows follows a power law). Everyone I know knows me.

The following should be associated with the prototype of the population. These are only appropriate when a link from a to b does not entail there should be a corresponding link from b to a.

INITIALISE-SOCIAL-NETWORK-CONSTANT-ASYMMETRIC -- Initialises the subset of other agents that I "know" (everyone knows the same number of people). Not everyone I know knows me.

INITIALISE-SOCIAL-NETWORK-NORMAL-DISTRIBUTION-ASYMMETRIC -- Initialises the subset of other agents that I "know" (the number of people each person knows is normally distributed). Not everyone I know knows me.

REMOVE-SUPER-NODES -- Removes individuals with the greatest number of acquaintances.

CREATE-NUMBER-OF-SUPER-NODES-REMOVED-SLIDER -- Creates a slider to control the number of nodes removed by REMOVE-SUPER-NODES.

To view social networks:

DISPLAY-LINE-TO-MY-ACQUAINTANCES -- I draw a line to all my acquaintances.

SET-SIZE-PROPORTIONAL-TO-NUMBER-OF-MY-ACQUAINTANCES -- I change my size to reflect the number of individuals in my-acquaintances.

World or Environment

Micro-behaviours for controlling the "world" the individuals "live" in.

SET-WORLD-SIZE -- I set the size of the world

SET-PATCH-SIZE -- I set the size of each patch

SET-WORLD-TO-TORUS -- I set the geometry of the world to a torus (coordinates wrap both horizontally and vertically)

SET-WORLD-TO-PLANE -- I set the geometry of the world to a plane (coordinates do not wrap)

SET-WORLD-TO-PLANE-WITH-CAMERA-FOLLOWING-CENTROID -- I set the geometry of the world to a plane (coordinates do not wrap) but the display of the world is constantly updated so the centre is the average position of all individuals

SET-WORLD-TO-VERTICAL-CYLINDER -- I set the geometry of the world to a vertical cylinder (coordinates wrap only horizontally)

SET-WORLD-TO-HORIZONTAL-CYLINDER -- I set the geometry of the world to a horizontal cylinder (coordinates wrap only vertically)

SET-WORLD-LOCATION -- I set where the display of the world is placed

SET-BACKGROUND-COLOR - Sets the colour of the every patch of the background.

PAUSE -- Pauses the running of the model.

PAUSE-WHEN -- Pauses the running of the model when some condition is true

SET-FRAME-DURATION -- Sets the value of frame-duration which controls how often the display is updated.

TURN-OFF-CLOCKED-MODE -- I turn off clocked mode.

MAKE-A-MOVIE-OF-A-MODEL -- Records a movie of a model running

User Input

ADD-BUTTON -- I create a button with an associated action

An example of using ADD-BUTTON is Add Navigation Buttons which creates four buttons for turning and accelerating.

ADD-NETLOGO-BUTTON -- I create a button with an action defined by NetLogo code

Creating Graphs and Plots

CREATE-PLOT -- I create a fully specified two-dimensional graph

CREATE-AUTO-PLOT -- I create a plot that scales dynamically as the data is produced

CREATE-EMPTY-PLOT -- I create a fully specified area where other micro-behaviours can draw graphs

CREATE-EMPTY-AUTO-PLOT -- I create an area that scales dynamically as where other micro-behaviours draw graphs

MULTIPLE-PLOT-GENERATIONS -- I enable layers of graphs to accumulate for each run of the model

USE-PEN-TO-ADD-TO-PLOT -- I use a previously declared pen add to a plot

ADD-TO-PLOT -- I use a temporary pen to add to a plot

CREATE-HISTOGRAM -- I create a histogram

Creating Sliders, Switches, Monitors, and other NetLogo Widgets

CREATE-MONITOR -- I add a monitor to the NetLogo interface

CREATE-CHOOSER -- I add a chooser that behaves like a pull-down menu to the NetLogo interface

CREATE-TEXT -- I add some text to the NetLogo interface

Sliders and input boxes can be created using DEFINE-PARAMETER. Switches can be created using DEFINE-BOOLEAN-PARAMETER.

Creating Event Logs

ADD-MESSAGE -- Adds a custom message to the output area.

USER-MESSAGE -- Displays a dialogue box.

SPECIFY-OUTPUT-AREA -- Describes the size and location of the output area.

LOG-ALL-BEHAVIOURS -- Adds to a log all behaviours I receive

LOG-SPECIFIED-BEHAVIOURS -- Adds to a log when I receive a specified behaviour

LOG-ALL-ATTRIBUTES -- Adds to a log every time any of my attributes is updated

LOG-SPECIFIED-ATTRIBUTES -- Adds to a log whenever any of the specified attributes is updated

Add Comments

COMMENT -- A behaviour that does nothing but provides a place to write comments.

Add NetLogo code or new micro-behaviours

NETLOGO-CODE - This can be used to define your own micro-behaviours or to add NetLogo reporters and commands that can be used in other micro-behaviours.

NEW-MICRO-BEHAVIOUR - A template we recommend you use if you wish to define a complete micro-behaviour (code, links, explanations, etc.). The code itself can be any NetLogo code as well as the BehaviourComposer's scheduling primitives and other extensions. References to attributes of a prototype should follow these attribute naming conventions.

Special-purpose resources for modelling topics ranging from swarming to epidemics to opinion dynamics.

Collective decision-making in animal groups

A specialised library of swarming micro-behaviours is available to build models found in Couzin, I. D., Krause, J., Franks, N. R. & Levin, S.A.(2005) Effective leadership and decision making in animal groups on the move Nature 433, 513-516.

Here is a simple swarming model using some of these micro-behaviours.

Opinion Dynamics Models

A library of opinion dynamics micro-behaviours inspired by the paper "How can extremism prevail? A study based on the relative agreement interaction model" by Guillaume Deffuant, Frédéric Amblard, Gérard Weisbuch and Thierry Faure (2002); Journal of Artificial Societies and Social Simulation vol. 5, no. 4; <http://jasss.soc.surrey.ac.uk/5/4/1.html> can be used to explore modelling opinion dynamics.

Here is a relative agreement model

Epidemic and Vaccination Models

The library of epidemic micro-behaviours were designed to explore the SVIR model as presented in "Mathematical models of vaccination", Almut Scherer and Angela McLean, British Medical Bulletin 2002;62 187-199. Here are some suggestions for exploring vaccination models.

Here is a step-by-step guide to modelling epidemics

Click to load a simple model of an epidemic spreading over a social network

Click to load a model of an epidemic spreading at home, school, and work

Click to try the Epidemic Game Maker which automates much of the construction of epidemics spreading in home, schools, and work.

Sugarscape -- Growing Artificial Societies

You can compose the elements of the Sugarscape library of micro-behaviours to recreate the models in Growing Artificial Societies by Joshua M. Epstein and Robert Axtell, Brookings Institute Press, The MIT Press, 1996.

Here is a step-by-step guide to building Sugarscape models.

Click here to load a Sugarscape model using these micro-behaviours

Economic Models of Network Formation

Use this library of network formation micro-behaviours to model economic agents forming a network.

Predator Prey Models

Here is a sample predator-prey model created using this step-by-step guide to building an ecosystem.

Acknowledgements

The micro-behaviours listed here were constructed for the BehaviourComposer as part of the Modelling4All Project at Oxford University funded by the Eduserv Foundation.