## 4 The Algorithms
### The DSR-Fle Variant Algorithm
#### 4.2.3 Improvement on the Spl-DSR-Fle Algorithm
For example, for the sharing plan \(\langle v_{j}^{p},v_{k}^{p},v_{j}^{d},v_{k}^{d}\rangle\), after picking up \(r_{j}\) at \(v_{j}^{p}\), the courier needs to travel to the pick-up region \(v_{k}^{p}\) of \(r_{k}\) and the drop-off region \(v_{j}^{d}\) of \(r_{j}\). However, a courier can travel directly from \(v_{j}^{p}\) to \(v_{j}^{d}\) in the routing plan \(\langle v_{j}^{p},v_{j}^{d},v_{k}^{p},v_{k}^{d}\rangle\) without sharing, which needs fewer periods to finish \(r_{j}\) than that of the sharing plan. For values of \(c>2\), there are up to \(c\) orders that can be shared and served at a time. Because of the computational reasons, the capacity parameter \(c\) has a substantial impact on the feasibility of solving the DSS-Fix problem. Here, we mainly consider the case \(c=2\). However, as we show in the experiments, even the minimum possible number of order sharing (i.e, 2-order sharing) can provide immense benefits to DSS-Fix variants. **Iterative DSS-Fix Algorithm. ** For any 2-order sharing \(\langle r_{j},r_{k}\rangle\), we package them as a whole and construct two virtual orders \(r_{jk}^{s}\) and \(r_{kj}^{s}\) for the shared plans (if any) \(\langle v_{j}^{p},v_{k}^{p},v_{j}^{d},v_{k}^{d}\rangle\) and \(\langle v_{k}^{p},v_{j}^{p},v_{j}^{d},v_{k}^{d}\rangle\), respectively. Let \(\tilde{R}^{s}\) denote all of the virtual shared orders. Given the sharing orders \(\tilde{R}^{s}\) and the real orders \(R\), we construct the \"sharing\" CSN \(G^{s}(R\cup\tilde{R}^{s},E)\). The directed edge \((r_{j},r_{k})\in E\) indicates the (real/virtual) orders \(r_{j}\) and \(r_{k}\) can be served consecutively. For the CSN \(G^{s}\), we invoke Algorithm 2 to return the set of served orders \(R^{{}^{\prime}}\). Given the optimal solution \(R^{{}^{\prime}}\) that might include virtual sharing orders, the CSN can be updated and screen out the real orders as follows. **Definition 3**. : CSN Update Rule. _The solution \(R^{{}^{\prime}}\) includes virtual sharing and real orders, which might involve the same order, and the CSN \(G^{s}\) should be updated to delete the undesirable orders, such as_

* _For the virtual order_ \(r^{s}_{jk}\) _(resp._ \(r^{s}_{kj}\)_), if it is not served in the solution_ \(R^{{}^{\prime}}\)_,_ \(r^{s}_{jk}\) _(resp._ \(r^{s}_{kj}\)_) will be deleted from the CSN_ \(G^{s}\)_._
* _For the virtual orders_ \(r^{s}_{jk}\) _and_ \(r^{s}_{kj}\) _that belong to the same 2-order sharing_ \(\langle r_{j},r_{k}\rangle\)_, if they are both served in_ \(R^{{}^{\prime}}\)_, one of the them will be deleted from the CSN_ \(G^{s}\)_._
* _For the virtual order_ \(r^{s}_{jk}\) _(resp._ \(r^{s}_{kj}\)_), if it is served in_ \(R^{{}^{\prime}}\)_, and both of the real orders_ \(r_{j}\) _and_ \(r_{k}\) _are also served in_ \(R^{{}^{\prime}}\)_,_ \(r^{s}_{jk}\) _(resp._ \(r_{kj}\)_) will be deleted from the CSN_ \(G^{s}\)_._
* _For the virtual order_ \(r^{s}_{jk}\) _(resp._ \(r^{s}_{kj}\)_), if it is served in_ \(R^{{}^{\prime}}\)_, however, only one of the real orders_ \(r_{j}\) _and_ \(r_{k}\) _is served in_ \(R^{{}^{\prime}}\)_, both_ \(r_{j}\) _and_ \(r_{k}\) _will be deleted from the CSN_ \(G^{s}\)_._

After updating the CSN, Algorithm 2 is invoked again to derive the orders served in the next iteration. The details of the iterative DSS-Fix algorithm are proposed in Algorithm 5. In Step 2, the set of virtual sharing orders \(\tilde{R}^{s}\) is constructed. Based on the constructed \(\tilde{R}^{s}\) and the real orders \(R\), the CSN graph \(G^{s}\) is constructed in Step 3. Steps 4-8 are the iterative process of finding the set of orders \(R^{{}^{\prime}}_{g}\) and updating the CSN \(G^{s}_{g}\) at each iteration \(g\). The iterative process terminates until there is no improvement over the previous iteration on the number of real orders served. ```
Input :Customer orders \(R\). Output :Served Orders \(R^{\prime}\subseteq R\).