Support » Running sga on Windows
Assumptions
OK, firstly we have made some assumptions, these being:
- You are running Windows XP and above
- That you have downloaded the sga C code and have converted it into an .exe file.
- You will need to save the cygwin1.dll into the same directory for sga to run. Cygwin1.dll can be downloaded from here
- You are running sga from a folder called sga on your C:\ and have saved sga.exe and cygwin1.dll into this folder.
How To Use the sga Program
- Open a new CMD window click on START > RUN > cmd > ENTER
- Make the cmd window as large as possible. If you hold down the ALT key and then press ENTER the cmd window will go to full screen mode.
- You will get the following cmd Window:-
- Navigate to the C:\sga folder by using the following command:
C:\sga
- Now the fun can really start! For your first experiment type in the following sga -f3 | more and press ENTER
This will display the window above, showing the first page of results. To see more results, then press SPACEBAR. Ok, now to explain what each line shows.
a) The first part shows the parameter settings that were used.
b) The second part is the settings for each generation separated by dashed lines.
c) Underneath the dashed lines are the first 10 generations of each population, unless the -s command has been used to change the number displayed.
d) Just above the dashed line for the next generation is a string of digits and/or dashes that represent the percentage of ones in each column: a - means no one's or all ones (i.e. convergence), a 0 means less than 10% ones, a 1 means 10% or more but less than 20%, and so on..
- To rerun the program use the up-arrow key to recall the last command. You can use the left and right arrows to move through the command and edit it if you wish.
Fitness Functions
There are a choice of 5 fitness functions that can be used when running the sga program.
These are:
- 1 constant (all fitnesses the same),
- 2 random (fitness() returns a random value),
- 3 onemax (maximise the number of ones),
- 4 diffmax (maximise the difference between number of ones and zeros),
- 5 integer (fitness equals integer equivalent of bitstring).
Command Options
There are several command options (with default values) which can be used to pass parameters to the program on start upthat can be used when running the:
-p 300 popsize (must be even, not 0 and not greater than 1000)
-c 16 chromsize (length of bitstring, not 0 and not greater than 80)
-x 70 crossover probability (0 = no crossover)
-m 1000 mutation rate (0 = no mutation, 500 = 1 in 500 bits mutated)
-f 1 fitness function (1 = constant, 2 = random, ... , 5 = integer)
-b 1 fitness boost (e.g. 2 = double the fitness of each individual)
-r 1 random seed (not 0)
-g 1000 number of generations (0 = run indefinitely)
-s 10 number of individuals to show in one generation (not > popsize)
-d 1 frequency of display (not 0, 8 = display every 8th generation)
Examples
sga | uses the defaults as above |
sga -p500 | sets the population size to 500 |
sga -c25 -x2 -m800 | chromsize = 25, crossover = 25, 1 in 800 bits mutated |
sga -s33 -d2 | displays 33 individuals from every population |