MatthewPeterKelly / OptimTraj

A trajectory optimization library for Matlab
MIT License
598 stars 207 forks source link

More NLP Solver Options for OptimTraj #22

Open stumarcus314 opened 7 years ago

stumarcus314 commented 7 years ago

The MATLAB code fminsdp: https://www.mathworks.com/matlabcentral/fileexchange/43643-fminsdp would make it really easy for OptimTraj to easily switch between several different 3rd party NLP solvers like IPOPT, SNOPT, KNITRO, and fmincon, assuming the user already has them installed. The documentation says that fminsdp is designed for small-scale optimization problems, but as long as there are no matrix inequality constraints (which is the novelty of fminsdp), fminsdp should be able to solve large-scale NLP problems (like those formulated from an optimal control problem by OptimTraj) via the third-party solvers. The fminsdp and fmincon interfaces are almost the same, so you would basically just have to replace the fmincon call in the OptimTraj code to fminsdp.

MatthewPeterKelly commented 7 years ago

This sounds good, although I'm a bit wary of this due to a problem that I ran into a few years ago, converting optimization problems between FMINCON and SNOPT.

These programs handle inequality constraints g(x) < Bnd differently. In particular, SNOPT requires that all constant terms be placed in the limit Bnd of the constraint, while FMINCON requires that all constant terms be placed in the function g(x), and that Bnd==0. SNOPT handles constraints numerically, and tends to drop constant terms in the g(x) function (yes, this sounds crazy, but I tested this very carefully a few years back). The result is that you can take a problem that is posed for SNOPT and easily convert it to be solved by FMINCON, but you cannot do the reverse.

I'm open to support for multiple solvers, but any pull requests would have to demonstrate that they are reliable on a wide set of problems, to ensure that problems like the one above don't arise.