Solve the Traveling Salesperson Problem.

Genetic algorithms enable you to solve difficult or even seemingly insoluble problems with simple, iterative algorithms modeled on genetics. For example, I show you how to use the genetic algorithm presented in this article to find the shortest route between two nodes in a randomly interconnected web, a problem that has many real-life analogues.

      Implementing this solution requires only a handful of objects. The Node and Link objects are elemental; the Node object has references to its terminating nodes. This pair of objects is sufficient for building a complete Web. Modeling pathways that connect a start node to a target node requires combining nodes and links. The Section object is a node/link unit, while the Route is a collection containing a combination of sections. The Route object must also refer to the start node for the route to be continuous from start to target.