/// <summary> /// Calculates the specified function. /// </summary> /// <param name="function">The function.</param> /// <param name="point">The point.</param> /// <returns>System.Double.</returns> internal double calculate(IOptFunction function, double[] point) { double fValue; var pointClone = (double[])point.Clone(); SearchIO.output("evaluating x =" + point.MakePrintString(), 4); if (functionData[function].TryGetValue(pointClone, out fValue)) { SearchIO.output("f =" + fValue + " (from store).", 4); return(fValue); } calc_dependent_Analysis(point); /**************************************************/ /*** This is the only function that should call ***/ /**********IOptFunction.calculate(x)***************/ fValue = function.calculate(point); /**************************************************/ functionData[function].Add(pointClone, fValue); functionData[function].numEvals++; SearchIO.output("f =" + fValue + " (f'n eval #" + numEvals + ")", 4); return(fValue); }
internal double calculate(IOptFunction function, double[] point) { return(function.calculate(point)); }