using DotNumerics.Optimization;
public void OptimizationSimplex()
{
Simplex simplex = new Simplex();
double[] initialGuess = new double[2];
initialGuess[0] = 0.1;
initialGuess[1] = 2;
double[] minimum = simplex.ComputeMin(BananaFunction, initialGuess);
}
//f(a,b) = 100*(b-a^2)^2 + (1-a)^2
private double BananaFunction(double[] x)
{
double f = 0;
f = 100 * Math.Pow((x[1] - x[0] * x[0]), 2) + Math.Pow((1 - x[0]), 2);
return f;
}