netlogo

How to create maze walls in NetLogo?

时光怂恿深爱的人放手 提交于 2019-12-06 12:54:44
I am trying to create a 5x5 grid with 2 exits and put some walls in it. In other words, I want to create a maze or a labyrinth. I was wondering if there is a way to make a border line thicker or change the colour of only one side of a patch. I want to put only one agent inside and let him find the exit by rewarding him with some points. (Q-learning algorithm) Does anyone have an idea? If this is not possible can you suggest comparable code please? Here is an example of what I want to create: As asked, I've posted some of my work (although it seems inefficient to have done this manually). Here

NetLogo: creation of lattice/grid resources world without using turtles?

主宰稳场 提交于 2019-12-06 11:33:10
I would like to create a "gridded" world of resources, in specific distance from the central patch and keep distances equal between these patches. Due to calculation demand, I prefer not to use turtles to create this patchy world. I expect to create something like this: Equally, I would like to define distance between patches as a slider tool. I was wandering to use turtle lattice walk and then turn patches to different color, but is there any way how to do that without turtles ? Thanks for any suggestions ! My not totally working exemple: to setup clear-all ask patches [set pcolor green]

Loading a Netlogo model with extension from RNetLogo

杀马特。学长 韩版系。学妹 提交于 2019-12-06 10:04:30
I am trying to load a Netlogo model in headless mode with RNetLogo. The model uses the rnd extension which is added to the model by extensions [rnd] . If I try to load the model with NLLoad(model.path) I get this error: NLLoadModel(model.path) [1] "Java-Object{Can't find extension: rnd at position 79 in }" Error in NLLoadModel(model.path) :` Unfortunately, I cannot find anything in the documentation of NLLoad . I tried setting the the working directory to the Netlogo directory: setwd("/Applications/Netlogo 6.0.1") . This changes the error to [1] "Java-Object{There was a problem while reading

Getting R to use newer versions of java

让人想犯罪 __ 提交于 2019-12-06 03:45:57
问题 This question is related to this other question. I am trying to use RNetLogo with R and get the following error. nl.path <- "/Applications/NetLogo 5.1.0" NLStart(nl.path) Error in .jnew("nlcon/Preprocess") : java.lang.UnsupportedClassVersionError: nlcon/Preprocess : Unsupported major.minor version 51.0 From what I understood in this other question, the problem is that R is using an old version of Java which is incompatible with RNetLogo. I installed Java 8.0 hoping to solve the problem but my

Using Lists vs Agentsets

时光毁灭记忆、已成空白 提交于 2019-12-06 01:40:06
问题 Lists of agents and agentsets are two different data types in NetLogo (and can be converted with turtle-set and sort ). The documentation states that you use lists for an ordered collection of agents and sets for an unordered collection. It appears that anonymous procedures available to lists makes lists more flexible than agentsets. On the other hand, using 'ask' in combination with agentsets is more common in the example models and has been stated to be more readable. Can one translate any

Netlogo Export/Tableau issues

守給你的承諾、 提交于 2019-12-05 20:08:14
Currently I'm playing around with exporting my data from Netlogo to a CSV file and then loading it into Tableau with the following code.. to write-result-to-file ; if nothing to write then stop if empty? Result-File [stop] ; Open file file-open Result-File ; Write into the file file-print (word Days-passed "," num-susceptible "," num-infected "," num-recovered) ; Close file file-close end Where am running into trouble is when I load the data into tableau it isn't properly picking up the measures/dimensions. Is there a way in Netlogo to specify the headers of each of my rows/columns before they

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

笑着哭i 提交于 2019-12-05 16:58:32
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 working (see photos below) in terms of finding the clusters (although I would prefer that it did not count green patches in the clusters), but I can't figure out how to get the sizes (or patch counts) of each of these clusters. Ideally I would like to make a histogram of the frequency distribution of cluster sizes (excluding green patches) and be

NetLogo turtles leaving a trail that fades with time

◇◆丶佛笑我妖孽 提交于 2019-12-05 16:23:50
问题 I have turtles moving across the view, and I'd like to be able to follow where they go by making them leave a trail behind them, as though they were emitting smoke as they went. Of course, I could use the turtle pen ( pen-down ), but since there are many turtles, the view rapidly gets filled with old trails. The solution could be trails that last only for a few ticks before they dissipate. But I don't know how to achieve that. To be more specific: 1) Is there a technique for making the line

Merge traffic lanes in NetLogo simulation

喜欢而已 提交于 2019-12-05 07:28:09
问题 I want to write a NetLogo program to merge automobile lanes. Vehicles are in 4 lanes, separated by 3.5 meters (with each patch representing 1m). The center coordinates of each lane are at ycor values of -3.75, -7.25, -10.75 and -14.25. Vehicles have random xcor values with ycor values at the center of one of the lanes, and are heading to the right. I want the traffic to merge so that cars driving toward the center of the map ( distancexy 0 0 <50 ) all move to the same lane at ycor = -14.25 as

R extension breaks connection to extensions directory in NetLogo

℡╲_俬逩灬. 提交于 2019-12-04 22:34:12
I am trying to get R and NetLogo to talk to each other using the r extension. I am passing graph objects rather than simply variables. This means I need to export a file from NetLogo and import a file in R, which means they need to point to the same directory. The code runs perfectly. However, once it is run, NetLogo loses the connection to the extensions folder. It appears to be related to setting the working directory in R because the following MWE also creates the problem. extensions [r] to testSETWD r:eval "setwd(\"C:\")" end After running this successfully, then trying to do any edits to