ECJ-INTEREST-L Archives

November 2015

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:
Fri, 13 Nov 2015 17:05:33 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (22 lines)
On Nov 13, 2015, at 4:45 PM, Bari <[log in to unmask]> wrote:

> I need to modify the first cell of an individual's genome and then send that individual to problem's evaluate(). As for example, if the genome is [10, 5, 3, 11, 12], I want to keep the first number (here it is 10) between 1 to 5. I can do that using IntegerVectorIndividual's genome field. But I can't modify the Individual in that way. As a result, I am not able to send a modified individual to problem's evaluate().

Why not?  Why can't you just say 
	((IntegerVectorIndividual)ind).genome[0] = 4?


> I read about Individual and the documentation says that Individual is immuatable but modification can be done and it is safe in a single threaded environment. But I am not finding any way (eg. any method like SetGenome() in IntegerVectorIndividual) to do that. Any suggestion is appreciated.

Individual is not immutable per se.  If you're doing this during evaluate, it's probably safe to do so.

> NB: I am not subclassing EvolutionState directly, I am using state = ec.simple.simpleEvolutionState in param file but eval is replaced by my own evaluator which is extending ec.simple.SimpleEvaluator.

Sure.  But instead of doing that, why not just subclass the problem in question and substitute an eval which does:

	Eval:
		modify the individual	
		call super.eval

Sean

ATOM RSS1 RSS2