netlogo

NetLogo: Recording distance a turtle has traveled

我与影子孤独终老i 提交于 2019-12-18 07:00:37
问题 I have a NetLogo model that requires a turtle to record its distance travelled from point A to B. It is important that the distance is measured by the turtle rather than simply calculating the distance between the two points. I think something like turtles-own would be sufficient to store the distance it has travelled? 回答1: I assume that you don't want to just use the distance from the original point because it's possible that your turtle has not traveled in a straight line? In any case, it

Generating permutations of a list in NetLogo

会有一股神秘感。 提交于 2019-12-18 06:59:36
问题 I'm trying to generate a list in NetLogo that contains several different unique lists of numbers 0 through n. For example, I have this line of code set mylists [[0 1 2] [0 2 1] [1 0 2] [1 2 0] [2 0 1] [2 1 0]] that I wrote to make all possible unique combinations of 0 1 and 2 without any repetition of the numbers within the lists. I would like to be able to the same thing but with a larger n. Is there an example of how to do this, or some sort of pseudocode algorithm that anyone knows of that

How to speed up least-cost path model at large spatial extents

二次信任 提交于 2019-12-14 03:54:13
问题 Following on from How can I increase speed up simulation of my least-cost path model, I try to find a way to speed up my least-cost path model that runs at a large spatial scale. My landscape has an extent of 100km² (1000 patches x 1000 patches with 1 patch = 1 pixel). For the moment, my code seems to work but it runs very slow: my code takes several hours to draw one least-cost path. The problem is that my model evolves according to discrete time steps of two minutes during 100 days and I

Exporting NetLogo data to graph with nodes and edges

有些话、适合烂在心里 提交于 2019-12-14 03:49:14
问题 I have created some links between agents (turtles) in NetLogo. This links will change at each time step. My aim is to export this data (i.e., turtles and links b/w them) to graph with vertices (turtles) edges (links), which can be given as input to Gephi. Is it possible to see the changes which occurs in netlogo in the graph when it is linked with Gephi. Can someone help me out. Thanks. 回答1: To export your network data in a format usable by Gephi, I would suggest using the nw:save-graphml

how to parse a string into real equation in netlogo

时光毁灭记忆、已成空白 提交于 2019-12-14 02:27:17
问题 I am trying to develop a model in netlogo, in which user can enter the equation for change in some variables. My question is what could be the best way to get equation input and how should i parse it and calculate results. looking for something like "mathml" which could work in netlogo. 回答1: A simple solution that doesn't involve MathML or anything of the sort would be to have your users directly enter NetLogo expressions and run those using runresult, which can take a string of NetLogo code

Netlogo - find the closest agent based on Manhattan distance

与世无争的帅哥 提交于 2019-12-13 20:17:38
问题 I am modelling a big warehouse operations (see below pic). I have implemented a vertex on each patch (green dots) and link them so that I could compute the shortest path (using dijkstra algorithm) from each vertex to all other vertices, stored in a table (dictionary) of each vertex. This process is done during setup stage and is quite time-consuming. Then the yellow inventory cells (rectangle) will issue the demand request for task fulfillment. The forklift truck (some in the path) is

NetLogo - calculate the difference of a variable of neighbouring agents

时光毁灭记忆、已成空白 提交于 2019-12-13 17:56:02
问题 I would like to have each agents ask their neighbours of their value of a turtle-owned variable and set them according to the differences the have. I know how to do this for distances: if (any? other turtles-here) [ ask neighbors [ ;; ask 8 neighbors / neighbors4 for 4 ;if (max-one-of turtles [distance myself]) <= 3 ;[set opinion opinion - .1] ; no change in opinion ;if (distancexy point1-pxcor point1-pycor) > 20 and (distancexy point1-pxcor point1-pycor) <= 50 ;[set point1-location "middle"]

Sketch a line in NetLogo From it's coefficents

夙愿已清 提交于 2019-12-13 17:32:57
问题 How can a draw a line in NetLogo given in the following form: Ax+By+C=0 That is, A , B and C are given. CODE: to make-line[a]; a is list containing A, B and C and in that order. let x 0 let y((-item 2 A) / item 1 A) let y1 0 let x1((-item 2 A) / item 0 A) crt 1[ set size 0.5 setxy x y pen-down facexy x1 y1 while [distancexy x1 y1 > 0.5] [ fd 0.1 ] ] end PROBLEM: The points tend to be outside the NetLogo boundaries many a lines. Given the coefficients of a line, is there a way to draw one

Sprouting turtles in NetLogo based on patch value

依然范特西╮ 提交于 2019-12-13 17:18:00
问题 I have loaded an ASCII file in NetLogo with values (ranging from 0 - 4.6) that represent the mean number (of a Poisson process) of turtles inhabiting the patch. I'd like to setup the model to sprout turtles on each patch using random-poisson with the mean value derived from the ASCII file. I know how to ask n-of patches to sprout a certain number of turtles but I don't know how to ask the sprout command to act on all patches. Any help would be great! 回答1: If your problem is asking all patches

Creating nodes/turtles out of a shp file from GIS General Examples

佐手、 提交于 2019-12-13 15:31:21
问题 I need to create nodes from the cities shapefile of GIS general examples, so I can use them as targets for turtles. I tried the follows solutions but it doesn't work: http://netlogo-users.18673.x6.nabble.com/Creating-nodes-turtles-out-of-a-shp-file-and-linking-them-td5004359.html http://netlogoabm.blogspot.com/2015/07/loading-gis-and-csv-data-to-model-to-be.html#more This is the code: extensions [ gis ] globals [ cities-dataset countries-dataset ] breed [ city-labels city-label ] breed [