netlogo

Draw a random-beta distribution in netlogo

倾然丶 夕夏残阳落幕 提交于 2019-12-10 20:57:27
问题 I'm attempting to generate a breed-owned variable which draws it's values from a random beta distribution in Netlogo. I've found the "bc" code example online but am struggling to adapt it to what I need. Right now, for convenience, I've generate my distribution from a random-normal distribution using create-breed 500 [ set target_factor random-normal 0.9 0.05 if target_factor > 1 [set target_factor 0.9999999999] if target_Factor < 0.5 [set target_factor 0.5000000001] ] So basically I'd like

NetLogo : How to do multiple operations on lists (find, get , replace, remove , search elements within lists , …)

ε祈祈猫儿з 提交于 2019-12-10 20:35:01
问题 I am new to NetLogo and I was wondering if there is a complete reference to do operations on lists, I have read most of the posts here in addition to Netlogo dictionary but for example if I need a list of pairs of numbers like [[1 2] [2 2] [2 3] ,,, ] when I search member? 3 thislist Will I have the option to say which element of inner list I am considering for the search ? for instance I will get false if it search first element and true if I search second element. Can anybody please clarify

How to make a matrix of random values in NetLogo?

假装没事ソ 提交于 2019-12-10 20:15:03
问题 Is there a way to easily make an $n \cross m$ matrix in NetLogo? Additionally would it be possible to fill this matrix with random values? Thanks. 回答1: this answer has been updated for NetLogo 6 task syntax See http://ccl.northwestern.edu/netlogo/docs/matrix.html for docs on NetLogo's matrix extension. For creating a matrix, there are several primitives that do that: matrix:make-constant , matrix:make-identity , matrix:from-row-list , matrix:from-column-list . For creating a matrix and

How to make turtles in netlogo die

对着背影说爱祢 提交于 2019-12-10 19:40:32
问题 I'm having trouble in making the turtles die. Is it possible to make the turtles die after certain ticks? If yes, how do you do you do it? Please help! Thanks, 回答1: Yes, this is the code if you want all the turtles to die after 100 ticks. if ticks > 100 [ ask turtles [ die ] ] . Of course, if all the turtles die, you probably want the simulation to stop instead. 来源: https://stackoverflow.com/questions/28516463/how-to-make-turtles-in-netlogo-die

Sorting list of lists by particular index of inner lists

六眼飞鱼酱① 提交于 2019-12-10 19:09:09
问题 I have a list that looks something like this: [["Local 7" 1 "say" "Say: Inspect Fences"] ["Local 7" 1 "do" "Do: Shepherd Cows"] ["Local 6" 1 "say" "Say: Shepherd Cows"] ["Local 6" 1 "do" "Do: Shepherd Cows"] ["Local 6" 2 "say" "Say: Shepherd Cows"] ["Local 6" 2 "do" "Do: Shepherd Cows"] ["Local 7" 2 "say" "Say: Inspect Fences"] ["Local 7" 2 "do" "Do: Shepherd Cows"] ["Local 6" 3 "say" "Say: Shepherd Cows"] ["Local 6" 3 "do" "Do: Shepherd Cows"] ["Local 7" 3 "say" "Say: Inspect Fences"] [

How to kill turtles when they touch?

偶尔善良 提交于 2019-12-10 18:39:46
问题 I can't seem to get turtles to die when they touch each other. I can only kill them when they are on the same patch. Is there any function like this? to killturtles if contact? [die] end 回答1: There is not but assuming your turtles are round or roundish ask other turtles in-radius (size / 2) [die] is a good approximation. 回答2: If "touch" means that the turtle icons are overlapping, you might need something like the method that King-Ink suggests (but there could be a complication like the one

NetLogo: procedure for performing an operation on one item in a list in a compact way?

浪尽此生 提交于 2019-12-10 18:37:16
问题 New to NetLogo... wondering if there's a procedure that performs an operation on one item in a list in a compact way (like map but for one item). For example, say I wanted to add 3 to the item at index i in list blah . Right now I'm doing this like: set blah replace-item i blah (item i blah + 3) It seems a little clunky, and like there would be a procedure that does that, but I haven't been able to find one. Just wanted to make sure I wasn't missing something. Thank you! Taylor 回答1: There isn

Cannot make R-extension work in NetLogo

╄→尐↘猪︶ㄣ 提交于 2019-12-10 18:19:41
问题 I realise this is not really a programming question, but I am hoping that one of the very experienced NetLogo people here can see what I am doing wrong, especially as many of you work in Java and I don't. I am trying to connect up the R-extension so I can use R libraries to do some tricky network stuff. I am using Windows 7. The detailed installation instructions describe three system variables that must be set. I have done so and echoing them from the command prompt, R_HOME and JRI_HOME

How to use the function “table:get” (table extension) when 2 keys are required?

爷,独闯天下 提交于 2019-12-10 17:49:24
问题 I have a file .txt with 3 columns: ID-polygon-1, ID-polygon-2 and distance. When I import my file into Netlogo, I obtain 3 lists [[list1][list2][list3]] which corresponds with the 3 columns. I used table:from-list list to create a table with the content of 3 lists. I obtain {{table: [[1 1] [67 518] [815 127]]}} (The table displays the first two lines of my dataset). For example, I would like to get the value of distance (list3) between ID-polygon-1 = 1 (list1) and ID-polygon-2 = 67 (list1),

How to find all the agents who are not included in an agentset?

自闭症网瘾萝莉.ら 提交于 2019-12-10 17:47:32
问题 I have an agentset named giant-component, and I set all the agents' color to red: ask giant-component [ set color red ask my-links [ set color red ] ] Now I need to set all other turtles' color to blue. I know that the easy trick would be to first set all turtles' color to blue, and then colour all the giant component to red, but during the simulation it may get confusing for the user to see it. Is there a way to get all the turtles that are not inside giant-component? 回答1: The answer above