Objective function
Vijay G Kovvali
vkovvali at mailcity.com
Thu Jun 29 11:20:52 EDT 2000
Hello, I am trying to run my GA as part of a class CGeneticData. I save the variables I want as the datamembers and then call the function RunGA to run a simple GA. I want to make my Objective function also part of the class so that it has access to some other class data and functions. The problem is that whenever I make the objective function as part of the class, it doesn't compile and spits out the error:
[C++ Error] CGeneticData1.cpp(67): E2285 Could not find a match for 'GARealGenome::GA1DArrayAlleleGenome(GARealAlleleSetArray,void)'
It doesn't give me an error if I move the objective function definition to the .cpp file (global). I don't understand this error. Please help. Thank you.
Vijay
My Structure is something like this:
In .h file
class CGeneticData
{
public:
int FSeed;
CData MyData;
void CRunGA();
float Objective1(GAGenome& g);
};
In .cpp file
void CGeneticData::RunGA()
{
GARealAlleleSetArray MyBounds; //populate bounds
GARealGenome MyGenome(MyBounds, Objective1);
GASimpleGA ga(MyGenome);
ga.evolve(FSeed);
}
float CGeneticData::Objective1(GAGenome& g)
{
//Do calculations using MyData
}
Send FREE Greetings for Father's Day--or any day!
Click here: http://www.whowhere.lycos.com/redirects/fathers_day.rdct
More information about the galib
mailing list