O'Reilly logo

Genetic Algorithms and Machine Learning for Programmers by Frances Buontempo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Did It Work?

The ants move around the bag and find shorter paths. There are lots of parameters to play around with. The ants’ starting position makes a big difference. Let’s see what happens with 25 ants, running for 50 epochs, and dropping to pheromone level by 0.25 each time.

Starting in the Same Place

If the ants start in the same place, they will find the best path quite quickly. Some of the ants still wander around a little but do improve. A typical run gives about 30 steps for the worst initial path, 6 for the best, and an average of 15. The best path gets to the minimal 5 steps relatively quickly. You can see the ants find the best possible path in the figure. The best path is the solid line; the worst path is the dashed line:

Since ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required