Pregunta

I have a large landscape composed of polygons (a polygon contains several patches). Without using Netlogo, I create a file.txt which contains values of distance between each source polygon in my landscape and each destination polygon that are situated in an buffer of 1km around the source polygon. I search for a rapid solution to retrieve distance contained in file .txt from my Netlogo program. My file .csv is as follows:

source-polygon      destination-polygon     distance
      A                     1                 101
      A                     2                 220
      A                     3                 412
      B                     5                 536
      B                     9                 789

For example, from Netlogo, I would like to rapidly retrieve the distance between the polygon A and polygon 3 (i.e. 412) in the file .txt. I imported and read my file .txt into Netlogo from read file lines with spaces into NetLogo as lists. But I find that searching values in a file .txt from Netlogo is slow. At each time step in my program, I retrieve values in my file .txt. So is there a more rapid solution ?

Thanks in advance for your help and advices.

¿Fue útil?

Solución

I would try the Table extension. You could use (word source-polygon destination-polygon) to create a string that serves as the table key. I do something similar and it is extremely fast. It should be clear how to do this from the Arrays & Tables section of the Extensions part of the User Manual.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top