## 3 Methodology--Mathematical Modelling and Heuristic Optimization Method
#### 3.1.2 Real-Time Logistics Resource Optimization
The new loading of AGV \(r\) passing pickup matrix cell \(\lambda-1\) can be calculated by adding the assigned new supply-demand and subtracting the value of a previously assigned delivery of an open task as follows:  
\[\forall\;r,\lambda,\beta:q_{0r}+\sum_{b=3}^{\lambda}\sum_{\alpha=1}^{\alpha_{ max}}\sum_{\beta=1}^{\beta_{max}}q_{s_{rb-2 rb-1}a\beta}^{*}+q_{\psi}^{NS}+ \sum_{b=\lambda+1}^{\lambda_{max}}\sum_{\alpha=1}^{\alpha_{max}}\sum_{\beta=1 }^{\beta_{max}}q_{s_{rb-1}s_{rb}a\beta}^{*}\leq C_{r}^{max} \tag{23}\]  
_Constraint 5:_ It is not permitted to exceed the upper and lower limit of pickup time frame for each scheduled matrix cell. \[\forall\;r,\lambda:\qquad t_{rA^{*}}^{Pmin}\leq t_{rA^{*}\psi}^{P1}+t_{rA^{*} \psi}^{P2}+t_{rA^{*}\psi}^{P3}+t_{rA^{*}\psi}^{P4}\leq t_{rA^{*}}^{Pmax}, \tag{24}\]  
where  
\[t_{rA^{*}\psi}^{P1}=t_{0r}+\sum_{b=3}^{\lambda}\frac{\xi_{s_{rb-2}s_{rb-1}} \Big{(}p_{s_{rb-2}}^{x},p_{s_{rb-2}}^{y},p_{s_{rb-1}}^{x},p_{s_{rb-1}}^{y}\Big{)} }{\overline{v}_{r}}, \tag{25}\]  
\[t_{rA^{*}\psi}^{P2}=\frac{\xi_{s_{rA-1}\psi}\Big{(}p_{s_{rA-1}}^{x},p_{s_{rA-2 }}^{y},p_{s_{rb}}^{x},p_{s_{rb}}^{y}\Big{)}}{\overline{v}_{r}}\;\text{and}\;t_{rA^ {*}\psi}^{P3}=\frac{\xi_{s_{rb}\lambda}\Big{(}p_{s_{rA}}^{x},p_{s_{rA}}^{y},p_{ s_{rb}}^{x},p_{s_{rb}}^{y}\Big{)}}{\overline{v}_{r}} \tag{26}\]\[t_{r\lambda^{*}\psi}^{\rm PA}=t_{0r}+\sum_{b=\lambda+1}^{\lambda_{max}}\frac{ \tilde{\xi}_{s_{rb-1}s_{rb}}\left(p_{s_{rb-1}}^{x},p_{s_{rb-1}}^{y},p_{s_{rb}}^{x },p_{s_{rb}}^{y}\right)}{\overline{v_{r}}}, \tag{27}\]  
where \(t_{r\lambda^{*}}^{Pmin}\) and \(t_{r\lambda^{*}}^{Pmax}\) is the lower and upper limit of pickup time for matrix cell \(s_{r\lambda^{*}}\), \(t_{r\lambda^{*}\psi}^{P1}\) is the travelling time from the AGV-pool to the predecessor matrix cell of the new supply-demand's matrix cell \(\psi\) in route r, \(t_{0r}\) is the initial travelling time from the AGV-pool to the first scheduled matrix cell, \(t_{r\lambda^{*}\psi}^{P2}\) is the travelling time from the predecessor matrix cell to the new supply-demand's matrix cell \(\psi\) in route r, \(t_{r\lambda^{*}\psi}^{P3}\) is the travelling time from the new supply-demand's matrix cell \(\psi\) to the following matrix cell in route r, and \(t_{r\lambda^{*}\psi}^{P4}\) is the travelling time from the pickup matrix cell of the new supply-demand \(\psi\) to matrix cell \(\lambda^{*}\) in route r.  
_Constraint 6_: It is not permitted to exceed the upper and lower limit of delivery time from each scheduled matrix cell. \[\forall\;r,\lambda: t_{r\lambda^{*}}^{Dmin}\leq t_{r\lambda^{*}\psi}^{D1}+t_{r \lambda^{*}\psi}^{D2}+t_{r\lambda^{*}\psi}^{D3}+t_{r\lambda^{*}\psi}^{D4}\leq t _{r\lambda^{*}}^{Dmax}, \tag{28}\]  
where \(t_{r\lambda^{*}\psi}^{D1}\), \(t_{r\lambda^{*}\psi}^{D2}\), \(t_{r\lambda^{*}\psi}^{D3}\), and \(t_{r\lambda^{*}\psi}^{D4}\) can be calculated in the same was as in (25)-(27). _Constraint 7_: It is not permittingt Feed to exceed the upper and lower limit of pickup and delivery time frame for each new supply-demand. \[\forall\;\psi: t_{\psi}^{PNmin}\leq t_{r\lambda^{*}\psi}^{P1}+t_{r\lambda^{*}\psi}^{P2 }\leq t_{\psi}^{PNmax}\quad\wedge\quad t_{\psi}^{DNmin}\leq t_{r\lambda^{*} \psi}^{D1}+t_{r\lambda^{*}\psi}^{D2}\leq t_{\psi}^{DNmax}, \tag{29}\]  
where \(t_{\psi}^{PNmin}\) and \(t_{\psi}^{PNmax}\) is the lower and upper limit of pickup time for new supply-demand \(\psi\) and \(t_{\psi}^{DNmin}\) and \(t_{\psi}^{DNmax}\) is the lower and upper limit of pickup time for new supply-demand \(\psi\). The decision variables have two different types: the decision variables of the assignment problems are integer matrices, while the decision variables of the scheduling problem are matrices with real values. The assignment matrices \(x_{ij\alpha\beta r}^{*}\), \(x_{r\lambda\psi}^{P}\) and \(x_{r\lambda\psi}^{D}\) define the scheduling of supply-demands both in extended and real-time optimization, so we have only integer decision variables. Figure 10 demonstrates the model framework including time frame and capacity constraints.