To implement maximum likelihood estimators, I am looking for a good C++ optimization library that plays nicely with Eigen's matrix objects. Eigen has some capability of interfacing of its own but if anyone here has experience of using Eigen with an optimizer library in tandem, that would be great!

I am aware of similar questions being asked here or here but those are specific for derivative-free methods.

I think a 'good' library would be one that plays nicely with other libraries such as Eigen or Armadillo. So far, I have found dlibnet and nlopt, which seem promising.

Ideally, the answer to this question could be a longer one with having the pros and cons of each library listed as well. Thank you so much!

Update: I have decided to go with CppNumericalSolvers for now. There was also Ceres (linking to the relevant bit) but what put me off that was the emphasis on non-linear least squares, which requires the objective function to be of a certain format, which for more complex statistical models cannot always be guaranteed. Even iterated generalised least squares which can achieve certain maximum likelihood estimators would fail this format.

Moreover, CppNumericalSolvers supports bindings to TensorFlow, Eigen, and MATLAB. Note that both Ceres and CppNumericalSolvers ask you to formulate your function as a class rather than a lambda function, which may put off some beginners.

Finally, there is ROOT which is an environment for C++ with tons of routines where C++ source files can be loaded as 'macros.' Elementary BFGS optimizers exist with plenty of examples such as here. However, this is an interpreted environment.

I am still hoping someone might answer my questions with some actual experience using a library.

  • 1
    $\begingroup$ i think libLBFGS - and its C++ wrapper LBFGS++ - should qualify as "good". libLBFGS is a C port of Jorge Nocedal's FORTRAN implementation of Limited-memory BFGS. The latter is widely used in the academic optimization community (it's particularly suitable for large-scale models). And LBFGS++ should play well with Eigen. $\endgroup$ – GoHokies Oct 24 '18 at 16:27
  • $\begingroup$ Just saw this, thank you so much @GoHokies $\endgroup$ – Hirek Oct 24 '18 at 16:35

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.