International Journals of Advanced Research in Computer Science and Software Engineering Research Article June 2017 Swarm Based Intelligence Routing Algorithm (Ant Colony) Madhusudan G Asst. Professor, Department of CS&E, SJCE, Mysore, Karnataka, India DOI: 10.23956/ijarcsse/V7I6/0106 Kumar TNR Asst. Professor, Department of CS&E, MSRIT, Bangaluru, Karnataka, India Abstract: The basis of the algorithm Swarm Intelligence (SI) Protocol, gives idea to difficult and intelligent characteristic through simple, non centralized and unsupervised interactions between a large sheer of autonomous swarm intelligent members. The algorithm ant colony optimization algorithm is popular due to its dynamic and adaptive nature in the real time system. It is concerened mainly with ants which find the shortest routing path to food by secreting a substance called pheromone. All the other ants follow the initial ant which took the shortest path from source to destination. When a obstacle or disturbance is faced by any other ant, further finds a new shortest path from source to destination and all other ants follow the new ant. Keywords: Ant Colony Optimization (ACO) I. INTRODUCTION Mobile Ad hoc network is self configuring network of mobile hosts connected by wireless links, the union of which forms the topology of the network [1]. Ant algorithms are the class of optimizing algorithms under swarm intelligence (SI)[2][3]. Routing in ant algorithm [4][5] is through interaction of network exploration agents called ants.the ant-based routing algorithms follow a similar general strategy. Nodes send ant agents out at regular intervals to randomly chosen destinations. The main aim of the ants is to find the sample paths, assign a quality to them, and use this information to update the routing tables in the other nodes they passed in the given network. These routing tables contains an entry for each destination and each neighbour, indicating the goodness of going over this neighbour on the way to the other destination.some of the algorithms used for routing in ad hoc networks are destination-sequenced distance vector routing, wireless routing protocol, ad hoc on-demand distance vector routing and dynamic source routing protocol [6][7]. The specific challenges and possible applications of MANETs have proved ways to many routing algorithms in mobile adhoc networks. The People traditionally classify these algorithms as either proactive or reactive with dynamic routing nature of the network. In the purely proactive routing protocols, nodes tries to maintain all times routing path to all other nodes in the network along with source and destination nodes. This means that they need to keep track of all dynamic topology changes, which may become difficult if there are a lot of nodes in the network between source and destination or if they are very mobile in the dynamoc environment. On the there hand in Reactive routing protocols nodes only gather routing information on demand or based on the current requirement of the network only. when they have data to be sent for a certain few destination they construct a path, and only when the path current becomes infeasible they search a new path in the network environment. In this way they greatly reduce the routing overhead occured in the network. But they can suffer from oscillations in network performance since they are never prepared for disruptive events. This goodness value is called pheromone. This pheromone information is used for the routing of both ants and data packets: all packets are routed stochastically, choosing with a higher probability those links with higher pheromone values. If enough ants are sent to the different destinations, nodes keep up-to-date information about the best paths from source to destination in the network, and automatically adapt their data load spreading to this network. Ant-based routing algorithms have a number of properties which are desirable in MANETs; They are highly adaptive to network changes, use active path sampling, Ant-based routing are robust to agent failures, provide multipath routing, and take care of data load spreading. II. ANT PATH OPTIMIZATION The termites would like to build a hill from the pebbles. A termite is bound by these rules:[8]a classic Swarm Intelligent routing is that of the path optimizing behavior of ants. It is widely used to motivate applications such as routing in computer networks and optimization of path in the network. Ants have been shown to adapt to their environment and always find the most efficient path to their food source. Ant Path Optimization basic technique is explained below. Consider a number of ants all traveling between their nest along a single available path to a food source (Fig 1.(a)). As each ant returns with food, it deposits a small amount of pheromone on the trail of the visited path. The Pheromone is a volatile chemical to which ants are attracted. It evaporates over time, requiring that new pheromone be continuously laid or else it will disappear completely and the trail path will vanish. Ants leaving the nest are attracted to the pheromone trail laid by returning ants. They are biased to follow it,when they leave the nest looking for more food. This example is uninteresting with only a single path from sourced to destination. When an unevenly shaped obstacle or distract is placed between the nest called as source and the food source called as destination. the ants are forced to choose a way around it (Fig.1.(b)). Because no pheromone exists around the obstacle, ants travel in equal proportions around each side until resuming the original pheromone trail. Since it takes longer for returning ants to travel around the longer side of the www.ijarcsse.com, All Rights Reserved Page 298
obstacle, pheromone has more time to decay in between ant arrivals (Fig.1.(c)). The weakened pheromone trail along the longer route around the obstacle is offset by the relatively strong trail on the shorter route; ants are able to travel that route more frequently and thus reinforce the pheromone trail there more often. Since ants are attracted to stronger pheromone trail, the shorter trail is eventually favored by nearly all ants over the longer trail (Fig.1.(d)).The global optimization problem is solved. The ants adapt to a new environment and are able to choose the shortest path between source and destination. Swarm Intelligent Framework: Swarm intelligence (SI) [9,10,11] is a relatively novel field that was originally defined as Any attempt to design algorithms or distributed problem-solving devices inspired by the collective behavior of social insects and other animal societies [9]. Wireless sensor networks (WSNs) [12] consist of a large number of autonomous nodes equipped with sensing capabilities, wireless communication interfaces, and limited processing and energy resources. The attraction of ants to pheromone represents the positive feedback in this swarm intelligent system. A stronger pheromone trail is built on the shorter path, and this allows ants to be drawn away from the suboptimal solution. Pheromone evaporation limits the amount of pheromone that can be placed on a trail. Fig.1 Ant Path Optimization Many ants are required to test the available paths to the food source. Each successive trip is a biased random choice by each ant. Each ant may have a different experience as it travels between the nest and the food source, and so these different experiences must be averaged out over time. Each trip represents a statistical test of the system. The sum of all trips and decisions by each ant is the eventual choice of the shortest path by the group. Ultimately, the act of each outgoing ant choosing the stronger pheromone trail yields an emergent shortest path algorithm. Akkaya and Younis [13] group routing protocols for WSNs into four categories: (i) data-centric, (ii) hierarchical, (iii) location based, and (iv) QoS-aware. Data-centric protocols do not require a globally unique ID for each sensor node, and perform mul-tihop routing by using attribute-based naming mechanisms. Most of the SI routing algorithms inspired by ant behaviors have been developed in the context of the framework of Ant Colony Optimization (ACO) [15,16,17], an optimization metaheuristic based on the abstraction and engineering of the basic mechanisms at work in ant colony foraging. For more comprehensive surveys, the interested reader is referred to [16,17,18,19,20] and the references therein. Pseudo Code of the algorithm: graph = {'S': {'A':1, 'B':9}, 'A': {'C':3, 'D':1}, 'B': {'D':1,'E':2}, 'C': {'F':2},'D': {'F':7,'G':8}, 'E': {'G':3}, 'F': {'T':5}, 'G': {'T':2} } newgraph ={'S':{'A':1, 'B':9},'A': {'D':1}, 'B': {'D':1,'E':2},'D': {'F':7,'G':8},'E': {'G':3},'F': {'T': 'G': {'T':2}} def findpaths(graph, start, end, path): path = path + [start]; if start == end: return [path]; if not graph.has_key(start): return []; paths = []; www.ijarcsse.com, All Rights Reserved Page 299
for node in graph[start]: if node not in path: newpaths = findpaths(graph, node, end, path); for newpath in newpaths: paths.append(newpath) ; return paths; def costpairs(paths): for path in paths: i=0, cost=0 ; while i <= len(path)/2: cost=cost+calculatecost(path[i],path[i+1]) ; i=i+1 ; path.append(cost) def calculatecost(node1,node2): return graph[node1][node2] ; def findshortestpath(paths): def findshortestpath(paths): cost=9999; for path in paths: if path[len(path)-1]<cost: cost=path[len(path)-1]; i=paths.index(path); return i; def transferpackets(paths): for path in paths: packets.append(path[len(path)-1]*2) maxhopcount=max(packets); i=maxhopcount k while i>0: for packet in packets: packets[packets.index(packet)]=packets[packets.index(packet)]-1; if packets[packets.index(packet-1)]==0: return packets.index(packet-1); i=i-1; def calculatepheromone(packets,paths):i=0;for node in packets: remainder = float(node/((paths[i][len(paths[i])-1])*2.0)) *100 ; pheromone.append((100-remainder)*0.1); i=i+1 ; def display(paths): str = "-->"; print "Source:S","\n","Destination:T"; print "Different routes calculated:\n"; for path in paths: ele = path[:len(path)-1]; print "\t\t ",str.join(ele)," "; return ; #main part ; def main(graph): str="-->"; i=1; paths = findpaths(graph, 'S', 'T',path); costpairs(paths); display(paths); shortestpathindex=findshortestpath(paths); print "\npackets(ants) are transferred to destination following different paths" print "\npackets are being transferred..." ; fastestpacket=transferpackets(paths); ele = paths[fastestpacket]; ele = ele[:len(ele)-1]; print "\npacket following path ",str.join(ele)," reached first\n"; print "\npheromone of shortest path:10.0"; calculate pheromone(packets,paths); print "\npheromone of different routes:\n"; for ele in pheromone: www.ijarcsse.com, All Rights Reserved Page 300
print "\troute",i,"-->",ele i=i+1 ele = paths[fastestpacket]; ele = ele[:len(ele)-1]; print "\nhighest priority is given to path",str.join(ele),"\nall the subsequent packets follow the same path" path=[]; pheromone=[]; packets=[]; main(graph); path=[]; pheromone=[]; packets=[]; print "\n--------------------------------case 2-----------------------------------\n" print "Network changed, node C moved out of the network" main(newgraph); The Source S, Destination T, representing the initial and final nodes of the network. The different routes calculated shown above. The packets are transferred to destination folllowing different paths.n The packet are being transferred with the best one is showed seperately. The pheromone of the different routes is also shown. The highest priority is given to path and all the subsequent packets follow the same path. www.ijarcsse.com, All Rights Reserved Page 301
In case 2 of the problem, the network is changed.ie., node c is moved out of the network. The source S and Destination T is taken as the source and the sink of the network. The different route calculated is shown above. The ants are transferred to destination is represented with packet with the best path is also represented. The pheromone of the different routes is shown and the highest priority is given to path is also repsented. All the subsequent packets follow the same path is shown with highest priority. III. OUTPUT ANALYSIS AND GRAPHS Comparison of Cost of the paths versus Pheromone Quantity: Representation of the Graph www.ijarcsse.com, All Rights Reserved Page 302
The graph is represented with pheromone quantity is taken along the Y axis and the cost of the different routes is taken along the X axis. From the graph above, it is clear that the ants will choose the shortest path because it will have the highest pheromone intensity. IV. CONCLUSION Implementation of Swarm Intelligence Routing using Ant Colony optimization has been done and conclusions can be drawn. We can say that the act of each outgoing ant choosing the stronger pheromone trail yeilds an emergent shortest path algorithm. Ants are able to adopt to the new environment and then find the shortest path by being biased towards the pheromone gradient. REFERENCES [1] Andrew S Tannenbaum, Computer Networks, 4th Edition, Prentice-Hall of India [2] E. Bonabeau, M. Dorigo, and G. Théraulaz, Swarm intelligence: from natural to artificial systems, Oxford University Press, 1999. [3] T. White, "Swarm intelligence and problem solving in telecommunications", Canadian Artificial Intelligence Magazine, spring, 1997. 42International Journal of Next-Generation Networks (IJNGN),Vol.1, No.1, December 2009 [4] G. Di Caro and M. Dorigo, "Mobile agents for adaptive routing", Proc. 31st Hawaii International Conference on System Sciences, IEEE Computer Society Press, Los Alamitos, CA, pp. 74-83, 1998. [5] Schoonderwoerd R, Holland O, Bruten J, Rothkrantz L. Ant-Based load Balancing in telecommunications networks, Adaptive Behavior Hewlelt-Packard Laboratories, Bristol- England, pp 162-207, 1996. [6] Nader F Mir, Computer and communication Networks, Pearson Education, 2007 [7] Liang S, Zincir Heywood A N, Heywood M I, The effect of Routing under local information using a Social insect Metaphor, IEEE International Congress of Evolutionary Computation, pp 1438-1443, May 2002. [8] Martin Roth and Stephen Wicker Termite: Emergent Ad-Hoc Networking " Wireless Intelligent Systems Laboratory School of Electrical and Computer Engineering Cornell University Ithaca, New York 14850 USA [9] E. Bonabeau, M. Dorigo, G. Theraulaz, Swarm Intelligence: From Natural to Artificial Systems, Oxford University Press, New York, USA, 1999. [10] A. Engelbrecht, Computational Intelligence: An Introduction, second ed., Wiley, 2007. [11] J. Kennedy, R.C. Eberhart, Y. Shi, Swarm Intelligence, Morgan Kaufman, San Francisco, USA, 2001. [12] I.F. Akyildiz, W. Su, Y. Sankarasubramaniam, E. Cayirci, A survey on sensor networks, IEEE Communications Magazine 40 (8) (2002) 102 114. [13] K. Akkaya, M. Younis, A survey on routing protocols for wireless sensor networks, Ad Hoc Networks 3 (3) (2005) 325 349. [14] J. Al-Karaki, A. Kamal, Routing techniques in wireless sensor networks: a survey, IEEE Wireless Communications 11 (6) (2004) 6 28. [15] G.A. Di Caro, Ant Colony Optimization and Its Application to Adaptive Routing in Telecommunication Networks, Ph.D. Thesis, Faculté des Sciences Appliquées, Université Libre de Bruxelles (ULB), Brussels, Belgium, 2004. [16] M. Dorigo, G.A. Di Caro, The ant colony optimization metaheuristic, in: D. Corne, M. Dorigo (Eds.), New Ideas in Optimization, McGraw-Hill, 1999, pp. 11 32. [17] M. Dorigo, T. Stützle (Eds.), Ant Colony Optimization, MIT press, 2004. [18] A.A. Abbasi, M. Younis, A survey on clustering algorithms for wireless sensor networks, ACM Computer Communications 30 (14 15) (2007) 2826 2841. [19] A. Boukerche, M. Ahmad, B. Turgut, D. Turgut, A taxonomy of routing protocols in sensor networks, in: A. Boukerche (Ed.), Algorithms and Protocols for Wireless Sensor Networks, Wiley, 2008, pp. 129 160 (Chapter 6). [20] Z. Jin, Y. Jian-Ping, Z. Si-Wang, L. Ya-Ping, L. Guang, A survey on position-based routing algorithms in wireless sensor networks, Algorithms 2 (1) (2009) 158 182. www.ijarcsse.com, All Rights Reserved Page 303