A genetic algorithm for shortest path with real constraints in computer networks

The shortest path problem has many different versions. In this manuscript, we proposed a muti-constrained optimization method to find the shortest path in a computer network. In general, a genetic algorithm is one of the common heuristic algorithms. In this paper, we employed the genetic algorithm to find the solution of the shortest path multi-constrained problem. The proposed algorithm finds the best route for network packets with minimum total cost, delay, and hop count constrained with limited bandwidth. The new algorithm was implemented on four different capacity networks with random network parameters, the results showed that the shortest path under constraints can be found in a reasonable time. The experimental results showed that the algorithm always found the shortest path with minimal constraints.


INTRODUCTION
The problem of finding the shortest path is a well-known combinatorial optimization problem, where the term shortest is measured by the minimum value of an objective function. It is defined as finding the shortest route between two nodes in a weighted network, where the shortest path is the one with the least sum of weights, given that every edge connecting any two nodes has a weight associated with it, where the shortest path is the one with the least sum of weights, given that every edge connecting any two nodes has a weight associated with it. Many networking problems are usually mapped to the same problem for instance path planning, vehicle routing, and computer network routing [1], [2]. Furthermore, the requirement for the shortest route is essential for the resolution of other connectivity problems [3]. In this century and last century, many algorithms have been tackled several versions of that problem, for instance, the Bellman's dynamic programming algorithm, Dijkstra algorithm, and the Bellman-Ford algorithm [4]. In computer networks, the shortest path problem is to determine which efficient route should packets take to reach their destinations.
Genetic algorithms are indeed good way to find the optimal solutions for several network problems. In our group's previous works, Hamed [5] considered the problem of multicast and that is finding the k shortest paths and constrained his problem with the required bandwidth and that is done by using the genetic algorithm (GA). Younes [6] attempted to figure out the best way for message multicasting by using a  [7] used an evolutionary algorithm to solve the multi-constrained routing (MCR) issue by restricted transmission latency and transmission success ratio.
In this paper, it can be concluded that GA is a common and recommended approach from our point of view to tackle the shortest path with multi-objectives and under conditioned constraints in computer networks. As mentioned before, finding an optimal solution in the network problems with a heuristic and a stochastic algorithm is very common, like in [3]. While the shortest path problem that has been studied in many papers uses many heuristic algorithms. For example, Xi et al. [8] used a dynamic direction restricted algorithm based on the Dijkstra algorithm to find the shortest path in traffic networks.
The consequence sections are organized: Section 2 explores related research and covers previous relevant algorithms, as well as identifying the research gap. The mathematical notations are gathered in Section 3. Section 4 describes the proposed method and the GA parameters utilization. Section 5 gives a pseudocode representation of the proposed algorithm. Section 6 illustrates the findings of the simulation and how they were implemented. Section 7 outlines the conclusion

RELATED WORKS
Numerous studies and implementations had focused on finding the shortest path. Monita et al. [9] implemented the shortest path first routing protocol to find its impact on the software-defined network (SDN). Torad and Hossamel-din [10] implemented (Dijkstra's algorithm) to find the first shortest path to a hospital with the right blood type to reduce the time needed to find the best hospital. Suryana et al. [11] combine four algorithms to find the shortest safe path in emergencies in an indoor environment, the network model was using one sensor data. Tarapata [12] uses a fast and modified version of Dijkstra's algorithm and effective data structures to analyze the complexity of a selected multi-objective shortest path problem. That proposed algorithm finds a solution efficiently to the multi-objective shortest path problem. Zhang and Mouftah [13] presented an algorithm based on a combination of informed search and backward routing. The algorithm finds the shortest path between any two pairs of points in the network with one constraint, the constraint is on the available bandwidth for each link through the path. In [14], the shortest path problem has been studied with multi-objectives. The treated problem considered fuzzy weighted arcs and without other constraints, the conversion speed of the algorithm compared with his previous algorithm [15] and the GA [16]. Li et al. [17] build a general model for the shortest path problem with three different types of constraints and with type II dynamics, and then they introduced their algorithm based on a multidimensional expression of the greedy search strategy. Sori et al. [18] present a fuzzy inference system to find the shortest path with three objectives and one constraint on the hop count, the multi-objective are the cost, time, and risk, which can be considered as corresponding to cost, delay, and interference. Liao et al. [19] used LINGO software to solve a constrained shortest path problem. Their objective is to find the path with the minimum cost where delay time does not more than a predetermined delay time. Hughes et al. [20] developed a model for the multiple shortest path problem that did take conflict arcs into account.
Many algorithms use artificial intelligence algorithms to find a solution for the shortest path problem. Marinakis et al. [21] considered the constrained shortest arc-disjoint path problem, they used a hybrid local search algorithm which is particle swarm optimization algorithm and variable neighborhood search algorithm, their algorithm finds the shortest path with limited delay and minimum cost. Ahmadi et al. [22] used the GA to find the shortest path while the arcs have stochastic conditions. Attiratanasunthron and Fakcharoenpholin [23] studied how long it has taken to execute the ant colony optimization algorithm to solve the shortest path optimization problem with positive weights and without constraints. The ant colony optimization algorithm was also used by Ghoseiri and Nadjari [24] to solve the two-objective shortest path problem, that paper dealt with a large-sized network and finds the solution in an acceptable running time. Ebrahimnejad et al. [15] had used a practical swarm optimization algorithm to find the shortest path under the constrain of the existence of mixed fuzzy weighted arcs. Again, Ebrahimnejad et al. [25] introduce an artificial bee colony algorithm to find the shortest path in wireless sensor networks. Liu et al. [26] introduced a GA to resolve the shortest path problem under multi-criteria and conditioned by constraints. In [27], the shortest path problem in an undirected graph with multi-objectives using an evolutionary algorithm has been introduced. That algorithm employed non-dominated solutions and different selection strategies by using an external set. It analyzed the stochastic convergence and proved the efficiency and the availability of the solution through simulations Alani et al. [28] proposed a new hybridizing of A* algorithm and ant colony optimization to solve single-source of the shortest path problem without constraints. The objective of the problem is to find a path with minimum time. For a large-scale (10,000 nodes and 10,000 demand) software network, the routing path in [27] considers finding a visible route for a set of demands with optimal bandwidth. The demanding route becomes clear when it passes two constraints: For each demand route path, there were two calculations: one based on overall latency, and one based on the total number of hops for each demand route path. Xu et al. [29] solve the routing with shortest path problem with multi-constraint but for one objective in large scale SDN, where shortest referred as minimum number of hops.
In Table 1 we summarize key parameters from the previously mentioned research. The research that uses GA is illustrated by shaded rows. Because the weights' values are ambiguous or the weights' values are frequently changed, some networks assign fuzzy weights to the arcs.
The list below is the key contributions and improvements of this proposal. − In comparison to the several studies mentioned above, we consider a multi-objective version for the shortest path problem. The cost, hop count, and delay are the three main kinds of objectives. The cost would be decided in a different way depending on the real network implantations. In many practical cases the cost could be the consumed electricity and in other ones may be considered as consumed bandwidth. − In comparison to the regular shortest path problem, we looked at the constrained shortest path problem, where the chosen practical restriction is an upper limit for bandwidth, which again reflects a practical constraint, many studies find the solution for the shortest path problem without considering real network limitations. − An optimization problem with three objectives and limited bandwidth is being handled effectively and efficiently using a novel genetic approach. − The introduced GA finds the optimal solution in a reasonable computation time, which can be implemented in real routing applications. − The algorithm results were tested on completely random networks.

MATHEMATICAL MODEL
Notations: G is network graph, N is set of nodes, E is set of edges, eij is the edge between a node i and a node j, C(e) is cost of an edge e, D(e) is delay of an edge e, B(e) is the bandwidth of an edge e, M is connection matrix of G, and Ts is the shortest path which rooted at nodes. To formulate our problem, we use weighted graph G= (N, E), where N is the set nodes (in computer networks represent the processing machines), and E indicates the connections links between computers (if the nodes can connect, we present that connection by edge e in set E). Hence, the shortest path problem is to find the path from one node to another node where the cost and delay are minimized, under a limited bandwidth of the path. We construct the set of all possible paths between any two nodes, and ( , ) is denoted as the path from node s to node d. For ant two nodes , , ( , ) is denoted as the edge between those nodes. The cost of any e is denoted as C(e), and D(e) denote the delay on edge e. we denote H(P) as the hop count in path P.
The cost of the path P is represented as the total cost of whole links e∈PT in the path and can be given by (1). We calculate the total delay in path PT by (2).
The hop count can be calculated by (3).
The vector SW(P) of path P contains the vector sum of objective values of the path.
The bandwidth of the path P from a node n to a node d is calculated by finding the least edge bandwidth in the path, and it is calculated by (5).
In general, the present shortest path optimization issue may be seen as a vector optimization problem, and it is presented in (6): where bandwidth is limited: B (P)>=B, and B is the bandwidth limit.

THE PROPOSED METHOD
The proposed algorithm implementation is based on the GA. As a result, the first step might be to define the GA parameters, such as: a. The chromosome: In the case of a network with N nodes, we will represent the chromosome as a vector of N elements since the longest path will pass through all nodes. In each chromosome, the first node and last node are present as the sender node and the destination node, as a result, each chromosome will have two or more non-zero elements to represent a pathway. b. Path length: The number of non-zero elements is the path length. c. Path sequence: The order of non-zero elements in each chromosome presents the route sequence nodes from source to destination.

Initial population
The primary population generation method produces a random set of chromosomes (set of paths) without repeated elements. i) Randomly generate a chromosome y with the first element as the source node and the last element as the destination node and the remaining elements as a random number from 0 to N. ii) For non-consequence, repeated elements replace the elements between them with zero. Iii) For all repeated consequence elements replace them with zero except one. Iv) Examine if the updated chromosome y is a valid one. In another way, check if it can present a connected path in the network graph. V) All chromosomes (paths) must meet the bandwidth limitation as shown in (5) and (6). Vi) Repeat the previous steps (a-e) till it produces the aimed population size.

The fitness/evaluation function
We use the vector SW(P) for each chromosome as its fitness function. To choose between any two paths we compare its fitness function value. For any path, we evaluate its vector SW(P) as (6): i) hop count: number of non-zero elements; ii) path delay: summation of the edges delays in the path defined by the chromosome; iii) path cost: calculated by adding the costs of all edges in the path, where the path is retrieved by the chromosome; and iv) the evaluation function value is equal to the summation of the above their items.

Genetic crossover operation
In general, crossover operations can be done in multiple cuts in the chromosome, but in this proposed GA, we choose to make a single cut point to generate the new offspring. The selected crossover ratio (Pc) is (0.9), that ratio is verified through many running of the program. The cut point is selected randomly at any point of the chromosome. A validation test is performed after the production of the additional chromosomes, just as it was done during steps 2 to 5 in section 4.1 initial population stage.

Genetic mutation operation
The mutation process is the change in the elements of the chromosome, to make a mutation in the path, in the proposed GA it is implemented by a one-bit change basis (one element). The chosen mutation ratio (Pm) is (0.02), and the turning point is chosen randomly. Again, a validation test is performed after the production of the changed chromosomes, just as it was done during steps 2 to 5 in Section 4.1 initial population stage.

THE ALGORITHM
The GA for our problem is described in the following pseudocode. For practical networks, the algorithm produces a shortest-path tree according to the objective function, where the bandwidth constraint is satisfied.
Algorithm find the shortest paths Input: Pc., Pm, pop_size, B, n (last node) and max_gen Output: The multi-objective shortest path (Minimize SW(PT)) from S to last node n 1. The primary population will be generated as described in subsection 4.1.

10.
apply mutation between every two chromosomes, steps are shown in subsection 4.4.

11.
Compute B(PT) of the candidate path by using (5).

12.
If(B(PT)<B discard PT and repeat from step 7

18.
Update the shortest path for the destination node N with the minimum SW(PT). 19. } 20. While ( > _ ) 21. Print out the multi-objective shortest path.

EXPERIMENTAL RESULTS
The suggested algorithm is implemented by using a Borland C++ version 5.5 program, and with primary parameters values: population size (pop-size=20), Pc=0.90, and Pm=0.02. Let the indexed node no.1 be the source node and the last indexed node be the destination node. The cost, delay, and bandwidth values for each given network are all randomly generated. Where Cij, Dij, and Bij distributed uniformly in the scope of [1], [20], and Hij=1.
We have generated randomly four different networks with a different number of nodes as 50, 100, 150, and 200 nodes for testing and validation of the proposed algorithm. The proposed algorithm generates the shortest path of the given networks that possess the minimum weight (cost, delay, and hop) with limited bandwidth. The proposed algorithm GA was run ten times to compute the minimal sum weights and the execution time for each network is stored to compute the average execution time. For all networks, we proposed that the bandwidth limitation is 10. Without loss of generalization, for all networks we consider the node with the final index to be the destination aim for all nodes (i.e., node no. 50 for 1 st network, node 100 for 2 nd network, and so on). Table 2 shows the best results for the first five nodes in the first network. The execution time is 10.37 for the best network and the average for all executions is 9.89. As shown in Table 2, the shortest path for 5 nodes, the shortest path of nodes no. (6,11,12,13,19,23,26) are also matched with what is shown in the table. For instance, the shortest path between node 6 and node 50 was 6-23-50, which can prove that the algorithm finds the best value of the objective function.

CONCLUSION
In this paper, we suggest a new utilization of the GA for solving the shortest path problem with bandwidth constraints. The aim is to find a route path between two nodes that has the fewest hops and meets the practical multi-objectives and practically with bandwidth limitation, as we know in practical life any network has bandwidth limitation. The proposed algorithm is a randomly weighed GA that finds the route

Abderrazak Ben Salah
is currently an assistant professor at the Faculty of Applied Studies and Community Service, Department of Management of Information Systems, Imam Abdurrahman Bin Faisal University, Dammam KSA. He received his Engineer degree in Software engineering in 1991 from Wrocław University of Science and Technology, Poland, his MSc degree in Computers Networks in 1992 from Wrocław University of Science and Technology, Poland, and his Ph.D. in Applied Computer Science in 1995 from Wroclaw University of Economics and Business, Poland. He has published many papers in the Applied Computer Science areas. His research interests include applied computer science, e-commerce security, networks and artificial intelligence. He can be contacted at asalah@iau.edu.sa.

Tamer Hashem Farag
holds a Ph.D. in Computer Science from Okayama University, Japan, 2009. He is currently an assistant professor at the Imam Abdulrahman bin Faisal University, Saudi Arabia. His research interest focused on the combinatorial optimization field, and his publication related to computer networks, image processing, management information technology, technology and sustainability, technology, and entrepreneurship. He can be contacted at thhanafy@iau.edu.sa.

Walaa Hassan
received a B.Sc. in mathematics and computer science in 1999, and M.Sc. in computational science in 2005 from Cairo University, Cairo, Egypt. She received her Ph.D. in September 2010 in network security from Okayama University, Japan. She is currently an assistant professor at Imam Abdulrahman bin Faisal University (IAU), Dammam, Saudi Arabia. Hassan's current research focuses on wireless network security, deep learning, and digital signature. She can be contacted at wahassan@iau.edu.sa.