title: How to know which resource is being used when using SimPy's AnyOf method?
body: <p>In my program, agents need to use some <strong>specific</strong> 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.</p>
  <h2>Think about 3 servers and 4 agents.</h2>
  <p><code>agent1</code> can use <code>server1</code>,</p>
  <p><code>agent2</code> can use <code>server1</code> and <code>server2</code>,</p>
  <p><code>agent3</code> can use <code>server2</code> and <code>server3</code>,</p>
  <p><code>agent4</code> can use <code>server3</code></p>
  <p>I am creating requests like below:</p>
  <pre class="lang-py prettyprint-override"><code>{server: server.request() for server in agent_2_server_list}
  
  output:
  {&lt;simpy.resources.resource.Resource at 0x7fd091b215e0&gt;: &lt;Request() object at 0x7fd091d51d00&gt;,
   &lt;simpy.resources.resource.Resource at 0x7fd091b21700&gt;: &lt;Request() object at 0x7fd091d51b50&gt;}
  </code></pre>
  <p>I am using <code>env.any_of([request1, request2])</code> 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?</p>