-- This testbed is designed to experiment with Genetic
Algorithm (GA) programs. The task is to solve the
Traveling Salesman problem, which cannot be solved by
the brute-force method of checking all paths, even when the number of cities is relatively
small -- for instance, with just 15 cities, the number of
possible paths connecting them is 15! = 1,307,674,368,000.
The problem we're trying to solve is the following:
given a number of cities (between 6 and 20) randomly placed as
points on a circle, and given a number of salesmen (between 4
and 100), find as short a path as possible starting from any
city, then traveling to every other city and then returning to
the first. I have placed the cities in a circle so that
we, as humans, can see the obvious shortest path (from each city
to its neighbor all around the circle). However, the
routines we develop do not know that there is an obvious
solution in this particular case -- we are developing a general
algorithm that should be suitable for any set of points on a
plane (or, for that matter, any dimension greater than or equal
to 2). Unless the number of cities that we choose is small
(like 4 or 7), it's unlikely that our algorithms will find the
shortest route, but the GA-Viewer will show us the best path
we've found (the best of our salesmen), and then the paths that
the other salesmen have found (progressively worse paths).
-- The testbed for experimenting with
Genetic Algorithms (GA) consists of two cooperating programs:
a) the
GA-Viewer.nlogo program (which I have provided) and b) a
Python genetic algorithm program (which you will write) The two work together, with the Netlogo-based Viewer calling the
Python program to implement the GA algorithm, and then receiving
the Python program's results, which the viewer displays.
-- Create a directory (folder) on your computer for GA
experiments. We'll call this your GA directory.
-- The GA-Viewer.nlogo can be downloaded by right-clicking
here, and choosing "Save As...". Put it into your GA
directory. It was written using Netlogo version 6.0.1, and
you may need to download and install that version to use it.
-- I've also provided a sample Python (non-GA) program that
works with the GA-Viewer, so that you can see how they interact.
It's called GA-Random -- it does not implement a genetic
algorithm -- it simply assigns a random path (a random
permutation of the cities) to each saleman. It's provided
so that you can see how the interaction between a Python program
and the GA-Viewer must occur. Download it from
here
to your GA directory. Once downloaded, change the
suffix of the file from ".txt" to ".py"
Below you'll find documentation on the GA-Viewer.nlogo
program, and then documentation on the data formats for the
transfer of information between the Netlogo program and your
Python program. And finally there's the documentation
about your Python program.
Contents:
|