In my program, agents need to use some specific resources. I want to call all of the resources that are assigned for an agent at the same time and use the first available one.
Think about 3 servers and 4 agents.
agent1 can use server1,
agent2 can use server1 and server2,
agent3 can use server2 and server3,
agent4 can use server3
I am creating requests like below:
{server: server.request() for server in agent_2_server_list}
output:
{<simpy.resources.resource.Resource at 0x7fd091b215e0>: <Request() object at 0x7fd091d51d00>,
<simpy.resources.resource.Resource at 0x7fd091b21700>: <Request() object at 0x7fd091d51b50>}
I am using env.any_of([request1, request2]) to use any of the above requests. However, I need to know which resource is used so that I can release it afterward. How can I do that?