This science of inventory control probably takes longer to master than getting a PhD.
So many factors: Order lead time, material cost, bulk pricing, cost of money, cost of storage, utilization rate, ... All balanced against the cost of an AOG.
There are shortcut formulae, but they all have risks and compromises.