O'Reilly logo

Hands-On Neural Network Programming with C# by Matt R. Cole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Let's add a new function

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required