[galib] How to pass arguments to the Objective function

mathew webber mathewwebber at hotmail.com
Mon Feb 28 13:36:57 EST 2005

Hello all,

I am a new user to the library and I am very impressed with it so far. I am 
using it for my Honours project and I am having problems passing an argument 
to my objective function.

I need to be able to pass a pointer to a 2 dimensional array, which is used 
to assess all the genomes. The array is read in from file and is the same 
for every Genome throughout, so it would be very inefficient to read it in 
every time the objective function was called:(

So I want my objective to read:

                Objective(GAGenome &, int*);

But using the following will obviously not work:

  	int* pointer;

  	GA1DArrayGenome<int> genome(10, Objective(pointer));

Is there a way for me to do this?

Any help is gratefully received on this one!

Thank you in advance,


P.S. a big thank you to Antonio for his guide on creating a static library 
in DevC++ which, helped me no end:-)

More information about the galib mailing list