UseParallel Option with fmincon
26 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Alan Weiss
2017-3-28
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
2 个评论
Alan Weiss
2017-3-29
As documented, the automatic parallel functionality is to estimate gradients by parallel finite differences. If you want to do something fancier in parallel, feel free, but you'll have to write the parallel code yourself.
Alan Weiss
MATLAB mathematical toolbox documentation
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!