The theory of quantity discounts and optimal pricing. (June 2017)