How the Ant Colony Optimization algorithm works

Ali Mirjalili
4 Oct 201822:26

Summary

TLDRThis video delves into the mathematical models behind ant colony optimization, focusing on how ants find the shortest path to food. It explains two key concepts: pheromone deposition and evaporation. The video introduces a matrix to represent pheromone levels on a graph and discusses methods for depositing pheromones based on path quality. It also covers the decision-making process ants use to select paths, influenced by pheromone levels and path costs. The speaker provides a detailed numerical example to illustrate these concepts, highlighting the interplay between pheromone levels, path quality, and the probability of choosing a particular path.

Takeaways

  • 🐜 The video discusses mathematical models for ant colony optimization (ACO), focusing on how ants find the shortest path from a source to food.
  • 📐 It introduces two main concepts: pheromone deposition and vaporization, which are crucial for simulating the ants' behavior on a graph.
  • 🔱 A mathematical model is presented to represent pheromone levels on a graph, where the amount of pheromone deposited by an ant is inversely proportional to the path length.
  • 🌟 Pheromone levels can be adjusted based on the quality of the path found, with higher quality paths receiving more pheromone.
  • 🌀 The concept of evaporation is included in the model, where a certain percentage of pheromone evaporates over time to simulate real-world conditions.
  • 📉 The video provides a numerical example to demonstrate how pheromone levels are calculated and updated on a graph, including the effects of evaporation.
  • 📈 A decision-making process is discussed, where ants use pheromone levels and path quality to choose the most promising path.
  • 🎯 The probability of choosing a path is calculated using a formula that considers both pheromone levels and path quality, with parameters to adjust their relative importance.
  • 🔄 The video explains how to use the calculated probabilities to select paths using a roulette wheel selection method, which is part of the ACO algorithm.
  • đŸ’» The presenter mentions that these mathematical models will be implemented in code for the ACO algorithm, indicating practical application in computer simulations.

Q & A

  • What are the two main concepts discussed in the video regarding ant colony optimization?

    -The two main concepts discussed are the mathematical modeling of pheromone deposition and the simulation of pheromone evaporation.

  • How is pheromone deposition mathematically modeled in the context of ant colony optimization?

    -Pheromone deposition is modeled using the equation Delta Tau(i, j, k) = 1 / L(k) if an ant k travels on the edge connecting node i to node j, otherwise it's 0. L(k) represents the length of the path found by ant k.

  • What does the variable 'LK' represent in the mathematical model?

    -In the mathematical model, 'LK' represents the length of the path found by the ant k.

  • How is pheromone evaporation simulated in the mathematical model?

    -Pheromone evaporation is simulated by including a term (1 - Rho) * Tau(i, j) in the equation, where Rho is a constant that defines the evaporation rate.

  • What is the significance of the constant 'Rho' in the evaporation equation?

    -The constant 'Rho' signifies the evaporation rate. When Rho is 0, there is no evaporation, and when it is 1, all pheromones evaporate before new ones can be deposited.

  • How does the quality of a path influence pheromone deposition according to the video?

    -The quality of a path influences pheromone deposition because ants deposit more pheromones on shorter paths or paths leading to high-quality food sources.

  • What is the role of the 'eta' term in the decision-making process of ant colony optimization?

    -The 'eta' term represents the quality of the edge (i, j) on the graph. It is used in the probability calculation to decide which path to choose, with the formula considering both pheromone levels and edge quality.

  • How is the probability of choosing an edge calculated in the ant colony optimization algorithm?

    -The probability of choosing an edge (i, j) is calculated using the formula: (Tau(i, j)^alpha * ETA(i, j)^beta) / sum(Tau(i, k)^alpha * ETA(i, k)^beta for all edges k from node i), where alpha and beta are parameters that control the relative importance of pheromone levels and edge quality.

  • What technique is used to select an edge based on the calculated probabilities?

    -The roulette wheel selection technique is used to choose an edge based on the calculated probabilities.

  • Can you explain the concept of a 'roulette wheel' in the context of ant colony optimization?

    -In the context of ant colony optimization, the 'roulette wheel' concept involves generating a random number and using the cumulative sum of probabilities to determine which edge to choose, simulating a probabilistic decision-making process.

  • What is the importance of the parameters alpha and beta in the probability calculation?

    -The parameters alpha and beta allow for the adjustment of the influence of pheromone levels (Tau) and edge quality (ETA) on the decision-making process. They help in fine-tuning the algorithm to emphasize either pheromone trails or path quality.

Outlines

00:00

🐜 Introduction to Mathematical Models of Ant Colony Optimization

The paragraph introduces the mathematical models used in ant colony optimization (ACO) for finding the shortest path in a graph. It discusses the need to model the deposition of pheromones by ants and the process of pheromone evaporation. The focus is on two main concepts: how to mathematically represent pheromone deposition and how to simulate the evaporation process. The explanation includes the decision-making process of ants when choosing a path, increasing the likelihood of selecting a short path by considering pheromone levels and path quality.

05:03

📊 Pheromone Deposition and Evaporation Equations

This section delves into the equations governing pheromone deposition and evaporation. It explains how the amount of pheromone deposited by ants can be represented mathematically, taking into account the quality of the path found. The concept of pheromone evaporation is introduced with an equation that includes a constant, 'Rho', which defines the evaporation rate. The paragraph provides a numerical example to illustrate how pheromone levels are calculated and updated on a graph, emphasizing the impact of evaporation on these levels.

10:03

📐 Calculating Pheromone Levels and Choosing Paths

The paragraph explains how to calculate pheromone levels on each edge of a graph and how ants use these levels to choose paths. It introduces a mathematical model that represents pheromone levels and discusses the use of matrices to store and update this information. The process of selecting a path using probabilities based on pheromone levels and edge quality is outlined, with an equation that considers both pheromone levels (Tau) and edge quality (ETA). The role of parameters alpha and beta in decision-making is highlighted, along with a numerical example that demonstrates how probabilities are calculated for different edges.

15:04

🎯 Probability Calculation and Path Selection

This section focuses on the calculation of probabilities for choosing a path and how these probabilities guide ants in selecting the next edge to traverse. It provides a detailed numerical example that shows how probabilities are computed based on pheromone levels and edge costs. The example illustrates how ants are more likely to choose paths with higher pheromone levels and lower costs. The paragraph also discusses the impact of varying pheromone levels on these probabilities and how the roulette wheel technique can be used to select a path based on these probabilities.

20:06

🔚 Summary and Implementation of ACO

The final paragraph summarizes the key points covered in the video script, which include the mathematical models for simulating pheromones, evaporation, and the use of these values to calculate the probability of choosing a path. It mentions the upcoming implementation of these mathematical equations in code for the ant colony optimization algorithm. The speaker thanks the viewers for watching and teases the next video in the series.

Mindmap

Keywords

💡Ant Colony Optimization (ACO)

Ant Colony Optimization (ACO) is a metaheuristic algorithm used to solve combinatorial optimization problems. It is inspired by the foraging behavior of ants, which deposit pheromones to communicate with each other. In the video, ACO is used to find the shortest path in a graph, simulating how ants find the shortest path from their nest to food sources. The script discusses mathematical models for simulating pheromone trails and evaporation, which are key components of the ACO algorithm.

💡Pheromone

Pheromone, in the context of ACO, refers to the chemical substances that ants deposit on their paths. These substances are used by other ants to determine the most efficient route to a food source. In the video script, pheromone is used to mathematically model the process of finding a short path on a graph, where the amount of pheromone deposited on each edge of the graph is represented by a matrix.

💡Evaporation

Evaporation in ACO refers to the process where pheromone trails gradually disappear over time, simulating the natural evaporation of pheromones in ant colonies. This concept is crucial for preventing the algorithm from becoming stuck in local optima. The script mentions how evaporation can be mathematically modeled using a constant (Rho) to define the evaporation rate, which is a key factor in the pheromone update rule.

💡Decision Making

Decision making in ACO involves using the pheromone levels to choose the next path or node. The script discusses how ants use the pheromone levels and the quality of the path to make decisions, increasing the probability of choosing a short path. This decision-making process is essential for the algorithm's ability to find optimal solutions.

💡Graph

A graph in the video represents a network of nodes (or vertices) connected by edges, which is a common way to model problems in combinatorial optimization. The script describes how to mathematically model the process of finding a short path on a graph using pheromone matrices and how ants use these graphs to navigate.

💡Famish

Famish, as used in the script, seems to be a typographical error and likely refers to 'pheromone'. It is used to describe the substance deposited by ants, which is central to the ACO algorithm. The script discusses how to mathematically model the deposition of famish (pheromone) on the ground and how it is represented in the algorithm.

💡Path Length

Path length is a measure of the distance or cost associated with moving from one node to another in a graph. In the video script, the length of each path is used to determine the amount of pheromone deposited by ants, with shorter paths receiving more pheromone, thus encouraging other ants to follow the same path.

💡Matrix

A matrix is a mathematical structure used to represent data in a tabular form. In the context of the video, matrices are used to represent the pheromone levels and path lengths on a graph. The script mentions how these matrices are updated as ants traverse the graph, which is essential for the functioning of the ACO algorithm.

💡Rho (ρ)

Rho (ρ) is a constant used in the ACO algorithm to control the evaporation rate of pheromones. A higher value of Rho means a higher evaporation rate, which can prevent the algorithm from converging too quickly on a suboptimal solution. The script explains how Rho is used in the mathematical model to simulate the evaporation process.

💡Quality of a Path

Quality of a path refers to the desirability of a particular route based on certain criteria, such as its length or the amount of pheromone deposited. In the video script, the quality of a path is considered when modeling the pheromone deposition process, with higher quality paths receiving more pheromone.

💡Combinatorial Optimization

Combinatorial Optimization is a type of mathematical optimization problem where the goal is to find the best solution from a finite set of possible solutions. The video script discusses how ACO is applied to solve such problems, specifically focusing on finding the shortest path in a graph.

Highlights

Introduction to mathematical models for ant colony optimization technique.

Explanation of how to mathematically model the process of finding a short path on a graph.

Discussion on the two main concepts from the previous video: pheromone deposition and vaporization.

How to mathematically model pheromone deposition by ants on the ground.

Simulation of pheromone vaporization based on time, duration, and other factors.

The decision-making process using pheromone and graph models to increase the probability of choosing a short path.

Cosmetics matrix defining the length of each path on the graph.

Introduction of a matrix to represent the amount of pheromone on each edge of the graph.

Different methods for depositing pheromone and how they affect the model.

Mathematical model representing pheromone level on a graph and the role of Delta Tau.

Explanation of how pheromone is deposited based on the quality of the path found by an ant.

The concept of pheromone evaporation and its role in the蚁 colony optimization algorithm.

Numerical example to understand pheromone level and evaporation rate.

Calculation of the length of pathways and how it affects pheromone deposition.

Impact of multiple ants on the pheromone level of an edge.

Introduction to the equation for calculating the probability of choosing an edge.

Role of parameters alpha and beta in the decision-making process.

Numerical example demonstrating the process of calculating the probability of choosing each edge.

How the roulette wheel technique is used to choose a destination based on probabilities.

Summary of the mathematical models used in ant colony optimization for combinatorial optimization problems.

Conclusion and鱄摊 of the next video in the series.

Transcripts

play00:10

hello everyone and welcome back in the

play00:13

last video we talked about the process

play00:15

of finding the shortest path in an ant

play00:19

colony from an s to food sirs in this

play00:23

video we're going to be focusing on the

play00:25

mathematical models developed for this

play00:29

technique so we'll see how we can

play00:31

mathematically model the process of

play00:33

finding a short path on a graph so there

play00:37

are two things that we have to focus and

play00:40

there were two main concepts in the last

play00:44

video the first one was as you can see

play00:46

here famine so we have famine of course

play00:50

ant deposit famine on the ground but how

play00:53

do we mathematically model this that's

play00:56

the first question that we are going to

play00:57

answer second one how do we simulate

play01:00

vaporization right let's say we simulate

play01:04

the famine right on a graph how do we

play01:07

then vaporize it based on time based on

play01:10

duration based on what that's the second

play01:12

question and finally as you can see over

play01:14

here we're going to be talking about the

play01:16

decision making process so we'll see how

play01:19

we can use you know a famine and a graph

play01:22

let's say Furman famine values or famine

play01:26

simulation to make a decision and to

play01:30

increase the probability of choosing a

play01:32

short path so these are the thing that

play01:34

we are going to find out in this video

play01:37

let's discuss the details of the

play01:40

mathematical models with the drawn

play01:42

example we have a cosmetics defining the

play01:45

length of each path on the left hand

play01:47

side as you can see now I'm going to

play01:51

also add another matrix to represent the

play01:55

famine the amount of famine on each edge

play01:58

of this graph but this matrix allows us

play02:02

to store the amount of famine on each

play02:05

edge of the graph but the question is

play02:09

how do we add famine to each of those

play02:11

pathways there are different methods out

play02:14

there some methods deposit the same

play02:16

amount of famine recall these of the

play02:18

paths found by the end for example if an

play02:21

ant goes this way

play02:23

they're gonna add

play02:24

one to each of those edges however there

play02:27

are also other models that deposit

play02:29

Furman based on the quality of a path

play02:32

found by an ant and in fact there are

play02:36

some species of ants that deposit more

play02:39

pheromones

play02:40

if the food source is big or of high

play02:43

quality so in this lesson I'll show you

play02:46

how to define the thermal level based on

play02:49

the quality of the path because it's

play02:51

obviously more promising for example if

play02:54

I have an end that goes on this path and

play02:56

this path is already very good I'm going

play03:00

to deposit more pheromone to be able to

play03:02

attract more ants to that path so yeah

play03:06

that's what we are going to consider and

play03:08

assume in this slice and in this course

play03:10

here's the mathematical model used to

play03:14

represent a pheromone level on a graph

play03:17

so basically Delta Tau shows the amount

play03:21

of pheromone that an ant deposit but

play03:24

remember an ant walks on a graph right

play03:27

so it goes from one point to the next

play03:31

and that's exactly what we need those

play03:33

subscripts right so I and J shows the

play03:37

edge connecting the node ID to the node

play03:40

J and what is KK is basically the case

play03:43

and so Delta Tau I and J and K shows the

play03:47

amount of pheromone deposited by the

play03:50

cave and on the I on the edge connecting

play03:55

I the node I to the node J and as you

play03:59

can see it's equal to 0 if the ant dozen

play04:03

go on an edge right so for example if

play04:07

it's one and two and this unders and go

play04:09

there the pheromone level should be

play04:11

equal to zero otherwise it's equal to

play04:15

one divided by L K so what is LK

play04:19

basically LK is the length of the path

play04:22

found by the cave end and why do we have

play04:25

to divide 1 by L K remember we are

play04:28

trying to find a shortest path so the

play04:31

shorter the path the higher pheromone

play04:34

should be deposited by the end

play04:36

so this is exactly what is simulated

play04:38

here or I should say this is exactly

play04:40

what has been mathematically model here

play04:43

so 1 divided by K so if I have a path

play04:46

with 5 edges

play04:48

you're gonna deposit you know those 5

play04:50

edges with high famine or high value

play04:52

here because that's a good path right so

play04:56

we have multiple ends of course how do

play04:59

we now calculate the amount of famine on

play05:02

each edge of course we need to add a

play05:05

summation so summation of K is equal to

play05:07

1 to M where m is equal to the total

play05:09

number of ends Delta Tau I and J K or

play05:14

super-sorry superscript K so this is

play05:17

where we don't have any evaporation

play05:18

right because we keep adding famine over

play05:22

time if you want to simulate the

play05:25

evaporation you have to add this part to

play05:29

your equation so 1 1 is Rho times the

play05:32

current thermal level plus the new

play05:36

famine the pole that should be deposited

play05:38

by all ends now as you can see we've got

play05:42

a constant here Rho is a constant that

play05:45

allows you to define the evaporation

play05:48

rate when Rho is equal to 0 there is no

play05:52

operation because 1 minus 0 times tau I

play05:55

and J so gonna add you know the current

play05:59

the new amount of pheromones to the

play06:02

current every time when Rho is equal to

play06:05

1 then that will be 1 minus 1 times tau

play06:07

that is where they have operation is at

play06:10

the maximum level Oh everything all the

play06:13

pheromones evaporates for the next step

play06:18

before it gets to even get deposited

play06:20

next time

play06:21

so people normally use a number between

play06:23

0 to 1 of course you're gonna choose

play06:26

small ones and sub-problem big ones for

play06:30

others it depends on the problem people

play06:32

normally use evaporation the equation

play06:35

with the evaporation to be able to

play06:37

simulate what happens in reality

play06:39

otherwise if there is no firm one on the

play06:41

ground you know the end

play06:43

cannot communicate so let's have a look

play06:46

at a numerical example to better

play06:49

understand the idea behind pheromone

play06:52

level and the evaporation rate so I've

play06:56

got two hands on the left hand side a

play06:57

pepper and a green so that is the path

play07:01

by the purple and that is a path

play07:05

traveled by the green and the first step

play07:09

is to calculate the length of those

play07:11

pathways so l1 is equal to 14 4 plus 5

play07:16

plus 4 plus 1 so Delta Tau 1 I and J is

play07:21

equal to 1 divided by 14 the second one

play07:25

at the second and l2 is equal to 31 so 4

play07:28

plus 8 plus 4 plus 15 will give you 30 1

play07:33

and Delta Tau 2 equals 2 1 divided by 31

play07:37

now how do we add that to our graph

play07:40

which is called Feynman graph easy look

play07:43

at these green lines without any pepper

play07:47

that's where I have to add 1 divided by

play07:50

31 ok

play07:51

no pepper color just green one because

play07:54

the pepper and doesn't walk on these

play07:57

edges of the graph for by contrast these

play08:01

sites where we have only pepper color we

play08:04

have to add 1 divided by 14 which we

play08:06

calculated already here for the other

play08:10

two edges this one and this one as you

play08:13

can see on the cost graph we have both

play08:16

ants trouble on them right so that's

play08:18

where I have to add 1/4 14 plus 1

play08:22

divided by 31 so as you get the idea now

play08:25

if multiple ants go through on one edge

play08:28

we're going to consider or calculate the

play08:31

sum of their pheromones as the farmer

play08:34

famine level of that edge so I'm using

play08:36

this equation and remember there is no

play08:39

evaporation and we're going to calculate

play08:42

this so that would be zero point zero

play08:43

seven zero point zero three and these

play08:45

are a zero point one basically zero

play08:48

point yeah one there we go so these are

play08:51

the final famine values for our famine

play08:55

graph so quick

play08:57

question for you let's say I've got now

play09:00

an ant here that's the next time let's

play09:02

say I have a red ant starting from the

play09:05

tent which path is more likely to be

play09:08

taken by that end one Fairmont zero

play09:12

point seven one zero point three one

play09:14

zero point one which one has a higher

play09:16

famine deposited of course this one so

play09:20

the array the red ant is more likely to

play09:22

choose this one just like the analogy

play09:25

that I talked about it before in one of

play09:27

the videos now let's consider the firm

play09:31

the firm one I need an initial firm on

play09:34

level let's say we have an end that walk

play09:36

around and deposit one on each of the

play09:40

edges now I'm going to consider a

play09:43

pheromone they have operation so one one

play09:46

is basically Rho times tau tau I and J

play09:51

and we're going to assume that the

play09:53

problem I mean the Rho is equal to 0.5

play09:57

that means every time 50% of the current

play10:00

ephemeral level evaporates so see what

play10:02

happens now remember these are the

play10:04

initial value or we caught one so 0.5

play10:07

times 1 that was the current value plus

play10:11

1 divided by 14 coming from the peple

play10:13

and this one again same value the ones

play10:17

the diagonals 0.5 times 1 plus 1 divided

play10:20

by 13 and the ones at the top and the

play10:23

bottom 0.5 times one plus one day what

play10:26

about 14 plus 1 divided by 31 so these

play10:30

are the final values that we can

play10:32

consider for this this this Fairmont

play10:36

graph so again still if you considered

play10:39

this note this side is more likely but

play10:42

as you can see we have more bigan begin

play10:45

numbers for these ones so again the idea

play10:47

evaporation removes a little bit of

play10:50

pheromone every time and deposit again

play10:53

depending on you know the graphs or the

play10:55

edges that the ants travel so far this

play10:59

is how we calculate the pheromone level

play11:03

for each of dance remember when you want

play11:06

to implement this this mathematical

play11:09

model you cannot have graph

play11:10

you can visualize them of course but you

play11:12

need a matrix so basically you need a

play11:14

matrix for your cost you need a matrix

play11:18

for your pheromones as well so we

play11:19

eventually these numbers will be updated

play11:21

to fare more matrix so that's about it

play11:26

for any combinatorial optimization

play11:27

problem that we want to solve using the

play11:30

ant colony optimization algorithm such

play11:33

pheremones matrices and updating

play11:35

processes should be considered the next

play11:38

step is to use the pheromones calculated

play11:42

in the first step to choose a path as

play11:45

discussed before and choose a path using

play11:49

probabilities here's an equation to

play11:52

simulate this you can see in this is lot

play11:55

that the probability of choosing the

play11:58

edge I and J is equal to tau I and J to

play12:02

the power alpha multiplied by ETA I and

play12:07

J to the power of beta divided by the

play12:09

sum of the same equation in the

play12:12

nominator of course tau is the pheromone

play12:15

level but what does Ito indicates

play12:18

basically ETA indicates the quality of

play12:21

the RJ edge on the graph with the

play12:25

parameters alpha and beta we can

play12:27

increase or decrease the impact of tau

play12:30

or ETA in the process of decision making

play12:32

the denominator of this equation as the

play12:36

pheromone and quality of all edges that

play12:38

can be considered from the node I this

play12:41

probability is calculated for all the

play12:43

edges connected to the current node and

play12:45

is a number in the interval of 0 & 1

play12:50

if you just want to make a decision

play12:52

based on the pheromone level then you

play12:55

can remove Ito from that equation so

play12:57

it's up to you if you want to consider

play13:00

the quality of an edge then this part

play13:03

should be there if not just remove it

play13:05

and remember we are interested in the

play13:07

shortest path so ETA I and J is equal to

play13:11

1 divided by L I and J so that means the

play13:15

length of an edge or the cost of n H

play13:17

indicates how good it is in the process

play13:20

of calculating the probability of

play13:23

choosing

play13:24

let's consider another numerical example

play13:27

to better understand the process of

play13:30

calculating the probability of choosing

play13:32

each of the edges on a graph so I've got

play13:35

two graphs here this one shows the costs

play13:38

right for each edge and this one shows

play13:41

the famines remember I'm going to assume

play13:44

that the alpha and beta and these

play13:47

equations are all equal to or both equal

play13:49

to one for the simplicity of course and

play13:52

normally people assume they are one

play13:54

unless they want to highlight the impact

play13:56

of one of them on calculating the

play13:58

probabilities but to make it simple I

play14:00

assume that they are both equal to one

play14:02

so how do we calculate this this

play14:04

probability so let's say we have a

play14:07

yellow end who is trying to find one of

play14:11

these passes or make a decision which

play14:13

one to pick so probability of choosing

play14:16

the pond is equal to so here's the pond

play14:18

here's the tenth is equal to the family

play14:23

level 1 times 1 divided by the cost

play14:27

which is 1 so 1 times 1 divided by 1

play14:30

that's the nominator what about the

play14:33

denominator basically the denominator is

play14:36

where we need to calculate the same

play14:38

equation for all these edges but the

play14:41

first one is the pond already so the

play14:43

same as the nominator but this one is

play14:47

for the tree so look at it 1 times 1

play14:51

divided by 15 which is its cost and last

play14:54

one is famine which is 1/2 the car of

play14:58

course plus 1/4 so that give us 0.75 and

play15:03

95 let's calculate the probability of

play15:06

choosing the car the nominator is

play15:11

different now 1 divided by 1 times 1/4

play15:15

but the denominator is identical because

play15:18

you're going to calculate all of them

play15:20

write the equation for all the edges and

play15:22

finally this is the probability of

play15:24

choosing the tree so it's equal to 0.05

play15:27

this one is equal to 0.18 roughly so

play15:32

what does that mean that means the ant

play15:36

is large

play15:38

to choose the pawn 76% with the

play15:41

probability of 76 percent five percent

play15:43

for the 319 percent for the car why we

play15:48

have very small percentage for the tree

play15:50

that's obvious because the weight the

play15:54

connection weight or the path is longer

play15:58

than the other think about 15 as

play16:00

compared to 1 and 4 and look at the

play16:03

probability of choosing the pond

play16:04

seventy-six percent right and that's a

play16:07

good indication of it you know the

play16:09

impact of the pheromone and at the same

play16:12

time the cost on calculating the

play16:15

probability of choosing one of the

play16:18

destinations in this example so see

play16:20

seventy-six percent this pie chart looks

play16:22

very good and shows you you know how big

play16:25

the probability of choosing the pond is

play16:27

seventy-six percent as compared to 19

play16:29

and five remember the pheromones level

play16:34

were identical so the impact where I

play16:36

similar on each of these probabilities

play16:38

to show what happens and how and then

play16:42

gravitates towards you know higher

play16:45

pheromones in addition to of course the

play16:47

costs are lower cuz I should say I'm

play16:49

going to replace this by five let's say

play16:52

the initial pheromone value for this

play16:56

edge is equal to five so what will

play16:58

happen in my equation so I have now 5

play17:01

times 1 divided by 4 or 5 times 1

play17:03

divided by 4

play17:04

this one just in the denominator not

play17:07

denominator because the pheromone level

play17:09

when you go from the tenth to the tree

play17:12

is equal to 1 and finally for that one

play17:14

so what are the probabilities now there

play17:17

we go

play17:18

43% for the pond 3% for the tree and 54%

play17:24

for the car they calculate the

play17:28

probability of choosing the car was 90

play17:30

percent and now it is equal to 54

play17:34

percent even more than the pond because

play17:39

the thermal level is 5 times as compared

play17:42

to the pheromone level of this edge so

play17:44

this is the idea of this equation and I

play17:46

hope these examples and these

play17:48

visualization a numerical example I

play17:50

should

play17:50

allow you to get your head around you

play17:53

know these this mathematical model it's

play17:56

fair to straightforward but very

play17:57

fascinating and beautiful from my port

play18:00

of perspective so that summarize

play18:03

everything I've got basically both of

play18:06

the graphs look at the comparison of the

play18:09

car

play18:10

in both cases from 19% to 54% so in the

play18:16

mathematical model of the ACO and

play18:18

consider both the quality of a path and

play18:21

also the amount of Fairmont deposited on

play18:25

you know that path so this is how the

play18:28

ACO you know to make a decision and

play18:31

choose one notes of each craft you know

play18:34

when trying to find the lowest-cost path

play18:37

or the shortest path in this example

play18:39

when a graph example a question that you

play18:42

might be asking now is how do we use

play18:45

these probabilities to choose one of

play18:47

those destinations okay

play18:49

we know that 76% of the times we have to

play18:52

choose the pond 5% the tree and 90% the

play18:57

car but how do we mathematically choose

play18:59

them well the answer is using a

play19:02

technique called roulette wheel I

play19:04

covered this completely in my course on

play19:07

the genetic algorithm if you haven't

play19:10

enrolled to that course that's fine I

play19:12

briefly take you through the steps of

play19:14

using a roulette wheel but if you want

play19:17

more details if you want to get into the

play19:20

details and basically implemented I

play19:23

highly recommend you to have a look at

play19:26

the lecture in my course on the genetic

play19:28

algorithm I think it is in the selection

play19:30

operator of the the genetic algorithm I

play19:34

believe it is in the selection so

play19:36

remember we have those probabilities

play19:38

0.76 0.19 and 0.5 the first step is to

play19:42

calculate the cumulative sum how do we

play19:45

calculate the cumulative sum is

play19:47

basically you're going to add the

play19:49

current probability to each of the ones

play19:53

under 2 itself and each of the ones on

play19:55

the right hand side so 76 plus 19 plus

play19:58

0.5 is required to basically one

play20:02

next up we have nineteen plus 0.5 so

play20:05

that's gonna give us zero point twenty

play20:07

four and finally last one nothing is on

play20:09

the right hand side so that's gonna give

play20:11

us zero point zero five now we don't use

play20:13

the probability vectors anymore we'll be

play20:16

using just the cumulative sum to pick

play20:19

one of them how do we pick one of the

play20:21

destinations well the answer is by

play20:23

generating a random number between zero

play20:26

and one so we generate a random number

play20:29

in the interval of zero and one if that

play20:32

random number is between zero point two

play20:34

to one as you can see in this comparison

play20:36

then we are gonna choose the pond if it

play20:39

is between 0.5 to 0.24 we're gonna

play20:43

choose the car otherwise we if the radio

play20:47

is numb if the random number not the

play20:48

radius number what am I saying

play20:50

if the random number is between 0 to 0.5

play20:53

then we are gonna choose the tree so

play20:57

think about the probability of choosing

play20:59

pond between zero point two two zero

play21:02

point one if I generate an random number

play21:04

in that interval between 0 to 1 there

play21:08

are roughly 75 76% that it goes it lies

play21:12

in this in this interval right sub

play21:13

interval so that's how we simulate the

play21:17

roulette wheel and use it to select one

play21:22

of the destinations in our graph using

play21:27

the ant colony optimization and that's

play21:30

pretty much everything guys for this

play21:32

video so let's quickly summarize

play21:33

everything that was a long video so we

play21:37

started with the mathematical models to

play21:40

be able to simulate pheromones on a

play21:42

graph evaporation and we ended up using

play21:46

those values to calculate the

play21:49

probability of choosing a destination or

play21:52

an edge basically on a graph so I'm

play21:56

going to be using these mathematical

play21:57

equations in my code later on when we

play22:00

you know implement the ant colony

play22:02

optimization that is the end of this

play22:05

video thanks for watching and I will see

play22:07

you in the next one

play22:16

you

Rate This
★
★
★
★
★

5.0 / 5 (0 votes)

Étiquettes Connexes
Ant ColonyOptimizationShortest PathMathematical ModelPheromone TrailsGraph TheoryEvaporation RateDecision MakingAlgorithmACO
Besoin d'un résumé en anglais ?