MATLAB: Fmincon and Parallel Computing

fminconMATLABoptimizationOptimization Toolboxparallel computingParallel Computing Toolbox

Hello,
I have a program that uses fmincon to optimize an objective function. The problem uses linear and nonlinear equality constraints, and nonlinear inequality constraints. I provide the gradients for both the objective function and nonlinear constrain function. I am using the 'sqp' algorithm so no Hessian is provided.
I have fmincon running inside a for-loop, so while each instance of fmincon might be fast, running it thousands of times in this for-loop can take several minutes (or longer!). This for-loop must proceed in sequential order. For example, the results of a loop are used in the following loop, and so on.
My question is, will parallel computing improve the speed of each optimization? If so, is it as simple as setting 'UseParallel' to 'always'? Or do I need to make other changes throughout the objective and constraint functions to accommodate parallel computing?
Thank you.

Best Answer

The automatic parallel computing in fmincon will not help, because you are providing function gradients, and that is all the parallel computing attempts to do. See Parallel Optimization Functionality.
Alan Weiss
MATLAB mathematical toolbox documentation