netlogo

Hunt success netlogo

北慕城南 提交于 2019-12-11 06:43:16
问题 I have coded my turtles to go out and hunt, however when they find prey they simply eat it, is there anyway to add a mathematical factor for their chances of success instead of it always being 100% essentially when they find prey, roll the dice and see if they can eat it. to search ;when wolf is hungry set energy energy - 1 fd v-wolf if random 600 = 1 ;; frequency of turn [ ifelse random 2 = 0 ;; 50:50 chance of left or right [ rt 15 ] ;; could add some variation to this with random-normal 45

Use undirected links instead of Directed links

a 夏天 提交于 2019-12-11 06:36:24
问题 In my model I use direct links to keep interaction value of each turtle to other turtles and each link has a different value for each end of the links which is exactly what I want and it was really easy to implement, However, I have a performance issue and my model is not working as fast as I think it should work. Now I am trying different methods to decrease the computation needs. One of the things that crossed my mind is to integrate all directed links to undirected links and put the value

Importing raster data into NetLogo results in a row/column of NaN values

一个人想着一个人 提交于 2019-12-11 06:20:31
问题 When importing rasters into NetLogo, there is an additional row or column of NaN cells that are added along one of the borders of the NetLogo world, which does not exist in the raster. Is this the same issue that was raised here: https://github.com/NetLogo/GIS-Extension/issues/5 ? In my case though, they are not random cells that have a value of NaN but cells along a border. EDIT: Here's the code I used to import the raster layer: set rasterLayer gis:load-dataset "x.asc" resize-world 0 gis

How to send parameters using NetLogo?

十年热恋 提交于 2019-12-11 05:57:24
问题 I am quite new to NetLogo and here is what I am stuck here for weeks. What I want to do is to make agents to be in group of 4 for 2 teams. My plan is to make a function hold 4 turtles id, to assign-groupmates [a1 a2 a3 a4] and assign them to team 1 assign-groupmates [a1 a2 a3 a4] =team1[] if team1 > 4 assign-groupmates [a1 a2 a3 a4] =team2[] What I done is: to assign-groupmates [ f g h i] let A who random f let B who random g let C who random h let D who random i ifelse f != g, g != h, h != i

How to write values in files for each turtle?

余生长醉 提交于 2019-12-11 05:56:52
问题 How can I write values in files for each turtle ? For example, I have 100 turtles and I would like to write data specific to each turtle in 100 files. For the moment, my code writes data for all turtles in one file .txt: to write-locations-to-file file-open "/home/reduan/IBM/outputs.txt" ask turtles [ file-print (word who " ; " xcor " ; " ycor " ; " color " ; " [pcolor] of patch-here "\r\n" ) ] end Thanks in advance for your help. 回答1: I'm not sure what it is exactly that you are having

Making agentset outof list

和自甴很熟 提交于 2019-12-11 05:41:46
问题 This is relevant to the previous question just asked. How can I convert list(which representing turtles) to a agentset? For example, I want to make agentset which contains 4 elements [turtle 0 turtle 3 turtle 4 turtle 7] out of list ["turtle 0" "turtle 3" "turtle 4" "turtle 7"] I've tried "foreach" before. Thank you in advance~!! 回答1: I am not sure why you would need to work with a list like ["turtle 0" "turtle 3" "turtle 4" "turtle 7"] in the first place. Storing references to agents as

NetLogo: measure real travel distances around obstacles before choosing destination

谁说胖子不能爱 提交于 2019-12-11 05:41:19
问题 I'm modeling territory colonization in Netlogo. Turtle 0 selects a territory center, then builds a territory by adding patches in order of value. Value is based on benefit / cost, where benefit is amount of food in the patch and cost is the distance from the territory center. Turtle 0 finishes building its territory once the summed patch values meets a threshold. Next, Turtle 1 sprouts and repeats the process to select its own territory, then Turtle 2, and so on. Importantly, new turtles

NetLogo turtles in labyrinth

对着背影说爱祢 提交于 2019-12-11 05:26:10
问题 I'm really new at programming in NetLogo and i need help. This is just my second assignment and i did most of it. I had to make robot walk in labyrinth. Robot can walk only on a black patches (violet patches represent the obstacles). Robot can go forward, back, left and right and it must go to the target. When it comes to the target it must stop. At the first part of the assignment i had to make procedure 'labyrinth' that will pick 15 random patches and paint them in violet (violet represents

In NetLogo can I ask agents to die along a gradient from a central patch?

我与影子孤独终老i 提交于 2019-12-11 05:22:44
问题 In my model I have agents sprout at random throughout the environment. I'd like to to have a density gradient of these agents. Is there a neater way to do it than running something like this for different radii?: ask patch 0 0 [ask n-of 20 turtles in-radius 20 [die]] Thanks 回答1: You could do something along those lines: to setup clear-all let max-distance max [ distancexy 0 0 ] of patches ask patches [ if random-float 1.0 > (distancexy 0 0 / max-distance) [ sprout 1 ] ] end Many variants are

random walk in netlogo- stoping condition issue

…衆ロ難τιáo~ 提交于 2019-12-11 05:08:34
问题 I have created a small network consist of nodes which are connected through links. Some of the nodes are sources and some of the targets. I try to implement Random Walk algorithm. I place walkers on source nodes, and walkers are moving randomly through the network. Now, I want to check walker reached to targets nodes, if all target nodes are visited by walker then ask walker to stop or die. I'm new to NetLogo and don't know how to implement this logic. Any help or guide will be appreciated.