Well that was easy! :-) Sean On Jan 26, 2013, at 12:07 PM, Rodrigo Barros wrote: > I figured it out by myself. Thanks anyway! =) > > On 26 January 2013 16:18, Rodrigo Barros <[log in to unmask]> wrote: >> Hi, >> I'm implementing a GE system to evolve functions for regression. >> One of my non-terminals is an if-then-else function. My grammar looks like this: >> >> <start>::= <exp> >> <exp>::= (* <coef> <var>) | (/ <coef> <var>) | (+ <coef> <var>) | (- >> <coef> <var>) | <var> >> <exp>::= (+ <exp> <exp>) | (- <exp> <exp>) | (* <exp> <exp>) | (/ >> <exp> <exp>) | (^ <exp> <int>) >> <exp>::= (log <exp>) | (cos <exp>) | (sin <exp>) >> <exp>::= (if <bool> <exp> <exp>) >> <bool>::= (gt <exp> <exp>) | (gteq <exp> <exp>) | (sm <exp> <exp>) | >> (smeq <exp> <exp>) | (eq <exp> <exp>) | (neq <exp> <exp>) >> <coef>::= (RealNumber) | <int> >> <int>::= (IntegerNumber) >> <var>::= (Att) >> >> And my GPData has two attributes: a boolean value and a double value. >> My implementation of the if-then-else rule is: >> >> public void eval(final EvolutionState state,final int thread,final >> GPData input,final ADFStack stack,final GPIndividual individual,final >> Problem problem) >> { >> boolean result; >> GEData data = ((GEData)(input)); >> children[0].eval(state,thread,input,stack,individual,problem); >> result = data.bool; >> if(result){ >> children[1].eval(state,thread,input,stack,individual,problem); >> } >> else{ >> children[2].eval(state,thread,input,stack,individual,problem); >> } >> } >> >> For some reason, I'm getting the following error: >> "Incorrect number of children for node if at >> pop.subpop.0.species.gp-species.ind" >> >> Though I'm pretty sure I configured correctly the rule in the parameters file: >> gp.fs.0.func.17 = seege.If >> gp.fs.0.func.17.nc = nc3 >> >> Do you have any idea why the If-then-else rule is supposedly receiving >> the wrong number of children (different from 3)? I don't know what >> else to try. >> >> Thank you in advance, >> >> Rodrigo >> >> >> >> -- >> Rodrigo Coelho Barros, MSc. >> PhD Candidate >> Bioinspired Computation Laboratory (BioCom) >> Department of Computer Science >> University of São Paulo at São Carlos (ICMC-USP) >> >> www.icmc.usp.br/~rcbarros >> e-mail (1): [log in to unmask] >> e-mail (2): [log in to unmask] >> e-mail (3): [log in to unmask] >> >> mobile: +44 75 7227 4565 > > > > -- > Rodrigo Coelho Barros, MSc. > PhD Candidate > Bioinspired Computation Laboratory (BioCom) > Department of Computer Science > University of São Paulo at São Carlos (ICMC-USP) > > www.icmc.usp.br/~rcbarros > e-mail (1): [log in to unmask] > e-mail (2): [log in to unmask] > e-mail (3): [log in to unmask] > > mobile: +44 75 7227 4565