Single-Commodity Vehicle Routing Problem with Pickup and Delivery Service

We present a novel variation of the vehicle routing problem VRP . Single commodity cargo with pickup and delivery service is considered. Customers are labeled as either cargo sink or cargo source, depending on their pickup or delivery demand. This problem is called a single commodity vehicle routing problem with pickup and delivery service 1-VRPPD . 1-VRPPD deals with multiple vehicles and is the same as the single-commodity traveling salesman problem 1PDTSP when the number of vehicles is equal to 1. Since 1-VRPPD specializes VRP, it isNP hard in the strong sense. Iterative modified simulated annealing IMSA is presented along with greedy random-based initial solution algorithm. IMSA provides a good approximation to the global optimum in a large search space. Experiment is done for the instances with different number of customers and their demands. With respect to average values of IMSA execution times, proposed method is appropriate for practical applications.


Introduction
In this paper, we consider a real-world problem with a loaded vehicle the term capacitated vehicle is also used in the literature .The vehicle is available for pickup and delivery service.Single-commodity cargo, that is, same cargo type, is present at the customer sites.The vehicle is able to carry out a Pickup and delivery service of such cargo among the customers.By starting and ending at the origin depot, the vehicle follows a route without having a predefined sequence of Pickup and delivery services.This problem is called a one-commodity vehicle routing problem 1-VRPPD .The main feature of 1-VRPPD is that delivery customers can be served with a cargo gathered from Pickup customers.This problem was first defined in 1 as a one-commodity Pickup and delivery traveling salesman problem 1-PDTSP , which is the same as 1-VRPPD, when the number of vehicles is equal to 1. Although, 1-VRPPD deals with multiple vehicles, in this paper we consider a single vehicle.In order to solve this problem, after servicing customers the vehicle does not return to the depot.An overview of OVRP algorithms is provided in 10 .A heuristic algorithm applied in 11 is comparable in terms of solution quality to the best performing published heuristics.Practical applications of OVRP are in home delivery of packages and newspapers with third-party contractors who use their own vehicles and do not return to the depot.
Hybrid variations of VRP with Pickup and delivery service have also been present in literature.A hybrid variation of VRP is considered in 12 and it is used for blood transportation in health care, where the vehicle route consists of the following sequence: delivery only, simultaneous Pickup and delivery, Pickup only.The proposed genetic algorithm GA called CLOVES solves the problem in four steps.
The 1-PDTSP, defined in 1, 13 , is solved with a branch-and-cut algorithm.A special case of the 1-PDTSP, when vehicle capacity is either 1 or ∞ and customers' demands are either 1 or -1, was defined in 14 and solved for a path and a tree graph topology.Practical applications of 1-VRPPD are found in the transport of material of the same type where delivery customers correspond to cargo sinks and Pickup customers correspond to cargo sources.That is the case in transportation of gas, earth, sand, eggs, money, and so forth.In such a way, some customers produce goods while others demand those goods.
In this paper, we present a scenario with an employee utilizing our VRP application.In order to find a feasible suboptimal vehicle route, the user imports customer's coordinates and demands, and runs the IMSA algorithm.Via graphical user interface, described in Section 4, the user can select one part of the resulting route in order to find a shorter route.
In this paper, we explore the benefits of solving 1-VRPPD with simulated annealing and its variations.

Problem and model definition
Let G be a complete graph, V {v 0 , . . ., v n } a vertex set, E {{v i , v j } : v i , v j ∈ V } an edge set, A { v i , v j : v i , v j ∈ V } an arc set.G has dual, directed and undirected, representations, as Figure 1 illustrates.Vertices v i , i ∈ {1, . . ., n} correspond to the customers and vertex v 0 corresponds to the depot vertex.Arc a ∈ A with start in v i and end in v j is denoted by v i , v j .Non-negative cost c ij is associated with each edge e {v i , v j } ∈ E that corresponds to the travel distance between two vertices v i and v j .Also, a binary number x e ∈ { 0, 1 } is assigned to e, where 1 represent visited edge and 0 represents unvisited edge.Thus, cost matrix c is symmetric, having the same cost in both directions, that is, Customer demand q i > 0 indicates cargo that needs to be delivered, that is, the customer requires delivery service.Customer demand q i ≤ 0 indicates cargo that needs to be collected, that is, the customer requires a Pickup service.When q i 0, Pickup service is considered in order to visit the costumer.
For a given vertex set S ⊆ V , let q S i∈S q i denote the total demand of the set.Let δ S and E S denote the set of edges e ∈ E that have only one or both endpoints in S respectively.
Let δ S : denote the set of vertices j from which vertex i is directly reachable.Let δ S : {{v i , v j } ∈ E : v i ∈ S, v j / ∈ S}, ∀S ⊂ V , denote the set of vertices j directly reachable from vertex i. δ S and δ − S are given with respect to A, while δ S is given with respect to E. To ensure cargo conservation let the depot cargo 3.1 and let A vehicle with a fixed positive vehicle capacity Q is available at the depot.To ensure feasibility, it is assumed that vehicle cargo q i ∈ 0, Q is a positive whole number and never exceeds its maximal value.An example of this model is illustrated in Figure 2.
Bearing in mind the aforementioned, a mathematical formulation of 1-VRPPD can be defined as Minimize e∈E c e x e 3.3 subject to x e ∈ {0, 1} ∀e ∈ E.

Proposed solution and implementation
Iterative modified simulated annealing IMSA algorithm is a heuristic algorithm with iterative approach strategy used for solving combinatorial optimization problems.IMSA and exact permutation algorithm EPA are used to solve the 1-VRPPD NP hard problem.
In this section, we describe the implementation of IMSA algorithm.The number of nodes, that is, customers, is denoted by n.The number of vehicles M is 1.

Exact permutation algorithm (EPA)
For the purpose of improving the optimal route length for small graph instances in which the number of nodes is n ≤ 15, we use Exact Permutation Algorithm EPA .Instances with graphs, which have more than 15 nodes, are not practical and solving EPA for an arbitrary n is impossible.Its computational complexity is O n! , therefore, it cannot be enumerated in polynomial time.EPA represents the Exeter's permutation algorithm described in 16 .EPA is used for improving existing solution via interactive graphical user interface GUI .Implementation of EPA is depicted at the end of Section 5.

Simulated annealing (SA)
Simulated annealing SA was first described in 17 .SA is a heuristic algorithm used for solving global optimization problems 13, 15 .In the beginning of the algorithm, at high temperature T, SA acts as a random algorithm.Subsequently, the current feasible 1. lnitialize nCounts max , nChanges max , T start , T end , B, L, α 2. x lnitialSolution ; 3. while Feasible(x) FALSE 4.
minDist Dist(x); solution X changes to another feasible neighbor solution Y in a very random way.In our implementation, neighbor feasible solution Y is created with nSAChanges random feasible substitutions made on current feasible solution X.In this work, we consider nSAChanges 2 √ n.As system anneals proportionally with the number of iteration ϑ, the algorithm becomes more deterministic.Criterion, which increases algorithm determinism, as ϑ growths and T falls, is the main part of the SA algorithm and is defined with temperature-probability function f Δ 4.1 .
where Δ RouteLength X -RouteLength Y is the amplitude defined with the difference between route lengths of X and Y. Notation T ϑ ∈ T start , T end represents the current temperature at iteration ϑ.Temperature T ϑ falls linearly from T start to T end as ϑ growths.Temperature-probability function f Δ results with continuous probability 0, 1 for rejecting new solutions.When Δ ≥ 0, the current feasible solution X is replaced with better feasible solution Y. Otherwise, random number r ∈ 0, 1 is generated and compared with f Δ .If r ≥ f Δ , new feasible solution Y is rejected and the current solution X remains unchanged.If r < f Δ , then the current feasible solution X with shorter route length is replaced with feasible solution Y with longer route length.Occasional acceptance of a solution that leads to a longer route prevents the algorithm from becoming stuck in a local minimum.

Modified simulated annealing (MSA)
Modified simulated annealing MSA algorithm inherits features of SA algorithm with a difference in creating neighbor solutions Y. MSA deals with multiple feasible neighbor solutions Y made from the current feasible solution X. Neighbor solutions Y are created

Iterated modified simulated annealing (IMSA)
IMSA is a heuristic algorithm.IMSA algorithm inherits features of MSA algorithm.In order to find better solution, IMSA algorithm has outer loop in which MSA repeats nCounts max times.Chances for finding a better optimum are higher when the execution time needed for finding suboptimal solution is longer or the number of iterations is greater.Algorithm 1 illustrates IMSA algorithm.Functions used in IMSA algorithm, shown in Algorithm 1, are: Initialize: sets parameters to their default user defined values.
InitialSolution: returns an initial feasible route.
Feasible: returns TRUE if the route is feasible, otherwise returns FALSE.
Dist: returns route length.
RandomNeighborSequence: returns neighbor sequence Y that differs from the current sequence X on nChanges made.
RandomNumber: returns a real number for a given interval.
InitialSolution is based on Greedy-random sequence GRS algorithm.In order to create an initial solution, GRS starts from the start node, also denoted as current node.From current node, all unvisited neighbor nodes, denoted as next node, are considered with respect to their vehicle capacity Q constraint and the route length d.The feasible neighbors, which satisfy vehicle capacity constraint, are sorted with respect to travel length from the current node to the next node.The neighbour with the shortest path would be selected with pure greedy algorithm.However, GRS algorithm calculates initial solution from the graph.Starting with the current node, GRS selects feasible neighbor nodes with respect to vehicle cargo.Again, the nearest feasible neighbor would be selected with the pure greedy algorithm.But GRS selects the nearest feasible neighbor solution with 80% probability and the second feasible solution with 20% probability.This way, the greedy algorithm becomes random.
The values of parameters are the same for all variations of SA algorithm.Starting temperature T start has value 1000, from which the system anneals until the temperature reaches final temperature T end 10.Constant L with default value 100 represents the number of neighbor solutions Y considers at the same temperature T. A bounded number of iterations B is set to be 1000 in order to prevent a long execution time if the input temperature interval T start , T end is too wide.Temperature reducing factor α equals 1.1 in order to decrease the temperature value by 10% in the next iteration, and is usually set to be a bit greater than 1.
In order to get the basic SA algorithm, the following changes need to be implemented in the algorithm from Algorithm 1. Line 6 does not exist in the SA algorithm, and it should be removed.Accordingly, parameter Changes max in line 10 should be replaced with nSAChanges.Parameter Counts max , in line 7, should be set to value 1 or the line 7 should be removed, respectively.The MSA algorithm can be extracted from IMSA illustrated in Algorithm 1, by removing the line 6 of the proposed algorithm.Thus, implementation of the SA algorithm is simpler.It uses a fixed number of random substitutions nSAChanges, while MSA and IMSA have an iteratively changeable number of changes from 1 to nChanges max .MSA differs from IMSA in the number of Counts max used to repeat the MSA algorithm.Finally, a small solution space is explored with SA, more is explored with MSA, and even more with IMSA algorithm.Parameters that are different for different methods are illustrated in Table 1.

Simulation environment
For the purpose of experimental analysis, we developed a simulation environment using MSVisual C 6.0. Figure 3 depicts functional components and the usage of the simulation environment.During the initialization phase in step 1, the graph with or without cargo, vehicle capacity Q, and common simulation parameters are defined.In order to search for an optimal solution, the methods discussed in the previous section are available in the search method phase, simulation step 2. When a suboptimal solution is found, output parameters, route length d and execution time t, are evaluated in simulation step 3.
A solution improvement method can be applied by using an interactive GUI.An interactive GUI enables a user to improve the route performances in simulation step 4 Figure 3 .By selecting a subset of vertices M ⊆ V on a route, the search improvement method provides some local improvements of selected subroutes.For example, let M {a, b, c, d, e, f, g} be a set of user-selected vertices.Such set M represents an input parameter for the solution improvement method that combines selected vertices in the resulting route.In that way, neighbor solutions Y differ from solution X only by vertices from set M, as illustrated in Figure 4.
In this paper, EPA that is defined in Section 4, is used to enumerate the routes with improved performance, if such routes exist.After the suboptimal solution phase in simulation step 3 Figure 3 , a suboptimal route can be improved by selecting vertex set M and starting the next simulation phase.Vertices v ∈ M from the suboptimal route are then permuted in the solution improvement method phase in step 5 Figure 3 .If the new route is feasible and shorter than the previous one, then it is set to be the route with improved performance.

Experimental results
We experimented with the simulation environment on a PC with Intel T7200 processor under Windows XP.We chose several instances from 13 with positive demand at the depot.In this way, we considered real world problems with the vehicle starting loaded or empty at the depot.We compare the results with those from 13 .
Figures 5-7 illustrate results for the graph instance with 25 vertices and vehicle capacities 10, 15, and 20.Circles represent vertices, and arrows represent the route.Numbers in vertices represent the amount of product q i > 0 that needs to be delivered, and q i ≤ 0 indicates that the product needs to be collected.Shaded circle with demand 0 is the depot vertex and corresponds to the vehicle start and end positions.Figure 5 illustrates an optimal route for the smallest vehicle capacity value Q 10.Figures 6 and 7 represent the resulting routes for Q 15 and Q 20, respectively.The longest route length corresponds to the smallest vehicle capacity.Larger vehicle capacity results in a shorter route.
Possible practical application of such a graph representation is when there are several places with same sort of material storage and other places that demand such material.For instance, the 1-VRPPD application may be used in newspaper redelivery service.A newspaper company puts a newspaper in circulation, that is, they produce certain amount of newspapers and deliver them to the newspaper stands.In the morning, shops receive newspapers and sell them during the day with different quantities.In the end of the day, Mathematical Problems in Engineering  newspapers are not appropriate for tomorrow sales.In order to reduce company losses, shops that posses lesser newspaper quantities require newspapers from shops that posses more newspapers in stock.A small vehicle with capacity Q, has a task to redeliver newspapers among newspaper stands.The heuristic algorithm presented in Algorithm 1 is appropriate for solving combinatorial optimization problems, which may be NP-hard.Besides 1-VRPPD, other problems can be solved with proposed algorithm.Such problems should have feasible initial solution, which is later improved when solution space is more explored.Inputs to the algorithm are: the algorithm parameters, a graph with vertexes which represents customers and their demands, and finally a depot vertex which represents start and goal position.As a result, the proposed algorithm always returns a Hamiltonian cycle with a suboptimal distance between vertexes.
Another practical application is in urgent medicament transport, when several hospitals have more medicaments of one type than the others do.Practical transportation of H5N1 medicament is feasible in an unpredictable epidemical contamination.Another practical application is in concrete industry where customers are served with a truck which can load concrete at several secondary depots, that is, at Pickup customers, and unload it according to customer demands.Another practical application is a sensor network, where sensors need to be transported in order to improve network efficiency.This is the case in military and meteorology applications.Due to some natural forces, a sensor network may be interrupted.Thus, our algorithm may reduce network sensor transportation expenses.
When vehicle capacity Q tends to infinity, 1-VRPPD requires less computational power than in cases where vehicle capacity Q is small.According to SA execution times shown in Table 2, feasible solutions are found quicker when vehicle capacity Q is larger.Thus for the same graph, when SA is used, execution times are highest when capacity constraints are stringent, when Q is smaller Figure 5 .As mentioned before, MSA has larger neighborhood space to explore than SA.With the number of customers n > 50, the average route length and execution time is smaller when vehicle capacity is larger.Consequently, IMSA average route length d is the smallest for largest Q.According to Table 2, the time needed for enumeration of the optimal feasible route is proportional to the size of explored neighborhood space.
Table 2 presents our experimental results, where graph instance features are denoted as follows.n is the number of vertices, K is quantity of products that needs to be collected and picked-up 3.2 , Q is vehicle capacity, d * is best solution found, rsd is the route length's relative standard deviation and d and t are average route length and average execution time.Vehicle capacity Q has an experimental variable in range 10, 30 in steps of 5. Proposed algorithm is random based and average values obtained from 100 experiments.
Route calculations with the IMSA last longer than with the MSA.Thus, using IMSA is more appropriate in the case when the user working with our application has customer demands several days before a vehicle starts with Pickup and delivery services.Then the user can setup even a daylong search strategy in order to get shorter routes.The number nCounts max Algorithm 1 , different in MSA and IMSA, needs to be set appropriately in order to satisfy user needs.If the route length is more important than the execution time, nCounts max must be set to a relatively large value.Otherwise, if the execution time is preferable, nCounts max must be set to a relatively small value.
In this paper, the IMSA is demonstrated as the algorithm resulting in short routes, and the MSA as the algorithm with the short execution time.
In Table 3, dependencies between the number of customers and average length and execution times for EPA, SA, MSA, and IMSA are proposed.For instances, with 15 customers, EPA execution time is about 3 hours long, making EPA impractical for larger instances.
Table 3 illustrates the characteristics of methods analyzed in this paper, average values of route lengths and execution times gathered in Table 2.In this way, IMSA is presented as the algorithm that has the shortest route length and the longest execution time.The SA algorithm is the algorithm with the shortest execution time and the longest route length.Dependency between average route length d and vehicle capacity is proposed in Figure 8.The chart in Figures 8 a , 8 c , 8 e , 8 g , 8 i illustrate how a change in vehicle capacity affects average route length d.The legend in Figure 8 illustrates which method is used and how many customers are involved in a single route.The smallest instance with 15 customers is marked as SA 15, MSA 15 and IMSA 15, respectively.Other instances with a different number of customers are marked accordingly.In the charts Figures 8 a , 8 c , 8 e , 8 g , 8 i , we see that the route length becomes shorter as the vehicle capacity growths.This is the case for all methods applied.Figure 9 a illustrates the average route length values shown in Table 3.It shows that the average route length depends linearly on a number of customers that needs to be served.Route lengths are highest in case of SA, than there comes MSA, and finally the smallest is for IMSA.This means that SA provides suboptimal routes that are on average the longest suboptimal routes.IMSA routes are on average the shortest   8 and 9.As illustrated in Figure 9 b , the execution time of SA is little shorter than of MSAs.The shortest execution times are on average for the SA search method.MSAs execution times are little longer than SA's, and much shorter than IMSA's, see Table 3 .
Results proposed in Table 4 compare our route length results with heuristic algorithm used in 13 .H represents heuristic algorithm proposed in 13 , d * is the shortest route length, d is an average route length, and t is the average execution time.Used graph instances with Pickup and delivery demands are available at 18 .We chose instances with positive vehicle capacity at the depot.These instances are presented in Table 4.Among tested instances, MSA and IMSA algorithms have longer route lengths, while execution times are shorter with MSA algorithm for several instances.As the number of customer increases, compared results have proportional growth of average execution time.
As illustrated in Table 4, IMSA heuristics is the algorithm that can solve 1-VRPPD and is comparable with heuristic H presented in 13 .MSA has 450% shorter execution time than H, while H provides 35% shorter route length.IMSA repeats MSA for 100 times.Thus, IMSA execution time is approximately 100 times longer than MSA.

Conclusion
In this paper, we have presented the IMSA algorithm.IMSA is an iterative approach heuristic algorithm used for solving the combinatorial optimization problem of 1-VRPPD.Both MSA and IMSA inherit features of the simulated annealing SA algorithm with different calculation of neighbor solutions.
After the suboptimal route is calculated, several local improvements along the route are possible.By using an interactive graphical user interface, a user has the ability to select a sub graph on which solution improvement method is applied.The exact permutation algorithm EPA was used as a solution improvement method.In order to have the results in reasonable time interval, selected sub graph should have less than 15 nodes, due to the time complexity of EPA.Such improvements are useful because of large search space of 1-VRPPD, since 1-VRPPD generalize VRP, which is already NP hard.As the experimental results substantiates, when the execution time is long enough or if the number of iterations is large enough, MSA and IMSA provide a good approximation to the global optimum in large search space.

Figure 8 :
Figure 8: Average route length d pixels and average execution time t ms output parameters for various graph instances with variable vehicle capacity Q values.

Figure 9 :
Figure 9: Best found route length d * pixels , average route length d pixels and average execution time t ms output parameters for various graph instances with variable n number of customers.

Table 1 :
Parameters of implemented algorithms.MSA nChanges max inner iterations, at the same temperature T ϑ , by making nChanges max random substitutions on X.At the current temperature T ϑ , the first inner iteration provides Y made with 1 random substitution over X.The second inner iteration provides another Y made with 2 substitutions over X.The last, nChanges max iteration provides another Y created from X by making nChanges max substitutions over X.In accordance with SA algorithm, at the same temperature more neighbor solutions Y are created with MSA algorithm.The current solution X is changed accordingly with the SA algorithm, for all Y solutions. in

Table 3 :
Average route lengths and execution times based on 100 experiments.

Table 4 :
IMSA algorithm output parameters compared with heuristic algorithm 13 .Resulting MSA routes are on average little longer than the IMSAs, while they are much shorter than the SAs suboptimal routes.The charts in Figures 8 b , 8 d , 8 f , 8 h , 8 j illustrate how vehicle capacity affects execution time t.Since IMSAs execution lasts much longer than SA and MSA, the execution time for IMSA is not displayed in Figures