Académique Documents
Professionnel Documents
Culture Documents
Supervisor:
Prof.AL ALLALI Naoufal
Produced by:
BABZINE Bahija && CHABOUT Hajar
The report deals with the Traveling Salesman Problem (TSP) and the use of the Ant Colony
Optimization (ACO) algorithm to solve it. The report begins by explaining the TSP problem
using an example. In the second chapter, it is explained what a real ant and an artificial ant are,
as well as how ACO uses pheromone trails to guide artificial ants in exploring the search space.
The third chapter covers the ACO algorithm and its variants, as well as the mathematical
relationships involved in the evaporation of pheromone trails and the selection of cities to visit.
The fourth chapter deals with code parallelization using fork join. Finally, in the last chapter,
the results obtained are presented, as well as a comparison between ACO and PSO, where it is
noticed that ACO is more effective than PSO in solving the TSP problem.
Resume
Le rapport traite du problème du TSP (Traveling Salesman Problem) et de l'utilisation de
l'algorithme ACO (Ant Colony Optimization) pour le résoudre. Le rapport commence par
expliquer le problème du TSP en donnant un exemple. Dans le deuxième chapitre, il est
expliqué ce qu'est une fourmi réelle et une fourmi artificielle, ainsi que la manière dont ACO
utilise les pistes de phéromones pour guider les fourmis artificielles dans l'exploration de
l'espace de recherche. Le troisième chapitre couvre l'algorithme ACO et ses variantes, ainsi que
les relations mathématiques impliquées dans l'évaporation des pistes de phéromones et la
sélection des villes à visiter. Le quatrième chapitre traite de la parallélisation du code par fork
join. Enfin, dans le dernier chapitre, les résultats obtenus sont présentés, ainsi qu'une
comparaison entre ACO et PSO, où il est remarqué que ACO est plus efficace que PSO pour
résoudre le problème du TSP.
Contents
Goal of this mini project .......................................................................................................................... 5
Organization of the report ...................................................................................................................... 5
I. Definition ......................................................................................................................................... 6
II. Example ........................................................................................................................................... 6
III. Conclusion ................................................................................................................................... 6
I. Real VS artificial ant colony ............................................................................................................. 7
II. Ant pheromones .............................................................................................................................. 7
1. pheromones ................................................................................................................................ 7
2. Pheromone trails ......................................................................................................................... 7
3. Evaporation of pheromones........................................................................................................ 7
III. Functioning .................................................................................................................................. 8
1. Finding the shortest path ............................................................................................................ 8
2. Conclusion ................................................................................................................................... 8
I. Ant Colony Optimization Algorithms (ACO) .................................................................................... 8
1. ACO variants ................................................................................................................................ 9
2. Operation of the Ant system algorithm: ..................................................................................... 9
II. Data provided: ................................................................................................................................. 9
III. Initialisation: ................................................................................................................................ 9
IV. Construction of the paths:........................................................................................................... 9
V. Pheromone Update: ...................................................................................................................... 10
VI. Algorithm: .................................................................................................................................. 10
VII. Conclusion ................................................................................................................................. 10
I. parallel and tsp problem ............................................................................................................... 10
1. Parallelization functioning in our code...................................................................................... 10
II. Conclusion ..................................................................................................................................... 11
I. Tools .............................................................................................................................................. 11
II. experimental results...................................................................................................................... 11
Table of Figures
Figure 1: Example of TSP ......................................................................................................................... 6
Figure 2: The shortest path ..................................................................................................................... 8
Figure 3: ACO Algorithm ........................................................................................................................ 10
Figure 4: Java Logo ................................................................................................................................ 11
Figure 5: Eclipse Logo ............................................................................................................................ 11
Figure 6: Comparison between ACO and PSO ....................................................................................... 12
List of abbreviation:
ACO : Ant Colony Optimisation.
TSP : Travel Salesman Problem.
AS : Ant System.
ACS: Ant Colony System
MMAS: Max Min Ant System.
EAS: Elitist Ant System.
PSO: Particle Swarm Optimization.
Introduction general
The Traveling Salesman Problem (TSP) is a classic optimization problem that involves finding
the shortest path that visits a set of cities exactly once and returns to the starting city. TSP is an
NP-hard problem and has numerous applications in logistics, transportation, and circuit board
drilling. To solve TSP, a range of optimization algorithms have been developed, including
heuristics, metaheuristics, and exact algorithms. Examples of such algorithms are simulated
annealing, genetic algorithms, ant colony optimization
Ant Colony Optimization (ACO) is a metaheuristic algorithm inspired by the foraging behavior
of ants that has been successfully applied to solve TSP. ACO is based on the concept of
pheromone trails, where ants deposit pheromones as they travel, and other ants follow these
trails to find the shortest path. ACO has been found to be an effective algorithm for solving
TSP and has been applied to real-world problems.[1][2][3]
II. Example
Solving the traveling salesman problem amounts to finding in this graph, a cycle passing
through all the vertices once (such a cycle is said to be Hamiltonian”) and which is of minimal
length.
III. Conclusion
So despite the simplicity of the problem but it is a complex optimization problem because we
do not find the exact solution quickly, The TSP is an NP-hard problem, meaning that it becomes
computationally infeasible to find the optimal solution as the number of cities increases.
Therefore, various optimization algorithms have been developed to find good approximate
solutions to the TSP.
2. Pheromone trails
Pheromone trails are scent markings used by ants to communicate and navigate between their
nest and food sources. They allow other ants to locate and follow the trail. The strength and
duration of the trail are determined by the amount of pheromones deposited and the frequency
of use. Pheromone trails are crucial for efficient ant foraging behavior and colony success.
3. Evaporation of pheromones
Pheromones evaporate naturally due to heat and ventilation, gradually reducing the strength of
ant trails. Lifetime depends on temperature, humidity, and type. Ants add new odor marks or
use tactile signals to compensate.
III. Functioning
1. Finding the shortest path
Real and virtual ants share a common goal: the search for more short path linking a starting
point (the nest) to destination sites (the food).
• The first ant finds the food source (F) via any path (a), then returns to the nest (N)
leaving behind a trail of pheromones (b).
• Ants travel indifferently on any of the four possible paths, but the reinforcement of the
pheromone trail makes the shortest path more attractive.
• Ants follow the shortest path, and the longer portions of other paths lose their
pheromone trail.
2. Conclusion
It is interesting to note that a single ant is able to build a solution of finding a way from the nest
to the food, this is only the behavior of the whole colony that creates the shortest path.
1. ACO variants
• Ant system (AS): The first ant colony algorithm The goal is to find the shortest distance
between their nest and a food source.
• Ant Colony System (ACS): Algorithm variant ant System that uses a path selection
method based on a quality value called "visibility" to solve optimization problems.
• Max-Min Ant System (MMA): Variant of the Ant System algorithm that uses upper
and lower bounds on pheromone rates to avoid premature convergence of the algorithm
and to improve the quality of the final solution.
• Elitist Ant System (EAS) : Variant of the Ant System algorithm that gives an advantage
to ants that have found the best solutions by allowing them to deposit more pheromones
on their path.
III. Initialisation:
➢ bi(t) be the number of ants in city i at time t
➢ m = p Σi∈X bi be the total number of ants, which is invariant over time
➢ τij(t) be the amount of pheromone on the edge (i,j) at time t
➢ n = |X| be the number of cities
➢ ηij = 1/dij be the visibility of city j when located in city i, which is invariant over time.
Let's now specify the behavior of the entire colony. At any time t, each ant chooses a destination city
based on a defined choice. All ants move to a city of their choice at time t+1. An iteration of the Ant
System algorithm is defined as the set of movements of the entire colony between time t and time t+1.
Thus, after n iterations, the entire colony will have completed a Hamiltonian circuit on the graph. In this
way, all ants will start and finish their tour at the same time.
VI. Algorithm:
VII. Conclusion
Ant Colony Optimization Algorithms (ACO) mimic the collective decision-making behavior
of ants to find optimal solutions to problems. ACO variants, such as Ant System, Ant Colony
System, Max-Min Ant System, and Elitist Ant System, have been successful in solving various
optimization problems.
4- parallelization
Parallelism is a computer technique that allows tasks to be executed in parallel, i.e.
simultaneously, in order to reduce the overall execution time of a program.
II. Conclusion
By using this parallelism technique, the ants' algorithm can be executed faster, which makes it
possible to find a solution for the traveling salesman problem more quickly.
I. Tools
Java is a high-level, object-oriented programming language with bytecode
compilation and platform independence, designed to be simple, secure, and
portable.
Figure 4: Java Logo
500
Time in ms
400
300 ACO
200 PSO
100
0
0 5 Number
10 of cities 15 20
▪ We notice in the two algorithms (ACO, PSO) that more the number of cities is increased,
the execution time increases.
▪ We also notice the more we increase the search space, the more the execution time in
PSO becomes larger and larger than the time execution in ACO. That is, the more
complex the problem becomes, the better the performance of the algorithms is ACO.
▪ Which is obvious since ACO is supposed to improve the performance of algorithms by
reducing their execution time.
6- Conclusion
In conclusion, this report has presented the TSP problem and the ACO algorithm as a solution.
By explaining in detail the functioning of artificial ants and pheromone trails, we have shown
how ACO can be used to efficiently explore the search space and find an optimal solution for
TSP. The variants of the ACO algorithm have also been presented, as well as how the code can
be parallelized to improve performance. Finally, by comparing ACO to PSO, we have shown
that ACO is more effective for solving the TSP problem. In summary, the ACO algorithm is a
powerful and effective method for solving TSP, and understanding it can be useful for solving
other combinatorial optimization problems.
References
[1]: awler, E. L., Lenstra, J. K., Rinnooy Kan, A. H. G., & Shmoys, D. B. (1985). The Traveling
Salesman Problem: A Guided Tour of Combinatorial Optimization. John Wiley & Sons.
[2]: Blum, C., & Roli, A. (2003). Metaheuristics in combinatorial optimization: Overview and
conceptual comparison. ACM Computing Surveys, 35(3), 268-308.
[3]: Dorigo, M., & Stützle, T. (2004). Ant Colony Optimization. MIT Press.
[4] : Papadimitriou, C. H., & Steiglitz, K. (1998). Combinatorial Optimization: Algorithms and
Complexity. Dover Publications.