Recent Researches in Mathematical Methods in Electrical Engineering and Computer Science

Software Framework for with Hybrid Algorithms

S.MASROM1, A.M. NASIR2 Malaysia Institute of Transport (MITRANS) Faculty of Computer and Mathematical Science Universiti Teknologi MARA, PERAK, MALAYSIA [email protected] [email protected]

SITI.Z.Z.ABIDIN A.S.A. RAHMAN Faculty of Computer and Mathematical Science Computer and Information Science Department Universiti Teknologi MARA, MALAYSIA Universiti Teknologi PETRONAS, MALAYSIA [email protected] [email protected]

Abstract: - The objective of vehicle routing problem (VRP) is to design a set of vehicle routes in which a fixed fleet of delivery vehicles from one or several depots to a number of customers have to be set with some constraints. To this date in the literature, many instances of VRP model have been introduced and applied for various types of scheduling problems. However, when implemented in a real life application, the VRP models proved to be very complex and time consuming, especially in the development phase. It is due to the fact that there are technical hurdles to overcome such as the steep learning curve, the diversity and complexity of the algorithms. This paper presents a generalize software framework for an effective development of VRP models. The software framework presented here is hybridized algorithm of two namely as Particle Swarm Optimization (PSO) and Genetic Algorithm (GA). The hybrid algorithm is used to optimize the best route for the vehicles that also incorporates a mechanism to trigger swarm condition for PSO algorithm. In order to test the functionality of the software framework, the applications of Pickup and Delivery Problem with Time Windows (PDPTW) and Vehicle Routing Problem with Time Windows (VRPTW) are developed based on the software framework. Experiments have been carried out by running the hybrid PSO with the VRPTW and PDPTW benchmark data set. The results indicate that the algorithm is able to produce significant improvement mostly to the PDPTW.

Key-Words: - Software framework, Vehicle Routing Problem, Particle Swarm Optimization, Genetic Algorithm, Mutation, Hybridization.

1 Introduction Colony Optimization (ACO)[5], Particle Swarm Optimization (PSO)[6], [7] and The vehicle routing problem (VRP) [1] is a popular [8]. and well-studied combinatorial optimization In the development of metaheuristic algorithms, problem. It is an intensive research area because of there are some difficulties involved in the design its usefulness to the logistics and transportation and implementations. In order to shorten the industry. Real world instances of the VRP are more development life cycle for metaheuristics based complicated which may involve a thousand of application, researchers may rely on open source customer locations and many complicated software packages for metaheuristic algorithms. constraints. The necessity for fast and good optimal However, based on the literature, it is found that the solution has directed many researchers to look available software packages are not originally seriously into metaheuristic based technique. By designed for VRP based models. Modification and using metaheuristic, remarkable results can be amendments are required to make the software achieved [2-3]. Some examples of metaheuristic packages relevant to the specific VRP models. algorithms are Genetic Algorithm (GA)[4], Ant Another difficult task is to design and implement

ISBN: 978-1-61804-051-0 55 Recent Researches in Mathematical Methods in Electrical Engineering and Computer Science

appropriate solution representation for VRP with significant improvements to the VRP optimal regard to the specific metaheuristics data structure. solutions. As for example, a combination of PSO These processes also require in-depth understanding with multiple phase neighborhood search and greedy on the programming language, inner and working randomized adaptive search (MPNS-GRASP) has structure of the software packages. been effectively solved VRP problem[14]. The In addition, many of the available software purpose of this hybridization is for expanding the packages were originally designed for only a single neighborhood strategy in PSO. In another work, metaheuristic algorithm. In many cases of complex PSO has also been hybridized with ACO for problem such as VRP, hybridization of performance improvement [13]. This technique is metaheuristic is sometime necessary. Metaheuristic proven to be effective when it is used in the hybridization is an improvement algorithm process implemention of VRP for grain logistic. A method to the original metaheuristic algorithm. It is proven that combines PSO with local search and simulated by various empirical experiments that metaheuristic annealing is another technique for PSO hybridization techniques are very promising in hybridization. The computational experiments have providing fast and high optimal solutions [9-11]. showed that the proposed algorithm is feasible and With the limitation issues in software packages, effective for capacitated vehicle routing problem, this research is initiated with the focus on various especially for large scale problems [10]. aspects of the design and implementation for VRP models and its metaheuristics hybridization. The 2.2 Software framework for metaheuristics selected metaheuristic algorithms are PSO and GA. and VRP These two algorithms have been widely applied for The development of programming code for various kinds of VRP problems [12-14]. optimization problem like VRP and its metaheuristic The remaining content of this paper is organized algorithm from scratch has been considered as as follows; Section 2 presents the related works on complex [22-23]. The process will have to go metaheuristics and available software packages for through huge works especially to those with no VRP. Section 3 describes the proposed software fundamental knowledge on computer programming framework including its architecture and concept and languages such as C, C++, C# and hybridization technique. Then, the computational results for two instances of VRP models are given in JAVA. Section 4. Lastly, Section 5 concludes the paper Recently, several software packages have been developed with concern on reducing the with a short summary. development complexity and phase cycle.

Researchers may use the freely available and widely

used Concorde package[24]. It is an exact solver for 2 Related works the travelling salesman problem (TSP), the most To this date of literature, a lot of research works related model to VRP. Another type for TSP is Lin- have been undertaken on solving VRP models by Kernighan-Helsgaun(LKH) package developed by using metaheuristic algorithms. The implementation Hesgaun [25]. However, this software package is not complexity in metaheuristic algorithms and its supported by metaheuristic algorithms. hybridization has directed researchers’ attention to Some of the available software packages with use available software packages. However, the metaheuristic algorithms are METASIS [26], number of software framework for VRP application EasyLocal++ [27], [28] and HeuristicLab with metaheuristic algorithm is very limited. [29]. All of these software packages are not originally designed for VRP models. Moreover, 2.1 Metaheuristics for VRP many of them were developed for single In recent years, the numbers of works that meteheuristic implementation. implementing VRP based application with metaheuristic algorithm is increasing. A variant of VRP problems have been successfully solved by 3 The Software Framework using GA [11, 15-16] , ACO [9, 17-18] , Tabu The software framework has been developed by search [15, 19-20] and also with PSO[12, 21]. using JAVA programming language. Generally, the Based on the literature, it can be seen that most architecture is composed of front and back end of the metaheristics techniques on VRP were components. The front end provides user interface concentrated on metaheuristic hybridization rather for application configurations while all the software than the single algorithm implementation [9-11]. engines are located at the back end. Fig. 1 illustrates The metaheuristic hybridizations have shown the architecture of the software framework.

ISBN: 978-1-61804-051-0 56 Recent Researches in Mathematical Methods in Electrical Engineering and Computer Science

according to the method introduced by Ai & Front End Back End InterfaceVRP module Problem Kachitvichyanukul [30]. Fig. 2 shows the solution configuration engine representation.

Hybrid engine n = 8 customers Algorithm PSO configuration (1) (2) (3) (4) (5) (6) (7) (8) 0.5 0.9 0.4 0.3 0.8 0.2 0.1 0.7

GA + operator (5) (6) (7) (8) 1.1 1.6 1.4 1.0 Database configuration Database engine m = 2 vehicles 2m = 4 dimensions Vehicle

Customer Fig. 2: Solution representation for each particle

In this method, every particle’s position in PSO is divided into (n+2m) dimension and each Fig. 1: Software architecture dimension is encoded as a real number. The first n dimensions represent the number of customers and the last 2m dimensions are related to the number of 3.1 Front end components vehicle with its reference point in Cartesian map. A The front end provides interfaces for experiment number of two dimensions are dedicated for each configurations including problem, algorithm and vehicle as a reference point. database setting. In the problem configuration, Developing a set of customer routes for vehicles users can choose the predefined VRP models such is an important procedure in problem formulation as Pickup and Delivery VRP with Time Windows engine. The procedure is different for every VRP (PDPTW), VRP with time windows (VRPTW), VRP model. The sum of total cost for all routes with a with split delivery and multiple depots VRP. set of constraints will be passed over to the The hybridization technique can be defined algorithm engine. through algorithm configuration components. An important configuration is to select operators from 3.2.2 Hybrid engine the GA to be incorporated into the PSO algorithm. Hybrid engine is the component for optimization Other configurations consist of basic PSO process. It uses PSO as the master algorithm and parameters such as coefficient acceleration (c1 and GA as the subordinate algorithm. The GA provides c2), population size, particle dimension, iteration several operators to be used by PSO including time, position range and velocity range. selection, crossover and mutation operators. In order to be connected to a specific database of Selection of operators can be done at the front end a particular VRP application, database interface is component. provided for files browsing purposes. The interface In every population generation of PSO, each is also designed to facilitate data entry and velocity of particle has to move towards the best manipulation of process on vehicles and customers fitness based on the information of previous information. experience which consists of previous velocity, personal best position of each particle, and 3.2 Back end components global best position of the swarm. Afterward, At the back end, three major components have been the particle position will be adjusted according developed for the software framework. These to the latest velocity. components are problem formulation, hybrid algorithm and database engines. Before advancing to the next evaluation process, the condition of particle will be 3.2.1 Problem engine examined and determined. The idea behind this All the predefined classes for VRP models and its process is adapted from the PSO Triggered variant are located in the problem formulation Mutation algorithm introduced by You & Ying engine. In this component, the general PSO solution [31]. A particle is considered healthy if it has representation for all VRP has been defined

ISBN: 978-1-61804-051-0 57 Recent Researches in Mathematical Methods in Electrical Engineering and Computer Science found a new personal best position at the from the software framework. The experiments run current iteration. The number of particles with on a personal computer with Intel Pentium 1.20 personal best improvement will be identified GHz-3GBRAM and processing under Windows 7. from the swarm population. When a certain A total of 20 runs for each case are conducted and percentage of particles in the swarm population an average result is obtained. The algorithm configuration is listed in Table 1. are not healthy, the population condition can be Table 1: Parameter setting considered as unhealthy and not strong. In this Parameter Value condition, the particles have fallen into local Number of particle 100 optima and stagnated. Number of iteration 1000 Every time of iteration, the occurrence of Inertia weight,w Linear decreasing from 0.9 to 0.4 unhealthy condition is counted. If the counted Xmin 0 number is bigger than a certain number of iterations, Xmax,Vmax 100 the swarm is ready for mutation process. The Personal and global acceleration 2 purpose of mutation operation is to change slightly Healthy percentage 60% the value of particles’ positions so that it will Unhealthy occurrence 3 increase the possibility of many potential solutions mutation rate 0.2 to be explored. A variety type of mutation operations have been proposed for PSO 4.1 Benchmark problem instance algorithm[32]. However, the operations are not The Solomon’s [34] and Li &Lim [19] benchmark really suitable and not specific for VRPTW data set are used respectively for the VRPTW and solutions. In VRPTW solutions, the customer PDPTW applications. Both Solomon and Li &Lim priority position is hardly dependent on the data is comprised of variety problem situations such initialization position. So, mutating at random as customer location, vehicles information, particle position will change the customer priority customers’ demand and corresponding time arrangement. It will cause to result inferiority to windows. However, in Li & Lim dataset, it is solutions. So, in the hybrid PSO (HPSO), the included with pickup and delivery data series. Table mutation is done on the vehicle location or reference 2 lists the criteria for all data sets. The C1, C2, R1 point. The formula for mutation operation is and RC are all Solomon data sets while Li & Lim is vi vi += represented with LC1, LC2, LR1 and LRC1. The tid )( XX tid )( pgaussian )( (1) short horizon is to represent less than 10 routes and The gaussion(p) function returns a random long horizon used to describe more than 30 routes. number drawn from a Gaussian distribution with a All instances are tested on 100 number of customers. standard deviation of p. The value of p is 0.1 times the length of dynamic range of the particle Table 2: Solomon data set dimension [33]. This is to ensure that the vehicle Data set Distribution Horizon Vehicle reference point for each vehicle is within the search capacity vector. C1,LC1 Clustered Short 200 C2,LC2 Clustered Long 700 3.2.3 Database engine R1,LR1 Random Short 200 The database engine is a database management RC1,LRC1 Random Short 200 clustered system (DBMS) used to create, read, update and delete records. It is included with application programming interface (API) that allows user to 4.2 Performance metrics interact with its underlying engine. In the software The results are measured primarily on three framework, MySQL has been used as database performance metrics namely as number of vehicles engine and the database is composed of vehicle, (NV), best distance and computational time. These depot and customer records. values are compared with the best known solutions from Solomon [34] and Li & Lim[19] .

4 Experiments and Results 4.3 Results Computational experiments have been conducted to Based on the results in Table 3, the HPSO evaluate the performance of the Hybrid PSO algorithm used in the software framework is capable (HPSO) for solving two different kinds of VRPTW to produce shorter distance than the Solomon best [34] and PDPTW [19] that have been generated distance. The improvements can be seen in all cases of VRPTW, extremely to the random (R)

ISBN: 978-1-61804-051-0 58 Recent Researches in Mathematical Methods in Electrical Engineering and Computer Science distribution (more than 60%). However, the HPSO 5 Conclusions algorithm could not reduce the number of vehicle This paper presents a software framework that offers used in all cases. The figures are similar with effective implementation of VRP instances by using Solomon’s vehicle numbers. hybrid PSO. The developments of VRPTW and PDPTW have demonstrated the capability of the Table 3: Computational results for VRPTW software framework. From the empirical results, it Prob. NV HPSO Best Best Error can be revealed that the hybrid method from the NV known (%) C101 10 820.1 10 827.3 0.15 software framework is proved to be more effective C102 10 820.2 10 827.3 0.18 than the best known solutions of benchmark C201 3 553.6 3 589.1 0.2 problems. In some of the PDPTW instances, the C202 3 574.3 3 589.1 0.21 numbers of vehicles are smaller than other methods. R101 20 1035.8 20 1637.7 0.25 This translates into cost reduction in the vehicle R102 18 918.5 18 1466.6 0.28 maintenance as well as drivers involvement. RC 101 15 1518.5 15 1619.8 0.27 RC 102 14 1175.3 14 1457.4 0.32

Table 4 has showed that all problem instances of Acknowledgements PDPTW have gained some improvement in the The authors would like to thank Kementerian optimum solutions (distance) by using HPSO. Pengajian Tinggi Malaysia and Universiti Teknologi Similar to VRPTW, an apparent achievement can be MARA for their financial support to this project. seen from the random distribution (R1) customers. But, the achievement is slightly lower than VRPTW instances with only about 50% improvement. On the References: contrary, most of the random and random clustered [1] G. B. Dantzig and J. H. Ramser, "The Truck instances in PDPTW have a smaller number of Dispatching Problem," Management Science, vehicles when using HPSO. vol. 6, pp. 80-91, 1959. [2] C.-H. Lin, et al., "Genetic Algorithm for Table 4: Computational results for PDPTW Shortest Driving Time in Intelligent Prob. NV HPSO Best Best Error Transportation Systems," International Journal NV known (%) of Hybrid Information Technology, vol. 2, pp. LC101 9 820.3 10 828.94 0.21 21-30, 2009. LC102 9 820.6 10 828.94 0.25 LC201 3 552.7 3 591.56 0.28 [3] P. R. Srivastava and T.-h. Kim, "Application of LC202 3 574.1 3 591.56 0.27 Genetic Algorithm in Software Testing," LR101 18 950.7 19 1650.78 0.21 International Journal of Software Engineering LR102 16 764.3 17 1487.57 0.28 and its Applications, vol. 3, pp. 87-96, 2009. LRC101 14 1517.3 14 1708.80 0.27 [4] M. Affenzeller, et al., Genetic Algorithms and LRC102 12 1172.8 13 1563.55 0.32 Genetic Programming - Modern Concepts and Practical Applications.: CRC Press, 2009. As shown in Table 5, the computational time for [5] M. Dorigo and T. Stutzle, Ant Colony implementing HPSO in both VRPTW and PDPTW Optimization: MIT Press Ltd., 2004. instances can be slightly longer than the original [6] M. Clerc, Particle Swarm Optimization: ISTE, PSO. However, the average time taken for PDPRW 2006. instances is a little bit shorter than the VRPTW [7] F. Glover and M. Laguna, Tabu Search. instances with 0.75 different. Boston.: Kluwer Academic, 1998. [8] P. J. M. V. Laarhoven and E. H. L. Aarts, Table 5: Computational time (CT) in second Simulated Annealing: Theory and Applications VRPTW PDPTW (Mathematics and Its Applications): Kluwer Prob. PSO HPSO Prob. PSO HPSO Academic Publishers Group, 1988. C101 125 140 LC101 119 136 [9] X. Zhang and L. Tang, "A new hybrid ant C102 125 140 LC102 120 138 colony optimization algorithm for the vehicle C201 138 145 LC201 137 140 routing problem," Pattern Recognition Letters, C202 137 143 LC202 138 140 R101 124 138 LR101 125 139 vol. 30, pp. 848-855, 2009. R101 122 138 LR102 126 140 [10] A. L. Chen, et al., "Hybrid discrete particle RC 101 123 137 LRC101 119 140 swarm optimization algorithm for capacitated RC 102 125 137 LRC102 152 139

ISBN: 978-1-61804-051-0 59 Recent Researches in Mathematical Methods in Electrical Engineering and Computer Science

vehicle routing problem," Jounal of Zhejiang international conference on Applied computer University Science A, vol. 7, pp. 607-614, 2006. science 2009, pp. 80-84. [11] L. Guiyun, "Research on Open Vehicle [22] S. Wagner, et al., "Benefits of Plugin-Based Routing Problem with Time Windows based on Heuristic Optimization Software Systems " in Improved Genetic Algorithm," in International Computer Aided Systems Theory – EUROCAST Conferences on Computational Intelligence and 2007. vol. 4739, R. M.-D. ı. e. al., Ed., ed: Software Engineering, 2009. , Wuhan, China, Springer Berlin / Heidelberg, 2007, pp. 747-754. 2009, pp. 1-5. [23] Jos, et al., "Using metaheuristic algorithms [12] T. J. Ai and V. Kachitvichyanukul, "Particle remotely via ROS," in Proceedings of the 9th swarm optimization and two solution annual conference on Genetic and evolutionary representations for solving the capacitated computation, London, England, 2007. vehicle routing problem," Computers & [24] D. A. Bixby, et al., The Traveling Salesman Industrial Engineering, vol. 56, p. 380, 2009. Problem: A Computational Study: Princeton [13] Y. Zhu, et al., "Hybrid Particle Swarm University Press, 2006. Algorithm for Grain Logistics Vehicle Routing [25] K.Helsgaun, "An effective implementation Problem," in Third International Symposium on of the Lin-Kernighan traveling salesman Intelligent Information Technology Application, heuristic," European Journal of Operational Nanchang, China, 2009, p. 364367. Research, vol. 126, pp. 106-130, 2000. [14] Y. Marinakis and M. Marinaki, "A hybrid [26] G. Ranjan, et al., "METASIS: A meta genetic - Particle Swarm Optimization heuristic based logic optimizer," in Circuits and Algorithm for the vehicle routing problem," Systems, 2007. MWSCAS 2007. 50th Midwest Expert System with Applications, vol. 37, pp. Symposium on, 2007, pp. 1501-1504. 1446-1455, 2010. [27] L. D. Gaspero and A. Schaerf, [15] B. Ombuki-Berman and F. T.Hanshar, "EASYLOCAL++: an object-oriented "Using Genetic Algorithms for Multi-depot framework for flexible design of local search Vehicle Routing," in Bio-Inspired Algorithm for algorithms," Software -Practice and Experience, the Vehicle Routing Problem, F. B. Pereira and vol. 00, pp. 1-34, 2003. J.Tavares, Eds., ed: Springer-Verlag Berlin [28] S. Cahon, et al., "ParadisEO : A framework Heidelberg, 2009, pp. 77-99. for the reusable design of parallel and [16] H.C.W.Lau, et al., "Application of Genetic distributed metaheuristics," Journal of Algorithms to solve the Multidepot Vehicle Heuristics - Special Issue on New Advances on Routing Problem," IEEE Transactions on Parallel Meta-Heuristics for Complex Automation Science and Engineering, vol. 7, pp. Problems, vol. 10, pp. 357-380, 2004. 383-392, 2010. [29] S. Wagner and M. Affenzeller, [17] Y. Gajpal and P. Abad, "An ant colony "HeuristicLab: A Generic and Extensible system (ACS) for vehicle routing problem with Optimization Environment " in Adaptive and simultaneous delivry and pickup," Computers & Natural Computing Algorithms, B. Ribeiro, et Operations Research, vol. 36, pp. 3215-3223, al., Eds., ed: Springer Vienna, 2005, pp. 538- 2009. 541. [18] J. E.Bell and P. R.McMullen, "Ant colony [30] T. J. Ai and V. Kachitvichyanukul, "A optimization techniques for the vehicle routing particle swarm optimization for the capacitated problem," Advance Engineering Informatics, vehicle routing problem," International Jounal vol. 18, pp. 41-48, 2004. of Logistic and SCM Systme, vol. 2, pp. 50-55, [19] H. Li and A. Lim, "A metaheuristic for the 2007. pickup and delivery problem with time [31] Z. You and T. Ying, "Particle swarm windows," in Tools with Artificial Intelligence, optimization with triggered mutation and its Proceedings of the 13th International implementation based on GPU," in Proceedings Conference on, 2001, pp. 160-167. of the 12th annual conference on Genetic and [20] A.-S. Pepin, et al., "A comparison of five evolutionary computation, Portland, Oregon, heuristics for the multiple depot vehicle USA, 2010. scheduling problem," Journal of Scheduling, [32] P. S. Andrews, "An Investigation into vol. 12, pp. 17-30, 209. Mutation Operators for Particle Swarm [21] D. Ponce, "Bio-inspired metaheuristics for Optimization," in IEEE Congress on, the vehicle routing problem," in The 9th WSEAS Evolutionary Computation, 2006. CEC 2006., pp. 1044-1051.

ISBN: 978-1-61804-051-0 60 Recent Researches in Mathematical Methods in Electrical Engineering and Computer Science

[33] N. Higashi and H. Iba, "Particle swarm optimization with Gaussian mutation," in Proceedings of the IEEE Swarm Intelligence Symposium, 2003. SIS '03., pp. 72-79. [34] M. Solomon, "Algorithms for the vehicle routing and scheduling problems with time window constraints," Operation Research, vol. 35, pp. 254-265, 1987.

ISBN: 978-1-61804-051-0 61