Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两条机场跑道作为 Simpy 资源:
runway = simpy.Resource(env, capacity=2) # two runways
这一切正常,但是我如何访问跑道 ID(1 或 2),以便我可以得到诸如“飞机 #1 从跑道 #1 起飞”之类的输出?
你不能(官方)。在内部,插槽只是一个列表,因此理论上您可以使用请求的列表索引。
或者,您可以使用Store并将两个“跑道”对象放入其中。这些对象(当然)有一个 ID,还可以携带额外的信息(无论你能想象到什么)。
Store