netlogo

how to move the turtles together free neighbors without other turtles occupy them

我只是一个虾纸丫 提交于 2019-12-11 12:59:04
问题 I want to move turtles with a "security distance" from other turtles, for example one patch. this is my code: ask turtles [ let q neighbors with [ (not any? turtles-here) and (not any? other turtles-on neighbors) ] if any? q [ face one-of q move-to patch-ahead 1 ] ] if any? turtles-on neighbors [ ????? ] the start condition is each turtles not have turtles-on neighbors. Also i wish turtles find a new patch to go if turtles-on q or any turtles-on q neighbors, but i have no idea.. i try also

NetLogo- How to make turtles die after certain tick

偶尔善良 提交于 2019-12-11 12:44:43
问题 I'm having a hard time in making the turtles die after certain ticks. What's a procedure that I could use to let the turtles die after 10 ticks? 回答1: It depends. Do you want them to die after 10 ticks of their (individual) life or 10 ticks of simulation? a) Let them live for 10 ticks 1. Declare the birthday (or birthtick) variable at the beginning of program: turtles-own [ birth-tick ] ; Note: you can define variables for specific breed if you are using breeds 2. Set their birth-tick when you

export plots with netlogo

早过忘川 提交于 2019-12-11 12:26:32
问题 I am trying to export all the plots of my NetLogo model after simulation runs in a csv format with the primitive export-all-plots . I haven't found yet the way to open this csv file with an external reader in order to get more clear plots. I tried with gnuplot but it looks like it's not able to open the csv format created with NetLogo: "export-plots data (NetLogo 5.0.5)" ^ "C:\results\interface.csv", line 1: invalid command How can I open csv plots with an external reader? 回答1: There are two

How to hatch turtles with probability

拟墨画扇 提交于 2019-12-11 11:40:37
问题 I'm trying to find a procedure to hatch a turtle based on random probability: 40% for A 30% for B 30% for C How do you hatch a turtle depending on that probability? What procedure/s should I use? 回答1: It looks like A, B, and C are breeds? Then to weighted-hatch ;; turtle-proc let p random-float 100 if (p >= 60) [hatch-As 1 [init-A]] if (if p >= 30 and p < 60) [hatch-Bs 1 [init-B]] if (p < 30) [hatch-Cs 1 [init-C]] end to init-A ;;put any desired initializations here end Etc. You could

Netlogo flocking model modification for multiple turtles in 1 patch

落花浮王杯 提交于 2019-12-11 11:05:38
问题 I'm attempting to modify the Flocking model code example to represent fishes forming schools (flocks) when they encounter each other, then move together using the logic of the rest of the code. Unfortunately, adhering to that logic requires them to occupy the same patch at the same time. The problem arises during the average-heading-towards-schoolmates report: to-report average-heading-towards-schoolmates ;; turtle procedure let x-component mean [sin (towards myself + 180)] of schoolmates let

NetLogo nw extension: how to use nw:extension for multiple destination

我的未来我决定 提交于 2019-12-11 10:45:46
问题 Hi guys is it possible for netlogo nw:extension to calculate path for multiple destination. I wanted my source 0 to pass by all the red nodes destination. I've attempt by first putting the node-links of to all destination is a list. Then from there i take the minimum number of node-links as my first path and then put the nodes(turtle) and node-link to visited so it doesn't check the node and it's link again. Eg (node-link 0 4) (node-link 0 8), then add the links and the destination node 8 to

List difference (omit one list from other list) in NetLogo

十年热恋 提交于 2019-12-11 10:37:57
问题 In case we want to omit one list from other list in Netlogo , how we should write the code? For example, first list is [1 2 3 4 5] And second list is [4 5] In this case what code should be written to remove list 2 from list 1 so as to having a new list comprises of 1, 2 and 3? 回答1: Code: to-report difference [l1 l2] report filter [not member? ? l2] l1 end Sample runs: observer> show difference [1 2 3 4 5] [4 5] observer: [1 2 3] observer> show difference [1 2 3 6] [1 2 3 4 5] observer: [6] 来源

Netlogo adding to list of lists

▼魔方 西西 提交于 2019-12-11 10:27:10
问题 I am looking to add patch variable values to a list of empty lists. The patches are divided into different zones, and I'm trying to see how certain patch variables differ by zone. I have an empty list of lists (actually contains 12 lists, but for simplicity): set mylist [[] [] [] []] And a list corresponding to the different zones: set zone-list [1 2 3 4] Here's how I'm trying to build the lists: (foreach mylist zone-list [set ?1 lput (sum-zone-variable ?2) ?1]) to-report sum-zone-variable [

Unable to use Mathematica Link in NetLogo 6.0

白昼怎懂夜的黑 提交于 2019-12-11 09:49:49
问题 I was trying to connect Netlogo 6.0 and Mathematica 11 on my Mac OSX system (v10.11.6). I have followed the installation instructions of the Netlogo Mathematica-Link: import NetLogo.m into Mathematica and load the package, << NetLogo`. The problem is when I try to start NetLogo from Mathematica: NLStart["/Applications/NetLogo 6.0/"] an error message appears "Mathematica could not find your NetLogo installation directory /Applications/NetLogo 6.0/, Would you like to locate it?", I find the

Get the mean age of all turtles on the time of death

有些话、适合烂在心里 提交于 2019-12-11 09:42:48
问题 I want to get the mean age of all dying turtles. I try to achieve that with the following code snipped: globals [mean-death-age] turtles-own [age prob-die?] to-report mean-age if (prob-die? = true) [ set mean-death-age mean [age] of turtles ] report mean-death-age end Every turtle has the probability of dying (prob-die?) which should be calculated new with every time step (tick). If prob-die? is set to true mean-death-age should be updated. At the moment I have the problem that I don't know