I am running a trial of ILNumerics (newest version as of posting) but get the wrong minimum when running a Optimization.fmin
optimizer.
The minimum should be at f(-5.218) = -3.342 with search bounds at -10 <= x <= 10.
private void Compute()
{
//var function = new Func<double, double>(input =>
//{
// var output = Math.Pow(input, 3) / Math.Exp(Math.Pow(input, 0.8));
// return output;
//});
Array<double> bounds = new double[] {-10.0, 10.0};
Array<double> start = new double[] {1};
Array<double> y = Optimization.fmin(myfunc, start, lowerBound: bounds[0], upperBound: bounds[1]);
Console.WriteLine("The minimum is found at");
Console.WriteLine("{0}", y);
Console.WriteLine("The value is");
Console.WriteLine("{0}", myfunc(y));
Console.ReadLine();
return;
}
static RetArray<double> myfunc(InArray<double> x)
{
var input = x.GetValue(0);
var output = Math.Pow(input, 3) / Math.Exp(Math.Pow(input, 0.8));
return output;
}