Subject: | |
From: | |
Reply To: | |
Date: | Fri, 13 Nov 2015 20:10:10 -0500 |
Content-Type: | multipart/alternative |
Parts/Attachments: |
|
|
Thanks a lot for your reply. Yes, it is working now.
On Fri, Nov 13, 2015 at 5:05 PM, Sean Luke <[log in to unmask]> wrote:
> 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
>
|
|
|