Questions tagged [netlogo]

NetLogo is an agent-based programming language and integrated modeling environment. NetLogo is free and open source software, under a GPL license. Commercial licenses are also available. It is written in Scala and Java and runs on the Java Virtual Machine.

NetLogo is a multi-agent programmable modeling environment. It is used by tens of thousands of students, teachers and researchers worldwide. It also powers HubNet participatory simulations. It is authored by Uri Wilensky and developed at the CCL. It is free and open source.

4110 questions
4
votes
3 answers

Converting agentset into list in NetLogo

I'm writing some code to vaccinate individuals in a population where flu is circulating. There are two kinds of vaccines (named HOV and HEV in the code); the HOV is already done. What I tried/wanted to do was convert the agentset of blue turtles…
Mallika
  • 63
  • 1
  • 5
4
votes
1 answer

NetLogo GIS: dealing with large shapefile

I'm developing a NetLogo model using the GIS extension to import a road network shapefile. The model works fine when I work on a small area of about 5x5 km. However I would like to allow potential users of the model to determine themselve their…
4
votes
1 answer

Netlogo: How to count the number of turtles with specific color and plot them on the Y axis

I want to count the number of turtles with specific color (Red) and plot them on the Y axis (the X axis is ticks). The following is the sample program, and 3D. We thank you for your cooperation. 3D image if (variety = 1) [ set-current-plot…
goodgest
  • 418
  • 3
  • 10
4
votes
1 answer

How store/count individual cluster sizes and plot them in NetLogo

I have a model that generates clusters of yellow patches and I am interested in looking at the frequency distribution of cluster sizes. To do this I have co-opted the code from 'Patch Clusters Example' in the Code Library of NetLogo. It seems to be…
HAJZ
  • 43
  • 3
4
votes
1 answer

NetLogo 6 anonymous procedures with no inputs

In the programming guide it's mentioned that anonymous procedures can have no inputs: [[] -> fd 1] [[] -> count turtles] My question is what would be the use of such a procedure?
4
votes
1 answer

How to sprout 1 turtle within a group of patches

If I assign a value to each patch, where most patches will share the same value to that attribute, is it possible to sprout just 1 turtle within that group of patches? Where each group of patches will have only 1 turtle? What would the syntax of…
UserBRy
  • 259
  • 3
  • 10
4
votes
1 answer

Trouble with nested ifelse in NetLogo

I´m new to NetLogo. Quite new to programming in general too. I read a lot of helpful things here. Now i hit rock bottom with my knowledge and decided to ask my first question ever. No matter how stupid i might sound: I try to make some turtles move…
JackBox
  • 69
  • 5
4
votes
1 answer

Can I use try catch (Exception Handling) in Netlogo

how can I use exception handling in NetLogo? If I have an error it displays run-time error. I do not want to display this error, instead I want to catch it at run-time and do something else instead (like in c# or vb.net). Any help will be…
Mirza Bilal
  • 519
  • 1
  • 5
  • 15
4
votes
1 answer

Pick a random element from list/array of strings in netLogo

I am new programmer in netlogo. I waned to know how can I pick a random string from a list/array of strings in netLogo? If anyone can please guide me, I will be very much thankful. Thanks PS : I have done efforts on my part, I only know how to pick…
Mirza Bilal
  • 519
  • 1
  • 5
  • 15
4
votes
2 answers

How to MAP over agentset?

I need to iterate over a specific agentset of patches and get the neighbors of them all and then join those... I'd do something like reduce patch-set (map [patch-set neighbors self] patches with [somecondition?]) But MAP and REDUCE won't work on…
caeus
  • 3,084
  • 1
  • 22
  • 36
4
votes
1 answer

Randomizing the order an agent calls a procedure?

I have an 5 procedures I'd like an agent to perform but I need them to randomize the order in which they perform them. For example: 1) possible ordering ask turtles [ move eat breed search spawn] 2) another possible ordering ask turtles…
Andrew Yoak
  • 643
  • 4
  • 13
4
votes
1 answer

Netlogo: produce a list of items in which each item is a list whose number of members equals its index

I need to produce a list in which each item represents a (nested) list whose number of members equals its index, in other words, I should make the following list: [[] [0] [0 1] [0 1 2] [0 1 2 3]] I understand that I should use n-values to do so,…
dotthei
  • 53
  • 5
4
votes
1 answer

NetLogo: how to identify the most extended cluster (patch cluster example)?

I'm working with Patch Cluster Example from Model Library and I wish to identify the cluster with the highest number of patches = the most extended one and then turn this cluster red. I know that I can simply count patches with [pvalue = X] ; X -…
maycca
  • 3,848
  • 5
  • 36
  • 67
4
votes
3 answers

Pass a function as a parameter in Netlogo

In many other programming languages, you can pass a function as an argument to another function and call it from within the function. Is there anyway to do this in Netlogo? Such as the following: ;; x,y,z are all ints to-report f [x y z] report x…
mattsap
  • 3,790
  • 1
  • 15
  • 36
4
votes
1 answer

Timing discrepancy between in Netlogo

Can anyone explain why there is a performance difference between the following two segments? It's statistically significant that the second timer call reports a smaller number than the first timer call. My only thoughts would be that Netlogo could…
mattsap
  • 3,790
  • 1
  • 15
  • 36