# New Retailing Problem for an Integrated Food Supply Chain in the Baking Industry
## 5 Solution Procedure
### Determination of the Optimal \(Q\) for Given \(n\) and \(T\)  
In this section, we first find the optimal lot size per shipment that maximizes \(\Pi_{j}(n,Q,T)\), \(j=1,2,3\), respectively, for a given \(n\) and \(T\). Then the optimal number of shipments is derived for a given \(Q\). Taking the first-order partial derivative of \(\Pi_{j}(n,Q,T)\), \(j=1,2,3\), with respect to \(Q\), respectively, we have  
\[\begin{array}{rl}\frac{\partial\Pi_{1}(n,Q,T)}{\partial Q}&=p_{2}S^{\prime} (Q)+(n-1)w^{\prime}-r+KDQ^{-2}-c_{ck}n-\frac{Q}{B}-c_{r}\\ &+[2g_{ck}+\rho(g_{r}-g_{ck})]S^{\prime}(Q)-p_{2}\Big{[}1-e^{-b(T)Q/D}\Big{]} \\ &-h_{s}nk_{T}Q\Big{(}\frac{2-n}{P}+\frac{n-1}{D}\Big{)},\end{array} \tag{23}\]  
\[\begin{array}{rl}\frac{\partial\Pi_{2}(n,Q,T)}{\partial Q}&=(p_{2}+g_{ck}+g_ {r}-2\beta)S^{\prime}(Q)+2\beta-r-\frac{Q}{B}+K\frac{D}{Q^{2}}\\ &-(c_{r}+c_{ck}n)+w(n-1)-p_{2}\Big{[}1-e^{-b(T)Q/D}\Big{]}\\ &-h_{s}nk_{T}\Big{(}\frac{2-n}{P}+\frac{n-1}{D}\Big{)},\end{array} \tag{24}\]  
\[\begin{array}{rl}\frac{\partial\Pi_{31}(n,Q,T)}{\partial Q}&=p_{2}S^{\prime} (Q)-c_{r}(1-\delta)-w(1-\delta)-r-\frac{Q}{B}+wn(1-\delta)+K\frac{D}{Q^{2}}\\ &-c_{ck}n(1-\delta)-p_{2}\Big{[}1-e^{-b(T)Q/D}\Big{]}-h_{s}nk_{T}Q\Big{(}\frac {2-n}{P}+\frac{n-1}{D}\Big{)},\end{array} \tag{25}\]  
\[\begin{array}{rl}\frac{\partial\Pi_{32}(n,Q,T)}{\partial Q}&=p_{2}S^{\prime} (Q)-c_{r}-r-\frac{Q}{B}+wn+K\frac{D}{Q^{2}}-c_{ck}n-p_{2}\Big{[}1-e^{-b(T)Q/D} \Big{]}\\ &-h_{s}nk_{T}Q\Big{(}\frac{2-n}{P}+\frac{n-1}{D}\Big{)},\end{array} \tag{26}\]  
\[\begin{array}{rl}\frac{\partial\Pi_{33}(n,Q,T)}{\partial Q}&=(p_{2}+g_{r})S^ {\prime}(Q)-w-r-\frac{Q}{B}-c_{r}+wn+KDQ^{-2}-c_{ck}n\\ &-g_{ck}[1-S^{\prime}(Q)]-p_{2}\Big{[}1-e^{-b(T)Q/D}\Big{]}-h_{s}nk_{T}Q\Big{(} \frac{2-n}{P}+\frac{n-1}{D}\Big{)},\end{array} \tag{27}\]  
Next, we take the second-order partial derivative of \(\Pi_{j}(n,Q,T)\)  
\[\begin{array}{rl}\frac{\partial^{2}\Pi_{31}(n,Q,T)}{\partial Q^{2}}&=-2 KDQ^ {-3}[2g_{ck}-\rho(g_{r}-g_{ck})]S^{\prime\prime}(Q)-\frac{1}{D}\\ &-\frac{P}{D}\Big{[}b(T)e^{-b(T)Q/D}-1\Big{]}-h_{s}nk_{T}\Big{(}\frac{2-n}{P}+ \frac{n-1}{D}\Big{)},\end{array} \tag{28}\]  
\[\begin{array}{rl}\frac{\partial^{2}\Pi_{2}(n,Q,T)}{\partial Q^{2}}=(p_{2}+g_ {ck}+g_{r}-2\beta)S^{\prime\prime}(Q)-2 KDQ^{-3}-p_{2}\frac{b(T)}{D}e^{-b(T)Q/D}, \end{array} \tag{29}\]  
and  
\[\begin{array}{rl}\frac{\partial^{2}\Pi_{31}(n,Q,T)}{\partial Q^{2}}&=p_{2} \Big{[}S^{\prime\prime}(Q)-b(T)e^{-b(T)Q/D}\Big{]}-K\frac{D}{Q^{3}}-1-h_{s}nk_ {T}\Big{(}\frac{2-n}{P}+\frac{n-1}{D}\Big{)},\end{array} \tag{30}\]  
\[\begin{array}{rl}\frac{\partial^{2}\Pi_{32}(n,Q,T)}{\partial Q^{2}}&=p_{2} \Big{[}S^{\prime\prime}(Q)-\frac{b(T)}{D}e^{-b(T)Q/D}\Big{]}-\frac{1}{D}-2 KD^ {3}-h_{s}nk_{T}\Big{(}\frac{2-n}{P}+\frac{n-1}{D}\Big{)},\end{array} \tag{31}\]  
\[\begin{array}{rl}\frac{\partial^{2}\Pi_{32}(n,Q,T)}{\partial Q^{2}}&=(p_{2}+g_ {r}+g_{ck})S^{\prime\prime}(Q)-p_{2}\Big{[}b(T)e^{-b(T)Q/D}-1\Big{]}\frac{1}{D }-2 KDQ^{-3}\\ &-h_{s}nk_{T}\Big{(}\frac{2-n}{P}+\frac{n-1}{D}\Big{)}.\end{array} \tag{32}\]  
By fixing \(n\) and \(T\), we have the following results.  
**Proposition 2**.: _For given \(n\) and \(T\),_  
1. _if_ \(p_{2}+g_{ck}+g_{r}>2\beta\)_, then the solution_ \(Q^{*}\) _which maximizes_ \(\Pi_{2}(Q|n,T)\) _not only exists but also is unique, where_ \(Q^{*}\in[0,\infty)\)_._
2. _if_ \(p_{2}+g_{ck}+g_{r}<2\beta\)_, then the solution_ \(Q^{*}\) _which maximizes_ \(\Pi_{2}(Q|n,T)\) _not only exists but also is unique, where_ \(Q^{*}\in[0,\infty)\)_._