netlogo

agent-based simulation: performance issue: Python vs NetLogo & Repast

那年仲夏 提交于 2019-12-02 23:34:50
I'm replicating a small piece of Sugarscape agent simulation model in Python 3. I found the performance of my code is ~3 times slower than that of NetLogo. Is it likely the problem with my code, or can it be the inherent limitation of Python? Obviously, this is just a fragment of the code, but that's where Python spends two-thirds of the run-time. I hope if I wrote something really inefficient it might show up in this fragment: UP = (0, -1) RIGHT = (1, 0) DOWN = (0, 1) LEFT = (-1, 0) all_directions = [UP, DOWN, RIGHT, LEFT] # point is just a tuple (x, y) def look_around(self): max_sugar_point

NetLogo BehaviorSpace crashing when using R extension

南楼画角 提交于 2019-12-02 16:31:50
问题 I'm running a model of animal home ranges on my machine. I've added the R-extension to my NetLogo code to calculate minimum convex polygons for each home range. When I run the model in BehaviorSpace on multiple cores, NetLogo will simply disappear (i.e., stop running) after several time steps. I've tried it in 5.04 and 5.1 and the same happens. The model does run properly in BehaviorSpace if I choose 1 core instead of the 4 available on my machine. It also runs properly if I turn off the R

Assigning turtles a ranked number in netlogo

陌路散爱 提交于 2019-12-02 16:29:59
问题 I'm trying to assign turtles a number which I can tell them to move in order of. Using previous posts and some general playing around I've managed to create a ranked order list of the turtles, but now I want to assign turtles a number based on their relative position in that list. Example: current list: [(turtle 8) (turtle 1) (turtle 9) (turtle 0)] desired turtle designation: turtle 8 = 1, turtle 1= 2, turtle 9 = 3, etc. So far I've reached: globals [rank_list] turtles-own [var. rank] set

Is the placement of set patch-size within my code correct and is set the right command to use?

风格不统一 提交于 2019-12-02 13:26:37
upon compilation I receive an error message saying set is the wrong commander before patch size 10 what commander should I use instead and why? globals[road?] to setup clear-all ask patches [set pcolor green] end to go if mouse-down? [ ask patch mouse-xcor mouse-ycor [ edit-world ] end to edit-world if EDIT_TOOL = "Road" [set pcolor grey set patch-size 10 ] end The right command is set-patch-size , with the hyphen after set . Patch-size can not be changed programatically but only in settings. All patches have the same size. What are you trying to do simulation wise with that line? Patch-size

Using to-reports while creating agents from a csv file

倖福魔咒の 提交于 2019-12-02 12:12:54
问题 My question is a bit long. I really appreciate it if you could please read it all and I'd be very grateful for any piece of advice. I have data related to 2 consumers as turtles who have rated laptops' features. The laptops have 2 kinds of features : size of the screen and battery life. Each has some levels. For example battery life has 5 hours, 12 hours, 24 hours, 30 hours. Data is stored in a csv file. 12 13.5 14 15 5 12 24 30 1 1 2 1 3 2 2 4 5 2 4 3 1 2 1 1 2 3 I want to sum the rates of 2

Determining max, min and mean turtle cluster size, as well as number of turtle clusters in netlogo

南笙酒味 提交于 2019-12-02 11:24:51
See the code below intended for determining the number of settled turtle clusters (Red and grey turtles) out of a number of randomly distributed non-settled turtles (black), as well as the maximum, minimum and mean cluster size (radial extent) in a netlogo world/ interface. globals[ cluster-size cluster-count cluster-size-growth cluster-count-growth ] to setup clear-all ask patches [ set pcolor white ] create-turtles 1000 [ set color black set label-color blue setxy random-xcor random-ycor set cluster-size 1 ] ask n-of 5 turtles [ ask turtles in-radius one-of [1 2 3] [ set color one-of [red

How do I create a timer on netlogo?

时光毁灭记忆、已成空白 提交于 2019-12-02 11:13:50
For my maze project, I want to create a monitor button that keeps track of how long it takes for the turtle to get from start to finish. How would I code for the timer? Check out reset-timer and timer and in the docs. During maze setup, do a reset-timer . During the running of maze you can check on elapsed time with timer If you mean how many patches passed in moving to the target, you can use following: turtles-own [target move-counter] to Your-Move-Function let t target face min-one-of all-possible-moves [distance t] fd 1 set move-counter move-counter + 1 end 来源: https://stackoverflow.com

Java error when trying to run NetLogo headlessly on a cluster

試著忘記壹切 提交于 2019-12-02 10:51:26
问题 I am attempting to run Netlogo headlessly using linux in order to send a job to a cluster. I have never used linux before, but I am attempting to follow the directions here (http://netlogo-users.18673.x6.nabble.com/Running-NetLogo-Headless-in-Behaviorspace-Sample-code-td4862232.html). My script is: #!/bin/bash #SBATCH -N 1 #SBATCH -n 1 #SBATCH -c 7 java -Xmx1024m -Dfile.encoding=UTF-8 -cp /opt/shared/netlogo/5.3.1-64/app/NetLogo.jar \ org.nlogo.headless.main \ --model /cluster/home/rfuda01/UM

NETLOGO: Using variable from previous tick

天涯浪子 提交于 2019-12-02 10:40:01
问题 is there some primitive for using value of variable from previous tick? I tried to compute variable of "price" for one agent and I mean to use formula which includes other agents' "price" variable but from previous tick. 回答1: No, there is no built-in way to do this in NetLogo. Your best bet would probably be to create a variable called something along the lines of varname-last-tick and then updating that as the last thing you do in the go procedure of these agents. It sounds like the variable

Assigning turtles a ranked number in netlogo

大憨熊 提交于 2019-12-02 10:39:03
I'm trying to assign turtles a number which I can tell them to move in order of. Using previous posts and some general playing around I've managed to create a ranked order list of the turtles, but now I want to assign turtles a number based on their relative position in that list. Example: current list: [(turtle 8) (turtle 1) (turtle 9) (turtle 0)] desired turtle designation: turtle 8 = 1, turtle 1= 2, turtle 9 = 3, etc. So far I've reached: globals [rank_list] turtles-own [var. rank] set rank_list sort-on [var.] turtles create-turtles (50) [setxy (random-float max-pxcor) (random-float max