[galib] galib & BCCB 4.0

Leslaw K Bieniasz (bieniasz@Princeton.EDU) bieniasz at Princeton.EDU
Thu Jul 7 13:55:37 EDT 2005

                        Princeton, 7.07.2005


I am new to galib, and also new to genetic algorithms, in general. However, I need to do
some calculations, and I am trying to use galib
for them. My platform is MS Windows, and Borland
C++ Builder 4.0. The platform is not explicitly
supported by galib, and probably for this reason
I am having some problems. I would be happy
to solve them.

After struggling for some time with compile errors
I have managed to create a Builder 4.0 project
for galib, as a "library" project. I have just
renamed all galib "c" files into "cpp" files,
and I have modified all #includes to include the
appropriate files from the project directory.
The project compiles with no errors, however there
is plenty of warnings "Conversion may loose significant digits" all over the library. As far
as I can see, they seem to result from rather careless lack of explicit casting between
short and int types, probably also between
int and unsigned int. My first question
therefore is: 
(1)What to do with these warnings?

I notice that in several places in the library
some "C" files (now changed by me to "CPP") are
#included. I would be happy to get rid of this 
feature, as I believe this is an extremely
bad practice in C++ to include CPP files.
Only headers should be #included. 
My second question therefore is:
(2) How can I eliminate these #includes?

I also have a simple program that checks the
operation of the library by minimising a simple
function. The program seems to work, at least the reults appear correct, but again there are some problems, and my related questions:

(3) In order to be able to use the library, I not
only have to #include the "ga.h" file, but also
which again is strange, and I am again getting 
a number of warnings
"Conversion may loose significant digits"
while compiling the program.

(4) The compiler has a problem of identifying
inambiguously one of the overloaded methods
add() for the class GARealAlleleSetArray.
The construct:
GARealAlleleSetArray allele; 
compiles only when I define explicitly
the parameters as float, for example:
const float XVAL_L = -10.0;  
const float XVAL_H =  10.0;  
const float XVAL_S =  0.1;  
const float YVAL_L = -5.0;   
const float YVAL_H =  5.0;   
const float YVAL_S =  0.05;  

(5) I am using class GARealGenome,
which as far as I can understand, is a typedef
for ArrayAlleleGenome<float>. However, I would
prefer to use double instead of float. But my 
attempt to instantiate ArrayAlleleGenome<double>
produces errors in 
GARealAlleleSetArray::add() again.
Apparently, the use of double is not possible
in these methods.
How can I do all calculations using double, and
not having compile errors?

(6) Is there any way of forcing the library to use
the same sequence of pseudo-random values in every
run? I need to do some debugging, but this impossible if at every run the results are different.

I am ready to share my current files with anyone
willing to help me in these matters.


Dr. Leslaw Bieniasz
TEMPORARY ADDRESS (1.05.2005-31.08.2005):
Chemistry Department, Frick Laboratory, Princeton University, Princeton, New Jersey, 08544 USA.
E-mail: bieniasz at princeton.edu
Institute of Physical Chemistry of the Polish Academy of Sciences, Department of Electrochemical Oxidation of Gaseous Fuels, 
ul. Zagrody 13, 30-318 Cracow, Poland.
tel./fax:   +48 (12) 266-03-41 
E-mail: nbbienia at cyf-kr.edu.pl
Interested in Computational Electrochemistry?
Visit my web site: http://www.cyf-kr.edu.pl/~nbbienia 

More information about the galib mailing list