-
Notifications
You must be signed in to change notification settings - Fork 225
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 check with IPOPT #83
Comments
Hi, I am not a maintainer and don't have a specific answer but I might be able to give a little more information that might be helpful. There is more information about what each term in the checker refers to at https://coin-or.github.io/Ipopt/SPECIALS.html. Changing the "derivative_test_perturbation" option will change the size of the errors and "derivative_test_tol" determines the cut-off for reporting the derivative is an error. I believe the relative size of the error would depend on the non-linearity in the supplied Jacobian. This is because it is comparing to a first order (linear) estimate of the derivative. Thus the derivatives will not be the same. So treat it more as a test to see if you have implemented the analytic derivatives correctly. With that in mind, I implemented a cart pole trajectory optimisation problem with IFOPT as the interface to IPOPT which is what is used in TOWR. The derivative checker there revealed errors in on the order of 1e-9 for a "derivative_test_perturbation" of 1e-8 and errors on the order of 1e-4 for a "derivative_test_perturbation" of 1e-4. But again, this is a different problem with different forms for the cost and constraints. A final note: In my experience, using the analytic derivatives instead of a finite-difference method can provide 1 to 2 orders of magnitude reduction in solution time with IPOPT so regardless it is well worth defining the Jacobian analytically. Thanks @awinkler for the awesome work in TOWR and IFOPT. |
Hello,
First of all, thanks for maintaining this nice repo!
In the
hopper_example.cc
, I have added this line to check derivatives.And I got the results as shown in the attached screenshot.
![Screenshot from 2021-01-14 11-54-59](https://user-images.githubusercontent.com/23005104/104629625-5998cc80-565f-11eb-9c2d-764d42f37a6d.png)
where the constraints and variables are indexed as following:
![Screenshot from 2021-01-14 11-53-32](https://user-images.githubusercontent.com/23005104/104629509-35d58680-565f-11eb-80bb-e483d8b50cc9.png)
Most of the derivatives are very very close, but there were some jacobian elements that have a relatively bigger error between the analytically computed value and the numerically computed value.
To which degree do you expect this comparison should be similar?
Should they be exactly the same or ~0.01 error is inevitable and should be accepted?
Best,
Junhyeok
The text was updated successfully, but these errors were encountered: