Zolkin1 / torc

TORC: Tools for Optimization, Robotics, and Control
1 stars 1 forks source link

Finite difference cost class implementation. #6

Closed gavin-hyl closed 5 months ago

gavin-hyl commented 6 months ago

Implemented class and tests. However, during testing I noticed that Hessian calculations had relatively low precision (10^-3 was the testing limit, see cost_tests.cpp). What are the potential use cases for the finite difference method? I was wondering if they aren't that common we can just add the functionalities in this class to that of the AD cost class.

Zolkin1 commented 6 months ago

Well if a user decides to use the AD class then they shouldn't ever need the finite difference methods because the AD ones should be more accurate (and faster). This is mostly just in case the function you have can't work with AD, or I expect this to be the easiest method to use, so it may be used out of pure laziness.

That being said, I don't have a ton of person experience with using finite differences for second order derivatives. But, it doesn't surprise me that it's low quality at second order. I can do some research to see what order of magnitude errors we expect.