Open junhyeokahn opened 3 years ago
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.
where the constraints and variables are indexed as following:
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