예제 #1
0
파일: ADF.cs 프로젝트: lulzzz/BraneCloud
        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());
            }
        }
예제 #2
0
        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());
            }
        }