Ala Qumsieh wrote:
> Recently, I started reading about GAs, and thought that the best way to 
> learn is to actually write a Perl module, and play around with it.

Absolutely!


> For lack of a better name, I called it AI::Genetic, but I'm open to 
> change if someone has a better suggestion. Of course, any other 
> suggestions/flames/improvements are more than welcome :)

Let's defer that until the module is actually ready to put on CPAN, eh?

Some comments:

The class is hard-wired to only handle individuals which are bitvectors.
That is unnecessarily restrictive.  In fact, the GA algorithm shouldn't
care about the internal representation of the individual.  Make a
separate class for bitvector individuals; it can implement a some 
necessary methods -- mutute, crossover, fitness -- which GA will then
call.   GA itself should only implement the evolutionary process.
Also, consider making the generation process (creating the next gen
from the previous) a Strategy, since this could be rather more complex
than the simple "select/mutate/crossover" pipeline you've got now.
If you do that, then the strategy object would also be a good place
to store the parametrics (mutution prob., etc.).


How to handle identical individuals?  Why is it a problem?

-- 
John Douglas Porter

I no longer love the color of your sweaters.

Reply via email to