Reorder code python
[Link]
q=statistical+reorder+point+formula+python+code&sca_esv=12f6b6e94d6427
7d&rlz=1C1CHBF_enIN977IN977&sxsrf=ADLYWIJJaGJI88axKD13EwJgmKQaM6z3h
w%3A1733415800554&ei=eNNRZ-
PHIYfj1e8P4Kr80Ag&oq=statistical+reorder+point+formula+py&gs_lp=Egxnd3M
td2l6LXNlcnAiJHN0YXRpc3RpY2FsIHJlb3JkZXIgcG9pbnQgZm9ybXVsYSBweSoCCAE
yBRAhGKABMgUQIRigATIFECEYoAEyBRAhGKABSM0kUN4GWLoNcAB4ApABAJgBjA
SgAZ4LqgEFNC0yLjG4AQHIAQD4AQGYAgSgAs8LwgIEEAAYR8ICBhAAGBYYHsICCx
AAGIAEGIYDGIoFwgIIEAAYogQYiQXCAggQABiABBiiBMICBBAhGBXCAgUQIRifBZgDA
IgGAZAGCJIHBTEuNC0zoAeREg&sclient=gws-wiz-serp
Python
Execution output
import numpy as np
from [Link] import norm
def reorder_point(avg_daily_demand, lead_time, z_score,
std_dev_demand=None):
"""
Calculates the reorder point.
Parameters:
avg_daily_demand: Average daily demand
lead_time: Lead time in days
z_score: Z-score for desired service level
std_dev_demand: Standard deviation of daily demand (optional)
Returns:
Reorder point
"""
lead_time_demand = avg_daily_demand * lead_time
if std_dev_demand is not None:
safety_stock = z_score * std_dev_demand * [Link](lead_time)
else:
safety_stock = 0
return lead_time_demand + safety_stock
# Example usage
avg_daily_demand = 10
lead_time = 7
z_score = 1.645 # 95% service level
std_dev_demand = 2
rop = reorder_point(avg_daily_demand, lead_time, z_score, std_dev_demand)
print("Reorder Point:", rop)
Reorder Point: 78.70452181340251
Explanation:
1. 1. Imports:
numpy for mathematical operations.
[Link] for the normal distribution's inverse cumulative
distribution function ([Link]).
2. 2. reorder_point function:
Takes the following arguments:
avg_daily_demand: Average daily demand.
lead_time: Lead time in days.
z_score: Z-score corresponding to the desired service level (e.g., 1.645 for
a 95% service level).
std_dev_demand: Standard deviation of daily demand (optional). If not
provided, safety stock is assumed to be 0.
Calculates lead_time_demand by
multiplying avg_daily_demand with lead_time.
If std_dev_demand is provided, calculates safety_stock using the
formula: z_score * std_dev_demand * sqrt(lead_time) .
Returns the reorder_point as the sum
of lead_time_demand and safety_stock.
3. 3. Example usage:
Sets example values for avg_daily_demand, lead_time, z_score,
and std_dev_demand.
Calls the reorder_point function with these values to calculate the
reorder point.
Prints the calculated reorder point.