netlogo

How to control square size in a grid from square area?

我只是一个虾纸丫 提交于 2020-01-14 14:22:29
问题 I am new to Netlogo. I used the code of "Traffic grid" to draw square grid. From this code, how can I control square size in the grid from square area (e.g. one square = 100km²) instead of horizontal and vertical road number ? In my Netlogo world, one patch = 10km². to setup let grid-x-inc world-width / grid-size-x let grid-y-inc world-height / grid-size-y ask patches [ set pcolor brown ] let roads patches with [( floor( (pxcor + max-pxcor - floor(grid-x-inc - 1) ) mod grid-x-inc ) = 0) or (

Interpretations of probabilities and percentages

核能气质少年 提交于 2020-01-13 13:12:22
问题 Thank you very much for your help for coding my model, If you do not mind please, I want to ask you about some interpretations in the coding I am sorry I am not expert in mathematics to move ask turtles with [gender = "male" ] [ if ( random-float 1) <= 0.025] why it is <= and what is the interpretation of this code, and for the percentage ask turtles [ if random 100 <= 50 [become-fat]] the same question why <= if we always say 50 % in the group will be fat why we put this sign??? and what is

NetLogo: How to filter a list using a criterion which refers on a corresponding list?

独自空忆成欢 提交于 2020-01-13 06:12:49
问题 My situation: I have two lists in NetLogo which are thought to correspond with each other, e.g. being two rows of of a matrix. For example set list-1 [1 2 2] set list-2 [13 7 8] where 1 is thought to be paired with 13, 2 with 7, and 2 with 8. These pairings may not be broken. My problem: I want to filter list-2 by applying a criterion on the corresponding elements of list-1. E.g. preserve an item of list-2 if the corresponding item equals 2 The result should be: list-2: [7 8] where the 13 is

Is NetLogo too slow for big simulations? How can I speed up a NetLogo model?

会有一股神秘感。 提交于 2020-01-12 07:47:30
问题 Is NetLogo a good platform for big models (>10,000s of patches, turtles)? How can I speed up a model that runs very slowly? 回答1: We just published an article on execution speed of NetLogo; it is available at: http://jasss.soc.surrey.ac.uk/20/1/3.html The article's main points are (a) NetLogo is not necessarily slow for executing large scientific models, and in fact has speed advantages over some alternatives; and (b) NetLogo models do often execute very slowly at first but can almost always

Check if turtles have same x-coordinate and y-coordinate as patches

邮差的信 提交于 2020-01-06 13:54:08
问题 I have a patchset subtractset and some of patches have turtles on it. Now, I wish to create turtles on only those patches which have different x-cor and y-cor as the patches. Note: This is different from below code: distribute-turtles (population * percent) subtractset with[count turtles-here = 0] as here a turtle maybe on patch and still have different x-cor and y-cor as the patch. Thanks. Please let me if there is some ambiguity in my question. 回答1: Patches have integer coordinates so one

How to create multiple generations of reproduction where mates are selected in the population

馋奶兔 提交于 2020-01-06 08:33:48
问题 I have a simulation with two sexes, males and females. Females select from a group of males and produce offspring. Multiple males can mate with a single female and females produce multiple offspring. When they reproduce, the parents die but there is some inheritance of traits which are turtles-own variables. I had help here in getting the females to choose from the pool of available males ( availa-males ). But the problem is that the mates variable doesn't work after the first round of mating

No stop when running Netlogo Behaviorspace headless on Linux when using r extension

做~自己de王妃 提交于 2020-01-06 08:04:49
问题 I am running a simple netlogo behaviorspace experiment on a Linux cluster with calling R extension. Here is the sample code: extensions [r] to setup clear-all setup-patches setup-turtles reset-ticks end to setup-patches ask patches [ set pcolor green ] end to setup-turtles create-turtles number ;; uses the value of the number slider to create turtles ask turtles [ setxy random-xcor random-ycor ] end to go if ticks >= 5 [ stop ] ;; stop after 5 ticks move-turtles tick ;; increase the tick

Easiest way to ignore blank lines when reading a file in Netlogo

我的未来我决定 提交于 2020-01-06 06:52:51
问题 I have some code that reads a file of names and creates a list: let who-file-name "world-health-field-surveillance.csv" let who-file-name-dict csv:from-file who-file-name let who-file-names sort [who] of names let index 1 ;not 0, this removes the header in the csv repeat length who-file-names [ file-open "world-health-field-surveillance.csv" if file-at-end? [stop] let entry (item 0 (item index who-file-name-dict)) if entry = "\n" [stop] The file might end with some blank lines or its possible

Easiest way to ignore blank lines when reading a file in Netlogo

让人想犯罪 __ 提交于 2020-01-06 06:52:24
问题 I have some code that reads a file of names and creates a list: let who-file-name "world-health-field-surveillance.csv" let who-file-name-dict csv:from-file who-file-name let who-file-names sort [who] of names let index 1 ;not 0, this removes the header in the csv repeat length who-file-names [ file-open "world-health-field-surveillance.csv" if file-at-end? [stop] let entry (item 0 (item index who-file-name-dict)) if entry = "\n" [stop] The file might end with some blank lines or its possible

Assign each number to 3 turtles

99封情书 提交于 2020-01-05 15:20:12
问题 I am creating a program that creates 1,500 "scientists" (turtles), in a world where there are 1500 "disciplines". I need to assign each turtle a "discipline" as a number between 1-500, and ensure that there are 3 turtles for each discipline. This means that set(random) isn't appropriate. Is there a primitive I can use? Nevermind, I think I have figured it out. Does this make sense? to set-discipline ask turtles [ set discipline -1 ] let unassigned turtles let current 1 while [any? unassigned]