User Manual for the Genetic Algorithms tool

 

Installation note 

This program requires a machine that runs Java 1.3 or higher virtual machine and a display resolution of 800 by 600 pixels. A Java virtual machine is not provided with the GGAT downloadable version from the web, but a Java Development Kit 1.3 is added in the CD-Rom.

To ensure that there are no package path conflicts, preventing execution of the software, a Start class is provided that should be used. A path has to be specified pointing to the Java virtual machine. In Microsoft Windows NT this is done by typing “classpath=%classpath%;C:\jdk1.3\bin” in the console window if the virtual machine is located in the \jdk1.3\bin directory of the C drive. Then in the same console window by typing “java -cp C:\GGAT Start” the GGAT should start, presuming the directory where the GGAT program is \GGAT on the C drive. When a bad command error massage is returned, it means the java virtual machine path is not specified correctly.

 

Program Overview

 The start window is the main window of the GGAT (figure 1).

  1 - GGAT main window

  

Exit Program

 The program can be terminated at any time by pressing the Exit button from the main window or by closing the main window from the X button usually in the upper right corner. An exit confirmation window verifies the user intent to exit the program (figure 2).

Figure 2 - GGAT exit confirmation

 Genetic Algorithm parameters setting

 The genetic algorithm has three sets of parameters that need to be specified before it is executed. They are the population parameters, recombination parameters and termination parameters. Each set of parameters is set in a separate window that is opened after the relevant edit parameter button is pressed from the main window (figure 1). Summary about some of the population and termination parameters are displayed in the main window (figure 1).

As the parameter windows are opened, the parameters selected by default for the genetic algorithm are visible as set choice. When text boxes are used to enter numerical values, wrong inputs are reported by opening an Error window with an appropriate message. To close the error window, the Done button should be pressed. A text box value is validated when the text box looses focus i.e. when another component of the window is pressed, including the exit buttons. When an invalid input is attempted like that, the last valid setting of that parameter is displayed and no invalid setting of the parameter is performed. The parameters are set in real time i.e. as they are selected, as opposed to when the parameter window is closed.

 

 

Population parameters

The population parameters are set trough the population parameters window (figure 3). The window is divided in two workspaces: population and phenotype. In the population workspace the size of the genetic algorithm population can be specified using the range 5 to 10000.

The number of parents drop down menu in the population workspace is disabled because the function is not available in this version of the GGAT.

Figure 3 – GGAT population parameters window

  

The parent selection technique and the schema of the genetic algorithm are set in the phenotype workspace. The parent selection technique is chosen from a drop down box from where roulette wheel or tournament parent selection is available. When tournament parent selection is chosen the text box indicating how many contestants should take part, is enabled. A value for it is expected between 2 and half the specified population size. Every time after the population size is changed, the number of contestants for tournament has to be revised.

The selection of the chromosome representation technique allows for integer or real number decoding. The number of chromosomes to be used should be specified next. This text box is greyed out for certain fitness functions since they support only single-chromosome genotypes. Usually a choice of 1 to 100 is allowed and wrong inputs reported immediately. The number of genes to be used for each chromosome is specified next. Values between 8 and 100 are only excepted and wrong inputs reported. After that the chromosome minimum value is set to either 0 or minus of what the maximum chromosome value will be.

All four choices change the chromosome maximum value setting because they affect its range therefore it has to be done before it is set. When any of these four parameters are changed the chromosome value is set to the maximum possible value it can be set to.

Only after the four parameters above are set the chromosome maximum value can be specified. The valid range for it depends on these other four parameters and errors are immediately reported when a wrong value is selected.

When all the population window parameters are set the Done button closes the window and the main window is brought in focus. The X button in the top right corner of the population parameters window has the same effect as the Done button.

 

Recombination Parameters

The recombination parameters are set through the recombination parameters window (figure 4).

Figure 4 – GGAT recombination parameters window

 

The window is divided in two workspaces: crossover and mutation. Separate from them there is a drop down menu that specifies which chromosome of the genotypes the crossover and mutation settings refer to. The selection choice depends on the number of chromosomes selected in the population parameters window. To use the same crossover and mutation parameters for the next chromosome in turn the “Same for next” button must be pressed, and the chromosome selection from the drop down list will be incremented. If there are no other chromosomes after the currently selected one, the button has no effect.

The crossover parameters are set in the crossover workspace. A choice of five crossover techniques is available to choose from, including a “no crossover” choice. The no crossover and multiple point crossover options can be selected by selecting the appropriate radio button, but for single point crossovers the specific crossover from the drop down menu has to be also selected.

Single moving random point crossover uses a randomly generated crossover point for each crossover operation. The single fixed random point uses a random crossover point generated just once before the genetic algorithm starts. With the specified point this crossover point is specified by the user and a value between 1 and the number of genes used for each chromosome minus one. Errors are reported for wrong crossover point setting. This text box is greyed out when other crossover methods are selected.

When multiple point crossover is chosen the number of points at which the chromosomes will be recombined and can be selected by selecting the tick box and typing a value. A value between 2 and the number of genes used for each chromosome minus one is expected otherwise an error is reported. When this value is not specified by the user a random one is picked at the start of the genetic algorithm. For every crossover operation the actual point positions are randomly generated.

The mutation parameters are set from the mutation workspace. A choice of three mutation techniques is available to choose from. Multiple point is selected by selecting the bottom radio button, but for the single point selection the specific technique has to be also chosen from the drop down menu.

The last bit flip mutation, mutates the last gene of a chromosome. Uniform mutation mutates a gene at a randomly generated position, which is regenerated for every mutation.

When multiple point mutation is used the maximum number of points that will be mutated is specified by the user. A value between 2 and the number of genes used for each chromosome subtracted one is expected or error reported. The actual number of points that will be mutated and the point positions (without repeating point positions) are randomly generated for every mutation.

When the number of chromosomes for the genetic algorithm are changed the crossover and mutation point parameters have to be revised.

When all the recombination window parameters are set for all the chromosomes in use, the Done button must be pressed to close the window and the main window will be brought in focus. The X button in the top right corner of the recombination parameters window has the same effect as the Done button. 

Termination Parameters

 The termination parameters are set trough the termination parameters window (figure 5).

Figure 5 – GGAT termination parameters window

 

The window is divided in two workspaces: evaluation function and alternative termination. In the first workspace the function fitness target is specified. Any numerical value that can be represented in a 64 bit floating point is a valid input. Invalid inputs are reported to the user. This should be known from the fitness function details, which will be described later in the text. However as a function is selected this parameter is set to the necessary one. Therefore this parameter should be altered by the used only if fitness function selected has given instruction for doing so (only the sin function for this version of GGAT). The drop down menu parameter selects whether the fitness function minimises or maximises fitness values in order to find solution. The same restrictions for user alterations of this parameter are valid as for the previous one.

The alternative termination workspace contains two text boxes. The top one selects the number of fitness evaluations after which the genetic algorithm will be terminated, if a solution is not found earlier that will terminate the execution. An integer value between 2 and 1000000 is expected and invalid inputs are reported to the user.

The second box specifies the population convergence factor. The difference between the best and worst genotype’s fitness is recorded at the start of a genetic algorithm execution and when this difference becomes smaller than the percentage selected by this convergence factor of the initial difference, the genetic algorithm terminates. A real number value between 1.0 and 0.0 is expected. Obviously when 0.0 is selected this termination criteria is not active.

 When all the termination window parameters are set for all the chromosomes in use, the Done button must be pressed to close the window and the main window will be brought in focus. The X button in the top right corner of the termination parameters window has the same effect as the Done button. 

Genetic Algorithm execution 

Main window

At the top left corner of the main window (figure 1) the fitness function to be used by the genetic algorithm is selected from a drop down list. A choice of five fitness functions are available. The details for each can be viewed by opening the Details window after pressing the button under the fitness selection drop down menu (figure 6). The Details window displays a summary about each function. The Details window provides a scrollable text area and a button to close it. Unlike the rest of the dialogue windows in the GGAT the Details window can be kept open on the side so that the summary is visible throughout the genetic algorithm execution.

 

Figure 6 - GGAT details window

 

The Execute GA button opens the Execution window where genetic algorithm executions are executed. 

Fitness functions

The first function is a multi modal quadratic equation with two optima. The equation was used from the “Genetic Algorithm Playground” tool [10], however there it was used as a uni-modal function. The aim is to minimise the function f(x) = x4 – 12x3 + 15x2 + 56x - 60 (figure 7).

Figure 7 - f(x) = x4 – 12x3 + 15x2 + 56x - 60

 

The function has a local minimum at x = -0.870173 and a global minimum at x = 7.81021. This function was included to provide an easy multi modal example for a single chromosome genotype genetic algorithm.

As a second example the sin function, f(x) = sin(x°) was used. This is also a smooth and easy function to solve (figure 8).

 

Figure 8 – f(x) = sin(x°)

 

Sin can be a highly multi modal function when the variable range is increased. Every optima is global, hence the performance of the genetic algorithm engine can be tested as how preferable one optimum can be to another after a series of executions. The global minima are located every 360 degrees in both positive and negative direction from x = 90, and similarly the global maxima are at every 360 degrees in both directions from x = -90.

A more complex optimisation function, known as De Jong’s function 1 [Goldberg, 1989] has been used also used. This function is one out of the five function test bed set, designed to test genetic algorithms’ performance by De Jong in1975. The function, f(xi) = Σ xi ; i = 1:n, can use multiple number of variables and is very smooth and uni-modal (figure 9). The range of -5.12 <= xi <= 5.12 is used and the global minimum is at xi = 0 and f(x) = 0.

 

Figure 9 – De Jong’s function 1. Reproduced with permission from Hartmut Pohlheim – [9]

 

Another famous optimisation function used with genetic algorithms is Rastrigin’s function [9]. The function, f(x) = 10n + Σ (xi2-10cos(2 Pi xi )), I = 1:n, can also use multiple variables but is very multi modal (figures 10a,10b). The range of -5.12 ≤ xi ≤ 5.12 is used again and the global minimum is at xi = 0 and f(x) = 0.

 

Figure 10a – Rastrigin’s function. Reproduced with permission from Hartmut Pohlheim – [9]

 

Figure 10b – Rastrigin’s function. Reproduced with permission from Hartmut Pohlheim – [9]

 

 

The fifth optimisation function is the so-called Schwefel's function [9]. The function, f(x) = Σ (-xi sin( Sgrt|xi| ) ), i = 1:n, can also use multiple variables and is very multi modal (figure 11). The local optima are irregularly distributed making it a difficult function to solve. The range of –500.0 <= xi <= 500.0 is used and the global minimum is at xi = 420.9687 and f(x) = -n418.9829.

 

Figure 11 – Schwefel’s function. Reproduced with permission from Hartmut Pohlheim – [9]

 

 

When a function is chosen some of the parameters specific for that function are automatically set. However the user is advised to use the Details window as a reference and check whether all the parameters are set appropriately before a genetic algorithm executions are started.

 

Execution window

Several genetic algorithms with the same parameters can be executed serially in the Execution window. By pressing the Start GA button, a genetic algorithm is started that window is renamed as Stop GA. To terminate a particular execution the Stop GA button should be pressed. While a genetic algorithm is sunning the best and median’s fitness of the population are displayed. The phenotype of the fittest genotype is also shown, and when this represents more than one chromosome, the chromosomes are separated by semicolons. After an genetic algorithm terminates (or it is stopped by the user) a summary of the best and median’s fitness of the population, and the phenotype of the fittest genotype found (possibly a solution to the problem).

For each genetic algorithm execution there is a choice whether logging should be done, represented by a tick box in the bottom of the Execution window. Further options on what to be logged are selected from the Log parameters window, accessible trough the Log parameters button in the Execution window.

 

Figure 12 - GGAT execution window

 

When a satisfactory solution to the problem is found, or the user wants to change the genetic algorithm parameters or exit the applications the Back to GA parameters button or the X button in the top right corner of the execution window.

 

Log parameters window

There are five tick boxes in the Log parameters window representing the logging options. When none of them is selected and logging is used, only the end result of the genetic algorithm is logged. The logging is done to text files named according the execution number of the genetic algorithm started from the Execution window. The files are saved to the directory where the GGAT was started from in the console window. It is the users responsibility to ensure that he/she has permissions to write to that path and that there is enough space for the log files. When a new set of genetic algorithms are executed and logged, they will replace old log files, therefore the user should use and save a copy of the log files used before a new set of genetic algorithms is executed, within a new Execution window. The log files have .txt extension and use Unix line separation i.e. Microsoft Notepad cannot read them, but Microsoft Internet Explorer for example, can.

 

Figure 13 - GGAT log parameters window

 

Conclusion 

The GGAT was an academic project and because of time constrains is likely to have bugs. Please report any such to the author so that they are removed for the any possible consequent versions of the GGAT.

 

Fast Page Navigation


Copyright © 2002 K Derderian.  All rights reserved.