MATLAB: Why using pattrensearch with genetic algorithm gives error while fminunc not

errorgapatternsearch

Dear All,
I'm using ga from matlab and I need to improve my result so I decided to use local search with GA. I used fminunc it gave almost the same result. So I tried to use patternsearch, but it gave error. Down I wrote my code
function [x,fval,exitflag,output,population,score] = PGA(nvars,PopulationSize_Data,Generations_Data,InitialPopulation_Data)
% This is an auto generated MATLAB file from Optimization Tool.
%%Start with the default options
options = gaoptimset;
%%Modify options setting
options = gaoptimset(options,'PopulationSize', PopulationSize_Data);
options = gaoptimset(options,'Generations', Generations_Data);
options = gaoptimset(options,'InitialPopulation', InitialPopulation_Data);
options = gaoptimset(options,'Display', 'off');
options = gaoptimset(options,'PlotFcns', { @gaplotbestf @gaplotbestindiv});
[x,fval,exitflag,output,population,score] = ...
ga(@FP,nvars,[],[],[],[],[],[],[],[],options)
To here my original code finish, so I add the next code for fminunc, when I write the code to use fminunc it gives result
fminuncOptions = optimoptions(@fminunc,'Display','iter','Algorithm','quasi-newton');
options = gaoptimset(options,'HybridFcn',{@fminunc, fminuncOptions});
[y,fval] = ga(@FP,nvars,[],[],[],[],[],[],[],options);
while for patternsearch I got error, in fact I want to use pattern search using poll to get better result.
options = optimoptions(@patternsearch,'Display','off');
options = gaoptimset(options,'HybridFcn', {@patternsearch,options});
[y,fval] = ga(@FP,nvars,[],[],[],[],[],[],[],[],options);
Can anyone help me with it please?
Thanks in advance.
Nadia

Best Answer

Currently, you cannot use optimoptions to set options for patternsearch. Use psoptimset to set patternsearch options.
Alan Weiss
MATLAB mathematical toolbox documentation