Documentation:FAQ

From Beagle

Specific difficulties often faced by the average users, but not necessary explained in the documentation.

Contents

How can I analyze the files that Beagle produces?

Beagle's output files are encoded with XML which means they can be fairly easily read by both humans and computers. To analyse these files after an evolutionary run, we've found a tool called XMLStarlet to be very useful. Because it is command-line based it is easily included into a script (called a batch file in Windows).

How do I get the best individual of an evolutionary run?

Beagle can be configured to write a milestone file (*.obm) when it terminates (in fact, it does this by default). Among other things, the milestone file contains the population of the evolutionary system. Another configurable Beagle feature is to store the very best individuals in a hall of fame (again, this is turned on by default). XMLStarlet can be used to scan the milestone file and output just the individuals in the hall of fame.

To extract the individuals in the hall-of-fame from the milestone file beagle.obm try:
xml sel -t -c 'Beagle/Vivarium/HallOfFame/Member/Individual' beagle.obm


How do I get the fitness scores of the best individual of each generation?

For this data, your program must have (a) written a log file and (b) had the log file configured at log level 2 or higher. And once again you will need XMLStarlet. This example assumes you have used the FitnessSimple fitness class.

The log file is called 'beagle.log' by default, but it's name can be configured with the register parameter 'lg.file.name'. For this I will assume you've stuck with the default setting.

You must have set the log level to 2 or higher. By default it is set at level 3, so you shouldn't have any issues if you stick to the default settings. If you wish to change the value, the register parameter is called 'lg.file.level'.

The following command will write a table of results giving the best fitness for each generation. The first line of the table is a comment giving you the table's headers.

xml sel -t -o "# Gen MaxFit" -n -m "Beagle/Logger/Log/Stats[@id='vivarium']" -v @generation -o " " -v "Measure[@id='fitness']/Max" -n beagle.log

The command produces a table similar to:

# Gen MaxFit
1 0.75
2 0.875
3 0.875
4 0.875
5 1

To get the average fitness for each generation consider using:

xml sel -t -o "# Gen AvgFit" -n -m "Beagle/Logger/Log/Stats[@id='vivarium']" -v @generation -o " " -v "Measure[@id='fitness']/Avg" -n beagle.log

It is also possible to extract the minimum fitness ("/Min") and the standard error ("/Std").

How to supply an information to a GP primitive ?

Create a new class derived from GP::Context by adding all needed information into it. Assign this new class to the System.

In the fitness evaluation operator, you set all variables in the context.

How to compile OpenBeagle 3.0.1 under Cygwin?

June 07, 2007

Install Cygwin packages (with dependencies):

automake: Wrapper scripts for automake and aclocal
gcc-mingw-g++: Mingw32 support headers and libraries for GCC C++
libtool1.5: (1.5) A shared library generation tool

Then on the command line:

zcat beagle-3.0.1.tar.gz | tar xf -
cd beagle-3.0.1
echo "typedef void (*sig_t) (int);" >> PACC/Util/SignalHandler.cpp
./bootstrap
./configure
make
make install

Do not forget that Cygwin linker is one pass only - order does matter.

Dynamic library linking under Linux

June 08 2007

After 'make install' on Ubuntu 7.04 you have to actualize ld cache by running 'ldconfig'. If you don't do it your programs are unable to find newly installed dynamic libraries.

Fourth question?

Answer to fourth question.