Using above assumptions, the inventory level follows the pattern
depicted in Fig. 1. To establish the total profit function, we
consider the following time intervals separately, [0, t1] and
[t1, t1 + t2]. During the interval [0, t1], the inventory is depleted
due to the combined effects of demand and deterioration. Hence
the inventory level is governed by the following differential
equation: