/// <summary> /// Execute the recursion /// </summary> public double EvaluateAsDouble(GPProgram tree) { if (m_RecursionCount >= MAXRECURSIONS || Unwind) { Unwind = true; m_RecursionCount--; double Result = m_RGB.EvaluateAsDouble(tree, this); if (m_RecursionCount == 0) { Unwind = false; } return(Result); } m_RecursionCount++; if (m_RCB.EvaluateAsDouble(tree, this) > 0.0) { m_RBB.EvaluateAsDouble(tree, this); m_RUB.EvaluateAsDouble(tree, this); } m_RecursionCount--; return(m_RGB.EvaluateAsDouble(tree, this)); }
private const int MAXITERATIONS = 25; // TODO: Think about parameterizing this /// <summary> //// Run this loop /// </summary> public double EvaluateAsDouble(GPProgram tree) { // // Loop initialization m_LIB.EvaluateAsDouble(tree, this); int LoopIndex = 0; // // Go into the loop double Result = 0.0; while ((LoopIndex < MAXITERATIONS) && (m_LCB.EvaluateAsDouble(tree, this) > 0.0)) { Result = m_LBB.EvaluateAsDouble(tree, this); m_LUB.EvaluateAsDouble(tree, this); LoopIndex++; } return(Result); }