-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function minimizer issue #8
Comments
This seems to be an issue with That function needs three values for x: the two extrema and the guess where the minimum is. Wasora sets the guess as the average of the extrema. With those values, the function above fails with I will need help from your side to figure this out... |
Ok, so the problem is that GSL believes that this function is a monotonically decreasing function, because it is evaluated at
In this particular example, this condition is not fulfilled, because So, the question is, can we estimate a better start value for the minimum? |
oh, and another thing is, why this is automatically resolved when setting |
|
|
For completeness, check out this input:
This time, GSL selects the potentially correct interval as well. |
if you want, make the default behavior as nocomplain, i.e. change the flag to |
I am not sure about that... I have already tested that way and results can be incorrect as well. So there is virtually no advantage with respect to what we have now. Maybe, we must catch the GSL error: if (f_minimum >= f_lower || f_minimum >= f_upper)
{
GSL_ERROR ("endpoints do not enclose a minimum", GSL_EINVAL);
} and replace it by: wasora_push_error_message("Interval endpoints may not enclose a minimum. Please, plot your function and make sure that the following conditions are fulfilled: f(x_lower) > f(x) and f(x) < f(x_upper), with x a first estimate of the location of the minimum.");
wasora_runtime_error(); This way, we can remove the current seventh argument
or
with force a flag that indicates if we must force the minimum search. Of course, the Let me know what you think! |
Go ahead. |
ok! I will do it now |
As I have previously explained, I want to catch the GSL error given by: if (f_minimum >= f_lower || f_minimum >= f_upper)
{
GSL_ERROR ("endpoints do not enclose a minimum", GSL_EINVAL);
} However, when we call if (x_lower > x_upper)
{
GSL_ERROR ("invalid interval (lower > upper)", GSL_EINVAL);
}
if (x_minimum >= x_upper || x_minimum <= x_lower)
{
GSL_ERROR ("x_minimum must lie inside interval (lower < x < upper)",
GSL_EINVAL);
} In this context, I cannot make the following check wasora_push_error_message("Interval endpoints may not enclose a minimum. Please, plot your function and make sure that the following conditions are fulfilled: f(x_lower) > f(x) and f(x) < f(x_upper), with x a first estimate of the location of the minimum.");
wasora_runtime_error(); because the two other errors which return a I would rather have to check the error message |
no, but I would take a look at what the |
Check out this mwe:
The correct value is
0.9
. However, we only reach that value when we setnocomplain = 1
. What do you think about this?The text was updated successfully, but these errors were encountered: