Agent based Modelling of Collective and Coordinated Behaviour

Agent-based Modelling of Collective and Coordinated Behaviour

For this course work you must submit three NetLogo Models (as .nlogo files) on the slot made available on Canvas (Unit 6 Course Work Assignments). In Model 1 turtles pile up “chips”, in Model 2 the turtles form grouping patterns based on attraction and repulsion and Model 3 integrates the grouping patterns that emerge in Model 2 with the collecting activities of Model 1.

Make sure to put your last name and Student Registration Number  in the name of the submitted NetLogo files (for example as in “patil123.nlogo”). If you do this course work in pairs, names and SRN numbers of both participants should be in the title of the .nlogo file (for example “smith234brown567.nlogo”).

The Models should show and contain the following

Model 1 “Collecting”:

  • Pile formation of either green chips, blue chips or both.
  • The possibility for the user to put two circular patches of chosen size (radius) at chosen x, y coordinates on the canvas.

This model can be built by adapting and extending NetLogo’s  “Termites” model (Models Library > Biology > Termites) or the equivalent mode set up in Practical 3 (Agent-Based Models 1).

Model 2 “Flocking”:

  • Grouping patterns formed by eight predefined sets of six parameter values (vision-angle, three vision distances, search-angle and exploration-option).
  • The user should have the opportunity to choose any of the eight sets when the model is running. The chosen set of parameter values are immediately activated and  his enables a direct inspection of the effect of parameter values on the type of grouping pattern.

This model is a simplified version of NetLogo’s “Flocking” model (Models Library > Biology > Flocking) and how it can be built is outlined in the description of Practical 4 (Agent-Based Models 2).

Model 3 “Flocking with Collecting”:

  • This model should combine the features of models 1 and 2. The procedure “to collect” represents Model 1 and it should be possible to run this procedure on its own as well as in combination with the procedure “to flock” (= Model 2). The combined option should show turtles that perform collective behaviour while their movements are coordinated by a chosen set of “flocking” parameters.
  • Likewise, the user should have the option to run the “to flock” procedure on its own. When both switches “collect-on?” and “flock-on?” are OFF the turtles should by white and “wiggle” whether or not there are objects and not be affected by any setting.
  • After having set up the models you should do experiments by running them for various parameter settings and try to understand how and why the patterns that emerge come about.

Your understanding of the models will be assessed in some of the  multiple choice questions that make up Course Work 3

NetLogo Models to use:

  1. Model 1 Collective Behaviour: “Termites” (NetLogo Models Library > Biology > Termites) or the equivalent program set up in Practical 3 (“Agent Based Model 1”).
  2. Model 2 Coordinated Behaviour: The program “Agent Based Model 2” which was set up in Practical 4 (which is a simplified version of the “Flocking” model in the NetLogo Models Library). Make sure that the model is in turtles-mode, as outlined in the description of Practical 4. This is crucial for connecting it to Model 1 (which is in turtle-mode).

However, for a better understanding of the working of the parameter settings, it is advised to also investigate the model as originally written in “observer-mode”  (this mode allows you to switch the cone on/off and combined with a travel-line this helps in interpreting the actions of the turtles and the resulting grouping patterns).

The sets of parameter values 1 – 8 should be exactly as given in the practical description.

Changes and Extensions to the “Termites” Model.

The original “Termites” (or the equivalent  “Agent Based Model 1”) model should be altered as follows:

  1. The random turn angle in the procedure to wiggle should be set at 20 (instead of the original 50).
  2. The “chips” should be green instead of yellow.
  3. Instead of the turtles changing their colour from white to orange when they pick up a chip, they should change their shape from the default shape to “arrow”.
  4. The to go procedure should be re-named as to collect. In accordance, the “go” button should become a “collect” button.

and extended by:

  1. An option to include blue “woodchips” with its own adjustable density. The model should be extended so that it can work on both the green and the blue type of  chip at the same time as well as on each of the types separately.
  2. This requires a specific shape change when a turtle picks up a blue chip, namely from default to “triangle”; as in the case of a green chip, the turtle does not change colour when it picks up a chip. In effect, in the Collecting model the state changes of the turtles never show up as a change of colour (they are always white) but only as a change of  shape.
  • The creation of two coloured circular objects at chosen x, y coordinates and of a chosen radius (an adjustable variable called ObjectSize).

 Get this done by writing in the ask patches (in the  to setup procedure)     

 statements of the form:

if (distancexy (x) (y) < Object#Size [set pcolor sky]

 where (x) and (y) are scaled x- and y-coordinates of the form:

                x = object#-xcor * max-pxcor

      y = object#-ycor * max-pxcor

The scaling factors for x   (object#-xcor) and y (object#-ycor) should range between -1 and 1 (with increments of 0.1) and be adjustable by dedicated sliders. The symbol # indicates the object number (i.e. 1 or 2).

Consult NetLogo’s dictionary for detailed information about the distancexy reporter.

Connecting the Models

The integrated model should be set up in such a way that the turtles are first of all splitting and joining as dictated by fission-fusion model (Agent Based Model 2) but start collecting when they run into a chip. It is therefore essential that you do not change anything in the code of Agent Based Model 2 (i.e. the  to flock procedure).

There are various ways to integrate the two models (NB both should be in turtle-mode). One way of doing this is outlined below.

Note that the two models have the procedure “wiggle” (P2) in common. This suggests a “connecting” procedure, for instance with the name to move, which includes a conditional call to P2 (“wiggle”).

The connecting procedure is called in a to go. This to go furthermore contains a switch, “collect-on?”. If this switch is ON, to collect (i.e. model 1) is activated.

The connecting procedure to move is defined outside the to go and includes calling P2 (“wiggle”), but only IF a switch (that controls flocking) is OFF, ELSE  to flock will be executed.

In the to collect procedure all calls to P2 (“wiggle”) should be replaced by a call which takes care of the suggested linking . Also, if “collecting?” is ON, the outward appearance of the turtles should be adjusted in order to assure that extension ii is not violated.

Suggestions for experiments

The “world settings” for all models are:

Location of origin: Center.

max-pxcor = max -pycor = 100, Patch size = 2.5 (but see the note on run times at the end of this document).

World wrapped horizontally and vertically.

Default number of turtles: 20

Size of turtles: 4

Default density of coloured patches: 10%

For Model 1: Number of turtles should be no more than 100, but it is worthwhile to see what happens with  a population as small as 10 turtles.

The density for chips should not exceed 10% and the slider should increment with steps of 0.01. Check what happens for very low percentages (e.g. 0.15, 0.25).

You could also play with some intrinsic values of the collecting model, like the “forward 20” step in the procedure “Search-for-chip” (P1).

What happens if this number of steps is much lower for the blue chips (e.g. fd 1) than for the green chips (fd 20) (or the other way around)?

Run the model with one circular object and vary its size (for example 5, 10, and 15). Run the model several times for each size. Also run the model with two objects and let them be either of the same size (both small = size 5, or both large = size 15) or one large (15) and the other small (5).

The “Info” tab on the “termites” model also offers nice suggestions and provides valuable background information.

For Model 2: Run the various settings 1 – 8 and try to figure out how the change in parameter values (look what happens with the sliders if you select a particular setting from the “Chooser”) affect the grouping patterns. You may also want to experiment with settings other than offered by the “Chooser”. For this, you need to override the “Chooser” by turning a switch (called “choose settings?”) OFF.

For Model 3: Switch both “collecting?” and “flocking?” on and pick a particular flocking setting and see how the type of grouping influences the piling up of the chips. Also switch collecting on and off during the run of a particular setting of flocking (and the other way around, i.e. choose different flocking settings during a run).

For all Models: To understand the working of the models it is helpful if you can switch on/off the turtles leaving a trail behind.

Some of the settings may take quite some time before a pattern becomes apparent. For the “Termites” model, using its original settings (chip density = 20%, 400 turtles), it takes more than 10 minutes when running at normal speed (and ~ 7 minutes at full speed) as measured by an online stopwatch ( on my laptop. Using a of density (10%)  and 100 turtles  for the “Termites” model requires ~ 1 – 1.5 minutes at full speed for one type of chips but takes more time for two types (blue and green). Completion time can be reduced by running the simulation in a smaller world (50 x 50, patch size = 5, density 10%, 100 turtles, ~ 20 seconds  at normal speed for the “Termites”), but this goes at the expense of a poorer resolution.

Want latest solution of this assignment

+ Submit Your Assignment Here

AssignmentHippo Features

On Time Delivery

Our motto is deliver assignment on Time. Our Expert writers deliver quality assignments to the students.

Plagiarism Free Work

Get reliable and unique assignments by using our 100% plagiarism-free.

24 X 7 Live Help

Get connected 24*7 with our Live Chat support executives to receive instant solutions for your assignment.

Services For All Subjects

Get Help with all the subjects like: Programming, Accounting, Finance, Engineering, Law and Marketing.

Best Price Guarantee

Get premium service at a pocket-friendly rate at AssignmentHippo


Client Review

I was struggling so hard to complete my marketing assignment on brand development when I decided to finally reach to the experts of this portal. They certainly deliver perfect consistency and the desired format. The content prepared by the experts of this platform was simply amazing. I definitely owe my grades to them.

Tap to Chat
Get instant assignment help