netlogo

NetLogo, weighted random draw from a list: how to use rnd-extension?

此生再无相见时 提交于 2019-11-27 06:21:15
问题 I have a list in NetLogo with values and a list of probabilities for each value. Now I want to draw a random value based on its probability (weighted random draw). I thought of using the Rnd extension, but I cant quite figure out how to get the weights right, please help set values [1 2 3] set probabilities [0.2 0.3 0.5] set state ( rnd:weighted-one-of agentset reporter-task ) 回答1: If you want/need to use two separate lists for your values and probabilities, the way to do it is to have the

How to create cluster patches that do not overlap between them

烂漫一生 提交于 2019-11-26 23:36:43
问题 I would like to create habitat clusters (e.g. forest patches as in the subject of Marine : Adding patch clusters in a landscape) by controlling the size of clusters and the number of clusters ? For example, I used the code of "plant-migration" : to create-forests ask n-of forest-number patches [ set pcolor green ] ask patches with [pcolor = green] [ let a self let b max list 1 round(random-normal mean-forest-area (mean-forest-area * coef-forest-area)) ask patches with [distance a <= b] [ set

NetLogo Efficient way to create fixed number of links

荒凉一梦 提交于 2019-11-26 21:55:03
问题 I have about 5000 agents (people) in my model. I want to give them an arbitrary number of friends and have reciprocal but random pairing. So if person A chooses person B then person B also chooses person A. My code works fine, but is fairly slow. I will likely want to increase both the number of friends and the number of people in the future. Any quicker suggestions? ask people [ let new-links friends - count my-links if new-links > 0 [ let candidates other people with [ count my-links <

NetLogo: 1 tick = how many seconds?

倾然丶 夕夏残阳落幕 提交于 2019-11-26 21:50:50
问题 How many ticks in a NetLogo simulation (at normal speed) are equal to 1 'real world' second? 回答1: Ticks are a unit of arbitrary time measurement inside the simulator, like most simulation engines ticks don't map directly to real world time - it's up to the person writing the simulation to decide how a tick maps to real world time. As for the "normal speed" setting that NetLogo has, what that means is (and this is from experience, not from knowledge of how the engine actually works) that each

How to speed up A* algorithm at large spatial scales?

别等时光非礼了梦想. 提交于 2019-11-26 00:38:29
问题 From http://ccl.northwestern.edu/netlogo/models/community/Astardemo, I coded an A* algorithm by using nodes in a network to define least-cost paths. The code seems to work but it is much too slow when I use it at large spatial scales.My landscape has an extent of 1000 patches x 1000 patches with 1 patch = 1 pixel. Even if I reduce it at 400 patches x 400 patches with 1 patch = 1 pixel, it is yet too slow (I can\'t modify my landscape below 400 patches x 400 patches). Here is the code: to find