Grey wolf optimization applied to the maximum flow problem

The problem of getting the maximum flow from source to destination in networks is investigated in this paper. A proposed algorithm is presented in order to solve Maximum Flow problem by using Grey Wolf Optimization (GWO). The GWO is a recently established meta-heuristics for optimization, inspired by grey wolves (Canis Lupus). In addition; in this current research, K-means clustering algorithm is used to group each 12 vertices with each other at one cluster according to GWO constraint. This work is implemented and tested various datasets between 50 vertices and 1000 vertices. The simulation results show rapprochement between experimental and theoretical results.


Introduction
*Metaheuristic optimization mechanisms are emerging and becoming very popular, the primary categories of these techniques are Single-Solution-Based and Population-Based. In the first category, the search begins with a single elect solution (Kirkpatrick et al., 1983).This unique elect solution is enhanced over several iterations. In the second category, it represents the optimization by starting with a set of random solutions. This population is enhanced over the course of iterations. The main advantage that characterizes the population-based Metaheuristic over the single-based algorithms is its' high exploration power. This power is attained as it works to find a global solution rather than local ones (Munakata and Hashier, 1993). Maximum Flow problem is considered as one of the various well known basic problems of optimization in weighted directed graphs. In addition, it could be applied to numerous applications such as computer science and engineering. Besides, it is solved by many researchers using several methods (Tarjan, 1983).
The issue of Maximum Flow is to define an optimal solution for a graph which is directed and integer weighted; where the weight at each edge (arc) interconnect two vertices (nodes) representing the flow capacity of this arc. According to these constraints, the goal reaches the maximum of total flow from the source to the sink. This scenario illustrates a simplistic version of the Maximum Flow problem.
A directed flow network G= (V, E) is given, where the number of vertices is represented by V and the number of edges is noted by E. The weight at each edge in the graph represents the capacity Cuv which is nonnegative c (u, v)>= 0; where u and v belong to V (Cormen et al., 2009). In addition, there are two special vertices; the source which is start vertex and sink which is the target vertex (Cormen et al., 2009). For a vertex u in V let E (u) be the set of all edges generated from vertex u, and Let F = max {Cuv by (u, v) in E}.
Thus, the problem is to define an optimal solution for a particular directed network where each edge has a capacity. Under these constraints, the purpose is to get the maximum total flow from a source vertex to a sink vertex (Eppstein, 1998  In this study, a proposed solution is presented to solve this problem using Grey Wolf Optimization (GWO). The GWO algorithm was introduced by Mirjalili et al. (2014). This algorithm is inspired by species of wolves (the Grey Wolf). The technique imitates the hunting procedures followed by Grey Wolves in nature. Wolves divide leadership hierarchy in their pack into four main types: Alpha, Beta, Delta, and Omega. In order to accomplish the three main steps of haunting are searching for prey, encircling prey and attacking prey.
The remainder of this paper is organized as follows: section II recites related work in details. While section III contains the Grey Wolf Optimization and how it works. Section IV includes the proposed algorithm "MAXFLOW-GWO". The experimental results are presented in section V. Finally, section VI draws the conclusion and future work.

Related works
Maximum Flow problem is a heavily studied combinatorial optimization issues by many researchers using various methods (Tarjan, 1983;McHugh, 1990). Ford and Fulkerson (1956) method was the first method that helps to get the Maximum Flow from source to destination by using it augmenting path algorithm. Dinic (1970) and Cormen et al. (2009) show that if each augmenting path in the shortest one, the algorithm will perform O (mn) augmentation steps; where the number of nodes represented by n and number of arcs is noted as m. Edmonds and Karp (1972) presented a new algorithm where its results were closely to Dinic (1970) algorithm. In addition, the shortest path where the length of the arc equals one could be got with the assistant of Breadth First Search (Thomas et al, 2001;Eppstein, 1998). Ever after that, there are many algorithms have been developed. Ahuja et al. (1989) ameliorated the shortest augmenting path algorithm (Thomas et al., 2001). Orlin (2013) presented ameliorated polynomial time algorithm that determined on the sparse network. As well as, he displayed how to solve the max-flow problem in O (mn), where m= O (n), in addition how to solve the max-flow in O (nm + m 31/16 log 2 n) time, where m= O (n 1.06 ). Thus, this is the improvement of the algorithm that presented by King et al. (1994) which solved the Max Flow in O (nm m/(n log n) ) time.
The Maximum Flow problem considered to be more difficult in applying genetic algorithm than other popular graph problems due to its various rare characteristics (Munakata and Hashier, 1993). Thus, Munakata and Hashier (1993) applied the Genetic algorithm (GA) to discover the Maximum Flow from the source to the sink in a weighted directed graph. In this approach, each solution is performed by a flow matrix. Two characteristics mainly exist in the fitness function -balancing vertices and the saturation rate of the flow. The initial population is chosen randomly at the beginning, the next generation will be better after using a genetic algorithm. Thus, optimal or near optimal solutions are found after a specific number of iterations. Barham et al. (2016) presented Chemical Reaction Optimization algorithm (CRO) for Max Flow problem. The CRO is presented by Lam and Li (2010), which is a meta-heuristic algorithm that designed for solving combinatorial optimization problems. The MaxFlow-CRO algorithm is proposed to find the best Maximum Flow that could be transported from the source to the sink in a flow network with no constraints for the capacity and violation where the flow in every arc rests within the upper bound value of the capacity.

Grey wolf optimization
The inspiration for Grey Wolf Optimizer (GWO) is a Species of Wolves called the Grey Wolf (Canis lupus), by imitating its hunting methods and hierarchical pack distribution which are referred to as Alpha, Beta, Delta, and Omega. These are used to imitate the series of commands as shown in Fig. 1 (Mirjalili et al., 2014). As seen, sovereignty reclines from top to bottom. The first level is Alpha which is the leader, which is not necessary to be the most robust wolf but the superior to other wolves in managing the pack. Thus it is responsible for the decision making. The second level is Beta which helps Alpha in decision making. Thus, it represents as the mentor to Alpha and an educator to the pack. The third level is Delta controls Omega. This category could be Scouts, sentinels, elders, hunters and caretakers. Finally, the fourth level is Omega that acts as the scapegoat and gives up to all dominant wolves. The Hunting behavior of Grey Wolves is split into three procedures: chasing, encircling and attacking the victim as described in (Mirjalili et al., 2014).

Chasing phase
The Algorithm considers that Alpha (α) as the best solution, Beta (β) as the second best solution and Delta (δ) as the third best solution. However, Omega represents the rest candidate solutions. Thus the hunting is led by the dominant wolves (α, β, and δ). In other words, Grey Wolves could recognize the position of the prey through an iteration process and surround it.

Encircling phase
In this phase, Grey Wolves encircle the victim through the hunt (optimization). In addition, it is mathematically modeled by Eqs. 2 and 3.
Such that D illustrates the distance between the location of the prey (Xp) and the location of the wolf (X) and the existing iteration number is cited by t. A and C are coefficient vectors as in Eqs. 4 and 5.
where, r1 and r2 are chosen randomly in [0, 1] and a is decreased from 2 to 0 linearly over the iteration.

Hunting phase
The hunt generally is led be the leader (α). However, sometimes Beta and Delta contribute in hunting. In another hand, there is no idea about the position of the prey that represents the optimum. Therefore, the algorithm assumes that Alpha, Beta, and Delta have preferable knowledge about the position of prey. Thus, the algorithm saves the first three best solutions then update the locations of the rest wolves (Omega) depending on the position of the dominant wolves (best search agent) according to the Eqs. 6, 7 and 8.

Attacking phase (Exploitation)
In this case; when the prey stops proceeding, the hunting (optimization) ends by assaulting it. It proceeds by reducing the value of a from 2 to 0 linearly. Thus this reduces the value of A which is a random value in [-a, a]. When A<1, candidate solutions tend to converge towards the prey. As well as that the algorithm prone to the local stagnation.

Search for prey phase (Exploration)
To avert the local stagnation, random values A is greater than 1 or less than -1, are used to force the Grey Wolves far from the victim. This emphasizes exploration and searches globally. When A>1 compels the Grey Wolves to space from the victim to discover fitter prey. There is another component that affects this phase which is C and belongs to [0,2].This component represents random weights of the prey in determining the distance. When C>1, it emphasizes its influence. However, when C<1, it reduces its effect.

Algorithm "MAXFLOW-GWO"
The Grey Wolf Optimization algorithm (MAXFLOW-GWO) is developed to solve the maximum flow problem (MFP). It is theoretically analyzed; and it is implemented and tested on datasets with different sizes. The run time performance of the MAXFLOW-GWO algorithm is compared with run time of the Ford-Fulkerson algorithm on the same datasets. By applying Grey Wolf Optimization to get the optimal solution for Maximum Flow problem, Figs. 2-6 show the proposed pseudo-code for "MaxFlow-GWO" algorithm.

Initialization stage
As presented in Fig. 2 initialize the Grey Wolf population, which is chosen at random. From these wolves select one of them randomly to be the prey and choose another one to be the source.

Fitness function
The goal of fitness function is to measure the minimum distance between each wolf and all centroids to assign to the nearest one and join to that cluster to be a member of its pack. As presented in Fig. 3.

Clustering
According to Mirjalili et al. (2014), let the group size between 5 and 12 wolves. Thus, K-means clustering algorithm is used to group each pack at least 5 wolves and at most 12 wolves. At the beginning, the number of clusters is calculated by Eq. 9. Moreover, the number of centroids is measured by Eq. 10. Thereafter, centroids are chosen randomly. Each wolf assigned to its nearest centroid by using Eq. 11. The double notation in the equation denotes that it is a function of Euclidean distance (Fong et al., 2014). Such that Xi is the wolf (i) and Cenj is the centroid in the cluster j. As shown in Fig. 4, each cluster k finds the first three best solutions randomly at the beginning. In other words, it finds α, β, and δ. During the three iterations, the fittest search agents update their positions around the prey relying on the positions α, β and δ by using Eqs. 2-8. At the end, each cluster has three best solution which is locally optimal, then compare these local optimal with others local optimal in other clusters. The minimum local optimal presents the first global optimal. Then, the second local optimal illustrates the second global optimal and so on.

Shortest path function
After all, clusters are constructed, three factors are determined: α, β, and δ. The factor α represents the nearest wolf to the prey in the cluster, the next closest wolf to the prey in the cluster is represented as β, and δ is the third nearest wolf to the prey in the same cluster. The lowest values of α, β, and δ are presented the minimum local optimal for each cluster. Then, the entire local optimal are compared, to find the first global optimal that is considered as the first step in the shortest path. The second global optimal is considered as the second step in the shortest path. And so on until the source is reached. In other words, not all clusters are included in the shortest path, depending on the distance between two wolves, as illustrated in Fig. 5.

Max-Flow function
After applying the previous functions, all wolves are grouped, each 12 in one cluster, and got all clusters done, the Max Flow function is applied. Numbers of edges between all wolves are found depending on the shortest path. In other words, there exist many paths from the wolf (source) to the prey (sink). In this function, Ford-Fulkerson algorithm (King et al., 1994) is used, which depends on the augmenting paths that found in the residual graph, which is used at each iteration. The flow on any edge could be raised or reduced. Thus, reducing the flow value on some edge may be substantial for with a view to being able to transfer more flow. Iterate the augmenting flow until the residual network graph has not any more augmenting paths.

Experimental results
In order to evaluate the performance of the MaxFlow-GWO, MATLAB program based simulation program was developed by using a dataset of different network sizes, which indicates the number of vertices in the graph. Moreover, the dataset sizes were taken between 50 and 1000 vertices according to previous studies (Barham et al., 2016). In this study, each scenario was repeated 10 experiments based on previous studies (Barham et al., 2016), and not depending on one experiment, to generate accuracy by using these specifications: Intel (R) core (TM) i7-47000MQ CPU with 2.40 GHz, 16 GB RAM and Windows7, 64-bit operating system. Table 1 presents the average run time for different datasets which were calculated in seconds. It is clear from Fig.  7 that the time complexity is quadratic polynomial which means it increases with increasing the number of vertices in the graph. In addition to that, it is fairly a good enough performance. Depending on Fig. 7 and Fig. 8, it is obvious that the experimental and theoretical results are very approximate. Ford-Fulkerson algorithm is chosen to compare with because it is the general algorithm that solved maximum flow problem (Goldberg and Tarjan, 1988;Chintan et al., 2010) and to validate the MAXFLOW-GWO algorithm. Moreover, the same specifications that were used for the proposed algorithm as shown in Table 2. In addition to that, it was repeated 10 experiments for each data size. Thus, Fig. 9 shows the comparison between MAXFLOW-GWO algorithm and Ford-Fulkerson algorithm in term of average running time for experimental results. It is obvious from Fig. 9 that the proposed algorithm accomplished better performance, especially for networks with large sizes.

Conclusion
This paper proposes a novel solution to Maximum Flow problem using the Grey Wolf Optimization algorithm. The GWO is used to get the optimal solution for Maximum Flow problem. The maximum flow problem was reviewed. The proposed MaxFlow-GWO algorithm was introduced and explained how it can be used to solve the maximum flow problem. The run time complexity of the algorithm is presented. The theoretical run time complexity is estimated to be O (N E F), where N indicates the number of wolves (vertices), E is the number of edges between wolves and F represents the Maximum Flow in the graph. The time complexity of MaxFlow-GWO algorithm is proven theoretically to be O (n+ E 2 ). Experimentally, the run time complexity is obtained as a quadratic polynomial, on the tested dataset, which indicates it increases proportionally to the number of vertices in the graph. Thus, theoretical and experimental results converge well.