# Online and Offline Model for Housekeeping Order Assignment Based on Dynamic Programming Algorithm
## 5 Results and Discussion
### Result Discussion
#### 5.4.2 Comparison to the Nearest Distance Method  
To validate the online assignment model, the nearest distance method is used as a comparison. The nearest distance method assumes that \(d_{k}\) is the distance between the \(k\)-th order and the corresponding housekeepingper who receives the order. The process of this model is as follows.  
Figure 5: Sensitivity analysis of the online order assignment model for the housekeepingper’s moving speed.  
Figure 6: Sensitivity analysis results of online order assignment model to order update time.  
Optimization function:  
\[\text{Min}\ \ \ d_{k}=\sqrt{\left(x_{i}-x_{k}\right)^{2}+\left(y_{i}-y_{k}\right)^{2}} \tag{14}\]  
Decision variable refers to Equation (9). All constraints are as follows:  
\[\left\{\begin{array}{l}\text{\emph{order}}_{k}=\left\{\begin{array}{l}0, \text{ matched}\\ 1,\text{ unmatched}\\ \end{array}\right.\\ \text{\emph{t}}_{k}=\left\{\begin{array}{l}\text{\emph{t}}_{\min},\text{ \emph{t}}_{\min}+0.5,\text{ }\ldots,\text{ }t_{\max}\\ \text{\emph{v}}=15 km/h\\ \end{array}\right.\\ \text{\emph{housekeeper}}_{i}=\left\{\begin{array}{l}0,\text{ free}\\ 1,\text{working}\\ \end{array}\right.\\ \text{\emph{gotime}}_{i}=\text{\emph{historytime}}+d/v\\ \sum\limits_{k=0}^{2303}\text{\emph{order}}_{k}\cdot op=2304\times y\\ op=\left\{\begin{array}{l}0,\text{ }t_{\max}-\text{\emph{historytime}}\leq 2\\ 1,\text{ }t_{\max}-\text{\emph{historytime}}>2\\ \text{\emph{gotime}}_{i}\leq t_{i}\\ 0\leq y\leq 1\\ S(i,k)=\alpha A_{i}+\beta B_{k}+\gamma C_{k}\end{array}\right. \tag{15}\]  
The core algorithm of the nearest distance assignment model is to assign orders to the nearest housekeepingeper to achieve fast service. This method can reduce the distance of the housekeepingeper's movement, but it ignores the importance of the housekeepingeper's service quality. The values of \(Sum\), \(m\), \(a\), and \(b\) of the online assignment model are compared with those of the nearest distance assignment model in Table 9.  
Compared with the nearest distance assignment model, the value \(Sum\) of the online assignment model is larger, the overall service evaluation score is higher, and the platform service quality is better. On the same day, \(m\) is smaller, and the housekeepingers with high service scores take more orders, while the housekeepingers with low service scores take fewer or no orders. The values of \(a\) and \(b\) are larger, and the daily work time utilization rate and choiceness rate are higher. From the long-term development of the company, the higher the overall service score and the better the service quality, the better the development of the company will be. Therefore, compared with the closest distance assignment model, the online assignment model proposed in this paper is superior.  
Overall, both offline and online delivery models have their own advantages and disadvantages, and the choice of which model to use depends on the optimization objectives and acceptable constraints. The offline model can obtain the overall optimal solution, but it requires a comprehensive understanding of the entire day's orders and housekeepingeper situation and may not handle unexpected situations properly. The online model takes into account time constraints and the clients' experience, which is more in line with the needs of the real situation and has better adaptability to unpredictable problems.