Where
TC = The total ordering (or setup) and carrying cost
P = The cost of placing and receiving an order (or the cost of setting up a production run)
Q = The number of units ordered each time an order is placed (or the lot size for production)
D = The known annual demand
C = The cost of carrying one unit of stock for one year