[galib] GAlib question

Chris Chapman cnchapman at msn.com
Wed Apr 11 12:52:26 EDT 2012


Hi Derek --
No problem, I'm CC'ing the list. I don't see anything obvious below but perhaps someone else will weigh in. Good luck! -- Chris

Date: Wed, 11 Apr 2012 06:04:31 -0700
Subject: GAlib question
From: derk at derk.org
To: cnchapman at msn.com

Hi, I have signed up for the mailing list but it hasn't gone through and I am looking for some relatively quick and simple help.  I noticed you had one of the last posts on the mailing list trying to help someone out and I figured I'd email you directly.  I hope this is not an inconvenience!


I am implementing a GA using the GA1DArrayGenome and as part of the initialization function I have this code:


        for(i=0; i<GenSize; i++)
                genome.gene(i,i);

        for(i=0; i<GenSize; i++)

        {
                j = GARandomInt(0, GenSize-1);
                genome.swap(i,j);
        }

So, the genome is just a permutation of values from 0 to n.  If I print out the entire population before step() it all looks fine.


Using cycle crossover (probability 0.85) and default mutation (probability 0.005), once I complete a step() if I print out the population, some of the numbers are duplicated.  For example, if the genes should all be unique values from 0 to 20, I am sometimes getting repeats of values (e.g. 11 will show up twice, and 17 won't show up at all).  


I have tried using the default crossover instead, dropping the mutation probability to 0, but nothing seems to work.  In fact, what ends up happening is eventually the step() function itself will just hang... the program does not get trapped in the objective function or anything, but gets caught in the step() function, which I have not overridden or modified or anything.


Any ideas where I might be going wrong?

If you could help, I would be most appreciative, but if not then no big deal.

Thanks in advance,
Derek Williams

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20120411/e39e847b/attachment.htm


More information about the galib mailing list