roboptim / roboptim-core

RobOptim Core Layer: interface and basic mathematical tools
http://www.roboptim.net
GNU Lesser General Public License v3.0
64 stars 35 forks source link

[Guidelines] impl_gradient vs impl_jacobian #108

Open bchretien opened 8 years ago

bchretien commented 8 years ago

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