I am new to Netlogo and I am struggling with the following problem with the implementation of a model for opinion dynamics in a spatial context. I imported a GIS raster with four different landuse classes (value 1-4) with the following code:
show "loading landCharacter from file luw6604.asc"
set landUse gis:load-dataset landUseDataSet
show word "rows : "gis:height-of landUse
show word "columns: "gis:width-of landUse
gis:set-world-envelope-ds gis:envelope-of landUse
gis:apply-raster landUse value
resize-world 0 gis:width-of landUse (gis:height-of landUse - ( 2 * gis:height-of landUse)) 0
In my model 3 static breeds of people shall have different opinons on every patch in the world based on the landuse-value at certain pxcor pycor and the distance between this patch and their own location.
Therefore, my idea is to create either a dictionary or parallel lists to store keys for location as well as the corresponding opinions.
However, after trying for days, I am more confused than in the beginng and I feel entirely lost. Please, If someone has any ideas, how to solve this problem. I would be very grateful
Best How To :
Jan, it sounds as if the GIS data is not essential to your question. Is the following correct? You want to store a value--an opinion--for each pair [patch, person]. This opinion is a function of two things: The breed of the person, and the person's distance to the patch. Here are some thoughts that occur to me. Some of the following may be useful.
I see a few natural ways to store this information:
Store opinions in people.
Store opinions in patches.
Store opinions both ways. This requires some care.
Store opinions in a separate data structure you can access using a patch, person pair.
Create a separate breed of turtles called
opinions. (This is probably not going to be what you want.)
Whether 1, 2, or 3 is most useful depends on what the rest of the program needs to do. For example, if my program was going to mainly operate on people, it might be most convenient to store opinions in people. Then I could access the opinions for each person using
ask people [...], for example.
Another factor is this:
If you store opinions in people, then within each person, there will be a data structure containing opinions that you have to be able to access via
pycors. This could be a list of lists, or you could use one of the two-dimensional data structures that NetLogo offers via extensions: array, table, and matrix.
If you store opinions in patches, you might be able to store them in a list, but you would have to have a way of finding the right element of the list. Perhaps each person could have a special index number that indicates which element of each patch's opinion list is the one corresponding to that person.
If you use option 4, you might need to create a 3-dimensional data structure (
pycor, and person).