MATLAB Answers

Why isn't parallel computing taking place when using MADS search methods in patternsearch?

3 views (last 30 days)
F Yung
F Yung on 25 Aug 2020
Commented: F Yung on 26 Aug 2020
I've been utilizing patternsearch for awhile to tune parameters for a black box simulation inside my objective function. It's working great. The most effective method for me has been the MADSPositiveBasis2N search function. However, it seems that when I set that as the search function, parallel computing is then disabled. I've confirmed that parallel computing takes place when using GSS or GPS search functions. According the bottom of this page, UseParallel should work for all search functions. Can anyone give me any insight into why this may not be working?
I've validated my local computing cluster.
A code snippet:
pattOpts = optimoptions('patternsearch','UseParallel',true,'Display','iter','MaxTime',60,'SearchFcn','MADSPositiveBasis2N');
[passVals,fVal] = patternsearch(fun_pass,initialPoint,[],[],[],[],lb,ub,[],pattOpts)


Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 26 Aug 2020
I think that you might have a slight misunderstanding of what some options mean, and also you need to set your options slightly differently. But I could be wrong about what you are attempting. I'll explain in detail.
The patternsearch function performs a POLL at each iteration as it searches for better values. It optionally calls a SEARCH method that can be a poll method. See Search and Poll. I think that you want poll alone, no search. In other words, I think that what you are trying to do is to not use search, but to use the 'MADSPositiveBasis2N' poll function. In that case, your options should be
pattOpts = optimoptions('patternsearch','UseParallel',true,'Display','iter','MaxTime',60,...
Notice that I set the poll method instead of search method. I also set the 'UseCompletePoll' option to true. This is not strictly necessary in some recent MATLAB versions, but is good practice.
However, I might be wrong, and it could be that you understand perfectly well the difference between a poll function and a search function. In that case, you need to set the 'UseCompleteSearch' option to true in order to search in parallel. Unlike for polling, the solver does not automatically set complete search to true when 'UseParallel' is true, and will not compute in parallel without it.
Alan Weiss
MATLAB mathematical toolbox documentation

  1 Comment

F Yung
F Yung on 26 Aug 2020
Thank you for the thorough answer, I think you've hit the nail on the head. I haven't been mentally differentiating between poll and search methods. For my work, the benefit of the MADS search method has been a continually decreasing function value. I didn't realize that the program was essentially following a straight line from iteration to iteration, following points from the search function and not polling at all.
I haven't tested yet but I think your secondary advice on setting UseCompleteSearch to true may work best for me in this situation. I didn't realize the connection that setting had with UseParallel. I'll take this advice and report back if I have any more trouble.
Thanks again!

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!