Skip to content
Advertisement

Inventory discrete event simulation with simpy object oriented

I m trying to formulate an inventory simulation with Simpy (a Python library for discrete event simulation) using an Object Oriented approach.

The simulation follow these steps:

  1. Initialization : A warehouse with unlimoted capacity and initial inventory on hand.
  2. Serve Customers : Customers arrive each inter arrival time and ask for a quantity of items demand.
    • If we have enough inventory on hand, the customer is served
    • If the demand is greater than the inventory on hand, all the items are sold
  3. Check Inventory for replenishment : If the inventory on hand drop at a certain level reorder point, we place an order to reach target inventory. We wait the lead time to fulfill the warehouse.

The problem

It s my first object oriented approach to simulation and I cannont see why the simulation doesn’t run properly. Actually, I don’t get any output and the script keeps running without displaying anaything.

JavaScript

Advertisement

Answer

In your method chek_inventory_and_order you have all of the logic, including the yield which would get you out of the method, contained under an if statement which is False given the initialization. Since that’s all happening within a while True, you’ve created an infinite loop. Looks to me like that’s why it keeps running forever with no output.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement