Optimization function similarly to Matlab’s fmincon

I am looking for a convenient Fortran function that works similarly to Matlab’s fmincon.

If you look at the Octave equivalent to fmincon: here.

So, how about using minpack?

MINPACK doesn’t offer constrained minimization. It is also aimed primarily at solving least squares problems and solving nonlinear equations.

For constrained minimization take a loop at NLopt and it’s Fortran interface nlopt-f. Depending on the form of your constraints, and availability of an analytic Jacobian, I’d also recommend taking a look at Powell’s Derivative Free Optimizers, including bobyqa, lincoa, and cobyla. More optimization codes can be found in the NIST Guide to Available Mathematical Software (GAMS), Class G2: Constrained optimization

In case your Fortran routines will be used in conjuction with R, you could also take a look at R’s internal optimization routines, see Writing R Extensions - Optimization.

SOL SNOPT User Guide is primarily in Fortran. fmincon covers a lot of territory so not sure SNOPT applies. I thought it was freely available from Stanford University but a quick look on the web page says “Proprietary”; so no idea; but might be available for Academic use.

Take a look at this post: Optimization, root finding, and nonlinear equation solving

For constrained optimization, you would need something like SLSQP (free), SNOPT (not free) or VF13AD (freely available for download). IPOPT (free, non-trivial to compile though) is C++ but has a Fortran interface that works.

1 Like

Is SNOPT worth the 6240$ license fee for commercial use? How does it compare with other solvers? The trial licenses are limited to 3-months. A perpetual MATLAB license for commercial use costs 2100$ and a home license for personal use costs 119$. I have no doubt that successful optimization of an industrial problem can save a few thousand $ or more. But the price seems kind of high in comparison to other software packages.

@fortran4r, did you end up using any suggested packages? Is there any particular kind of bound constraint you need, e.g. box, linear, non-linear, equality?