5/1/2023 0 Comments Netlogo course![]() Of course you will need to create a new/different file for each new/different set of GIS files you use. In the file with your main model, you will only have the import-world part. My personal suggestion is that you create a separate NetLogo file to do this: only in this separate file you will have the GIS extension's procedures and the export-world command. You can perform the export once when the GIS data has been loaded (so that the GIS information is stored in patches) and store the file somewhere: this means that you won't need to upload GIS data again but will only need to perform import-world. These commands will let you export to a file the current state of your NetLogo world, and then import into NetLogo that state from the file. You can get rid of this process by using export-world and import-world (see here and here). Importing GIS data in NetLogo is a lengthy process. Eliminate the time needed to upload GIS data assuming that it is not addressing non-code options such as computer cluster etc. I intend this question to be exclusively on code, i.e. ![]() Opening note: In no way I am assuming that my suggestions are exhaustive, as other people might see other things to improve. Report read-from-string word reduce word a_list "" Set turtle-profiles-code ( word turtle-profiles-habitat-code turtle-profiles-reproduction-code turtle-profiles-metabolism-code ) Turtle-metabolism = 6 Įnergy-reproduction = 5 Įnergy-reproduction = 10 Įnergy-reproduction = 15 Set turtle-profiles-habitat-code reduce_list turtle-profiles-habitat Set CurrentHotPatchSet CurrentHotPatchSet with each turtle must be a minimum distance of 3 patches and can't have more than one turtle in each patch Set energy-reproduction this-reproduction Set turtle-profiles-habitat item ValidHabsItem ValidHabs I need the ValidHabsItem and turtle-profiles-habitat, because in the "go" procedure I'm calling each item (ValidHabsItem) from the ValidHabs list to execute all the procedures Let s ( length list1 ) * ( length list2 ) * 50 50 individuals per profile = 3 * 3 * 50 = 450 turtles Set CurrentHotPatchSet HotPatchSet with CurrentHotPatchSet will be the HotPatchSet with the current habitatcover ValidHabsItem is the item that goes from 0 to 62 since there are 63 habitacover combinations (see the list ValidHabs has 63 items) ![]() Set HotPatchSet patches with referring to all 6 habitatcovers that have some type of vegetation removing habitatcover 7 that has no vegetation Let list2 ( list 10 15 20 ) reproduction types Let list1 ( list 2 4 8 ) metabolism types And depending on how the class distributions (habitatcover) are on the map, it takes longer to create the turtles To setup-layers the original code I use GIS. To read-legal-habs create list of valid habitats for each turtle profile Read-legal-habs create list of valid habitats for each turtle profile Resize-world 999 * 0 ( 999 * 1 ) ( 999 * -1 ) 999 * 0 defines the edge size of the world and location of origin: corner top left. I know the problem is in the "setup-patches" procedure, but I'm not quite sure how to solve it. I've already tried to make modifications to speed it up and haven't had much success. The problem is that as the world is 1000x1000 and 450 turtles are born per list item (which has 63 items in total), using GIS, as well, I have several maps to perform these procedures, in addition to having minimum 15 repetitions per map (using BehaviourSpace) takes a lot of time do execute one map (almost 5 days per map). Therefore, for item 0 of ValidHabs which is 450 individuals will be born (= 9 * 50) it executes all the procedures and goes to the next item in the ValidHabs list until it goes through all the items in this list. Turtles can born in the 6 types of habitatcover that have vegetation and their combinations result in 63 items (please, see the variable in the code called ValidHabs).Īlso, I have 3 types of metabolism and 3 types of reproduction, which results in 9 combinations, that is, 9 types of turtles.įor each ValidHabs item (which has a total of 63 items) 50 individuals of each of the 9 types of turtles are born. 6 habitatcover have vegetation and therefore is used by turtles (mobile agent) and 1 class has no vegetation and therefore is not used by turtles (habitatcover 7). I have a map (I use the GIS extension, but to be a replicable example I didn't use it here) with 7 classes (which in the code is called habitatcover). The problem is in the "setup-patches" procedure that refers to the creation of turtles (please, see the code). I tried a few things and they didn't work. I have a problem with accelerating a code in NetLogo.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |