<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hi Derek --<div><br></div><div>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<br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Date: Wed, 11 Apr 2012 06:04:31 -0700<br>Subject: GAlib question<br>From: derk@derk.org<br>To: cnchapman@msn.com<br><br>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.&nbsp; 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.&nbsp; I hope this is not an inconvenience!<br>
<br>I am implementing a GA using the GA1DArrayGenome and as part of the initialization function I have this code:<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(i=0; i&lt;GenSize; i++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; genome.gene(i,i);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(i=0; i&lt;GenSize; i++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j = GARandomInt(0, GenSize-1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; genome.swap(i,j);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>So, the genome is just a permutation of values from 0 to n.&nbsp; If I print out the entire population before step() it all looks fine.<br>
<br>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.&nbsp; 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).&nbsp; <br>
<br>I have tried using the default crossover instead, dropping the mutation probability to 0, but nothing seems to work.&nbsp; 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.<br>
<br>Any ideas where I might be going wrong?<br><br>If you could help, I would be most appreciative, but if not then no big deal.<br><br>Thanks in advance,<br>Derek Williams<br><br></div></div>                                               </div></body>
</html>