Extending Wilson to EPQ: the finite-production-rate correction
When stock is replenished by an in-house production line running at rate p units per day while demand drains it at rate d, average inventory is no longer Q/2. It is [Q(1 - d/p)]/2. Substituting that into the total-cost setup and re-solving yields Q* = sqrt(2DS / [H(1 - d/p)])[1].
The average-inventory correction
Under Wilson, the lot Q arrives instantaneously and average inventory across the cycle is Q/2. Under EPQ, the lot builds up across the production run at rate (p - d), then consumes at rate d. The maximum inventory level is Q(1 - d/p), reached at the end of the production phase. Average inventory over the full cycle is therefore Q(1 - d/p)/2.
Differentiate and solve
Take dTC/dQ, set to zero, isolate Q. The derivation mirrors the classic step 3 but with H replaced by H(1 - d/p).
Boundary behaviour
As p tends to infinity, (1 - d/p) tends to 1 and the EPQ formula collapses to Wilson: instantaneous production is equivalent to instantaneous resupply. As p tends to d from above, the correction factor tends to zero, the denominator vanishes, and Q* blows up to infinity, which is correct: if your production line can barely keep up with demand, the optimal policy is to never stop running it.