Print

Print


Eric,
  Thanks! I KNEW that EvolutionState had to have a reference to the problem
somewhere, I just couldn't figure out where.
  There are many levels to this framework.
  I'll go try that and see what happens.

-Mark

On Thu, Jun 6, 2019 at 2:40 PM Eric 'Siggy' Scott <[log in to unmask]> wrote:

> Hi Mark,
>
> I haven't work with ERCs, but I expect that you can solve your problem by
> reaching into the EvolutionState object:
>
> The EvolutionState has a reference to your Problem:
> state.evaluator.p_problem.  So you don't need to create custom
> EvolutionState fields: any method that has a reference to state can access
> your problem and the data associated with it.  We do this, for example, for
> TSP: ec.app.tsp.TSPProblem dynamically loads a description of a TSP problem
> from a file, and other parts of ECJ access it by making calls to
> state.evaluator.p_problem.
>
> Thanks,
> Eric
>
> On Thu, Jun 6, 2019 at 12:25 PM Mark Parker <[log in to unmask]>
> wrote:
>
>> Hi all,
>>   Hoping someone can help me with this one. I'm finding passing data
>> between classes troublesome. What I'm trying to do is have an ERC that has
>> indices that map to a table cell built up by Problem.setup from reading the
>> training data.
>>   The issue is that I want the max indices to be dynamic and determined
>> during the reading of the training data file during Problem setup. I can't,
>> however, figure out how to get that info from the Problem class to the ERC
>> class so it can mutate without running into out of bounds issues.
>>   I've tried setting some custom parameters during Problem.setup but that
>> class gets instantiated after my ERC class so my ERC class can't find said
>> parameters cause they haven't been set yet.
>>   The only thing I can think of, which I don't really want to do, is to
>> subclass SimpleEvolutionState and put in some fields and methods that
>> Problem.setup can call to set, and MyERC can call to get.
>>   This all feels very clunky and I feel like there's got to be a better
>> way.
>>
>> Any help is appreciated.
>>
>> Thanks,
>>
>> -Mark
>>
>
>
> --
>
> Doctoral Candidate, George Mason University
> http://mason.gmu.edu/~escott8/
>