MATLAB: Isn’t parallel computing taking place when using MADS search methods in patternsearch

madspositivebasisMATLABoptimizationparallel computingpatternsearch

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)

Best Answer

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,...
'PollMethod','MADSPositiveBasis2N','UseCompletePoll',true);
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