roboptim-core icon indicating copy to clipboard operation
roboptim-core copied to clipboard

[Guidelines] impl_gradient vs impl_jacobian

Open bchretien opened this issue 8 years ago • 0 comments

While most plugins do query the full constraint Jacobian through impl_jacobian, CFSQP can and does query single rows of the Jacobian matrix (e.g. gradient w.r.t. the i-th parameter for the j-th output of the k-th constraint). As a result, the plugin relies on proper impl_gradient implementations.

In practice, for complex multidimensional constraints, it is often easier to provide a single impl_jacobian method, and in this case, it is common for users to implement an empty impl_gradient (pure virtual method), and CFSQP fails since it gets a null vector, leaving the user confused.

Thus, we should clarify the guidelines for such cases (e.g. throw exceptions in the empty impl_gradient method), and provide helper classes/functions to detect such issues, for instance by comparing results from impl_jacobian and impl_gradient.

cc @stanislas-brossette

bchretien avatar Mar 04 '16 11:03 bchretien