fmincon and Parallel Computing

39 views (last 30 days)
John R.
John R. on 17 Dec 2015
Commented: John R. on 17 Dec 2015
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.

Accepted Answer

Alan Weiss
Alan Weiss on 17 Dec 2015
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
  1 Comment
John R.
John R. on 17 Dec 2015
Thanks Alan. That document explained it very well. It would appear that for my particular case, the only way to take advantage of Parallel Computing would be to use parfor-loops within my objective and constraint functions and elsewhere in the code.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!