FAQ Database Discussion Community

How to get NetLogo to run a function every 30 minutes

I'm trying to get NetLogo to run a function every 30 minutes. Can anyone suggest how to do this? Thanks. The structure of go looks like this: to go get-data (run every 30 mins) execute-and-return-decision-based-on-the-data-just-retrieved end ...

Netlogo-Read data from file in every ticks

I am using NetLogo and I want to read two types of data (for example "x" and "y") from a file for each agent in each time step (tick). Does anyone know how I can do this? Thank you in advance Here is the code: breed [agents agent] agents-own [...

how to create turtles from extension in NetLogo

I am trying to create turtles from my extension in Java. In a default command primitive I am doing something like: public void perform(Argument[] argmnts, Context cntxt) throws ExtensionException, LogoException { try { Manager.world = (World) cntxt.getAgent().world(); Manager.empirical = readNetwork(new File(filename)); AgentSet breed = Manager.world.getBreed("TURTLES"); for(Vertex v:Manager.empirical.getVertices()){ Turtle turtle =...

is there a built in way to create a list of consecutive integers?

I'm looking for a built in way to create a list of consecutive integers: 1 to n. IE: [0 1 2 3 4 5 6 7 8] Does it exist? Currently I'm manually creating the list, which is wasteful. Manual method: let group-list [0 1 2 3 4 5 6...

NetLogo - Distributing grains of sand in sandpile model to random neighbours

This code relates to an adaption of the NetLogo sandpile model. When the count go grains in each patch exceeds the threshold which in this case is 3, the grains are re-distributed to the surrounding neighbors. I am trying to re-distribute one grain to 4 random neighbour patches. The code...

How to make constrained combinations of scenarios in NetLogo Behavior Space?

In my problem I have seven global variables to be controlled by Behavior Space. Variable weights are in a range of 0 to 1 with an increment of 0.1 like, [“A” [0 0.1 1]], [“B” [0 0.1 1]], [“C” [0 0.1 1]], [“D” [0 0.1 1]], [“E” [0 0.1 1]],...

nw:weighted-path-to, nw:turtles-on-weighted-path-to and multiple equally weighted paths

I apologise upfront if this is a stupid question. When one calls nw:weighted-path-to a list of links is returned describing the shortest path between origin and destination turtles. Similarly, calling nw:turtles-on-weighted-path-to returns a list of the turtles on the shortest path between origin and destination. It is my understanding that...

Is there any jar file is defined in 3D environment can be used in writting Netlogo extension, for example the path has pzcor?

I am rewriting a NetLogo extension by Java, the original extension is NetlogoAStarPathFinding2D For the path method in the Netlogo.jar library included in the class path, the value members of path only have pxcor and pycor, see definition of path in Netlogo.jar I want to rewrite the extension, the target...

random seed fails to reproduce run in NetLogo when selecting breed-neighbors

I have a network with three undirected link breeds undirected-link-breed [ parentals parental ] undirected-link-breed [ diffusions diffusion ] undirected-link-breed [ simdiffusions simdiffusion ] I have have fixed the seed and run my go procedure calling different procedures that always reproduce the output, as expected given the seed. My go...

turtles think that they are always on a patch that is black

i am making a model for a class in netlogo, but i have run into a problem, whenever a turtle asks the patch that it is on what color it is, it thinks that it is black, even when it is colored white globals [var inside outside var1 ratio] turtles-own...

How to avoid adding a link between two nodes twice

I've made the following netlogo procedure that creates a network with a given number of nodes and undirected links between nodes: to setup ;; Here I created the nodes and sort them around a circle clear-all create-turtles number-of-nodes layout-circle turtles max-pxcor ;; Here I add the links let i 0...

Error while loading raster data in netlogo

I am unable to load raster image into netlogo. Following is the code i have used: extensions [ gis ] globals [ raster-dataset ] to setup set raster-dataset gis:load-dataset "D:/SUKHJIT PROJECT/1979sup2.asc" end The error message displayed: Extension exception: only GEOGCS and PROJCS are supported error while observer running GIS:LOAD-DATASET called...

netlogo multiple catchment area using neighbors

Hi i'm new to netlogo programming, i have a few problems.. i'm tring to make a model where the turtles are created in a delimited areas named home-patches and have to go in other delimited areas named security-patches. now i want that the turtles go in this security-patches using a...

Creating overlapping agents in a line

Using the below code I get agents are like this: to setup ask breadth-patches [sprout-walls wall-agents[set color 2]] ask length-patches [sprout-walls wall-agents[set color 2]] ask gap-patches [sprout-walls wall-agents[set color 2]] ask length-patches[align-inside-at-top] ask breadth-patches [align-inside-at-right-left] ask gap-patches[align-inside-at-top] end to align-inside-at-top ;; patch procedure let counter count walls-here ;; we will...

Netlogo Linking Breeds

I'm still trying to get used to Netlogo. I have two breeds, Buyers and Sellers. Buyers have their own "dPrice" and Sellers have their own "dPrice". All the buyers and sellers start with having done no trades. I need to have each buyer to search through sellers that have not...

Netlogo - Sampling from a Beta-Pert Distribtuion

I'm posting this partially to get a question answered and partially so someone else might find it later and save them the headache. I am trying to create a beta-pert distribution in NetLogo by following the formula here from Epix Analytics I've created an Beta(Alpha1, alpha2) distribution using the transformation...

Is there something similar to contains in netlogo

Im trying to do an if statement with an condition that if the string contains a certain word like bellow if(phrase) = "word") Any ideas?

Checking unique list in a patchset

I have each patch containing a list of length 4. For exaample state = [ 1 0 1 4 ] I want to check how many patches have such unique lists, given the order of elements in the list matters. Thus, for example in each of 4 patches with the...

Netlogo one-to-one relation

I have a netlogo problem for which I can't seem to find a solution, but yet it feels very basic. I have two types of breeds: breed [individuals individual] breed [cars car] I want to create a link from one individual to one car. So, its a one-one relation. I...

ODE implemetation in NetLogo

How does one implement ODE in netlogo? Right now , I use the Euler method which is solves the the given equations: R[t+1] = r[t] + v[t] * step-size V[t+1] = v[t] + f * step-size Found this similar question, but it suggest uni-directional link from mathematica to netlogo which...

Netlogo Headless error

I get this error while running NetLogo, headless on HPC. I job seems to keep running but doesn't write anything. Exception in thread "main" java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.lang.ClassLoader.defineClass(ClassLoader.java:643) at org.nlogo.generator.CustomClassLoader.loadClass(CustomClassLoader.scala:27) at org.nlogo.generator.CustomClassLoader.loadBytecodeClass(CustomClassLoader.scala:32) at...

How to make a size slider in netlogo?

I'm new to netlogo and i'm trying to make a slider that allows you to change the size of the turtles. so far i've made a slider called size-of-turtle and in the code i tried putting: "set size size-of-turtle" but i just get an error message. please help.

Find a single duplicate in a list of lists Netlogo

I am trying to find a duplicate between the sublists of a list , if I have this list let listA [[-9 2] [-9 1] [-9 0][-9 -1][-9 -2][-9 -3][-9 -4][-8 0][-9 0]] and it is a restriction that this list can have only one sublist that can be repeated...

NetLogo: histogram with list of strings

I just tried to create a histogram build upon a list of characters like this: histogram [a c a c b c a c c c c c c a c c a c a c a a c c c a a b c b c] But it doesn't...

How to get connected two or more turtles within radius NetLogo

I have more turtles moving in the world, i would like to get them connected when they are inside an area (circles). This is an example: I was trying with a function like this, called in the "go" procedure (tick advanced) but this doesn't work. Any suggestion? to connect ask...

Netlogo High performance Computing

Are there any high performance computing facilites available for running NetLogo behavior space like R servers. Thanks.

Weird error in naming movie output file

I can't seem to get the error reason. Working Code: print word "output" date-and-time movie-start "output" Not Working Code: movie-start word "output" date-and-time Error: error (IllegalStateException) while observer running MOVIE-START called by procedure GO called by Button 'go' NetLogo is unable to supply you with more details about this error....

Histogram over non-integral buckets

I'm trying to get a histogram plot for data that has been collected in buckets that are portions of [0,1]. That is, I collect counts of values that fall into [0, 0.05), [0.05, 0.1), [0.1, 0.15), etc. The data is collected in an list, where each element of the list...

Behaviour Space Output .csv file Change

I wish get the behaviour space output of format table removing information other than just the variables,reporters and run-number. The output still being .csv file.

How to load a graphml file with Netlogo NW extension

I think there is a bug in the way nw:load-graphml works. Take this graphml file with 3 nodes and 3 links of an undirected breed "parentals" and 2 links of a directed breed "diffusions" : <?xml version="1.0" encoding="UTF-8"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> <!-- Created by igraph --> <key id="e_breed"...

Netlogo HPC CPU Percentage Use Increase

I submit jobs using headless NetLogo to a HPC server by the following code: #!/bin/bash #$ -N r20p #$ -q all.q #$ -pe mpi 24 /home/abhishekb/netlogo/netlogo-5.1.0/netlogo-headless.sh \ --model /home/abhishekb/models/corrected-rk4-20presults.nlogo \ --experiment test \ --table /home/abhishekb/csvresults/corrected-rk4-20presults.csv Below is the snapshot of a cluster queue using: qstat -g c I wish to...

how to show/hide links according to Switch in NetLogo

I'd like to show/hide a breed of links according to the value of a Switch in the UI. I know how to show/hide links when the corresponding procedure is embedded in a setup or go procedure, but I am wondering if I can detach my visible-links procedure in order to...

How to create a “random-pareto” in NetLogo?

Since I am not well-versed in mathematics, I am struggling with the implementation of a random number generator in NetLogo which follows roughly a pareto distribution. This is the follow-up question of this one here, where I would like to substitue the random-float with something like "random-pareto" in order to...

Progress of simulations in headless mode

Is there any way to check the progress of simulations in headless mode as opposed to gui? Basic Code: $ ~/netlogo-5.1.0/netlogo-headless.sh \ --model ~/myproject/MyModel.nlogo \ --experiment MyExperiment \ --table ~/myproject/MyNewOutputData.csv ...

if elseif else implementation in Netlogo environment

I wish - if elseif else statement in NetLogo. How can I do so efficiently? I checked NetLogo documentation no command to do so. Previous similar question didn't answer it directly but solved in the context. One simple solution is: let flag true if(condition1) [ ... set flag false ]...

How can I take real time data from a web site using NetLogo?

We are trying to let NetLogo take the real time data, but we didn’t found any threads helpful online that tells how. We used historical stock price data to train our agents in the first stage. After the end of the training phase, we would like to use real time...

How to add power law likelihood to Netlogo Model

I would like to add a likelihood of natural disaster in my environmantal ABM that follows the power law (often few damage, less often mediocre damage, rarely strong damage, very rarely complete damage). I coded so far the following: to environment ;environmental hits create-hits 1 [ ; I do not...

Netlogo headless on HPC machine error

My runninfg netlogo headless on google compute, can someone please help me with this error: [email protected]:~$ /home/abhigenie92_gmail_com/netlogo-5.1.0/netlogo-headless.sh \ > --model /home/abhigenie92_gmail_com/copy.nlogo \ > --experiment k-e\ > --table /home/abhigenie92_gmail_com/MyNewOutputData.csv \ > --threads 2 unknown argument: /home/abhigenie92_gmail_com/MyNewOutputData.csv ...

NetLogo: Measure maximum distance between 2 patches

my question is really trivial but as a beginner in NetLogo I still cannot find my answer.. I have created a patchy surface (available here: basic nlogo code) to setup clear-all setup-patches reset-ticks end ;create patchy surface to setup-patches ask n-of 5 patches [ set pcolor green ] ask patch...

define neighbor turtles using in-radius or distance

I would like to define neighbors using in-radius or distance. My solution so far is: turtles-own [ my-neighbors num-neighbors] to setup ca crt 100 [ move-to one-of patches with [ not any? turtles-here ] set my-neighbors (other turtles) in-radius 3 set num-neighbors count my-neighbors ] end The problem with this...

Shortest path query returning empty list

I have a network with 2851 nodes and 2887 links. The network represents railway lines in a city I have been using the NW extension to identify the shortest path between some turtles. However, for some queries, I am returning a blank list, rather than a legitimate response, or false...

Extension not found error with control flow extension

I am trying to use https://github.com/qiemem/ControlFlowExtension as an alternative to if-else. I have it to added to the extensions folder(C:\Program Files (x86)\NetLogo 5.1.0\extensions). The extracted zipped folder from github. In the NetLogo code I use the following, extensions[ControlFlowExtension-master] But it still shows me the following error: ...

NetLogo nothing named SCREEN-SIZE-X has been defined

i'm new using NetLogo and I'm trying to learn it using the 'Hello World' model found on the net. I'm running NetLogo 5.2 on Mac OS X (Yosemite). When I try to set the turtles randomly, in this way setxy random screen-size-x random screen-size-y I get this error: Nothing named...

Behaviour space simultaneous simulations error

I'm using behaviour space to run 100 simulations. The problem is when I try to run more than 1 simulation at a time, some of the variables don't seem to be cleared properly. Here is an example output: Each simulation (the first column is the run number) has a variable...

read from a specific file in each tick in NetLogo

I am using NetLogo. I have 10 agents and I want to change one of the attributes of my agents in each tick. I have a .txt file and I want to read ten lines of the file in each tick. In other words, I want to read 10 lines...

Setting Age on Turtles

I have my turtles own age as one of their variables and I have age set to ticks so that my turtles age whenever they reach a certain number of ticks. However, this causes all turtles to age at the same time (say when ticks = 5), regardless of when...

Why do i get this error every time i try to run the code within my U.I.?

I have the code: if pcolor = blue [ask turtles-here [set heading towards one-of neighbors4 with [pcolor] = grey ] fd speed ]. This has the aim of making a turtle that is spawned on a blue patch set its heading towards a neighbour with pcolor = grey and then...

Running NetLogo on HPC machine: how to specify the number of cores to be used?

$ wget https://ccl.northwestern.edu/netlogo/5.1.0/netlogo-5.1.0.tar.gz $ tar -xzf netlogo-5.1.0.tar.gz $ ~/netlogo-5.1.0/netlogo-headless.sh \ --model ~/myproject/MyModel.nlogo \ --experiment MyExperiment \ --table ~/myproject/MyNewOutputData.csv Using the above commands to run a netlogo headless on HPC machine. The problem is how to I specify the number of cores to be used or does by default take...

set variables in netlogo

Say there are two variables: x and y. Let x be a function of y, e.g. set x 2 * y. If future lines of the code alter the value of y, the value of x does not seem to automatically update, without me specifying again: set x 2 *...

Is it possible to assign a number to a lists with the same name to be differentiated?

A part of my program relies on recording the lengths of roads within my user interface as they are drawn out. As this requires looping , and as I want to be able to keep the name of the list all the data is stored in the same, is it...

Plotting attribute of a non-consecutive agentset

How can I plot an attribute of an agentset in netlogo, each with a different pen. Consider there are other types of agents also, and the who numbers of the agentset to be plotted are not all consecutive to distribution/creation at start.

Average results from multiple simulations

I have a simulation with a lot of random components, so I would like to run many simulations and average the results (the result is determined by a variable called score). How would you do this in Netlogo? Currently I'm working on a program that will export the results to...

why am i unable to read strings form a txt file from net logo?

I am trying to read in net logo the following line from a txt file: job1 1 1 15 25 90 3 1111 1100 0010 0110 1011 0 0 0 0 0 0 0 0 0 0 0 however, all the time i received: Expected a constant (line 1, character...

How to create random binary/boolean variable in Netlogo

I'd like to assign a random boolean variable to each turtle, but I'm not seeing a function that would simulate a draw from a Bernoulli distribution. This gets close, but it's awkward: ifelse random-in-range 0 1 < .5 [set expensive? false] [ set expensive? true ] Anyone know a better...

Why am i getting the expected a true/false here rather than an a list or block here?

I have the code: if [pcolor] of patch-here = grey and [pcolor] n-of 2 neighbors4 = grey [set X X + 1 set agentset-number = N] This seemed to produce no error before hand, I am curious as to what is incorrect within this snippet of code and how...

R - ggplot maximum tick grouped by runnumber Netlogo

I have a small problem. I have the output of Netlogo in an R dataframe. Now I would like to plot the maximum number of ticks of each Run over the Runnumber. So I have one column that is called 'tick' and one that is called 'runNumber'. And I would...

how to turn a column full of factored lists into a data frame

I'm new to R and I'm hoping to turn some output from a NetLogo model I developed into something I can analyze in R. My NetLogo model consolidates 8 different variables into a list and exports it to R as a huge column of factors: > tail(d$conflict) [1] [152 264...

Selectively grab Instances for creating a movie

How can I selectively grab only the world and just 2 of 3 plots in my NetLogo model run? movie-grab-view grabs only the world view while other movie-grab-interfacegrabs all. Is the other to way to the aforementioned? Note: this of course excludes buttons, sliders etc....

NetLogo simulation recording: how to adjust the recording rate?

I have implemented a dynamical system in NetLogo using rk4, which makes the updation extremely slow. I can't observe anything when see the model. Is there any efficent way to record the simulation. I know not much about graphics what does frame rate mean, does increasing that be of any...

How to call a list for update multiple times until a condition is fulfilled in Netlogo

I am new to Netlogo and still learning , what i want to do is call a list after an update is done and do another update to it until a condition is reached , if a have a list let xy [[-2 6][-1 6][0 6][-1 6][-2 6][1 5][2 5][-3...

Netlogo- Creating agents with traits from .csv files

I'm attempting to populate my world with agents whose traits are from a csv file. The file looks like this: I'm pretty fluent in other areas of NetLogo but this is the first time diving in to external data inputs. I've looked in other places but and other topics are...

Development of turtles from one breed to another

I dont know much about netlogo so this may be a really simple solution but I have multiple breeds of turtles where each breed is a different age range (eggs, hatchlings, juveniles, hawksbills (adults)) and i need them to be able to go from one breed to the next after...

netlogo turtles move directly to another turtle when in range

This is a predator prey simulation with raptors and humans. I want the Raptors to move directly to the nearest human when in range. How to implement this in netlogo? Any suggestions?

Netlogo: How to randomly select out of all neighbor patches that have a higher elevation?

I want my turtles to be able to assess which neighbour patches have a higher elevation than the current patch and then randomly select one of these higher elevation patches to move to. Thank you very much in advance....

netlogo export viewer with zoom level

I would like to know if there is a "primitive" way for export view around a specified agents in netlogo. Something like rather than thank you...

Should I use in-radius or in-cone to define vision in NetLogo 3D?

I'm trying to make two models, one in base NetLogo and the other in the 3D version. In the 3D version how do I define a spherical visual range rather than a circular one? Is it by using in-radius or in-cone or perhaps something different? Hope you can help. ...

Running netlogo with 64 bit Java from a batch file

To overcome memory constraints I'm trying to run Netlogo with a 64 bit version of JRE. I have tried using the example at http://netlogo-users.18673.x6.nabble.com/We-found-a-solution-for-Out-of-Memory-Errors-td5005459.html. As recommended I have created a desktop based batch file with the following code included: "C:\Program Files\Java\jre1.8.0_31\bin\java" -Xmx10g -Dfile.encoding=UTF-8 -jar "C:\Program Files (x86)\NetLogo 5.1.0\NetLogo.jar" I have...

Trouble using with-min

A simple question, but one I'm totally failing on. I have a group of turtles that need to locate the nearest neighbour, as I wish to create a link between them. I've tried the following code, but I keep coming back with a null set [nobody found]: ask turtles [create-links-with...

Draw an arrow for a vector on the top of each of the turtles

I wish to draw an arrow at the top turtle representing a vector denoted by [x1,y1] . The vector is of unit magnitude and the size of the arrow should not exceed that of the turtle. The vector is stored in a list with two elements. I don't wish to...

How to control the positioning of a turtle on a patch?

In order for two way traffic to flow along a road that is the thickness of a single patch it is necessary for the position of each turtle to be to either the left or the right of the patch on which they are travelling. How can I control where...

Perspective based ranking?

I have a program where each peer has their own ranking system of other peers, what is the best way to implement this is NetLogo? Normally, I would solve this with a 2D list: [[turtle 1, score], [turtle 2, score], ...] But this seems very troubling in NetLogo. This is...

How to report a list in Behaviorspace NetLogo?

I am running a NetLogo model in BehaviorSpace each time varying number of runs. I have turtle-breed pigs, and they accumulate a table with patch-types as keys and number of visits to each patch-type as values. In the end I calculate a list of mean number of visits from all...

NetLogo Headless Meaning with respect to speed

What does one exactly mean by headless mode of NetLogo? I am considering it is running netlogo without GUI, what about the speed of slider for the model running.