I need to solve a problem, which due to my lack of Java training I can't solve. What is the code to write to trace the agent who took a resource? Let me explain better...I have a series of rooms, each agent who enters the structure takes a room which he keeps for his entire stay, and I would like to see in real-time, which rooms are occupied and by which agent. How can I do this? Thank you
You can simply save the resource seized to the agent and vice versa using variables, in the seize block.
Here is a simple example
I have a Person and a RoomResource agent, each with a variable of the other's type.
In this very simple flow chart with a source that creates persons, and a seize connected to a resource pool of RoomResource agents, and the resource units live in a population called roomResource
.
You simply specify the following in the seize block
agent.room = unit;
unit.agent = agent;
You will see that agent represents the agent in the block, and unit represents the unit being seized from the resource pool
Now you can visually use this for your agents
Now you can see what Person occupies which room and which room is used for each person by accessing the variable