Manage taxi company: run model
Now that you have successfully randomized events in the previous exercise, let's apply these new concepts in the context of a discrete-event model.
A taxi company with ten taxis wants to optimize their business to maximize profit.
You know that taxis usually:
- Wait between one to ten minutes for new customer calls, and
- Take between one and ten minutes to arrive at the customer pick-up location (random duration between the given interval).
The average ride takes 20 minutes with a standard deviation of five minutes. Let's build a discrete-event model and run it for an eight-hour shift.
The time in the model is in minutes.
Cet exercice fait partie du cours
Discrete Event Simulation in Python
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
def taxi_ride(env, order, taxis):
with taxis.request() as taxi_request:
taxi_request_time = env.now
yield taxi_request
wait_time = env.now - taxi_request_time
waiting_taxi_dispatch.append(wait_time)
# Clock-in time between taxi dispatch and passenger boarding
yield env.timeout(____)
wait_time = env.now - taxi_request_time
waiting_passsenger_pickup.append(wait_time)
# Clock-in riding time from pick-up to drop-off
yield env.timeout(____)