public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { // get a context and prepare it var c = stack.Take(); c.PrepareADF(this, (GPProblem)problem); // evaluate my Arguments and load 'em in for (var x = 0; x < Children.Length; x++) { input.CopyTo(c.Arguments[x]); Children[x].Eval(state, thread, c.Arguments[x], stack, individual, problem); } // Now push the context onto the stack. stack.Push(c); // evaluate the top of the associatedTree individual.Trees[AssociatedTree].Child.Eval(state, thread, input, stack, individual, problem); // pop the context off, and we're done! if (stack.Pop(1) != 1) { state.Output.Fatal("Stack prematurely empty for " + ToStringForError()); } }
public override void Eval(IEvolutionState state, int thread, GPData input, ADFStack stack, GPIndividual individual, IProblem problem) { // prepare a context var c = stack.Push(stack.Take()); c.PrepareADM(this); // evaluate the top of the associatedTree individual.Trees[AssociatedTree].Child.Eval(state, thread, input, stack, individual, problem); // pop the context off, and we're done! if (stack.Pop(1) != 1) { state.Output.Fatal("Stack prematurely empty for " + ToStringForError()); } }