INSERTION METHOD FOR MULTIPLE MESSENGER PROBLEM WITH MULTIPLE DEPOTS INSERTION METHOD FOR MULTIPLE MESSENGER PROBLEM WITH MULTIPLE DEPOTS

= 1, 2,..., K specify depots, nodes K + 1, K + 3,..., K + 2 n - 1 correspond to pickup locations and K + 2, K + 4,..., K + 2 n denote delivery locations. Minimal distances c ij and associated travel times d ij for all pairs of locations are given ( i, j = 1,2,..., K + 2 n ; i ! j ). In addition, Tmax is defined as the acceptable time for each route duration. In the following algorithm we suppose that all vehicles will be used for shipments delivery, i.e. K routes will be generated. Let U * k be a sequence of h k nodes included in route k of length z k and duration T k , and U k be a set of nodes that can be still included in route k (in the certain step of routes generation). Number u U * ik k ! corresponds to the node on position i in sequence U * k . Value of z is the total length of all generated routes. The algorithm is based on inserting locations to current routes which extends their length. If insertion method is used for travelling salesperson problem, the route is obviously initialized Messenger problem, as the variation of pickup and delivery problem, deals with the transport of a set of packages from their origins to given destinations. In reality, several vehicles have to be used to be able to satisfy all requirements within given time limit. Messengers can be located in one or multiple depots. Because of NP-hardness of the problem it is impossible, for most real problems, to find the optimal solution in acceptable time. Therefore, heuristic algorithms must be used. In the paper, insertion method for routes generation is presented. As the computational experiments in VBA for Excel show, obtained results can be improved using the exchange algorithm.


Introduction
Messenger problem, as a variation of a pickup and delivery problem, is analogous to dial-a-ride problem (DARP), which Cordeau et al. [1] classify as the "one-to-one" problem. For transport of each person, a pickup location and a drop off location are given. Cordeau and Laporte [2] present models and algorithms for solving DARP, de Paepe et al. [3] investigate the computational complexity of this class of problems. Static DARP with multiple vehicles prepared in one depot for transport of persons is solved by Cordeau [4], which describes branchand-cut method. For this type of problem with time windows, Toth and Vigo [5] used parallel insertion method, Jorgensen et al. [6] applied genetic metaheuristics. For packages transport, we prefer to use the designation messenger problem. In [7] heuristic algorithms for the multiple messenger problem located in one depot are developed as the modifications of nearest neighbour method, insertion algorithm and exchange method.
In the paper, the messenger problem with multiple vehicles located in multiple depots is solved. Multiple vehicles are going to be used especially in situations with the limited vehicle capacities in terms of shipment sizes, or in case that time limitation for routes duration are given. Due to the computational complexity of these problems, heuristic algorithms are developed for real instances. Modification of insertion method is used for generation of multiple routes and exchange algorithm is applied for their improvement.

Insertion method for multiple messenger problem with multiple depots
In messenger problem, a location of pickup and a location of delivery are given for each shipment. Suppose n packages have to be transported by messengers, all are known in advance. Let us denote all pickup nodes in the network by the even numbers and all delivery nodes by the odd numbers. In addition, if the package is picked up at node i it will be delivered at node i + 1. For service, K messengers in separated depots are available. Let us assume, because of the proposed algorithms, K is an odd number. In case the real number of messengers is even, a dummy messenger is introduced. Nodes k = 1, 2,..., K specify depots, nodes K + 1, K + 3,..., K + 2n -1 correspond to pickup locations and K + 2, K + 4,..., K + 2n denote delivery locations. Minimal distances c ij and associated travel times d ij for all pairs of locations are given (i, j = 1,2,..., K + 2n; i ! j). In addition, Tmax is defined as the acceptable time for each route duration. In the following algorithm we suppose that all vehicles will be used for shipments delivery, i.e. K routes will be generated. Let U * k be a sequence of h k nodes included in route k of length z k and duration T k , and U k be a set of nodes that can be still included in route k (in the certain step of routes generation). Number u U * i k k ! corresponds to the node on position i in sequence U * k . Value of z is the total length of all generated routes.
The algorithm is based on inserting locations to current routes which extends their length. If insertion method is used for travelling salesperson problem, the route is obviously initialized Step 3 Step 4 If U k = Ø for 6k = 1, 2,..., K then go to Step 5 else go to Step 3.
Step 5 z zk End.
In each iteration, the related pickup and delivery locations are inserted in two possible ways [8]: the delivery location will be visited immediately after visiting the pickup location, or it will be visited later, after visiting other locations. In the first case, value zImmrj T expresses the minimal extension of the current route of messenger k, if pickup node r and delivery node r + 1 are inserted together behind the node on position j in sequence U * k . Value tImm T is calculated to check whether it is acceptable to include those locations in the route due to time limitation. by finding the farthest location s from the depot 1. Then, the cycle {1, s, 1} is created as the initial route. Another location is inserted to the cycle with the objective to minimize its extension. This approach is repeated until all locations are incorporated in the Hamiltonian cycle. In case of multiple messenger problem, two important rules have to be respected: pickup location and related delivery location have to be inserted to the same route, and pickup location has to be inserted to the route in front of related delivery location. In addition, delivery location can be inserted exactly behind related pick-up one or behind several locations farther [8]. If multiple messengers are considered in the problem, finding the farthest location to each depot in the initialization step can be disadvantageous because that location can be very close to another depot. In such situation it would be inefficient to include the location in the route of the concerned messenger. In the proposed algorithm this weakness is eliminated. For each messenger k, we are searching for the location that is closer to depot k than to all other depots. If more locations satisfy this condition, the farthest one to depot k determines the initial route (see variables LowDist and LowLoc). If no such location exists, i.e. all locations are farther to depot k than to any of remaining depots, as the initial location, it is taken the one with the minimal difference between its distance from depot k and minimal distance from other depots (see variables UpDif and UpLoc). Because at the beginning each messenger can visit all locations, all sets U k include all pickup and delivery nodes.
Step 1 For k = 1, 2,..., K set U k = {K + 2, K + 4,..., K + 2n}. Step 2 For all routes k = 1, 2,..., K, k!m the most advantageous insertion of nodes r and r + 1 is found using the approach described in Step 3 of insertion method. For each route its minimal extension zExtk T (k = 1, 2,..., K, k!m) is calculated. Their minimal value is selected: Let this extension of route p correspond to the insertion of node r behind node ui p and node r + 1 behind node u p j .

Step 3
If zExcl Ext then the exchange is realized, i.e. routes m and p are modified, and it is continued with Step 1, else with Step 4.
It should be emphasized that the proposed algorithm does not exchange shipments but transfers them from one route to another. Because in Step 2 time limitation Tmax has to be respected, real exchange could be executed in case of infeasibility. However, it is necessary to check feasibility of both routes m and p. The algorithm can be modified: all pairs of shipments across all routes are tested to feasibility and optimality.
If the algorithm finishes because the transfer cannot be realized (in Step 3), we can continue with Step 1 so that route m is added into "tabu list" and will be ignored when finding maximal reduction zExclm T . Of course, it is possible to add other routes into "tabu list" if necessary.

Computational experiments
In [9] the application in VBA for Excel was developed on the base of proposed method and computational experiments were executed. They related the real matrix of minimal distances between 650 locations in the Czech Republic. Instances with 10, 20, 30 and 40 shipments were generated randomly for 3, 5, 7 and 11 messengers. In each category, 10 samples were examined (see Table 1).
Similarly, in the second case, value zLatrvw T corresponds to the minimal extension of the route, if nodes r and r + 1 are inserted to sequence U

Exchange algorithm
The application of insertion algorithm leads to the generation of multiple routes that can be improved using another heuristic approach. For the problem with multiple messengers starting in one depot, exchange method was proposed in [7]. In the paper, the method is modified for the problem considering multiple depots. Let us assume K generated routes given by sequences U * k (k = 1, 2,..., K). Node ui k is a member of related sequence U * k on position i.

Step 1
For each route the shipment is found, i.e. the pair of pickup and delivery locations, whose exclusion from the route brings the maximal reduction of the length. This shipment is the candidate for the possible exchange. Let us denote this reduction zExclk T (k = 1, 2,..., K). The maximal reduction is selected: Let us assume this reduction in route m corresponds to nodes r and r + 1 on positions v and w in sequence U * m .  is not so expressive, final results show its higher efficiency in comparison with nearest neighbour algorithm. The statistically significant generalization of interesting conclusions requires the stronger analysis and wider experiments on real data. Greater savings would be probably achieved by the modifications mentioned above. Similarly to other special vehicle routing problems [10], time windows can be considered in multiple messenger problem. The proposed heuristic methods can be also extended to multiple messenger problems with a limited capacity of vehicles. As it was proved on the single vehicle messenger problem [8], insertion algorithm has its significance especially in case of dynamic problems. Future research will be aimed at using heuristic algorithms just in multiple messenger problems with multiple depots.