MATLAB: UseParallel Option with fmincon

fminconoptimizationparallel

Hello,
I am using fmincon to solve a large dimensioned problem (thousands of variables) and want to turn on the 'UseParallel' option to reduce computational time. Currently I supply fmincon with objective and constraint functions (nonlinear equality) as well as the gradients for these two functions. Before I run fmincon I establish a parallel pool on my local machine using parpool('local') which begins a parallel pool connected to two workers. Next, I run fmincon with the "UseParallel" option set to true. When I do this I receive no errors, however I observe no reduction in speed or any other evidence fmincon is actually computing anything in parallel. It was my understanding that by turning this option on fmincon would compute the gradient and constraints in parallel, but this doesn't seem to be happening. Am I misunderstanding something?

Best Answer

Well, if you supply the gradients and set the appropriate options (set SpecifyObjectiveGradient and SpecifyConstraintGradient to true), then fmincon does not estimate the gradients numerically, so there is no point in using parallel computing. There is no parallel gradient estimation going on in this case.
Depending on the complexity of your gradient calculations, it can be faster to estimate the gradients numerically. I mean, it is possible that numerical estimation of the gradients would be faster than analytic evaluation. Set the gradient options to false and see. Of course,it is also possible that numerical estimates are slower than analytic evaluations.
Alan Weiss
MATLAB mathematical toolbox documentation