# Leveraging Blockchain and Consignment Contracts to Optimize Food Supply Chains Under Uncertainty
## 5 Mathematical Model and Methods
### Traditional System with Blockchain  
The retailer's total entire profit for the traditional system with blockchain is  
\[\phi_{TS}^{r}=\left\{\begin{array}{l}(p_{BC}D_{BC}-wq)-h_{TS}^{r}(q-D_{BC}) ;\;D_{BC}\leq q\\ (p_{BC}-w)q-s^{r}(D_{BC}-q);\;D_{BC}>q\end{array}\right.\]  
The retailer keeps ownership of the product, purchases the entire lot at wholesale from the manufacturer, and sells it to the customer at a selling price. If \(x\leq q\), the retailer incurs a holding cost of \(h_{TS}^{r}\) for every unsold item. Conversely, when \(x>q\), the retailer suffers a loss of reputation quantified as \(s^{r}\) for each unit that is out of stock. The projected profit for the retailer can be articulated as  
\[E(\phi_{TS}^{r}) = \int_{0}^{q}[p_{BC}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma a_ {d})x\] \[- h_{TS}^{r}(q-(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma a_{d}) x-wq)]f(x)dx\] \[+ \int_{q}^{\infty}[p_{BC}q-S^{r}((D_{0}^{BC}-\eta_{2}p_{BC}-\
u \alpha-\gamma a_{d})x-q)-wq]f(x)dx\]  
The retailer acquires \(q\) from the producer. The initial integral represents the retailer's projected profit, assuming that the existing stock surpasses the consumer demand. The retailer meets the demand and incurs a holding cost, denoted as \(h_{TS}^{r}\), for each unit that remains unsold. The subsequent integral illustrates that the retailer faces a stock-out expense when they deplete their current stock, quantified as \(s^{r}\), for each unit that remains unfulfilled.  
In the TS, a retailer receives the demand from the customer and gives the manufacturer the order quantity indirectly. The retailer determines the order quantity based on customer demand.  
\[X\sim U\Big{[}\mu-\frac{\sigma}{2},\mu+\frac{\sigma}{2}\Big{]}\]  
The detailed calculation can be found in the Appendix A.1.  
\[Q^{*}=(\mu-\frac{\sigma}{2})+[\frac{p_{BC}-w+s^{r}(D_{0}^{BC}-\eta_{2}p_{BC}- \
u\alpha-\gamma q_{d})}{(p_{BC}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma q_{ d})+h_{TS}^{r}+S^{r})}]\sigma \tag{8}\]  
The wholesale price and the manufacturer's profit can be written as  
\[\phi_{TS}^{m}=(w-c)Q^{*} \tag{9}\]  
\[w = [(p_{BC}(\sigma^{2}-2\mu\sigma+2c)-2s^{r})(D_{0}^{BC}-\eta_{2}p_{ BC}-\
u\alpha-\gamma q_{d}) \tag{10}\] \[+ (\sigma-2\mu\sigma+2c)(h_{TS}^{r}-s^{r})-2\sigma(p_{BC}-1)]\] \[\times \frac{1}{2(p_{BC}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma q_{ d})+h_{TS}^{r}-s^{r}-1)}\]  
The estimated profit of the players in the TS with blockchain are given below. The proof is given in the Appendix A.1.  
\[E(\phi_{TS}^{r}) = (p_{BC}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma q_{d})+h_{TS}^{ r}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma q_{d}))\mu \tag{11}\] \[- (p_{BC}+h_{TS}^{r}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma q_{ d})+s^{r})\frac{1}{2}((\mu+\frac{\sigma^{2}}{2}-((\mu-\frac{\sigma}{2})\] \[+ \frac{p_{BC}-A+s^{r}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma q_ {d})}{(p_{BC}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\Gamma q_{d})+h_{TS}^{r}+S^{ r})}\sigma))\] \[E(\phi_{TS}^{m}) = \left[\frac{(p_{BC}(\sigma^{2}-2\mu\sigma+2c)-2s^{r})D_{0}^{BC}- \eta_{2}p_{BC}-\
u\alpha-\gamma q_{d})+(\sigma-2\mu\sigma+2c)(h_{TS}^{r}-s^{ r})-2\sigma(p_{BC}-1)}{2(p_{BC}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma q_{d})+h_{TS}^{ r}-s^{r}-1)}-c\right]\] (12) \[\times \left[(\mu-\frac{\sigma}{2})+\frac{p_{BC}-A+s^{r}(D_{0}^{BC}-\eta_ {2}p_{BC}-\
u\alpha-\gamma q_{d})}{(p_{BC}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha -\gamma q_{d})}+h_{TS}^{r}+S^{r})\sigma\right]\]  
where,  
\[A=\frac{(p_{BC}(\sigma^{2}-2\mu\sigma+2c)-2s^{r})D_{0}^{BC}-\eta_{2}p_{BC}-\
u \alpha-\gamma q_{d})+(\sigma-2\mu\sigma+2c)(h_{TS}^{r}-s^{r})-2\sigma(p_{BC}- 1)}{2(p_{BC}(D_{0}^{BC}-\eta_{2}p_{BC}-\
u\alpha-\gamma q_{d})+h_{TS}^{r}-s^{ r}-1)}\]