FMINCON and FMINUNC Optimisation – Which One to Choose?
Matlab provides a huge library of toolboxes and I used a lot on the Optimisation Toolbox; particularly – fmincon and fminunc.
FMINCON is a function script from the MATLAB Optimisation Toolbox that uses constrained optimisation routines to minimise (or maximise) functions.
FMINUNC is a function script from the MATLAB Optimisation Toolbox that uses unconstrained optimisation routines to minimise (or maximise) functions.
These two functions are extremely powerful which can be used to find the minimum point of any smooth stochastic function. They can incorporate Gradient and Hessian information to help speed up the optimisation; or otherwise these values can be approximated by finite-differencing.
Although there is so such thing as a single general purpose algorithm to suit all purposes, but the trust region algorithm is highly recommended for all kinds, including large-scale optimisation routines.
The main question here is, when do you use FMINCON or FMINUNC? In general, FMINCON is used when:
- the adapted value (to be trained) is within a range of values, e.g. x1 < x < x2.
- negative values are to be avoided, e.g. x > 0.
- there is a presence of constrained functions (which are additional information to be included in the optimisation routine).
Otherwise, FMINUNC is a preferred choice as it allows a huge range of values of training value, x to be considered.