-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Derivative test for objective function #487
Comments
The error in the bracket is actually absolute if the absolute value of the approximated gradient is below 1: Ipopt/src/Interfaces/IpTNLPAdapter.cpp Lines 3039 to 3041 in 9159a30
So for weight 10^-4 you get absolute difference:
For weight 1 you get a relative difference
The same for the other observation:
|
Thank you for the immediate explanation. Why there is need for absolute difference? Wouldn't it be more representative to compute the relative difference for all cases in the sense that the number in the brackets would be the same? |
I think it is quite common to not scale up the absolute difference when computing a relative difference. Also the case that But I don't really mind changing this formula a bit. |
Hi,
I am using ipopt through ifopt and I am doing some derivative tests by setting the options:
I am comparing the results for two cases: the first case has an objective function with a single cost term with weight 10^-4 while the second case has the same cost term with weight 1. The rest of the problem formulation (variables etc.) are the same.
The results from the derivative checker are shown below:
For weight 10^-4:
For weight 1.0:
As expected, the floating point numbers of the second case are the same as the respective of the first case multiplied by 10^4 (expected as the weight is passed to the derivatives). However, the difference between them (that is the number in brackets) does not follow this trend. Shouldn't the differences (number in brackets) for the second case be the same as the respective from the first case multiplied by 10^4?
Another observation: I looked into the documentation where it is stated that "The first floating point number is the value given by the user code, and the second number (after "~") is the finite differences estimation. Finally, the number in square brackets is the relative difference between these two numbers."
However in the example of the documentation this rule is not satisfied for the
grad_f
(see photo below).The difference between
-6.5159999999999991e+02
and-6.5559997134793468e+02
is not equal to[ 6.101e-03]
.The text was updated successfully, but these errors were encountered: