Advanced optimisation 
techniques demo disk
Copy the disk onto your hard disk (using the xcopy or copy command). 
You need a PC-compatible computer with a VGA screen, and a mouse if possible. If 
your setup includes a secondary monochrome monitor, our software will automatically 
display additional information on that monitor.
TSPGA, FOOD and GAFUNC: the genetic algorithm
The genetic algorithm lets you obtain solutions to problems that cannot be solved 
directly, analytically or algorithmically. 
With this method, many thousands of more or less correct solutions ("genotypes") 
are submitted to a crude version of the evolution of species: survival of the fittest, 
and evolution of successive generations through reproduction and mutation ("genetic 
variation"). 
In problem-solving applications of this method, each creature embodies a possible 
solution to the problem considered, and the better it solves the problem, the fitter it is.
The initial population thus has successive generations. The fittest members of the 
population are allowed to imprint the next generation more than other, less fit ones. 
Successive generations become better and better solutions to the problem 
considered.
The mechanism ensuring evolution and solution is not dependent on the problem to 
be solved. The only changing parts are the function that decodes the genotype into a 
solution in terms of the problem (you can use any way that satisfies you, preferably 
the simplest possible) and the one that computes the fitness of these solutions 
(generally by testing on a few hundred test cases). This technique is truly generic.
A few applications of this technique are presented here:
FOOD.EXE (freely adapted from published works by Mr. John KOZA): robots move 
around in a room (with green walls). The paths followed through the rooms are shown 
in red for a few members of the population. We want to obtain robots that "know" to 
pick up as much food as possible (blue squares).


Click on Find to start the evolution. Hit <Escape> to stop it. The paths followed by a 
representative sample of the population are shown in red in the largest, top window. 
The evolution of the amount of food picked up (fitnesses) in the two small windows, 
bottom right, as well as the distribution of fitnesses in the current population.

 

TSPGA.EXE solves the "Travelling Salesman's Problem" (TSP). 
To start it, type tspga, then <Return>, or tspga 32 (for example) for a 32-city tour 
(the number of cities by default is 25, the maximum allowed 256). 
Click on Find to start the evolution and hit <Escape> to stop it. Click-Left on Cities 
or hit <F1> to create a "square-style" new map, click-Right (or <Shift>-<F1>) to create 
a new map with random city positions. 
GAFUNC.EXE shows a few examples of 2-variable function optimisation. Selection 
intensity (option /i) is intentionally low in this demonstration, else the population 
concentrates so fast around the "good" parts of the data space that the evolution is 
hardly visible (blink and you miss it). It is possible to take arbitrary constraints into 
account; some examples have red zones, that are "forbidden". The population quickly 
avoids these. This software also shows an example of a function with many equal 
maxima (Multimax on the menu).
Why this technique is interesting
The GA does not require any knowledge of how to get a solution for the problem to be 
solved; we only need a way to evaluate possible solutions. (The encoding and decoding of 
genotypes is usually straightforward.) This a brutal approach that requires lots of 
computing power, but shows the immense practical advantage to provide near-optimal 
solutions to problems that do not have an algorithmical solution (that we do not know how 
to solve by a succession of predefined steps). 
The GA is also easy to put to use: the "engine" is shared (and contained in the Galvano 
Library), there is little problem-specific code to write.
For the connoisseurs
TSPGA, GAFUNC and FOOD all have a variety of options. To display the options list, type 
TSPGA ? or TSPGA /help. Rates of each genetic operation, number of 
chromosomes, of generations, etc. can be set. 
Some of the most interesting options are /q and /BsS (/q is active by default) which 
automatically balance the different operators' rates and location of operation to avoid 
excess dispersion as well as domination by any one genotype.
Option /rs lets you apply another, very efficient optimisation method: simulated 
annealing, described separately in the last section.
Bonus: STAMPS
The STAMPS software is used to compute optimal frankings. This problem is hard, similar 
to the knapsack problem or the Traveling salesman's.
To try this application, type for instance STAMPS 3.5. The software indicates how many 
stamps of each kind are needed to realise the desired amount.
The solution provided by STAMPS is higher (if unavoidable) or equal to the desired amount; 
the number of stamps and of kinds is as low as possible, to reduce manipulations. The 
stock od stamps is defined in STAMPS.txt that you can modify as you wish, using for 
instance DOS's edit.
TSPSA: simulated annealing
TSPSA.EXE is an application of simulated annealing. 

 

This software is adapted from published works by Teuvo KOHONEN and Bernard 
ANGNIOL. 
The working principle of simulated annealing is borrowed from metallurgy: a piece of 
metal is heated (= the atoms are given thermal agitation), then left to cool slowly. The 
slow and regular cooling of the metal allows the atoms to slide progressively in their 
most stable ("minimal energy") positions. (Rapid cooling would have "frozen" them in 
whatever position they happened to be at that time.) The resulting structure of the 
metal is stronger and stabler.
Here we do not minimize the energy of a block of metal, but some cost function 
relevant to the problem at hand.

The example shown here is another way of solving the Traveling Salesman's problem. 
The solution appears very fast. Two successive launches do not generally yield the 
same solution. The system looks "alive".
Click on Find (or hit <F2>) to start the evolution, hit <Escape> to interrupt it. 
Click-Left on Cities (or <F1>) to create a "square-style" new map, click-Right (or 
<Shift>-<F1>) for a truly random map.

Speed is only one of the differences between the previous approach (specific and 
fast) and the use of the GA to solve the same problem:


Ad hoc approach
(analytical, specific)
Genetic approach 


Speed
Depends, generally good
Poor

Performance
Depends
Fair to good

Human work
A few minutes to a few theses
1 day

Applicability
Most interesting problems 
have no usable mathematical 
expression, or are non-
computable("NP-complete").
General




Optimisation techniques: the genetic algorithm and simulated annealing - 5


