ECJ-INTEREST-L Archives

September 2008

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Sean Luke <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Sat, 6 Sep 2008 10:54:10 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (41 lines)
On Sep 5, 2008, at 5:46 PM, Myron Tuttle wrote:

> 1) When Subpopulation.setup() first creates the array of individuals  
> each individual is null.  This isn't a problem when creating new  
> individuals, but when reading on line 270  
> Subpopulation.readSubpopulation() first checks to see if the  
> individual in the individual array is null which it's always going  
> to be.  So instead of reading in the individual it will always  
> create new individuals.  It appears that this check was done to  
> avoid an invalid element error since readIndividual() is an instance  
> function.  A dummy individual seems like the easiest way to fix this  
> issue.

My quick scan of the code suggests this isn't what you are thinking.   
I think it's correct.  If the slot is null, instead of using the  
readIndividual(state, reader) method, it's supposed to resort to using  
the merely "less efficient" newIndividual(state, reader) method, which  
creates the dummy individual for you, calls  
readIndividual(state,reader) on it, and sticks it in.


> 2) Even after this fix though there is still a problem if the  
> individual has a custom printIndividual() method (for instance, if  
> the class is a child of Individual with additional information that  
> is printed and needs to be read in).  It would be necessary then to  
> create a dummy individual that is the same type of individual  
> specified in the subpop's species before calling readIndividual() on  
> it.

newIndividual does that.  But if you wanted to, it's easy:  grab the  
Species's prototype and clone it.


> 3) Tutorial 3 should be updated to reflect the changes to  
> printSubpopulation() and readSubpopulation() that include the number  
> of individuals and individual index preambles.

Thanks, I missed that.

Sean

ATOM RSS1 RSS2