I know that simpy is a process-based discrete-event simulation framework. I have several agents that might do different things at the same time. Can I still use simpy to simulate my agents? For example, a car arrives to a parking lot. Then the driver exists. Walks to the entrance of a shopping mall and enters. Some shoppers might leave at the same time. There can be several cars arriving to the parking lot at the same time as well. When an event triggers, that event uses env.timeout(time)
time to execute. However, this increases the simulation clock for the environment. Thus, for all agents?? Is there a way to simulate such a case? Could you suggest me a simulation framework/library to simulate such a scenario?
Edit due to @Michael's answer: I do launch the agents (2 type of agents) by using env.process
. A While loop function inside of these processes yield env.timeout
for agent creation and also creates new processes with env.process(foo(A,B,C))
. Inside of these processes, I have several yield env.process
. Inside of them again there are some yield env.process
. I am using yield
on the later functions because agents have to wait for the event to be finished. All of the agents are using some shared resources and stores or waiting for some agents to arrive. There are some associations between different types of agents as well. So, I am using external dictionaries to store all of the information about agents, resources and stores. I had some interesting results that made me think of whether I am using correct library or code structure to achieve what I want to do. After reading @Michael's answer, I believe I am on the right track. I can launch several agent creation processes and they can work simultaneously.
Yes
env.timeout does not advance the clock. when a agent calls env.timeout, that agent waits until the clock gets to that time, it does not block other agents from doing stuff. Other agents can still do stuff while the first agent is waiting to env.timeout to finish.
note that each agent needs to be launched asynchronously with env.process, not with yield
here is a less simple example