Metaheuristics in Optimization: Algorithmic Perspective
Share:

Srinivasan Balan North Carolina State University 
The key motivation of metaheuristics is to find a goodenough solution to an optimization problem. In this article, some stateoftheart metaheuristics algorithms along with illustrative examples will be demonstrated.
Introduction
The computer science and operations research communities have been striving to solve complex, largescale realworld problems. In the previous article (Fall 2020), I described the fundamental algorithms that changed scientific computing in mathematics, computer science, and operations research. While solving a largescale problem, finding a feasible solution and improving the solution to converge to the optimal global solution is necessary. However, finding exact solutions is difficult because resources are constrained, and most of the optimization problems are complex. Metaheuristic can solve this difficulty by offering approximate solutions.
Comprehending computational complexity is crucial to reap the benefits of metaheuristic. In computational complexity theory, we know only a few algorithms that are guaranteed to converge to optimality in reasonable run time (polynomial timealgorithms). However, many realworld problems are NP (nondeterministic). i.e., given a solution to the problem, we can verify the solution in a reasonable amount of time. Is P ≠ NP? Finding polynomialtime algorithms for the NPcomplete problems is still in progress. NPcomplete problems are the hardest in NP. If any NPcomplete problem is Ptime solvable, then all problems in NP are ptime solvable.
This article is inspired by the previous article on "Algorithms that changed the world" in the Fall 2020 issue. In continuation to this, I share the top five metaheuristic algorithms (Genetic Algorithm, Simulated Annealing, Tabu Search, Swarm Intelligence Algorithm, Variable Neighborhood Search) to solve complex optimization problems that are difficult to solve to optimality using traditional optimization techniques.
Metaheuristic algorithms
A metaheuristic algorithm is a search procedure designed to find, a good solution to an optimization problem that is complex and difficult to solve to optimality. It is imperative to find a nearoptimal solution based on imperfect or incomplete information in this realworld of limited resources (e.g., computational power and time). The emergence of metaheuristics for solving such optimization problems is one of the most notable achievements of the last two decades in operations research.
There are challenges that call for attention to develop better solutions over existing traditional approaches. Different metaheuristic algorithms are described by authors that are pretty extensive to various applications to solve nonlinear nonconvex optimization problems. In combinatorial optimization, it is impossible to solve specific problems that are NPhard (i.e., in reasonable run time). Thus, metaheuristics can often find good solutions with less computational effort than optimization algorithms, iterative methods, and simple greedy heuristics. There are different varieties of problems that are impractical to solve using an optimization algorithm to global optimality. For example, an optimization problem becomes complex when there are stochastic random variables present in the objective or constraints. Hence, it is not easy to solve largescale stochastic programs using stochastic programming or robust optimization techniques.
Metaheuristic can play a key role in different domains. In essence, many optimization problems are multiobjective functions with nonlinear constraints. For instance, most of the engineering optimization problems are highly nonlinear that demand solutions to multiobjective problems. On the other hand, artificial intelligence and machine learning problems rely heavily on large datasets, and it is difficult to formulate the optimization problem to solve for optimality. Therefore, metaheuristics play a significant role in solving practical problems that are difficult to solve using conventional optimization methods.
Metaheuristic algorithms are classified based on how they operate over the search space [3] such as natureinspired vs. nonnatured inspired, populationbased vs. single point search, dynamic vs. static objective functions, one vs. various neighborhood structures, memory usage vs. memoryless methods. The purpose of this article is not to compare search and optimization techniques. Nevertheless, it is critical to question whether conventional search methods meet robustness requirements. Metaheuristics are suitable for both exploitation and exploration of the solution space.
Now, let us explore some metaheuristic algorithms. In addition to their algorithmic perspective, a reallife scenario of emergency response allocation of marine accidents and the application of metaheuristics will be exemplified.
Genetic Algorithm
The genetic algorithm (GA) is a metaheuristic motivated by the evolutionary process of natural selection and natural genetics. The algorithm [9] combines the fittest's survival among string structures with a structured yet randomized information exchange to form a search algorithm. The key aspect of genetic algorithms is the balance between efficiency and efficacy necessary for survival in different harsh competitive environments.
Genetic algorithms are theoretically and empirically proven to provide robust searches in complex spaces. In GA, a pool of initial solution sequences is generated and stored in a population pool. These sequences represent the genetic representation of a solution domain. A fitness function that describes a solution value of the objective function is determined. Using a selection operator, twoparent solutions from the population undergo genetic operators such as crossover and mutation with an associated probability. The parent chromosomes generate offspring chromosomes by crossover operator to represent child solutions, namely child1 and child2. These offspring chromosomes undergo a mutation (swapping of Alleles) operator. The fitness function (objective) is evaluated for the children's solution, and the population is updated based on the betterness (Elitism) of the fitness function. The algorithm is repeated until maximum generations or by a stopping condition. Generally, the solution sequences are encoded in either binary or bit string structure to represent the solution.
Consider an example of allocating response vessels (e.g., rv_{1}, rv_{2}, rv_{3}, rv_{4}, and rv_{5}) in a few accident scenes, say s_{1}, s_{2}, s_{3}, s_{4} and s_{5}. The sequence's chromosome representation would be [s_{1} − s_{3} − s_{4} − s_{2} − s_{5}]. The "Child" represents the proposed "Accident Scenes" to assign "Response Vessels". There are several types of crossover operators used in GA. Crossover operators such as single point crossover, twopoint crossover, kpoint crossover, prioritybased encoding, and uniform crossover are widely used. A sample onepoint crossover is shown below that may split the parent chromosome at a certain point.
Response Vessels  rv_{1}  rv_{2}  rv_{3}  rv_{4}  rv_{5}  
Parent (Accident Scenes)  s_{1}  s_{2}  s_{3}  s_{4}  s_{5}  
Child  s_{4}  s_{5}  s_{1}  s_{2}  s_{3}  (Crossover) 
Child  s_{4}  s_{5}  s_{3}  s_{2}  s_{1}  (Mutation) 
In mutation, one of the child sequences is swapped, such as s_{1} is swapped with s_{3}. The stopping condition depends on the type of combinatorial optimization problem. Generally, maximum generations and maximum run time is considered as stopping criteria. However, stopping conditions can be based on stall time and maximum stall generations. A generic process flow of the development of the Genetic Algorithm is shown in Algorithm 1.
Some of the applications of GA are feature selection and hyperparameter tuning in machine learning, gametheory applications, scheduling problems, molecular structure optimization, nonlinear programming, and financial mathematics. A response vessel allocation model using GA is proposed in [14] to support the oil spill contingency plan.
Algorithm 1: Genetic algorithm 
Simulated Annealing
Simulated annealing (SA) [12] is primarily inspired by the annealing: heating and controlled cooling operation in metallurgy.
A generic process flow of the SA algorithm is shown in Algorithm 2. A neighborhood solution (s) is generated using a local search procedure using an initial seed (s_{0}) and temperature. The fitness value of the objective function is evaluated for this seed and neighborhood solution. Let δ be the difference between the fitness function values. If δ < 0, the neighbor solution is accepted, else, the neighbor solution is accepted with a Boltzmann probability density of $e^{(\frac{\delta}{T})}$. Thus, both exploitation (extensive search in a previously known search space) and exploration (explore new opportune wider search spaces) are deployed over the search space. In the process of cooling, the algorithm converged to an approximate solution, escaping from local optima to find the nearoptimal solution. This slow cooling implemented in the SA algorithm is interpreted as an exploration process that involves a slight decrease in the probability of accepting worse solutions when the solution space is explored. In summary, the SA algorithm behaves like a hillclimbing heuristics but with more power not to get stuck in the local optima [19].
Algorithm 2: Simulated Annealing algorithm 
Although SA usually achieves an approximate solution to the global minimum, it could be enough for many practical problems and implementation. Applications of SA include traveling salesman problems, graph coloring problems, vehicle routing and extensions, verylargescale integration and computer design, and scheduling problems. Several variants of SA proposed by authors are quantum annealing, dualphase evolution, stochastic tunneling, and parallel tempering. Optimal ship routing can be proposed using SA [13] that minimized the time of voyage and maximize the safety of voyage.
Tabu Search
Tabu search (TS), another metaheuristic algorithm, is based on the memory structures and uses local search methods to find a potential solution by checking its neighbors to find a better solution [8]. Generally, local search methods get stuck in suboptimal regions. TS enhances the search process by restricting (henceforth the term Tabu) the same solution's recurrence from coming back to previously visited solutions. TS has many similarities with SA, and both involve hill climbing and exploration possibilities. The memory structure defines a set of rules used to filter solutions from the neighborhood search. More commonly, a Tabu list consists of solutions defined by Tabu tenure (number of iterations) that the solution remains in the solution bucket. The memory structures used in TS can be divided into three categories [7]:
Short term memory: If a potential solution appears in the Tabu list, it cannot be revisited until it reaches Tabu tenure
Intermediate memory: Intensification rules are used to improve the search spaces
Long term memory: Diversification rules that drive the search into new regions. A reset is applied if the solution gets stuck in a plateau or suboptimal region
A simple local search algorithm is shown below in Algorithm 3. TS uses a local search or a nearest neighborhood (greedy) search procedure to move from one potential solution iteratively, s_{0} to an improved solution s by a simple operation σ in the neighborhood s_{0}, until some stopping criterion has been satisfied. Many local search heuristics are available in practice, including steepest descent, 2opt, 3opt, Ropt, nearest neighbor, and random descent.
Algorithm 3: Local Search algorithm [19] 
The algorithm is initiated by random initialization and solutions. In each iteration, a new solution is found by making local movements over the current solution. The neighbor solution is the best among all (or a subset of) possible solutions in the neighborhood using operator N(σ). In the exploration process, recently visited solutions should not be visited, thereby maintaining a tabu list in order to strict the solution movement in the local search process. Therefore, we have a dynamic neighborhood compared to the static neighborhood obtained by other local search algorithms. Typically, there are three kinds of tabu lists maintained using memory structures: 1) A long term memory that hold the history through all the exploration process and reset the search process getting stuck in local optima, 2) an intermediate memory to improve the search space and 3) a short term memory to keep the most recently visited solutions as tabu movements.
Tabu search is very efficient and escapes from the local solution to find the nearoptimal solution. Some of the applications of solving combinatorial problems using Tabu search are Scheduling, communications path assignment, graph coloring, graph partitioning, job shop scheduling, neural network pattern recognition, and routing problems [7]. The optimal allocation of berth, similar to a car park, for ships is proposed in [4] using the Tabu Search algorithm.
Algorithm 4: Tabu Search algorithm 
Swarm Intelligence Algorithms
Swarm Intelligence Algorithms are inspired by bird flocking's social behavior, animal herding, bacterial growth, and fish schooling. Swarm intelligence systems, initially developed within cellular robotic systems [1], are typically made up of a population of simple agents interacting locally with one another and with their environment. Researchers propose several natureinspired swarm intelligence algorithms to solve a combinatorial problem to a nearoptimal solution. Algorithms such as ant colony optimization [5], particle swarm optimization (PSO) [11], bee colony optimization, cuckoo search are some of the wellknown algorithms under swarm intelligence.
PSO [11] is a populationbased evolutionary algorithm in which the best solution can be represented as a vector in an ndimensional space. In every iteration, the velocity (v_{ij}) and the position (x_{i}) of the particles are controlled to converge to the nearoptimal solution that maximizes or minimizes the objective function. Particles move through the solution space and are evaluated based on a fitness function. In each iteration, particles are updated with two values, namely p_{Best} and g_{Best}. p_{Best} (y_{ij}) is the best solution achieved so far, whereas the g_{Best} (ŷ_{j}) is the secondbest value obtained by any particle in the population. A schematic representation of the p_{Best} and g_{Best} is shown in Figure 1. Thus, exploration happens with neighborhood search and reduces the susceptibility of PSO falling into local optima but slows down convergence speed.
Figure 1: Velocity component construction of a particle swarm 
The position of the particle is changed by adding a velocity, v_{i}(t), to the current position, as in Equation below, with x_{i}(0) ∼ U(x_{min},x_{max}).
x_{i}(t + 1) = x_{i}(t) + v_{i}(t + 1)
For g_{Best} PSO, the velocity of particle i is calculated as in Equation below, where c_{1} and c_{2} are acceleration constants. The PSO algorithm is shown below in Algorithm 5.
v_{ij}(t + 1) = v_{ij}(t) + c_{1}r_{1j}(t)[y_{ij}(t) − x_{ij}(t)] + c_{2}r_{2j}(t)[ŷ_{j}(t) − x_{ij}(t)]
Algorithm 5: Particle Swarm Optimization algorithm 
PSO can be applied to various optimization problems [20], including civil infrastructure systems, traffic accident forecasting, structural engineering, multithresholding modalities for suspicious region detection on mammograms, photovoltaic array reconfiguration, power systems, and rail transit assembly of robot systems. Some exciting applications including NASA's swarm technology investigation for planetary mapping, the movie 'Batman Returns' makes use of swarm technology for rendering, depicting the penguins' movements, and the 'Lord of the Rings' film trilogy made use of similar technology during battle scenes.
To illustrate, in the case of an emergency response system of a marine oil spill, allocation and deployment of response vessels (e.g., rescue ships) can be optimized using PSO, as proposed in [21]. In an oil recovery operation, the key goal is to collect as much oil as possible, and this is a timecontingent operation. The optimal response plan (considering the allocation of resources, recovery behaviors of skimmers, space for carrying equipment of vessel transportation, and resource utilization from response centers) proposed in this research recovered approximately 80.28% of the spilled oil within the first 48 response hours.
Figure 2: Emergency Response of Marine Accidents, using PSO [21] 
Variable Neighborhood Search
Variable neighborhood search (VNS) [16] algorithm explores distant neighborhoods of the initial solution and moves to a new improved solution. Similar to Tabu search, a local search method is applied repeatedly to get from solutions in the neighborhood to local optima and escape from the valleys that contain them. This characteristic helps VNS to solve linear, nonlinear, integer, and mixedinteger programs. VNS uses a simple local search coupled with the first improvement heuristic and neighborhood change algorithms; it has both exploitation and exploration process similar to other metaheuristics.
The details of the VNS algorithm are shown in Algorithm 10. At first, a first improvement heuristic is invoked to find the local optima, given the solution's feasible region, as in Algorithm 6. Then, the neighborhood heuristic is invoked to escape from the local optima to find a better solution in the new feasible area, as in Algorithm 7. The algorithm is repeated until maximum preset iterations and CPU run time. In addition to the first improvement heuristic, a simple local search can be used for the local search operation, as in Algorithm 3.
Algorithm 6: First improvement heuristic [10] 
Algorithm 7: Neighborhood change heuristic [10] 
Algorithm 8: Variable Neighborhood Search algorithm [10] 
A variant of VNS [6] uses a deterministic neighborhood search, unlike the single neighborhood structure. 'Shaking' is an additional step performed to find the best alternative solution from the k^{th} neighborhood at random. Similarly, reduced VNS, skewed VNS, variable search decomposition, parallel VNS are widely used techniques to solve mathematical programming problems [10]. Overall, VNS is simple and broadly applicable. It is more efficient to produce good solution quality in reasonable CPU time. Applications of VNS include location theory, network design, lotsizing, pooling problems, reliability, geometry, and telecommunication design.
Summary
To summarize, metaheuristics are used to find goodenough solutions for an optimization problem. Metaheuristics are simpler to design and implement [17]. A few wellestablished metaheuristic algorithms that can solve optimization problems in a reasonable time frame are described in this article. Effective algorithm development is a continuous improvement process. Several search procedures, natureinspired algorithms are being developed to solve a variety of complex optimization problems.
In light of advantages, metaheuristics are strategies that guide the search process. There are simple local search techniques to complex learning processes available in the form of iterative algorithms. Metaheuristics are approximate solution methods and usually nondeterministic [3]. The critical aspect of metaheuristics is not problemspecific, and hence any optimization problem can be solved with ease of understanding. Nevertheless, despite its popularity and practical efficacy, metaheuristic methods give inadequate quality solutions. It heavily relies on proper implementation and hyperparameters tuning, which in itself is another optimization landscape [2].
Considering implementation platforms of metaheuristics to solve realworld problems, MATLAB [15] has inbuilt GA, SA, and particle swarm algorithms. Similarly, many packages were developed using various programming languages such as C + +, Java, and Python (e.g., [18]) to solve optimization problems.
References:
 Beni, G. and Wang, J. (1993). Swarm intelligence in cellular robotic systems. In Robots and biological systems: towards a new bionics?, pages 703–712. Springer.
 Bennett, K. P. and ParradoHernández, E. (2006). The interplay of optimization and machine learning research. The Journal of Machine Learning Research, 7:1265–1281.
 Blum, C. and Roli, A. (2003). Metaheuristics in combinatorial optimization: Overview and conceptual comparison. ACM computing surveys (CSUR), 35(3):268–308.
 Cordeau, J.F., Laporte, G., Legato, P., and Moccia, L. (2005). Models and tabu search heuristics for the berthallocation problem. Transportation science, 39(4):526–538.
 Dorigo, M. and Di Caro, G. (1999). Ant colony optimization: a new metaheuristic. In Proceedings of the 1999 congress on evolutionary computationCEC99 (Cat. No. 99TH8406), volume 2, pages 1470–1477. IEEE.
 Garcia, C. G., PérezBrito, D., Campos, V., and Martí, R. (2006). Variable neighborhood search for the linear ordering problem. Computers & operations research, 33(12):3549–3565.
 Glover, F. (1990). Tabu search: A tutorial. Interfaces, 20(4):74–94.
 Glover, F. and Taillard, E. (1993). A user’s guide to tabu search. Annals of operations research, 41(1):1–28.
 Golberg, D. E. (1989). Genetic algorithms in search, optimization, and machine learning. Addion wesley, 1989(102):36.
 Hansen, P. and Mladenovic, N. (2001). Variable neighborhood search: Principles and applications. European journal of operational research, 130(3):449–467.
 Kennedy, J. and Eberhart, R. (1995). Particle swarm optimization. In Proceedings of ICNN’95international conference on neural networks, volume 4, pages 1942–1948. IEEE.
 Kirkpatrick, S., Gelatt, C. D., and Vecchi, M. P. (1983). Optimization by simulated annealing. science, 220(4598):671–680.
 Kosmas, O. and Vlachos, D. (2012). Simulated annealing for optimal ship routing. Computers & Operations Research, 39(3):576–581.
 Łazuga, K., Gucma, L., and Perkovic, M. (2018). The model of optimal allocation of maritime oil spill combat ships. Sustainability, 10(7):2321.
 MATLAB (2010). version 7.10.0 (R2010a). The MathWorks Inc., Natick, Massachusetts.
 Mladenovic, N. and Hansen, P. (1997). Variable neighborhood search. Computers & operations research, 24(11):1097–1100.
 MorenoArmendáriz, M. A., Hagan, M., Alba, E., Rubio, J. d. J., CruzVillar, C. A., and Leguizamón, G. (2016). Advances in neural networks and hybridmetaheuristics: Theory, algorithms, and novel engineering applications.
 Olson, R. S. and Moore, J. H. (2016). Tpot: A treebased pipeline optimization tool for automating machine learning. In Workshop on automatic machine learning, pages 66–74. PMLR.
 Reeves, C. (1993). Modern heuristic techniques for combinatorial problems. Blackwell scientific publications.
 Wang, D., Tan, D., and Liu, L. (2018). Particle swarm optimization algorithm: an overview. Soft Computing, 22(2):387–408.
 Ye, X., Chen, B., Lee, K., Storesund, R., Li, P., Kang, Q., and Zhang, B. (2021). An emergency response system by dynamic simulation and enhanced particle swarm optimization and application for a marine oil spill accident. Journal of Cleaner Production, 297:126591.