Lot size optimization