netlogo

Netlogo Dijkstra algorithm

随声附和 提交于 2021-02-11 14:21:46
问题 to-report find-path [ init final ] ask init [set dist_d 0] let current init let p_dij [] set p_dij insert-item 0 p_dij current show "dij" while [not (current = final)] [ ask [neighbors with [pcolor = yellow and not (dist_d = -1)]] of current [set dist_d min (list dist_d (1 + [dist_d] of current))] ask current [set dist_d -1] let min_d min [dist_d] of neighbors set current one-of neighbors with [dist_d = min_d and pcolor = yellow] set p_dij insert-item (length p_dij - 1) p_dij current ] ask

Attempting to trick NetLogo into executing a function passed as an argument

会有一股神秘感。 提交于 2021-02-10 14:50:21
问题 The following produces a compilation error. to-report call-first/last [first/last a-list] report first/last a-list end a-list in the body is highlighted with the error: Expected command. So I tried the following. to-report call-first/last [first/last a-list] report first map first/last (list a-list) end This code compiled(!), but when I attempted to have the observer execute it call-first/last first [1 2 3] call-first/last was highlighted with the error message: CALL-FIRST/LAST expected 2

NetLogo Systems Dynamics Modeler for Agents

旧街凉风 提交于 2021-02-07 10:18:27
问题 I´m trying to use the NetLogo System Dynamics Modeler to control the behavior of individual agents. But when I set up the Modeler diagram, the code that is generated automatically includes variables (stocks, variables) as Global. Instead I would like these variable to be under turtles-own , so that each agent runs the systems dynamic model autonomously. If this is not possible, I guess I can go on writing the ODEs myself. But in doing this, is it best to solve the ODEs in R using the R

NetLogo Systems Dynamics Modeler for Agents

你说的曾经没有我的故事 提交于 2021-02-07 10:16:09
问题 I´m trying to use the NetLogo System Dynamics Modeler to control the behavior of individual agents. But when I set up the Modeler diagram, the code that is generated automatically includes variables (stocks, variables) as Global. Instead I would like these variable to be under turtles-own , so that each agent runs the systems dynamic model autonomously. If this is not possible, I guess I can go on writing the ODEs myself. But in doing this, is it best to solve the ODEs in R using the R

Netlogo: asking a turtle to count its neighbors

孤人 提交于 2021-01-29 20:21:17
问题 I´m asking a turtle to count its neighboring turtles that are healthy with the following code let healthy-neighbors count turtles-on neighbors with [infected? = false] I get the following: You can´t use INFECTED? in a patch context, because INFECTED? is turtle-only My mistake must be basic, but can't find it, any help? 回答1: NetLogo is seeing that as turtles-on (neighbors with [infected? = false) , and since neighbors gives an agentset of patches, the with clauses is expecting patches, but

netlogo, gis extension not drawing and giving an error

余生颓废 提交于 2021-01-29 08:32:59
问题 I am trying to draw a few gis files using netlogo. I have 3 shape files (area boundary, building polygons & road network). When I use the gis:draw command one of the files draws perfectly (area boundary) but with the other 2 shape files. One doesn't draw at all (road network) and other gives the following error "unsupported shape type 15 error while observer running GIS:LOAD_DATASET" The largest file size is 1927KB Any ideas why? 来源: https://stackoverflow.com/questions/55352775/netlogo-gis

Deleting the opposite of a link in a list in netlogo

荒凉一梦 提交于 2021-01-29 04:40:59
问题 i have a list of links but sometimes within the list two links that are opposite of each other appear in the list. All links have values and the list is organized from highest value to lowest. what i want to do is to make the opposite link with the lower value die. does any one have any ideas? not that it would help a great deal but i got my list from this line of code: set max-links sort-on [(- label)] link-set [max-one-of my-in-links [label]] of turtles 回答1: I'm assuming that these are

Deleting the opposite of a link in a list in netlogo

这一生的挚爱 提交于 2021-01-29 04:38:27
问题 i have a list of links but sometimes within the list two links that are opposite of each other appear in the list. All links have values and the list is organized from highest value to lowest. what i want to do is to make the opposite link with the lower value die. does any one have any ideas? not that it would help a great deal but i got my list from this line of code: set max-links sort-on [(- label)] link-set [max-one-of my-in-links [label]] of turtles 回答1: I'm assuming that these are

Importing vector “.shp” file in NetLogo

浪尽此生 提交于 2021-01-28 06:54:28
问题 I digitized the roads of an area from Google Earth, Saved them to .Kml format, Then I opened this kml data file in QGIS 2.1 and converted it into ESRI shape file in WGS84 CRS. The file is successfully converted to shape file. But when I imported this file in NetLogo, a run-time error occurred which is "Extension exception: unsupported shape type 13 error while observer running GIS:LOAD-DATASET" My code is gis:load-coordinate-system (word "Roads.prj") to setup let paths-dataset gis:load

Netlogo doesen't recognize the GIS coordinates in the defined envelope of the world, it treats them as netologo world coordinates

◇◆丶佛笑我妖孽 提交于 2021-01-27 18:52:25
问题 I want to import some polygons from shapefile and create turtles with specific coordinates (a set of points that will be put in specific polygons). I successfully imported the polygons, set the envelope of the world... However, when I tried to add turtles and put them on a specific place (setxy), it added them at the same point (like those two points have the same coordinates, and they have not). And I chose coordinates of the points for which I know they belong spatially to the different