Skip to content

MainTechAI/Ants

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ant colony optimization

At the time I wrote this code, I was a fairly inexperienced Python developer. So, the architecture of the application turned out to be pretty weird. Perhaps I should rewrite it.

Output example

1 epoch ended, best result: 202.0 shortest path [0, 6, 13, 14, 9, 11, 4, 5, 10, 3, 7, 1, 2, 8, 12]

2 epoch ended, best result: 192.0 shortest path [0, 5, 10, 3, 4, 7, 12, 6, 13, 14, 9, 11, 2, 1, 8]

3 epoch ended, best result: 182.0 shortest path [0, 14, 1, 2, 9, 8, 4, 10, 7, 3, 6, 5, 12, 11, 13]

4 epoch ended, best result: 182.0 shortest path [0, 14, 1, 2, 9, 8, 4, 10, 7, 3, 6, 5, 12, 11, 13]

5 epoch ended, best result: 182.0 shortest path [0, 14, 1, 2, 9, 8, 4, 10, 7, 3, 6, 5, 12, 11, 13]

6 epoch ended, best result: 177.0 shortest path [0, 3, 7, 10, 1, 8, 4, 11, 13, 14, 6, 5, 12, 2, 9]

7 epoch ended, best result: 177.0 shortest path [0, 3, 7, 10, 1, 8, 4, 11, 13, 14, 6, 5, 12, 2, 9]

8 epoch ended, best result: 177.0 shortest path [0, 3, 7, 10, 1, 8, 4, 11, 13, 14, 6, 5, 12, 2, 9]

9 epoch ended, best result: 170.0 shortest path [0, 7, 12, 2, 13, 11, 9, 8, 4, 1, 14, 6, 5, 10, 3]

10 epoch ended, best result: 164.0 shortest path [0, 4, 11, 2, 13, 12, 7, 3, 10, 14, 6, 5, 9, 8, 1]

11 epoch ended, best result: 164.0 shortest path [0, 4, 11, 2, 13, 12, 7, 3, 10, 14, 6, 5, 9, 8, 1]

21 epoch ended, best result: 163.0 shortest path [0, 13, 14, 6, 9, 2, 8, 1, 4, 3, 7, 10, 5, 11, 12]

26 epoch ended, best result: 154.0 shortest path [0, 8, 4, 3, 7, 10, 14, 6, 12, 9, 2, 1, 13, 11, 5]

28 epoch ended, best result: 140.0 shortest path [0, 13, 11, 4, 2, 8, 1, 7, 12, 9, 5, 6, 14, 10, 3]

50 epoch ended, best result: 140.0 shortest path [0, 13, 11, 4, 2, 8, 1, 7, 12, 9, 5, 6, 14, 10, 3]

Exploration completed, best result: 140.0

About

Ant colony optimization algorithm applied to the travelling salesman problem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages