Parallel Whale Optimization Algorithm for Maximum Flow Problem

Maximum Flow Problem (MFP) is considered as one of several famous problems in directed graphs. Many researchers studied MFP and its applications to solve problems using different techniques. One of the most popular algorithms that are employed to solve MFP is Ford-Fulkerson algorithm. However, this algorithm has long run time when it comes to application with large data size. For this reason, this study presents a parallel whale optimization (PWO) algorithm to get maximum flow in a weighted directed graph. The PWO algorithm is implemented and tested on datasets with different sizes. The PWO algorithm achieved up to 3.79 speedup on a machine with 4 processors.


Introduction
In this study, a parallel algorithm for solving the maximum flow problem (MFP) based on a meta-heuristic approach called a whale optimization algorithm (WOA) by (Mirjalili & Lewis, 2016) is proposed. MFP is a well-known issue from various issues of optimization in the weighted directed network (Topcoder -Community -Maximum Flow Section 1&2). It can be applied to many applications such as networks, engineering, and transportations (Munakata & Hashier, 1993). Many solutions were presented and suggested by researchers to solve MFP using different techniques (Tarjan,1986, Ford andFulkerson, 1956). The problem of MF is to determine the optimum solution for a directed and weighted graph; where the weight indicates to the flow capacity at each edge that communicates two vertices (Topcoder -Community -Maximum Flow Section 1&2). Based on that, the main target is obtaining the maximum value of flow from the source to the sink (Community -Maximum Flow Section 1&2 -Topcoder).
A directed and weighted flow network is defined as G = (V, E), where V indicates to the set of vertices and E points to set of edges (Cormen, 2009). Thus, a flow capacity (C uv ) is represented by the weight at each edge which is non-negative C (u, v) ≥0; where u and v belong to V (Cormen, 2009). Moreover, the network has two main vertices: the source s and the sink t. The source is the inception vertex and the sink is the intention vertex (Cormen, 2009). Assume a graph G (V, E) contains a vertex called X, and all edges connected with vertex X are called E(X), suppose that F uv = max{C uv : (u,v) ϵ E}. Thus, the main issue is to get the optimal solution for a specific directed graph wherever every edge has a capacity. According to these restrictions, the aim is to find the maximum aggregate flow that directed to the sink (Goldberg & Tarjan, 1988). This scenario is mathematically modeled by Equation (1) (Cormen, 2009). Where, the flow on the edge (u, v) is represented by X uv . mas.ccsenet.org Modern Applied Science Vol. 14, No. 3;2020 Currently optimization algorithms are gaining significant popularity and perform great significant roles in many various applications, mainly because they are founded on easy notion resulting from their imitation of natural perceptions and ideas which are nature-gained (Mirjalili & Lewis, 2016). Consequently, they are also perceived easy to apply and can be of significance in a variety of problem settings. The Whale Optimization Algorithm (WOA) is one of these optimization algorithms, and currently suggested in (Mirjalili & Lewis, 2016) and inspired from the foraging and hunting mechanism of the humpback whale in nature.
Most meta-heuristic optimization algorithms come up in the previous decades (Kirkpatrick et al., 1983). There are three main categories of these meta-heuristic optimization algorithms: physics-based, evolutionary and swarm intelligence algorithms (Kirkpatrick et al., 1983. The physics-based mechanisms were derivative from physics-based rules (Alatas, 2011, Masadeh et al., 2019. Evolutionary meta-heuristic mechanisms were stimulated from nature (Holland, 1992. The swarm intelligence algorithms were derived from the swarms' societal intelligent attitude (Dorigo et al., 2008).
The behavior of humpback whales is simulated in the WOA (Mirjalili & Lewis, 2016), which imitates the hunting behavior of the humpback whales. The main stages of this behavior are the investigative phase of looking for the prey and surrounding it, and the exploitation phase which signifies a bubble-net method and confronting the prey.
Recently, parallel computing comes to be an affecting solution to surpass computation speed. In the sector of supercomputing, there will emerge the need to analyze big networks having billions of vertices and edges consistently. Due to this, there is a need to make MF solvers be faster and be capable of operating on immense networks. The traditional MF algorithm runs on one processor. The parallel algorithms can be applied on several processors to solve MFP faster than in single processor. Therefore, this study is a representative of a probable equivalent resolution to the MFP by using the WOA. This will be by concurrently grouping the search space to establish the MF for the individual cluster (local MF) in the pursuit of finding the general solution (global MF) of the chosen graph. By assuming that the graph is the search space and that the whales are looking to get the prey, the WOA solves MFP. In this setting, the sink in the network indicates to the prey and the vertices represent the whales.
In this research, a parallel WOA was proposed in order to solve the MFP by clustering the search space to collect the MF for each cluster simultaneously for the purpose of finding the global MF of the desired graph. This research is organized as follows: Section 2 presents related works and background on this research. A description of the WOA in details is presented in Section 3. Section 4 describes the proposed Parallel-MaxFlow-WOA. The complexity analysis of proposed algorithm is outlined in Section 5. Section 6 presents an example of the proposed technique. The simulation results are argued out in Section 7. Finally, the conclusion and future work are drawn in Section 8.

Related Work
It has come to the attention of many researchers that the MFP involves quite a wide range of concerns all which need to be studied in different ways (Ford & Fulkerson, 1956, McHugh, 1990. Ford and Fulkerson (FF) method was the first to be applied in 1956 (Ford and Fulkerson, 1956). It is significant in getting the MF from the origin to a destination by applying augmenting path algorithm. Dinic (Dinic, 1970) and Cormen (Cormen, 2009) discovered that the run time complexity performance of the algorithm is O (mn) augmentation steps if every augmenting path in the shortest one; where m is the count of arcs while n denotes the number of nodes (Cormen, 2009, Dinic, 1970. Edmonds and Karp presented work which was close to that of Dinic's algorithm using some new algorithm (Dinic, 1970, Edmonds & Karp, 1972. The new algorithm acknowledged that the shortest path was that the dimension of the arc equals one; this kind of results was attained using the Breadth First Search (Eppstein, 1998, Leiserson et al., 2001).
More algorithms have been established with time to solve the MFP. There was an adapted of a new algorithm to work out the shortest augmenting path algorithm (Leiserson et al., 2001, Nemhauser & Wolsey, 1989). Orlin's study (Orlin, 2013) on sparse network exhibited ameliorated polynomial time algorithm (Orlin, 2013). Moreover, the researcher presented ways of finding a solution for the MFP in O (mn); where m = O (n), as well as, resolving the MF in O (nm+m 31/16 log 2 n) time, where m= O(n 1.06 ). (King et al., 1994) describe an improvement to this algorithm. They find a solution for the MFP in O (nm m/ (n log n) ) time.
Genetic algorithm (GA) is seen to be difficult algorithm to be useful in MFP in most of the graph problem because the graph problems are recognized by its multiple unique characteristics (Munakata & Hashier, 1993). However, the GA was applied to establish the MF from the source to the sink in a weighted directed graph by (Munakata & Hashier, 1993). Every answer is executed by a specific flow matrix in the previous study. In the mas.ccsenet.org Modern Applied Science Vol. 14, No. 3; 2020 fitness function, there are two major characteristics, which include balancing nodes and the concentration levels of the flow. The initial generation population is selected randomly. After applying the GA, the resulted generation is then improved. The results will be optimal or near optimal after a specific count of iterations of utilizing the genetic algorithm.
Lam and Li suggested Chemical Reaction Optimization CRO (Lam et al., 2010), which is a meta-heuristic algorithm that was mainly intended for solving combinatorial optimization problems. The run time complexity of CRO algorithm for MFP is O (I E 2 ) were presented by (Barham et al., 2016). Where, I indicates to the iterations number and E denotes the edges count in the flow graph. The MaxFlow-CRO algorithm is designed to identify the best MF that can be relocated from the source to the sink in the flowing network with no restraints for the capacity and violation, where the flow in each arc rests in the upper capacity boundary.
Grey Wolf Optimization (GWO) algorithm was suggested by (Mirjalili et al., 2014), which is a meta-heuristics algorithm that is proposed as a resolution to the combinatorial optimization problems too. Masadeh (Masadeh et al., 2017) implemented a GWO algorithm to solve the MFP in O (|N| + |E| 2 ) time.
A parallel genetic algorithm (PGA) was presented by . This would be done by solving each augmenting route in the elected graph from the origin to the sink in equivalent stages during iterations. By using the Message Passing Interface (MPI) library the PGA is implemented. Similarly, the study is realized and shown results from real distributed system IMAN1 supercomputer. Additionally, the study's outcomes present recommendable enhancement in regard to speedup efficiency. In addition, PGA makes the running time faster by realizing up to 50% corresponding efficiency.
A contrast study concerning the performances of GA and CRO algorithms in resolving MFP associated with FF algorithm that is known algorithm for explaining MFP is presented by (Khanafseh et al., 2017). Establishing which algorithm will come up with results roughly closer to FF with the same accuracy is the main aim of the study. Therefore, the outcomes of both algorithms that discussed in their study may be useful in solving MFP with accurateness nearly close to FF results. However, it is better when GA in relation to time and accuracy is applied.
WOA was adapted to solve the MFP by . The MFP is solved by the WOA by assuming the graph is the search space which the whales seek to reach their prey. The prey is the sink in the network, represented by the graph, while other whales are signified in other nodes within the graph. The experimental outcomes of the proposed algorithm indicated that the technique can reinforce its performance while solving the MFP.
According to , the WOA is employed to solve MF problem in sequential manner. This is to make the computation faster and without degrading the accuracy. The parallel MaxFlow WOA is proposed in this research.

Whale Optimization Algorithm
Whale Optimization Algorithm (WOA) is a random optimization algorithm that was created by (Mirjalili & Lewis, 2016). The WOA aims to locate global optimum of a search agents (whales) population in a problem. The first step in the search process starts with creating randomly multiple candidate solutions of a specific problem. Then, through numbers of iterations the candidate solutions are improved until reaching a satisfied solution set. The Whales in reality mimic a bubble-net feeding method which is a private hunting technique as shown in Figure 1 (Mirjalili & Lewis, 2016 For a given problem, random solutions are created by WOA in order to optimize this problem. At each iteration, search agents update their positions rely on randomly selected search agent or the search agents which will get so far. In order to ensure the exploration stage, update the positions of the other search agents which relies on the best solution which mentions the pivot point when |A| is bigger than 1. Whereas, the other case is when |A| is less than 1; where the best solutions plays another role with the pivot point. However, in exploration phase the position of a search agent is updated according to a randomly selected search agent until find the best search agent. This technique allows WOA to proceed a global search. The mathematical model is represented as shown in Equation (7) and Equation (8). Algorithm 1 shows the pseudocode of the WOA [Mirjalili & Lewis, 2016].

Proposed Parallel-MaxFlow-WOA
The proposed algorithm was to improve the WOA in solving MFP by using the parallel approach. Thus, when clustering the search spaces alternating each cluster processing sequentially, all the clusters proceed simultaneously, hoping for reduction overall running.

Initialization Phase
Starting with a random population of whales represents the vertices; one of them is selected at random to represent the source and the prey is selected to denote the sink. In this stage; the distance between the whole Initialize the whales population X i (i = 1, 2, 3, …, n) Initialize r, M and N Calculate the fitness of each search agent X* = the best search agent While t ≤ Max_iteration do For each search agent do If |N| ≤ 1 then Update the position of the current search agent by the Equation (2).
Else if |N| ≥1 then Select a random search agent X rand Update the position of the current agent by Equation (8) End if End for Update r, M and N Update X* if there is a better solution t = t + 1 End while Return X* whales and all X rand are computed in order to help the whales to assign to the nearest X rand and to be a member of its cluster.

Fitness Function
The main mission of X rand is to create bubble-net when it sees the prey. Thus, all the whales that are in the search space and see the bubble-net will associate its cluster. Thereafter, the members that joined the cluster should update their locations toward the X rand . Moreover, the locations of the whales will update depending on the value of A. In case A is less than one, the whale is still associating the cluster and updates its location. This means the whale moves towards the prey. When A is greater than one, the whale is not associating the cluster and should look for another near X rand to join. This behaviour is modelled mathematically by Equation (9), Equation (10) and Equation (11) (Mirjalili and Lewis, 2016).
Where ( ) is a random position vector, ( ) is the best search agent.
Where r indicates the radius of the bubble-net, h represents the height of bubble-net that is chosen randomly between 6 and 12 as its inspiration in nature (Watkins & Schevill, 1979) and π is a constant value that is approximated to 3.14.

Clustering Phase
Each cluster has X rand that is selected randomly at the beginning, then fitness function will be computed for each whale in order to inspect if it catches sight of the bubble-net. Thus, the whole clusters will compute their local maximum flows simultaneously. In other words, all clusters are working at the same time to get their local maximum flow, then get the global maximum flow at them sink.

Maximum Flow Function
In this stage, each cluster will calculate its maximum flow (MF) by invoking max-flow function which is proposed by Ford-Fulkerson (Ford & Fulkerson, 1993) that is based on augmenting paths in the given residual flow network to find the MF from the source to the sink. In other words, each cluster works as an autonomous subnetwork, and each one computes the MF by using FF algorithm simultaneously. This technique will get back the local MF for each cluster. The MF function will create N numbers of clusters and each one will calculate its local MF. Thus, the algorithm will return the global MF of the given network using the following Equation (12).

Complexity Analysis of Parallel-MaxFlow-WOA
The proposed algorithm works by clustering the graph space into N clusters, each cluster represents a subgraph of the original graph, and then the Ford Fulkerson algorithm employs in order to find the maximum flow of the graph. In WOA, the FF algorithm will be run N times

Example of Parallel-MaxFlow-WOA
In this subsection, an example is presented in order to clarify how the suggested algorithm is adapted the WOA to solve MFP. The following example is based on the given network shown in Figure 3 that has a set of nodes and a set of edges. Moreover, each edge has a capacity which is selected randomly . mas.ccsenet

Initiali
As shown the sink re nodes repr

Fitness
When eac function. I in Figure 6 t.org s Function and ch cluster is c In this case ma 6.  does not belon which is con Vol. 14,No. 3; ng to any clust nsidered the ne 2020 ter in earest mas.ccsenet

Paralle
Each node the MF fr cluster get other word Equation.
t  luster will com gure 7. Thus, e given networ e global MF u 2020 mpute each rk. In using

Simulation Results of Parallel-WOA
Matlab R2016a software with Parallel Toolbox was employed in order to evaluate the performance of Parallel-WOA for solving MF problem. For sequential mode, only one worker (process) is used to do the computation. On the other hand, four workers (processes) were used in order to do computation in parallel. In addition, the sizes of the used datasets were between 1000 and 10000. Every scenario was generated 5 experiments to have their average run time.
The simulation platform is a portable computer with following specifications: Intel (R) core (TM) i7-4510U CPU with 2.40 GHz, 16 GB RAM and Windows 8.1, 64-bit operating system.

Data Sets
The data sets that used to assess the proposed technique were randomly generated graphs with different sizes and large number of edges in these graphs; for that each node (i) in the graph is connected to every other nodes that those distances from the source node is greater than the current one (i); Table 1 shows the graphs that had been used in the experiments.
The proposed technique is based on clustering the nodes in the graph's space. The data partitioning is an important issue and should be kept into account to accurately compare sequential with parallel mode, for that the random graph generator was oriented to make the random generation smart in somehow to fairly distributing the data. In this subsection, the computation time was examined which means the time that each processor spends in computing the MF values. The computation time depends on the number of processors and the input size. When the input size is large, it is better to have many processors to do the computation, especially in the proposed work different clusters used to represent the partition of the graphs, for that the number of clusters was determined by the number of processors that are available in simulation platform. For sequential mode only one processor runs to compute the MF value for each cluster in a sequential manner; on the other hand, four processors are used to make each processor works on individual cluster. Figure 9 shows the computation time that was taken by only one worker (processor) and four workers.

Conclusion and Future Work
The maximum flow problem is an essential problem in network flow theory and it has been studied deeply from different aspects. In this study, we presented a parallel whale optimization algorithm for solving the maximum flow problem, which is simple to implement. Different from the intuitive idea, the basic idea of the proposed algorithm is clustering the graph and finds the maximum flow for each cluster simultaneously as a step to find the overall maximum flow of the graph. The simulation result showed that the given parallel algorithm outperforms the sequential one and has a great enhancement of the computing time, since it achieves 3.79 of speedup.
As a future work, the proposed algorithm was tested on a single machine with multi-processors so for future apply the proposed algorithm on distributed machines to take the overall advantages of hardware.

Copyrights
Copyright for this article is retained by the author(s), with first publication rights granted to the journal.
This is an open-access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/3.0/).