public override float PredictSolutionFitness(PushGPIndividual pgpIndividual)
        {
            List <float> errors = new List <float>();

            for (int n = 0; n < _sampleSize; n++)
            {
                GATestCase test = _solutionGA._testCases[_sampleIndices[n]];
                float      e    = _solutionGA.EvaluateTestCase(pgpIndividual, test._input, test._output);
                errors.Add(e);
            }
            return(AbsoluteAverageOfErrors(errors));
        }
        public virtual float GetIndividualTestCaseResult(GAIndividual inIndividual, GATestCase inTestCase)
        {
            _interpreter.ClearStacks();
            float      currentInput = (float)inTestCase._input;
            FloatStack stack        = _interpreter.FloatStack();

            stack.Push(currentInput);
            // Must be included in order to use the input stack.
            _interpreter.InputStack().Push(currentInput);
            _interpreter.Execute(((PushGPIndividual)inIndividual)._program, _executionLimit);
            float result = stack.Top();

            // If no result, return 0
            if (stack.Size() == 0)
            {
                return(0);
            }
            return(result);
        }