Now it's time for us to demonstrate how to add a new function. The function we are going to deal with is a modified version of the original Levy function and is the 13th version known to exist. This function is a minimization function.
The function itself, which you can find in the visual workbench source code, looks like this:
public double LevyFunction13(double[] data){double x1 = data[0];double x2 = data[1];double term1 = Math.Pow(Math.Sin(3 * Math.PI * x1), 2);double term2 = Math.Pow((x1 - 1), 2) * (1 + (Math.Pow(Math.Sin(3 * Math.PI * x2),2)));double term3 = Math.Pow((x2 - 1), 2) * (1 + (Math.Pow(Math.Sin(2 * Math.PI * x2), 2)));return term1 + term2 + term3;}
Definitely a lot of math there, right? Many times, ...