[galib] optimisation within a member function (i.e. objective function is not global)

Xavier Chardon xavier.chardon at rennes.inra.fr
Wed Aug 31 13:03:12 EDT 2005


Hi all,

I know this question has been asked before, but I haven't found any answer.

I would like to perform an optimisation within a member function of a 
class. The genome is created within this function, and the objective 
function is another member of this class, i.e.:

GA1DArrayAlleleGenome<int> myGenome(length, alleles, 
ClassName::ObjectiveFunction)

But the last argument causes a compiler error (I use visual studio 
.net). He says he can't find the function or can't cast the argument to 
'GAGenome::Evaluator'.


It will only work if the objective function is a global function, not a 
member of a class. Can anyone think of a workaround (I would like to 
avoid defining my objective function as a global one).

Thanks,

Xavier Chardon



More information about the galib mailing list