netlogo

what does `forward 1` mean in netlogo? how to specify the nearest patch of a turtle in netlogo?

故事扮演 提交于 2019-12-08 06:56:57
问题 when we ask a turtle to forward 2 , does it mean: on its heading direction, move to the second nearest patch on its heading direction, move to the second nearest patch's center point on its heading direction, move to the second nearest patch's center point which is (pxcor, pycor) which one is correct? or are they the same answer? How do we define the nearest patch this turtle is pointing to? Is the following understanding correct? top patch: if heading is between -45(315) and 45 degree right

Make turtles move ONCE according to their ranked order in a list

时光毁灭记忆、已成空白 提交于 2019-12-08 06:06:59
问题 This question is built off my previous 2. I've been working to get a rank-ordered list for my turtles, ranked by an owned factor. They're then required to move in ranked order. That part works perfectly fine, and the code can be found at: Assigning turtles a ranked number in netlogo The problem: using that code, they're moving in the correct order but instead of moving once, the program seems to be continuously re-running it for every turtle in the list so the first turtle in a world of 10

Netlogo: limit the number of links an agent can make

南笙酒味 提交于 2019-12-08 05:43:38
问题 I have turtles linking if they have an equal value for var1 (this works fine). I want to limit the number of links to just three. I added an IF statement before the linking part of the code ( If count my-links < 3 ), but it does not work; the agents continue to link past the max value I set. I read the other question How to limit the number of links an agent can make in a model but that doesn't seem to quite do what I am attempting here. What am I doing wrong? to communicate If count my-links

How to match a value of a list of numbers to item from a list of names in netlogo?

匆匆过客 提交于 2019-12-08 04:07:12
问题 I am trying something (in netlogo), but it is not working. I want a value of a position from a list of numbers. And I want to use the number that comes out of it to retrieve a name from a list of names. So if I have a list like [1 2 3 4] en a list with ["chicken" "duck" "monkey" "dog"] I want my number 2 to correspond with "duck". So far, my zq is a list of numbers and my usedstrategies is a list of names. let m precision (max zq) 1 let l position m zq let p (position l zq) usedstrategies But

How to create maze walls in NetLogo?

我的未来我决定 提交于 2019-12-08 02:43:47
问题 I am trying to create a 5x5 grid with 2 exits and put some walls in it. In other words, I want to create a maze or a labyrinth. I was wondering if there is a way to make a border line thicker or change the colour of only one side of a patch. I want to put only one agent inside and let him find the exit by rewarding him with some points. (Q-learning algorithm) Does anyone have an idea? If this is not possible can you suggest comparable code please? Here is an example of what I want to create:

Error trying to run headless BehaviorSpace

此生再无相见时 提交于 2019-12-07 23:15:49
问题 I feel I must apologize for such a basic question, but I am getting an error simply trying to run BehaviorSpace experiments in headless mode. I tried running my own model experiments from the command line, but got an error. So I then tried following the exact instructions on the BehaviorSpace documentation. To do this, I created a BehaviorSpace experiment in the Fire.nlogo model called "experiment1" (see screen shot) and then tried to execute commands to run experiment1 from the command line.

Loading a Netlogo model with extension from RNetLogo

蹲街弑〆低调 提交于 2019-12-07 20:16:53
问题 I am trying to load a Netlogo model in headless mode with RNetLogo. The model uses the rnd extension which is added to the model by extensions [rnd] . If I try to load the model with NLLoad(model.path) I get this error: NLLoadModel(model.path) [1] "Java-Object{Can't find extension: rnd at position 79 in }" Error in NLLoadModel(model.path) :` Unfortunately, I cannot find anything in the documentation of NLLoad. I tried setting the the working directory to the Netlogo directory: setwd("

Make turtles move ONCE according to their ranked order in a list

偶尔善良 提交于 2019-12-06 15:17:48
This question is built off my previous 2. I've been working to get a rank-ordered list for my turtles, ranked by an owned factor. They're then required to move in ranked order. That part works perfectly fine, and the code can be found at: Assigning turtles a ranked number in netlogo The problem: using that code, they're moving in the correct order but instead of moving once, the program seems to be continuously re-running it for every turtle in the list so the first turtle in a world of 10 ends up moving 10 times, the second moves 9 times, etc. I'm completely stumped on this, but I need it to

How to create random binary/boolean variable in Netlogo

前提是你 提交于 2019-12-06 14:47:19
问题 I'd like to assign a random boolean variable to each turtle, but I'm not seeing a function that would simulate a draw from a Bernoulli distribution. This gets close, but it's awkward: ifelse random-in-range 0 1 < .5 [set expensive? false] [ set expensive? true ] Anyone know a better way? 回答1: A few options: one-of [ true false ] random 2 = 1 random-float 1 < 0.5 - If you need to modify the probability, to get any Bernoulli distribution you want If I deal with a lot of probabilistic stuff in a

Is there a NOOP in Netlogo?

梦想的初衷 提交于 2019-12-06 13:52:56
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? 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