I am working on an organizational behavior problem where I have a work group/community of practice I'm trying to create out of agents from each region. As seen below, I am using the GIS extension to load in a regional shapefile and then randomly distribute agents based on a slider in the interface. Agent attributes are set, with two of them being randomly generated between 0-1 (EJknowledge and EJtranslation). The code then assigns the agents to the region they are spawned in.
Where I am stuck is in my need to take the agent with the highest EJknowledge in each agentset (region) and create a new agentset with all of those agents so I can have them "meet" once a month for their work group/community of practice meeting. All attributes are the same for all agents, so I didn't think having a separate breed would provide me any advantage.
I have two questions:
- It is possible to assign an agent to multiple agentsets at the same time?
- How do I identify an agent in each agentset (region) by the same attribute and place them in the same agentset?
In the code I have it set up where I was attempting to use max-one-of to identify the highest EJknowledge agent in a region and set it to another agentset. This current writing didn't work for me because I only know how to write this for one agentset and have not figured out how to run it for multiple agentsets then assigning to the "cop" agentset. I'm sure this is just a shortcoming in my syntax knowledge but I have yet to find other questions that have a satisfying application for my problem.
globals [region1 region2 cop]
turtles-own [region EJknowledge]
patches-own [ID]
to go
;; create turtles and assign attributes
create 25 turtles
ask turtles [
set shape "person"
set color blue
set EJknowledge random-normal 0.5 0.1
set region [ID] patch-here
]
;; assign agents to regions
ask turtles [
set region1 turtles with [region = 1]
set region2 turtles with [region = 2]
]
;;
ask turtles [
set cop max-one-of region1 [ EJknowledge ]
]
end