Print

Print


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)