I developed ant colony algorithm. It is working quite good at the moment.
In some moot points it can show not best path, but close to best one.
For example, I have this graph:
Matrix is:
1 2 3 4 5 6 7
1 0 6 5 0 0 2 0
2 6 0 3 2 1 5 0
3 5 3 0 2 5 0 0
4 0 2 2 0 3 0 0
5 0 1 5 3 0 6 0
6 2 5 0 0 6 0 2
7 0 0 0 0 0 2 0
First col and first row are vertex names.
So possible paths are (path - length of the path):
1. 1-2-5 with length 7
2. 1-6-2-5 with length 8
3. 1-6-5 with length 8
My programm is choosing 1st path in 1/10 starts, 2nd path in 7/10 starts and 3rd path in 2/10 start of the programm.
Is it working correct?
Explanation for this is ants has their own eyes (vision, they look at edge length) and also they can detect pheromone level. Own eyes shows for them, that 1-2 edge is rather long and longer then edge 1-6, so in generally they will choose edge 1-6 instead of choosing 1-2. Same for 6-5 and 6-2: 6-2 is more attractive, because it is shorter.
Am I right with my assumption?