Swarm Intelligence Part 1 Ants Algorithm
Swarm IntelligencePart 1
Ants Algorithm
BIONICSاز • بسياری برای گرفتن الگو و الهام منبع طبيعت
است بوده علمی های پيشرفت و تحقيقات•: مثال عنوان به
ژنتيک – های Genetic Algorithmsالگوريتمعصبی – های Neural Networksشبکهده – خودسازمان های Self-organizingسيستم
Systems از • برخی رفتار اساس بر موارد این از گروهی
رفتار که عسل زنبور و ها مورچه مثل حشراتاست بوده دارند اجتماعی
های • الگوريتم اساس این بر شبکه زمینه درتوزیع و مسیريابی مثل کاربردهايی برای قدرتمندی
اند شده طراحی بار
• BIONICS: Application of biological principles to the study and design of engineering systems.
Swarm Intelligence
“any attempt to design algorithms or distributed problem-solving devices inspired by the collective behavior of social insect colonies and other animal societies” [Bonabeau, Dorigo, Theraulaz: Swarm Intelligence, p. 7]
الگوريتم طراحی و سازی مدل
Ants ها مورچه
عالم • موجودات انگيزترين شگفت از يکی ها مورچههستند.
را • ای پيچیده های فعاليت گروهی صورت به ها مورچه: دهند می انجام
زياد – يا کم حجم در غذا انتقال و کشفغذا – سازی ذخیرهپيچيده – سازی النهالنه – تميزکاریها – تخم از محافظتآب – از عبور برای پل تشکيلکشاورزی–داری – گله–.........
مشترک ويژگی
نظم • بدون بعضا و ساده حرکاتی ها مورچه تک تکدهند می انجام خاص
خاص • نظمی آنها حرکات برآيند از مجموع در اما. آید می پديد پيچیده بسيار وگاها
•. ندارد دخالت امر اين در رهبری و هدايت نوع هیچ
Emergence
•Emergence به هم با مرتبط ساده عوامل تعدادی که افتد می اتفاق وقتیمی ای پيچیده هوشمند رفتار به منجر که کنند می عمل هماهنگ ای گونه
شود.• : است باال به پايين از فرایند يک عوامل Emergenceاین جمعیت متن از
. گیرد نمی صورت آن در مديریتی و رهبری هيچگونه و شود می شروع
Unique global behavior arising from the interaction of many agents
پديد جزء عوامل از زيادی تعداد تعامل برآيند از که کلی رفتارآيد می
Emergence
•Emergence : جمعی زندگی افتد می اتفاق متعددی های سيستم دربدن دفاعی سيستم انسان، مغز حشرات، از بعضی خاصا و حيوانات
شهری زندگی و شهرسازی سیتم ها، انسان اجتماعی انسان،رفتارهای..... و انسان
بروز • به منجر سطح يک در موجود عوامل ها سيستم اين از يک هر در. شوند می باالتر سطح در ويژگی يا رفتار
"EMERGENCE The connected lives of ants, brains, cities, and software" by Steven Johnson
Unique global behavior arising from the interaction of many agents
پديد جزء عوامل از زيادی تعداد تعامل برآيند از که کلی رفتارآيد می
ها مورچه رفتار
کند • می اجرا را ای ساده الگوريتم مورچه هرمجموعه • اثر بر تری پيچيده بسيار الگوريتم
شود می اجرا ها مورچه رفتارهای
Swarm Intelligence
• Swarm Intelligence جزئی تعامل جمعی هوش ياهدف یک حصول برای ساده عوامل زيادی تعداد
است کلی•: از عبارتند جمعی هوش خصوصيات
اند – ساده عواملمی – برقرار ارتباط هم با غيرمستقيم صورت به عوامل
کنندحاصل – عوامل ساده جزئی رفتارهای از پيچیده کلی رفتار
شود میپايدارند – رفتارها اینتاثيرند – بی کلی نتيجه حصول در عوامل تک تک
ها: مورچه النه تميزکاری مثال
را • النه درسطح پراکنده غذای ویا ها آشغال ها مورچهکنند می کپه جا چند یا یک در و آوری جمع
•: شود می عملی ترتيب اين به کار ايندر – هدف بی و دلخواه صورت به گردش به شروع مورچه هر
کند می النه سطحدارد – می بر را آن کرد برخورد آشغال تکه یک به مورچه اگردهد – می ادامه خود تصادفی گردش به مورچهکنار – در را قبلی تکه ديگررسید آشغال تکه يک به مورچه اگر
دهد می قرار آندهد – می ادامه خود گردش به باز وکنار – گوشه در ها آشغال که شود می مشاهده مدتی از بعد
. اند شده کپه النه
Ant Colony Optimization
• Marco Dorigo is research director of the IRIDIA lab at the Université Libre de Bruxelles
• Inspired by the remarkable ability of social insects to solve problems, Dorigo and Stützle introduce new technological design principles for seeking optimized solutions to difficult real-world problems, such as network routing and task scheduling.
Ant Colony Optimization
•Ant Colony Optimization ازکردن پيدا برای ها مورچه قابليت
ترين کوتاه یا کوتاه مسيرهایشبکه در مسيريابی برای مسيرها
کند می استفاده
می چگونه ها مورچهمسير ترين کوتاه توانند
؟ کنند پيدا را
می برقرار ارتباط ها مورچه چگونهکنند
فقط • و ندارند را شنيدن و ديدن توانايی ها مورچهکنند می استفاده بويايی حس از
ندارند • نيز صدا ها مورچهو • صدا با توانند نمی ها مورچه ترتيب اين به
کنند ایجاد ارتباط هم با شنيدنتوانند • می بويايی حس از استفاده با ولی
کنند منتقل را اطالعاترا • ارتباط نوع :”stigmergy“اين گويند می
بوی – که گذارند می جا به را موادی خود از ها مورچهدارند خاصی
مواد – این شود pheromoneبه می گفتهها – ها pheromoneمورچه مورچه ساير از مانده جا به
کنند می حس رابوی – شدت ها مورچه براین نيز pheromoneعالوه را
دهند می تشخيص
The Shortest Path (1)
• Two ants start their random walk • They both eventually find the food• The one taking the shorter path finds the food first• Each ant leaves a trail of pheromones behind• Once taken the food the ants follow their pheromone trail
towards the nest
Nest Food
The Shortest Path (2)
• The one taken the shorter path returns first and arrives back to the nest first
Nest Food
The Shortest Path (3)
• Now a third ants wants to search for food
• The ant realizes the trials left behind by its predecessors
• Most likely it follows one of the existing trials rather than initiating a new trial
• Most likely it follows the trial with the higher density of pheromones
Nest Food
The Shortest Path (4)
• This results in even denser pheromone trial on the shorter path
• In long term this results in most ants using the shortest path
Nest Food
Simple Stochastic Algorithm
حرکت • به شروع مورچه يک وقتی: کند می
را – جديد مسير یک کوچکی احتمال با. کند می شروع
مسيرهای – از يکی بيشتری احتمال بادارای را pheromoneموجود
. کند می انتخابهر – موجود مسيرهای انتخاب در ولی
شدت يک pheromoneچهآن انتخاب احتمال باشد مسيربيشتر
. بود خواهد باالتر نيز
تازه؟ مسيرهای چرا
کوتاه • الزاما قبلی های مورچهاند نکرده انتخاب مسيررا ترين
تواند • می جديد مسيرهای انتخابتر کوتاه مسيرهای يافتن به منجر
بشوديافتن • به منتهی اين نهايت در
شود می مسير ترين کوتاه
pheromone تدريجی محو و تبخير
•Pheromone. شود می تبخير تدريج به•. است الگوريتم بودن پويا ضروريات از یکی اينبدون • تر کوتاه مسيرهای به کوتاه مسيرهای از انتقال
پذير pheromoneتبخير امکان قديمی مسيرهای در . بود نخواهد
وفقی الگوريتم
•. کند می عمل وفقی صورت به الگوريتمتبخیر • و تازه مسيرهای شروع احتمال امر اين علت
. است قبلی مسيرهای در تدريجی
مسير تغييرات و خرابی با مقابله
می • وفقی و پويا رفتار دليل به الگوريتممسير در خرابی وقوع صورت در تواند
مقابله آن با جايگزين مسير يافتن باکند.
شود • ايجاد مسير در تغيير اگر همچنينمی هماهنگ تغييرات با را خود الگوريتم
کند.مورچه • مسير در سنگی اگر مثال برای
دور را آن ها مورچه شود داده قرار هاآن کنار در را جديدی کوتاه مسير و زده
. کنند می پيدا
*Disclaimer: May not work with a cube of ice
جانبی اثر
اطراف • محيط در موجود غذاهای بین در ها مورچه. کنند می منتقل را آنها ترين نزديک ابتدا النه
است • الگوريتم جانبی اثر یک اينباشد • داشته زيادی کاربردهای تواند می پديده اين
StarLogo• http://education.mit.edu/starlogo/• StarLogo is a programmable
modeling environment for exploring the behaviors of decentralized systems, such as ant colonies.
• In decentralized systems, orderly patterns can arise without centralized control.
• Increasingly, researchers are choosing decentralized models for the organizations and technologies that they construct in the world, and for the theories that they construct about the world.
• StarLogo visualizes the behavior of the decentralized system
StarLogo
• StarLogo consists of graphic turtles and an environment• The behavior of the turtles can be programmed• All turtles run the same program in parallel• A turtle can represent almost any type of object: an ant in a colony, a car in a
traffic jam, an antibody in an immune system, a molecule in a gas • Also the effect of the environment on turtles can be programmed• You can write programs for thousands of "patches" that make up the turtles'
environment. • Turtles and patches can interact with one another• Turtles can be programmed to "sniff" around the environment, and change
their behaviors based on what they sense in the patches
Modeling the Ants Behavior
DEMO
Don’t go awayWe will continue after the demo
Part 2Ants in Networks
History
•ABC routing (Schoonderwoerd et al., 96)•Regular and Uniform ant routing (Subramanian et al., 97)•Antnet (Dorigo et al., 98)•Antnet++ (Dorigo et al., 02)•Improved Antnet (Boyan et al., 02)•Modified Antnet (Tekiner et al., 04)•Antnet with evaporation (Tekiner et al., 04)•Ants algorithm with QoS (Carrillo et al., 04)
What Are Ants
• Ants are emulated by mobile agents• Mobile agents are carried by packets• Especial packets can be used as mobile agents
(ants)
initialize_ant ()while (current_state target_state)
A = read_local_pheromone-table()P = compute_transition_probabilities (A, M, problem_constraints)next_state = apply_ant_decision_policy (P, problem_constraints)move_to_next_state (next_state)if (step-by-step_pheromone_update)
update_pheromone_table() // deposit pheromone on visited arcupdate_ant_memory()
if (delayed_pheromone_update)evaluate_solution()update_pheromone_tables() // deposit pheromone on ALL visited arcs
die()
What About Pheromones?
• Pheromones pass the information about the length of the path (time) to other ants– The agents can pass the same information to
data packets at the nodes
• Ants decide based on the density of the pheromones and some probability values– The probability values can be calculated
based on the path information and listed in routing tables in the nodes
AntNet
• First application of ants algorithm for routing in (datagram) packet networks
• Ants are sent between source-destination pairs to create a test and feedback signal system
• Ants discover and maintain routes– Inter-node trip times are used to adjust next-hop
probabilities
• Packets are forwarded based on next-hop probabilities
Routing Table
• Start with a static routing table for each node.• Each routing table stores the probabilities of using the
next hops to reach all possible destinations– Sum of probabilities at each row equals one
Port/dest
N1 N2 … Nn
1 P11 P12 … P1n
2 P21 P22 … P2n
3 P31 P32 … P3n
Ports (Neighboring Nodes)
Destin
ation
s
Routing Table Updates
• To create a dynamic routing table, create “ants” as agents that will go back and forth to random destinations.
• These ants will then update the probabilities in the routing table.
• Packets will be transferred to paths based on the probabilities listed in the routing table
The Agents• Two types of agents (ants):
– Forward Ants (to collect information)– Backward Ants (to update probability
table)• Two types of queues:
– Low priority queue (data packets and forward ants)
– High priority queue (backward ants)• Forward ants are routed at the same
priority as data packets– Forward Ants experience the same
congestion and delay as data• Backward ants are routed with higher
priority than other packets
Buffer
FIFO1
FIFO2
Out[ ]
Port1
Port2FIFO1
FIFO2
FIFO1
FIFO2
Port N
Scheduler
Scheduler
Scheduler
Forward Ants
• At regular intervals every node creates a forward ant to randomly selected destinations.– Destinations are selected to match current traffic patterns– Forward ant uses probabilistic routing tables at every intermediate
node to choose output port from unvisited list of nodes.
• Elapsed time and node identifier is pushed to ant’s stack.• If a cycle is detected , cycle is deleted from ant’s memory.• When a forward ant reaches to its destination It
transforms itself to a backward ant
Backward Ants
• A backward ant visits the list of the nodes in its stack in a reverse order,
• Updates corresponding entries in the routing tables and array on its way back to source by using its values stored on its stack.
Example
Statistics
• Except for the routing table, each node also keeps a table with records of the mean and variance of the trip time to every destination
• At each node, backward ants update the trip time statistics to the destination in addition to the next-hop probability
N1 N2 … NnStat1 Stat2 … Statn
Routing Table Updates
• Reinforcement Factor (Based on the trip time and the statistics)
r = f (1 - Wbest/T) + g (mean,var)0 < r < 1,
• Increase the probability of the channel that backward ant comes from
P’ = P + r * (1 - P) = P * (1 – r) + r
• Decrease the probability of the other channels P’ = P * (1 - r)
Data Packets
• Data packets are routed using the next-hop probabilities
• The packets are distributed over the paths proportional to their probabilities
• A probability threshold level can be used to avoid selection of not-so-good paths
• Achieve some degree of load balancing over all existing good paths
Performance
• AntNet reports better performance in terms of:– Delay – Throughput– Robustness– Reaction to changes
• Traffic overhead is higher than OSPF
Variations
• Different varieties of the antnet routing algorithm will be resulted depending on the:– Forward ant routing mechanism– Routing table update mechanism– Packet forwarding criterion
Router Architecture
Loo
kup an
d
forwardin
g
Forward_ANT
Backward_ANT
Data Packet
Buffer
FIFO1
FIFO2
Out[ ]
Port1
Port2FIFO1
FIFO2
FIFO1
FIFO2
Port N
Scheduler
Scheduler
Scheduler
P\N N1 N2 … N31 P11 P12 … P13
2 P21 P22 … P23
… … … … …3 P31 P32 … P33
Updating
Evaporation
• Link usage statistics are used to evaporate the pheromone laid by the ants.
• It is the proportion of number of forward ants destined to the node x over the total ants received by the current node in the given time window.
• By evaporating the links probabilities in a predefined rate, average delay experienced per packet is reduced
“Improved antnet routing algorithm with link probability evaporation” F. Tekiner, F. Z. Gassemlooy, and S. Al-Khayatt
Congestion
• Agents are delayed if congestion occurs
• Has the same effect of a longer path
• Pheromones evaporate more
• Less pheromone if agent is delayed more
Quality of Service
• M-Class ants are used for M-class type of services
• Probabilities in the routing table represent the probability that packets can reach the required level of QoS
• The probabilities are updated based on the delay statistics per QoS class and the available bandwidth
• Considering other QoS parameters, such as availability etc., can be studied
“A Quality of Service Routing Scheme for Packet Switched Networks based on Ant Colony Behavior ”Liliana Carrillo and J.L. Marzo
Security Issues
• Threats– Untrustworthy hosts
• Forward data/ant packets to a wrong direction• Delay data packets• Generate bursts of ant packets
– Malicious Agents• Carry false trip time information
• Attack Goals– Increase the packet latency
• Mislead packets to a longer path– Break down a critical node
• Mislead packets to a certain node to overload it – Drop Data Packets
• Mislead packets to a malicious node
“Security Issues in Ant Routing”Weilin Zhong
Conclusion
• Application of swarm intelligence in network routing problems
• Inspired by the stigmergy model in ant colonies
• Using mobile multi-agent systems
• A distributed adaptive routing algorithm
• Autonomous
THE END