netlogo

Creating a random shape (blob) of a given area in NetLogo

落花浮王杯 提交于 2019-11-30 05:57:59
问题 Is it possible to create random shapes (see below for example) of a given area in NetLogo? 回答1: A first stab at Seth's suggestion #1. It creates a neat visual too! patches-own [ height ] to blobbify clear-all repeat (ceiling 2 * (ln (world-height * world-width))) [ ask patch (round (random (world-width / 2)) - world-width / 4) (round (random (world-height / 2)) - world-height / 4) [ set height world-width * world-height ] ] while [ count patches with [ height > 1 ] < (world-width * world

Including a Netlogo source file into another

丶灬走出姿态 提交于 2019-11-30 04:30:18
问题 How can I include the procedures from one Netlogo file into another? Basically, I want to separate the code of a genetic algorithm from my (quite complicated) fitness function, but, obviously, I want the fitness reporter, which will reside in "fitness.nlogo", to be available in the genetic algorithm code, probably "genetic.nlogo". If it can be done, how are the procedures imported, and the code executed? Is it like Python, where importing a module pretty much executes everything in the module

Netlogo Sprouting turtles at regular intervals

試著忘記壹切 提交于 2019-11-29 18:38:18
I want to place turtles on each of the black patches(below Figure) at a specified step size: Therefore if step size less more turtles will be created/sprouted and more step size will result in less turtles. Code I use right now: ask patches with [pcolor = black][sprout-dead-turtles wall-agents [set color red]] This gives the following result: Previous question asked on same lines: Netlogo Sprouting turtles spaced at less than one patch Here: to fill-wall [ d ] set d precision d 1 ; make sure d is a multiple of 0.1 let n precision (d / 0.1) 0 ; interval at which to hatch ask one-of possible

To build patch clusters at large spatial scales

巧了我就是萌 提交于 2019-11-29 17:20:50
I used the code from How to create cluster patches that do not overlap between them to build patches as shown in the first figure below. Here is the code : to make-cluster loop [ let cluster [patches in-radius (2 + random-float 2)] of one-of patches if all? (patch-set [neighbors] of cluster) [pcolor = black] [ ask cluster [ set pcolor green ] stop ] ] clear-all repeat 20 [ make-cluster ] When I use this code in a large spatial extent (i.e. 1000 x 1000 patches with patch size = 1 pixel), green patches are like circles (see the second figure below). How can I have patches as shown in the first

Reading an Excel .txt file with both text and numbers into NetLogo

岁酱吖の 提交于 2019-11-29 14:59:55
I have a file prepared in Excel that contans both text and numbers e.g line 1 would have MyAge 20 MyYear 1994. I save it as a .txt (text tab delimited) file and attempt to read it into Netlogo. When I open the file in Notepad, the numbers show as numbers and the text show with "". Netlogo does nto read the file saying "expecting a constant". If I remove the text or manually surround the text with quotes, then it works fine. So if my line read: "MyAge" 20 "MyYear" 1994, it owkrs ifne. It would be tedious for small data sets and near impossible for large data sets to manually add "' to all

Time for a procedure to run in NetLogo

我的未来我决定 提交于 2019-11-29 14:44:57
How can I find the time it took to run a procedure in NetLogo? Using 'ticks' defined in NetLogo is inaccurate for my purposes. A vague idea would to subtract the system time at the start and end of procedure if possible. But I am unaware of any methods defined in NetLogo which would allow me to do this. Charles' suggestion of the profiler extension is a great. The profiler extension is incredibly useful. However, it may be overkill for your situation. Checkout reset-timer and timer . reset-timer sets an internal timer to 0, and then timer reports the amount of time that has passed since reset

NetLogo R Extension Installation Error in Mac OS X Yosemite

帅比萌擦擦* 提交于 2019-11-29 12:12:53
I am having problems installing the R extension for NetLogo. I'm using NetLogo 5.05 and version 1.3 of the extension, which is supposed to work with R version 3.0 or higher. My version of R is 3.1.2. Following the instructions from this page , I have changed the .plist file within the NetLogo app so that it points to jri and to my R installation: <key>NSJavaRoot</key> <string>..</string> <key>LSEnvironment</key> <dict> <key>JRI_HOME</key> <string>/Library/Frameworks/R.framework/Resources/library/rJava/jri</string> <key>R_HOME</key> <string>/Library/Frameworks/R.framework/Resources</string> <

NetLogo: Recording distance a turtle has traveled

懵懂的女人 提交于 2019-11-29 11:42:56
I have a NetLogo model that requires a turtle to record its distance travelled from point A to B. It is important that the distance is measured by the turtle rather than simply calculating the distance between the two points. I think something like turtles-own would be sufficient to store the distance it has travelled? Nicolas Payette I assume that you don't want to just use the distance from the original point because it's possible that your turtle has not traveled in a straight line? In any case, it is certainly possible to use a turtles-own variable. Here is a complete example: turtles-own

Generating permutations of a list in NetLogo

◇◆丶佛笑我妖孽 提交于 2019-11-29 11:30:36
I'm trying to generate a list in NetLogo that contains several different unique lists of numbers 0 through n. For example, I have this line of code set mylists [[0 1 2] [0 2 1] [1 0 2] [1 2 0] [2 0 1] [2 1 0]] that I wrote to make all possible unique combinations of 0 1 and 2 without any repetition of the numbers within the lists. I would like to be able to the same thing but with a larger n. Is there an example of how to do this, or some sort of pseudocode algorithm that anyone knows of that I could check out? Thanks! If you don't mind a recursive solution, you could do this: to-report

How to model a very large world in NetLogo?

送分小仙女□ 提交于 2019-11-29 08:43:43
I need to create a very large grid of patches to have GIS information of a very large network (such as a city-wide network). My question is how to get NetLogo to model such a world? When I set the max-pxcor and max-pycor to large numbers, it stop working. I need a world of for example size 50000 * 50000. Thanks for your help. See http://ccl.northwestern.edu/netlogo/docs/faq.html#howbig , which says in part: “The NetLogo engine has no fixed limits on size...” It's highly unlikely that you'll be able to fit a 50,000 x 50,000 world, in your computer though — that's 2.5 billion patches. Memory