GARealGenome
vijay G kovvali
vkovvali at lycos.com
Thu Aug 9 23:53:54 EDT 2001
This is how my structure looks:
class CMyClass // A stripped down version of my class
{
public:
void Do_GA_Stuff();
float FitnessFunc(GAGenome& );
};
float (CMyClass::*pt2Member)(GAGenome&);
void CMyClass::Do_GA_Stuff()
{
GARealAlleleSetArray MyBounds;
// Fill MyBounds
pt2Member = &CMyClass::FitnessFunc;
// Create a pointer to Member Function
GARealGenome MyGenome(MyBounds, (*this.*pt2Member));
GASimpleGA ga(MyGenome);
ga.evolve();
}
float CMyClass::FitnessFunc(GAGenome& g)
{
// Do stuff
return value;
}
Thelibrary class for the GAReal Genome takes the following constructor:
GA1DArrayAlleleGenome(const GAAlleleSetArray<T> & a,
GAGenome::Evaluator f=(GAGenome::Evaluator)0,
void * u=(void *)0);
I am getting the following error with:
GARealGenome MyGenome(MyBounds, (*this.*pt2Member));
[C++ Error] CControl1.cpp(1007): E2285 Could not find a match for 'GARealGenome::GA1DArrayAlleleGenome(GARealAlleleSetArray,float(GAGenome &))'
The fitness function should be a float (GAGenome&), so I don't understand the problem. Any help on how I can correct this problem would be great. Thank you. I am using BCB 5.0.
Vijay
Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/
More information about the galib
mailing list