0

I am writing a NetLogo model to describe the food exchange interactions between pairs of bees until the food is distributed evenly among all. I have two breeds of "fulls" and "hungries" in my model. Right now I am counting the number of interactions until the model stops, like this:

ask turtles [
     set neighborhood other hungries-on neighbors
     set target one-of neighborhood with-min [distance myself]
     ifelse target != nobody
       [ exchange-food
         set counter counter + 1]
     ;if there are no hungry neighbors continue moving and searching for one
        [continue ]
]

The counter here, counts all the exchange-food interactions but I am also interested in the number of unique interactions. Does it mean that I have to keep a list of tuples as a turtle-own variable for each turtle! But I don't even need the actual ids, I just want to count the number of unique interaction. How can I keep track of this? Any simpler ideas?

Gol
  • 27
  • 1
  • 5
  • 3
    easiest way to count unique interactions is to create a link between two turtles that interact (hide the link so you don't see it). You don't even need to test whether there is already a link there, NetLogo won't create a multiple link. At the end, simply count the links. – JenB Feb 16 '19 at 08:24
  • Thanks, for your great suggestion! – Gol Feb 16 '19 at 23:17

0 Answers0