Menu

OneMax

Alberto Tonda

Running a first experiment: OneMax

OneMax is a simple experiment that only hints at the potential of Evolutionary Algorithms. Basically, the objective of OneMax is to find a binary number of arbitrary size (the default is 50 bits) where all bits are set at '1', starting from a randomly created population of binary numbers of 50 bits.

It is one of the most used test bench in evolutionary computation because it is simple, unimodal (has only one global optimum), separable (can be solved for each bit independently), and the definition of the fitness function is quite straightforward.
While running the experiment, you will see µGP's output:

µGP's output

The output reports the current Generation, the global entropy (a measure of the diversity of the population), the age of individuals (from the generation they are created to the current one) their average size (in terms of nodes in the graph describing them) and their average fitness.
Below, you have more details about the best and the worst individual in the population, σ (sigma, the strength of the genetic operators) and τ (tau, the number of individuals for the Tournament Selection).

Run OneMax on Unix systems

To run this experiment, you need to have Perl on your system, because the external evaluator is written in Perl. To check if you already have it (since it is included in most distributions), just type "perl -v". If you don’t have it, you will need to install it with your favorite package manager (eg. sudo apt-get install perl on Ubuntu/Mint/Debian). If you installed ugp3, you only have to move to the OneMax folder and run:

cd $UGP3_BASE_DIRECTORY/Samples/OneMax/Base
ugp3

If you did not install ugp3, first you will have to copy the executable in the OneMax folder and run it, or run the executable from the Frontends/ugp3/ directory. To run it directly from the original folder:

cd $UGP3_BASE_DIRECTORY/Samples/OneMax/Base
../../Frontends/ugp3/ugp3

Run OneMax on Windows systems

You will need to install a distribution of Perl for Windows systems (because the external evaluator is written in Perl). You can find one here. Extract the files from the ugp3.zip file, and go to the directory Samples/OneMax. You can simply copy the executable (ugp3.exe) to the Samples/OneMax/Base directory, and double click. It is probably slightly better to execute it from command line, so you will be able to take a good look at the output produced.

Further reading

To better understand how µGP is working, you can proceed to Configuration files; for a practical tutorial focused on tweaking OneMax, see More fun with OneMax! and Even more fun with OneMax!.


Related

Wiki: Home