A Graphical Visualization Tool for Analyzing the Behavior of Metaheuristic Algorithms Joaquín Pérez 1, Nelva Almanza 1, Miguel Hidalgo 1, Gerardo Vela, Lizbeth Alvarado 1, Moisés García 1, Adriana Mexicano 2, Crispín Zavala 3 1 National Research Center and Technological Development, Morelos, México 2 Technical Institute of Victoria, Tamaulipas, México 3 University of the State of Morelos, Morelos, México 1 jpo_cenidet@yahoo.com.mx 2 mexicanoa@gmail.com 3 crispin_zavala@uaem.mx Abstract This paper proposes a visualization tool for analyzing the behavior of metaheuristic algorithms. It works by reproducing graphically the solutions generated in execution time. The tool was evaluated analyzing the Hybrid Grouping Genetic Algorithm for Bin Packing (HGGA_BP). It was used to solve a benchmark with 17 instances of the one dimensional Bin Packing problem (1D-BPP). The use of the visualization tool allowed identifying some logical errors in the program code which avoided the algorithm converge in some cases to the optimal solution. After correcting errors the HGGA_BP algorithm increased its efficiency until 48%, in some cases. Keywords Metaheuristic algorithms, bin packing problem, graphical visualization tools. I. INTRODUCTION Currently there are a variety of algorithms developed to solve combinatorial optimization problems such genetic algorithms [1], simulated annealing [2], ant colony optimization [3], tabu search [4], among others [5], [6], which are heuristic-based. By its nature, the analysis of these algorithms is a difficult task. Traditionally the analysis of algorithms has been focused on efficiency [7], [8], [9], [10], performance [1], [11], [12], [13], [14], [15], [16], application of some statistical methods [17], [18], [19], or descriptive statistics [20]. Previous approaches have been insufficient to improve the algorithms. According to the literature, one promising approach is the graphical visualization of the behavior of the algorithms. In this sense, this paper presents a graphical visualization tool for analyzing algorithms that solves the 1D-BPP with the objective of improving metaheuristic algorithms. II. RELATED WORK In this section are described some tools developed to analyze graphically the behavior of some metaheuristics. Visualizer for Metaheuristics Development Framework (V-MDF) [21], [22], this tool was developed to analyze algorithms for solving the Military Transport Planning problem (MTP). The tool addresses the problem of tuning search strategies for any search strategy. Until now the tool had been applied for Tabu Search, Ant Colony Optimization (ACO), Simulated Annealing and Genetic Algorithms, it uses a Distance Radar visualization module where the human and computer can collaborate to diagnose the occurrence of negative incidents along the search trajectory on a set of training instances. This tool allows observing the behavior of the search and some dynamic changes of the search strategies. The visualizer (VIZ) [23]. VIZ is able to reproduce in animated way the behavior of any search algorithm. It had been used for visualizing the behavior of three local search algorithms (iterative local search, reactive-tabu search and stochastic local search). It allows observing: the objective value and the behavior of the objective function by means of applying fitness distance correlation. VIZ also has an event bar which allows highlight relevant information during a search. This tool allows solving the Traveling Salesman Problem (TSP), Low Autocorrelation Binary Sequence and Quadratic Assignment Problem. Several features of this tool can be found in [24], [25], [26]. TSPAntSim [27], this tool is a web-based simulation and analysis software (TSP AntSim) for solving TSP using ACO algorithms. Six different versions of ACO algorithm and two search algorithms (2-opt and 3-opt) were implemented. International Conference on Innovative Trends in Science, Engineering and Management (ITICSEM 2014), Dubai, UAE Page 32
TSPAntSim is able to combine the six metaheuristics with the two search algorithms in order to analyze the algorithm behavior when they are finding solutions. TSPAntSim provides interactive visualization with real-time analysis by showing the changes of a solution during any execution. TSPAntSim can be found in [19]. CuboidTSP [28], [27], this tool is a 3D visual tool for solving a variant to de TSP where all points (cities) and paths (solution) are on the faces of a cuboid. In order to solve the problem a hybrid method based on genetic algorithms and 2-opt to adapt the Euclidean TSP to the surface of a cuboid was developed. CuboidTSP is available at [29]. Regarding to the algorithm parameters, the tool has the option of change then manually, in order to examine different solutions. Solutions are represented as union of point through lines on the surface of a cuboid. SphereTSP [30], is a 3D visual tool, specifically designed for solving the TSP in a spherical surface. In this version of TSP, lines in plane geometry are replaced by great circles in spherical geometry as in CuboidTSP a hybrid method based on genetic algorithms and 2-opt search algorithm was used but this approach is all related to spherical surfaces. A Java-based interactive visualization tool is available in [31]. According to the literature, it was observed that tools are limited been specialized for specific types of problems, any of them in 1D-BPP. In general there are two main ways for developing graphical visualization tools; one of them, and the most relevant for this work, is oriented to the algorithm performance analysis in order to tune parameters o modify the current solution algorithms; it contributes to improve algorithms for obtaining better results [21], [23]. These two general tools have the limitation that the algorithm that is going to be analyzed has to be implemented inside the visual tool framework. The other way consists on showing in graphical form the obtained solutions; however this way is too limited when the objective is the analysis of the algorithm internal process [28], [30]. In contrast our tool is more general due to the embedded code, which is handled as an intermediary between the tool and the algorithmic implementation. Other important feature is that solution data generated by the metaheuristic can be stored in a database and it is available to be reproduced through graphical or tabular form and gives the possibility for doing SQL query executions. This tool also has the feature that is not limited to any algorithmic implementation allowing the user select the algorithm implementation to analyze. Table I highlights the interesting features of this research in comparison to related work, Tool column contains the name of each of the reviewed work, next columns represent the relevant features as a: reproduction of executions, b: use of embedded code, c: parameter storage in a database, d: tabular visualization, e:graphical visualization in execution time. The / character means that tool has the feature corresponding to the marked column. TABLE I COMPARATIVE TABLE OF RELATED WORK Tool a B c d e V-MDF / VIZ / TSPAntSim / / CuboidTSP / SphereTSP / / / / III. THE GEOGRAPHICAL VISUALIZATION TOOL The tool has three main modules, as is shown in Figure 1. The first module a) embedded code is a set of embedded code functions which have to be inserted in the metaheuristic implementation in order to analyze it. This module interacts with the database module by sending the information extracted from the implementation. Data extraction can be done in three ways; i) extracting details of the intermediate solutions, ii) extracting the solution value, and iii) extracting parameters of the test instance. The second module b) database is responsible for storing the extracted information from the metaheuristic. FIG. 1. GENERAL ARCHITECTURE OF GRAPHICAL VISUALIZATION TOOL. The third module is the graphical visualization which takes the information from database module; this module allows the user to view data for analyzing in three different ways: i) graphical performance of the metaheuristic implementation, ii) graphical intermediate solutions, and iii) tabulated intermediate solutions. The Figure 2 shows in general how the three modules inter- act. First, the user which is going to analyze a metaheuristic use the a) Embedded code in order to embed the functions for International Conference on Innovative Trends in Science, Engineering and Management (ITICSEM 2014), Dubai, UAE Page 33
extracting data, in this case the user most be an expert who knows the metaheuristic code; when the user execute the metaheuristic with the embedded code, automatically the module b) database will be storing data, which should be ready to be processed by the module c) graphical visualization in any of their three ways: i) graphical performance, ii) graphical solutions or iii) tabulated solutions. As a result, the tool gives the expert a set of visual information which can be evaluated in order to have a better understanding of the internal metaheuristic behavior and probably improve it. Figure 3 shows the graphical representation of the two relevant segments of overall performance of the algorithm. The x-axis represents the number of internal solutions generated by the algorithm HGGA_BP and the y-axis is the solution value (number of bins used to accommodate the items). It is possible to note in Figure 3 that HGGA_BP algorithm after a sequence of several solutions equal to 28, the 536 767 solution found the optimal value (represented as a triangle), despite 27 is the optimal solution, the algorithm continued iterating, the second segment shows the second time when HGGA_BP algorithm found the optimal solution (787 484 solution); however, the algorithm stops until generates a total of 877 999 internal solutions demonstrating a lack of a mechanism for maintain best found solutions. FIG. 2. INTERACTION BETWEEN MODULES. IV. COMPUTATIONAL EXPERIMENTS In order to validate the graphical visualization tool, it was evaluated analyzing the behavior of the HGGA_BP meta- heuristic algorithm [16], when it was solving the gau_1 test set of the 1D-BPP extracted from [32], [33] which has 17 instances. To test the functionality of Modules Embedded code and Database, the functions were inserted into the HGGA_BP algorithm implementation, after that, the implementation was executed with each of the 17 instances, it allowed extract and store correctly the data for each of the solutions generated by the HGGA_BP algorithm in each case. Because the HGGA_BP algorithm is evolutionary, it generates thousands of internal solutions to build the initial population and for applying mutation and crossover operators, in the following the attention will be focused on TEST0030 instance whose optimal solution was not reached by the algorithm HGGA_BP in the results reported [16]. The evaluation of the behavior of the metaheuristic was done using the Graphical visualization Module, in this case we were amazed to see that the algorithm was able to find the optimal solution more than once, however, it did not stop and continued computing solutions, for this reason the final solution did not match to the optimal solution. FIG. 3. ALGORITHM PERFORMANCE, A GRAPHICAL VISUALIZATION. FIG. 4. EXAMPLE OF A SOLUTION USING THE VISUALIZATION TOOL. International Conference on Innovative Trends in Science, Engineering and Management (ITICSEM 2014), Dubai, UAE Page 34
Finally the Tabular visualization was used to observe the items weights allocated in each bin of the solution. As example of the tabular visualization, Table II shows the four bins (column Bin) with the higher residual capacity (column r) and showing their item weights (columns w 1, w 2, w 3, w 4, w 5 ). In this case Bins 1 and 2 have only 4 item weights, Bin 3 just has 3, and Bin 4 has 5; all of them have a residual capacity of 3, 2, 1 y 1 units respectively. TEST0055a 65,141 1,783 TEST0049 6,504 197 TEST0075 53,157 1,889 TEST0054 40,172 1,265 TEST0068 46,279 1,545 TEST0014 943,152 943,152 TABLE III TABULAR VIEW Bin r w 1 w 2 w 3 w 4 w 5 1 3 3,755 3,389 1,566 1,287-2 2 4,844 3,020 1,468 666-3 1 4,723 3,746 1,530 - - 4 1 4,113 3,325 2,316 212 33 TEST0082 144,385 4,466 TEST0044 59,931 2,129 TEST0030 877,999 536,766 TEST0005 275,730 8,287 TEST0095 66,700 1,523 TEST0055b 12,526 400 TEST0084 36,792 946 TOTAL 4,177,030 2,574,649 V. RESULTS According to computational experiments it was found that HGGA_BP algorithm is able to be improved in order to get better results. While we were testing instances, it was found the optimal solution for instance TEST0030 of the set of gau_1 instances [32], [33], whose optimal solution was not found by HGGA_BP algorithm in [16]. After improving the convergence criteria of HGGA_BP algorithm, the solutions for gau_1 instances were calculated and in some cases the number of iterations was reduced. Table III shows the number of generated solutions using the HGGA_BP algorithm for each of the 17 instances, as well as the number of generated solutions solving the instances with the improved algorithm. In particular, for the instance TEST0030, the number of computed solutions was reduced from 877,999 to 536,766. In general, for the group of gau_1 instances the number of computed solutions was reduced by 48%. TABLE IIIII NUMBER OF COMPUTED SOLUTIONS FOR EACH INSTANCE Instance HGGA_BP Improved HGGA_BP TEST0022 961,579 961,579 TEST0065 97,419 97,419 TEST0097 37,032 1,122 TEST0058 452,532 10,181 VI. CONCLUSION This paper shows that it is feasible to analyze the behavior of the metaheuristics by using graphical visualization tools in order to improve them. In order to validate the visual tool a set of computational experiments were conducted obtaining satisfactory results. In particular, this work shows the experimental results of applying the graphical visualization tool in the analysis of the HGGA_BP metaheuristic algorithm using the gau_1 test instances of the 1D-BPP were used. The main obtained result was the identification of interest visual patterns in the execution of the HGGA_BP algorithm derived from the pattern knowledge, it was possible suggest improvements to the HGGA_BP algorithm. In order to contrast quantitative results, improvements were added to HGGA_BP algorithm. The improved algorithm was tested and the efficiency was incremented in 48% in some instances by means of reducing the iteration number. The proposed visual tool is particularly useful doe to next features: a) every execution and the parameter changes of metaheuristic are stored in a database; it allows the manipulation data by SQL queries and permit analyzing different stages of algorithm performance, b) the visual abstraction of the whole or specific parts of algorithm executions can be accessed for doing detailed analyzes by means of observing visual patterns, and c) it allows International Conference on Innovative Trends in Science, Engineering and Management (ITICSEM 2014), Dubai, UAE Page 35
selecting any or several interesting execution for compare o doing a further analysis. Finally, we consider the approach used in this work can be used in the development of other visual tools for analyzing algorithms that solve other combinatorial optimization problems. References [1] Holland J.H. 1975. Adaptation in Natural and Artificial Systems. The University of Michigan Press. [2] Kirkpatrick S., Gelatt C.D. and Vecchi M.P. 1983. Optimization by simulated annealing. Science Vol. 220 No. 4598, 671-680. [3] Dorigo M. 1992 Learning and Natural Algorithms. Doctoral Thesis. Dipartimento di Elettronica., Politecnico de Milano, Italy. [4] Glover F. 1986. Future paths for integer programming and links to artificial intelligence. Computers and Operations Research Vol. 13 No. 5, 533-549. [5] Maroto C., Alcaraz J. and Ruiz R. 2002. Investigación Operativa: Modelos y Técnicas de Optimización. Universidad Politécnica de Valencia. [6] Rayward S.V., Osman I., Reeves C. and Smith G. 1996. Modern Heuristic Search Methods. John Wiley & Sons. [7] Cruz L. 1999 Automatización del Diseño de la Fragmentación Vertical y Ubicación en Bases de Datos Distribuidas Usando Métodos Heurísticos y Exactos. Master Thesis. Universidad Virtual del Campus Tampico del Instituto Tecnológico y de Estudios Superiores de Monterrey, México. [8] Pérez J., Pazos R., Frausto S., Romero D. and Cruz L. 2002. Predicción del desempeño de algoritmos exactos y heurísticos: Un enfoque estadístico. I+D Computación Vol. 1, 114-127. [9] Pérez R.V. 2007 Modelado Causal del Desempeño de Algoritmos Metaheurísticos en Problemas de Distribución de Objetos. Master Thesis. Instituto Tecnológico de Ciudad Madero, Cd. Madero, México. [10] Landero V. 2008 Metodología para la Explicación Causal del Comportamiento y Desempeño de Algoritmos Heurísticos Aplicados al Problema de Bin Packing. Doctoral Thesis. Centro Nacional de Investigación y Desarrollo Tecnológico, México. [11] Barr R., Golden B., Kelly J., Resende M. and Stewart W. 1995. Designing and reporting on computational experiments with heuristics methods. Journal of Heuristics Vol. 1, 9-32. [12] Cohen P.R. 1995. Empirical Methods for Artificial Intelligence. The MIT Press. [13] McGeoch C.C. 2002. Experimental Analysis of Algorithms. Handbook of Global Optimization, 489-513. [14] Lemeire J. and Dirkx E. 2004. Causal models for parallel performance analysis. [15] Lemeire J. 2007 Learning Causal Models of Multivariate Systems and the Value of It for the Performance Modeling of Computer Programs. Doctoral Thesis. Vrije Universiteit Brussel, Belgium. [16] Quiroz C.M. 2009 Caracterización de Factores de Desempeño de Algoritmos de Solución de Bin Packing. Master Thesis. Cd. Madero, México. [17] Tukey J.W. 1977. Exploratory Data Analysis. Addison-Wesley. [18] Hartwig F. and Dearing B.E. 1979. Exploratory Data Analysis. Sage Publications Inc. [19] Ugur A. and Aydin D. 2012. TSPAntSim. Available: http://yzgrafik.ege.edu.tr/projects/tspantsim/ [20] Álvarez V.H. 2006 Modelo para Representar la Complejidad del Problema y el Desempeño de Algoritmos. Master Thesis. Instituto Tecnológico de Ciudad Madero, Cd. Madero, México. [21] Halim S., Wan H. and Hoong L. 2005. Tuning tabu search strategies via visual diagnosis. In Proceedings of the 6th Metaheuristics International Conference, Vol. 39, 630-636. [22] Halim S., Hock R. and Hoong L. 2007. An integrated white+black box approach for designing and tuning stochastic local search. In Proceedings of Principles and Practice of Constrained Programming (CP), Vol. 4741, 332-347. [23] Halim S., Hock R. and Hoong C.L. 2006. Visualization for analyzing trajectory-based metaheuristic search algorithms. In Proceedings of Poster Paper of European Conference on Artificial Intelligence (ECAI). [24] Halim S., Hock R. and Hoong L. 2006. Viz: a visual analysis suite for explaining local search behavior. In Proceedings of the 19 th Annual ACM Symposium on User Interface Software and Technology. [25] Halim S., Hock R. and Halim F. 2008. Engineering stochastic local search for the low autocorrelation binary sequence problem. In Proceedings of Principles and Practice of Constraint Programming (CP), Vol. 5202, 640-645. [26] Halim S. and Hock R. 2007. Designing and tuning sls through animation and graphics an extended walk-through. In Proceedings of SLS: Stochastic Local Search Workshop, 16-30. [27] Ugur A. and Aydin D. 2009. An interactive simulation and analysis software for solving TSP using ant colony optimization algorithms. In Proceedings of Advances in Engineering Software, Vol. 40, 341-349. [28] Ugur A. 2008. Path planning on a cuboid using genetic algorithms. Information Sciences, Vol. 178, No. 16, 3275-3287. [29] Aybars U. 2014. CuboidTSP Version 2.0. Available: http://yzgrafik.ege.edu.tr/ugur/cuboidtsp [30] Ugur A., Korukolu S., Caliskan A., Cinsdikici M. and Alp A. 2009. Genetic algorithm based solution for tsp on a sphere. Mathematical and Computational Applications, Vol. 14, No. 3, 219-228. [31] Ugur A. 2014. SphereTSP. Available: http://yzgrafik.ege.edu.tr/ugur/spheretsp [32] Special Interest Group on Cutting and Packing. 2013. Esicup. Available: http://paginas.fe.up.pt/esicup/tikilistfilegallery.php?galleryid=1 [33] Schoenfield J.E. 2002. Fast, exact solution of open bin packing problems without linear programming. In US Army Space & Missile Defense Command. International Conference on Innovative Trends in Science, Engineering and Management (ITICSEM 2014), Dubai, UAE Page 36