Print

Print


Thank you very much Sean.

Best,
Márcio
--------
Prof. Dr. Márcio Porto Basgalupp
Instituto de Ciência e Tecnologia (ICT)
Universidade Federal de São Paulo (UNIFESP)
Tel: +55 12 3309-9500 (r: 9762)


On Wed, Dec 2, 2015 at 8:01 PM, Sean Luke <[log in to unmask]> wrote:
> I have been able to replicate this bug.  This appears to be triggered NOT when you have multiple rules as you thought, but rather when you have multiple bodies with the same function name, as in:
>
> <a> :== (+ <b> <c>) | (+ <d> <e>)
>
> In this example, we have two +'s even though they are obviously different and valid.  THAT's what's messing things up.
>
> This is messing up the predictive parse table, some code we cooked up to enable GE and GP programs to be converted back and forth for a project with Conor Ryan a while back.
>
> Since you don't need that feature probably, you can just cut it out with by redefining ec.gp.ge.GrammarParser.populatePredictiveParseTable(...) to be:
>
>     public void populatePredictiveParseTable(GrammarNode gn)
>         {
>         return;
>         }
>
> It seems to work for me as a stop-gap measure.  In the mean time, I'll poke Khaled, who originally did this work, about possible fixes.  Khaled?
>
> Sean
>
>
> On Dec 1, 2015, at 11:49 AM, Márcio Basgalupp <[log in to unmask]> wrote:
>
>> Hi guys,
>>
>> I'm having the following error when running an application based on
>> Grammatical Evolution.
>>
>> java.lang.ArrayIndexOutOfBoundsException: 8
>> at ec.gp.ge.GrammarParser.populatePredictiveParseTable(GrammarParser.java:464)
>> at ec.gp.ge.GESpecies.setup(GESpecies.java:207)
>> at ec.Subpopulation.setup(Subpopulation.java:166)
>> at ec.Population.setup(Population.java:142)
>> at ec.simple.SimpleInitializer.setupPopulation(SimpleInitializer.java:55)
>> at ec.simple.SimpleInitializer.initialPopulation(SimpleInitializer.java:46)
>> at ec.simple.SimpleEvolutionState.startFresh(SimpleEvolutionState.java:54)
>> at ec.EvolutionState.run(EvolutionState.java:438)
>>
>> This application used to work before, and I don't know what happened.
>> Maybe because I have updated the ECJ version. I can see that there is
>> a problem in the grammar:
>>
>> <start>::= <exp>
>> <exp>::=  (* <coef> <var>) | (/ <coef> <var>) | (+ <coef> <var>) | (-
>> <coef> <var>) | <var>
>> <exp>::= (+ <exp> <exp>) | (- <exp> <exp>) | (* <exp> <exp>) | (/ <exp> <exp>)
>> <exp>::= (log <exp>) | (cos <exp>) | (sin <exp>)
>> <coef>::= (RealNumber)
>> <var>::= (Att)
>>
>> Actually it is because I have more than one rules with 'Heads' called
>> <exp>. If I remove two of them, resulting in
>>
>> <start>::= <exp>
>> <exp>::=  (* <coef> <var>) | (/ <coef> <var>) | (+ <coef> <var>) | (-
>> <coef> <var>) | <var>
>> <coef>::= (RealNumber)
>> <var>::= (Att)
>>
>> the application works perfectly.
>>
>> Could someone help me to fix this situation? I have no idea why it is
>> happening. According to ECJ manual, there is no problem of having more
>> than two heads with the same name (and it worked perfectly before the
>> ECJ's upgrading).
>>
>> Best,
>> Márcio
>>
>> --------
>> Prof. Dr. Márcio Porto Basgalupp
>> Instituto de Ciência e Tecnologia (ICT)
>> Universidade Federal de São Paulo (UNIFESP)
>> Tel: +55 12 3309-9500 (r: 9762)