Hi all, I'm coding a small class that maximizes a given function F and returns the coordinates. For example in maximizing the 1-dimensional fitness function below I currently have:
using System;
public static class Program
{
public static double F(double x)
{
// for example
return Math.Exp(0.4 * Math.Pow(x - 0.4, 2) - 0.08 * Math.Pow(x, 4));
}
static void Main(string[] args)
{
Metaheutistic Solve = new Metaheutistic;
Solve.Maximize(Mu, Lambda, Theta);
}
}
The method "Maximize" in the class Metaheutistic contains the algorithm that does all the work. My problem is this algorithm is in a class that does not know what the fitness function looks like.
I'm new to C# and if I've gone on a bender here I'm open to doing it all over again to get it right. I do however need to keep the Solver class separate from the fitness function.
Many thanks. *I'm not sure "Passing" is the correct term I'm looking for