inventory-simulation
inventory-simulation copied to clipboard
simulation places infinite orders if lead time is too long
I'm a beginner at simpy and python, but maybe this will help someone else that is having this problem with an otherwise excellent package.
When I increased the lead time the simulation would create too many orders.
To fix it I added this variable
self.num_ordered = 0.
changed this line in def review_inventory
if self.level <= self.reorder_point and self.num_ordered == 0:
and added these two lines in def place_order, the order matters
self.num_ordered += units #add this
yield env.timeout(lead_time)
# update inventory level and costs
self.update_cost(env)
self.level += units
self.num_ordered -= units #add this