netlogo

Ask up to n-of turtles

假装没事ソ 提交于 2019-12-23 19:04:03
问题 Is there a built in function that will ask up to n-of turtles? So if you ask 50 turtles but there are only 40 it will ask those 40 and move on. Or there aren't any, it will just move on. Alternatively does anyone have any neat code for achieving this? 回答1: This will pick out 40 random turtles: ask n-of 40 turtles [ <whatever you want them to do> ] If you want to pick out a smaller number when there are not 40 available, you could do something like: let num min (list 40 count turtles) ask n-of

Making turtles wait x number of ticks

橙三吉。 提交于 2019-12-23 17:23:15
问题 Part of what I am trying to do is make a breed of turtles move around, but when one reaches its destination that turtle waits for a certain number of ticks before continuing ? Also is it possible to make turtles wait for different number of ticks depending upon their destination ( different patch colors). Is it a case of making a turtle breed or global variable to count the number of ticks? The hopefully relevant code is below. 回答1: You are right, this can be done by making the turtles count

How to properly plot variables

﹥>﹥吖頭↗ 提交于 2019-12-23 17:13:51
问题 I tried to look into docs, but I haven't found the answer that I needed. So I am asking here: I have for example 15 turtles (this number can vary) and I need to draw their variable (for example Revenue) into one plot. I know I can plot variable of 1 agent trough command plot [revenue] of turtle 0 But how can I plot the whole agentset? My second problem is when I have the command plot [revenue] of turtle 0, netlogo gives me an error which says: OF expected input to be a turtle agentset or

NetLogo BehaviorSpace - Measure runs using reporters

放肆的年华 提交于 2019-12-23 15:43:13
问题 In my NetLogo model my turtles are called inhabitants. each inhabitant has their own start opinion (initial_opinion) an a final opinion (final_opinion). Their opinion are calculated using random numbers so i want to run the model atleast 20 times when i change some parameters. Therefore i'm using the BehaviorSpace. However, i have no idea how i get my values of these two variables in a spreadsheet. What code do i need to add in the box 'Measure runs using these reporters:'. I do not want to

How to share a NetLogo model online

蹲街弑〆低调 提交于 2019-12-23 10:49:08
问题 I'm trying to share my NetLogo model online so that it can be run by others on their laptops or smartphones without NetLogo desktop installed. I have found that it is possible to run models online with NetLogo web (http://www.netlogoweb.org/launch#http://www.netlogoweb.org/assets/modelslib/Sample%20Models/Biology/Evolution/Cooperation.nlogo) and also possible to upload a model from NetLogo to NetLogo web. The uploaded model can be exported as a .html file. What I am having trouble with is

How to share a NetLogo model online

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 10:48:33
问题 I'm trying to share my NetLogo model online so that it can be run by others on their laptops or smartphones without NetLogo desktop installed. I have found that it is possible to run models online with NetLogo web (http://www.netlogoweb.org/launch#http://www.netlogoweb.org/assets/modelslib/Sample%20Models/Biology/Evolution/Cooperation.nlogo) and also possible to upload a model from NetLogo to NetLogo web. The uploaded model can be exported as a .html file. What I am having trouble with is

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

梦想的初衷 提交于 2019-12-22 18:24:08
问题 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

Netlogo Export/Tableau issues

不问归期 提交于 2019-12-22 09:46:52
问题 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

NetLogo Efficiently create network with arbitrary degree distribution

二次信任 提交于 2019-12-22 09:09:52
问题 This is a follow up question to NetLogo Efficient way to create fixed number of links. Having focussed on avoiding the nested `ask', I now have this code. It is much more efficient, but is creating too many links. Clearly a logic error but I can't see it. globals [ candidates friends ] to setup clear-all set friends 2 create-turtles 5000 set candidates turtles make-network end to make-network ask turtles [ let new-links friends - count my-links if new-links > 0 [ let chosen n-of min (list new

R extension breaks connection to extensions directory in NetLogo

£可爱£侵袭症+ 提交于 2019-12-22 02:05:32
问题 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]