/// <summary> /// Makes a clone of the branch /// </summary> public new Object Clone() { GPProgramBranchADRoot obj = (GPProgramBranchADRoot)base.Clone(); // // TODO: I don't believe these first two are be necessary, the base.Clone() // should take care of them for me...because it has a .MemberwiseClone() call. obj.m_WhichFunction = m_WhichFunction; obj.m_NumberArgs = m_NumberArgs; obj.m_ParamResults = new double[m_NumberArgs]; return(obj); }
/// <summary> /// Declare each of the AD program branch parameters /// </summary> /// <param name="ADBranch">Which ADF to work with</param> private String ConstructADParameters(GPProgramBranchADRoot ADBranch) { String Parameters = ""; for (short nParam = 0; nParam < ADBranch.NumberArgs; nParam++) { if (nParam != 0) { Parameters += ","; } Parameters += ("p" + nParam); } return(Parameters); }
/// <summary> /// Evaluates the parameters to a function before the function is called. /// </summary> /// <param name="tree">Program tree this Function belongs to</param> /// <param name="execBranch">Program Branch this Function is executing within</param> public void PrepareFunctionParameters(GPProgram tree, GPProgramBranch execBranch, GPProgramBranchADRoot ADFunction) { // // Compute the parameters to the Function short nNumberArgs = ADFunction.NumberArgs; double[] argResult = new double[nNumberArgs]; for (int nParam = 0; nParam < nNumberArgs; nParam++) { argResult[nParam] = ((GPNode)m_Children[nParam]).EvaluateAsDouble(tree, execBranch); } // // Place the results into the Function program branch for (int nParam = 0; nParam < nNumberArgs; nParam++) { ADFunction.ParamResults[nParam] = argResult[nParam]; } }