[galib] FW: Errors using ga.selector();

Junkeh junkeh at fakeh.co.uk
Fri Apr 8 09:14:02 EDT 2005


My name is Daniel McGreal and I am currently using GAlib as part of my third
year dissertation.  However, I have come up against the following errors
when using ga.selector():

Dis.cpp: In function `int main(int, char**)':
Dis.cpp:60: error: invalid conversion from `int (*)(int, fd_set*, fd_set*,
fd_set*, const timeval*)' to `int'
Dis.cpp:60: error:   initializing argument 1 of
`GASelectionScheme::GASelectionScheme(int)'
Dis.cpp:60: error: cannot allocate an object of type `const
GASelectionScheme'
Dis.cpp:60: error:   because the following virtual functions are abstract:
../ga/GASelector.h:63: error:  virtual GASelectionScheme*
GASelectionScheme::clone() const
../ga/GASelector.h:68: error:  virtual GAGenome& GASelectionScheme::select()
const

The relevant code looks like this:

	if(sel==0) GARankSelector select;
	else if(sel==1) GARouletteWheelSelector select;
	else if(sel==2) GATournamentSelector select;
	else if(sel==3) GAUniformSelector select;
	else{cout << endl << "Unrecognised selection method, using
Tournament..." << endl; GATournamentSelector select;}


	ga.selector(select); //This is the line with the error, removing it
makes everything proceed normally.

Does anyone know, or can think of, a solution for these errors?

Many thanks,
Dan.





More information about the galib mailing list