netlogo

Timing discrepancy between in Netlogo

僤鯓⒐⒋嵵緔 提交于 2019-12-10 15:23:06
问题 Can anyone explain why there is a performance difference between the following two segments? It's statistically significant that the second timer call reports a smaller number than the first timer call. My only thoughts would be that Netlogo could be caching the turtles in memory. Is this the expected behavior or is there a bug? to setup clear-all crt 100 let repetitions 10000 ;;Timing assigning x to self reset-timer repeat repetitions [ ask turtles [ let x self ] ] show timer ;;Timing

define neighbor turtles using in-radius or distance

ぃ、小莉子 提交于 2019-12-10 15:18:28
问题 I would like to define neighbors using in-radius or distance. My solution so far is: turtles-own [ my-neighbors num-neighbors] to setup ca crt 100 [ move-to one-of patches with [ not any? turtles-here ] set my-neighbors (other turtles) in-radius 3 set num-neighbors count my-neighbors ] end The problem with this is that most of the turtles have between 0 to 4 neighbors, but a few of them have a relatively huge number of neighbors (e.g., 34 and 65). Those turtles are located close to the center

The path does not reach the end node in my A* algorithm

一曲冷凌霜 提交于 2019-12-10 14:03:24
问题 Following on from How to speed up least-cost path model at large spatial extents, I tried to code an A* algorithm in Netlogo to increase my least-cost path model at large spatial extents. Here is my code: to findPath [ID-start-node ID-end-node] let currentNodesInList [ ] let current-node node ID-start-node let end-node node ID-end-node ask current-node [ set color red] ask end-node [ set color red] set currentNodesInList lput current-node currentNodesInList while [not member? end-node

Netlogo: How to stop a turtle for a certain ticks with a specific patch in the middle of world?

笑着哭i 提交于 2019-12-10 11:57:39
问题 I am a beginner. I already checked the programming guidance dictionary. I am considering a two-lane road (eg, road 1, road 2) model. And also I am considering a model in which the turtle specified by the specified patch((10 0) and (20 2)) stops for 10 ticks. However, I do not know how to write and specify the specific parameter for xcor and ycor for each road (Eg xcor and ycor on road 1, xcor and ycor on road 2). And also I do not know how to write and controol the parameter "speed" within

Is there a NOOP in Netlogo?

我与影子孤独终老i 提交于 2019-12-10 10:40:33
问题 I am looking for a way to do nothing in netlogo. In other programming lanagues this is known as a no op method. Is there a way that I could do this in netlogo? 回答1: You can write a no-op procedure of your own pretty easily: to no-op end ; usage to go no-op end If you only want built-in primitives, display or clear-output might be candidates, depending on what you're using in your model. 来源: https://stackoverflow.com/questions/51082725/is-there-a-noop-in-netlogo

NetLogo: how to identify the most extended cluster (patch cluster example)?

感情迁移 提交于 2019-12-10 10:07:34
问题 I'm working with Patch Cluster Example from Model Library and I wish to identify the cluster with the highest number of patches = the most extended one and then turn this cluster red. I know that I can simply count patches with [pvalue = X] ; X - whatever plabel of patches in connected cluster to know what is the extent of specific cluster with [plabel = 1] , cluster with [plabel = 2] , cluster with [plabel = 3] ... To color it, it is simply: ask patches with [plabel = X] [ set pcolor red ]

How can use NetLogo to simulate the outcome of a function

余生长醉 提交于 2019-12-09 03:56:33
问题 assuming I got a function like Y= 0.5*a+0.23*b+0.52*c+0.3 a is a continuous variable, b and c are categorical variables(like 1 or 0) I wanna create multiple agents that can hatch the number of Y (round up to an integer) with different b and c Honestly, I am new to Netlogo and I am not very familiar with coding. I went through the three tutorials of the user manual, but I still have no clue to do that. three tutorials of the user manual. Thank you 回答1: This does what you said. But I don't

Solving ODEs in NetLogo, Eulers vs R-K vs R solver

杀马特。学长 韩版系。学妹 提交于 2019-12-08 13:33:32
In my model each agent solves a system of ODEs at each tick. I have employed Eulers method (similar to the systems dynamics modeler in NetLogo) to solve these first order ODEs. However, for a stable solution, I am forced to use a very small time step (dt), which means the simulation proceeds very slowly with this method. I´m curious if anyone has advice on a method to solve the ODEs more quickly? I am considering implementing Runge-Kutta (with a larger time step?) as was done here ( http://academic.evergreen.edu/m/mcavityd/netlogo/Bouncing_Ball.html ). I would also consider using the R

Solving ODEs in NetLogo, Eulers vs R-K vs R solver

非 Y 不嫁゛ 提交于 2019-12-08 08:59:20
问题 In my model each agent solves a system of ODEs at each tick. I have employed Eulers method (similar to the systems dynamics modeler in NetLogo) to solve these first order ODEs. However, for a stable solution, I am forced to use a very small time step (dt), which means the simulation proceeds very slowly with this method. I´m curious if anyone has advice on a method to solve the ODEs more quickly? I am considering implementing Runge-Kutta (with a larger time step?) as was done here (http:/

How to limit the number of links an agent can make in a model?

你。 提交于 2019-12-08 07:06:20
问题 I'm setting up a model with a number of agents who are connected via links as follows: ask turtles [create-links-with turtles in-radius vision with [self != myself]] But I want to be able to limit the number of connections that an individual agent can make. I've tried a few things but to no avail. Hope you can help. 回答1: You can get a randomly selected subset of turtles to link to using the n-of primitive like this: ask turtles [create-links-with n-of 3 turtles in-radius vision with [self !=