Recovering list of polling points with patternsearch
Mostrar comentarios más antiguos
Hi,
I'm currently using patternsearch to minimize a highly non-linear function with 5 arguments. I'd like to know, if there's a way to recover a list of the polling points that the patternsearch algorithm has evaluated with the respective value of my objective function. I'm running patternseach from an m-file not using optimtool -- I don't know if that's relevant for my question.
Any help is gratefully appreciated!
Respuestas (1)
Grzegorz Knor
el 17 de Nov. de 2011
The solution is a little dangerous :)
Go to directory matlabroot/toolbox/globaloptim/globaloptim/private/:
cd(matlabroot)
cd toolbox/globaloptim/globaloptim/private/
and edit funevaluate.m ( make sure that you have done the copy of this file! ):
open funevaluate.m
Add at the beginning of the file the following lines:
global X_global
X_global(:,end+1) = X;
Now you can try run patternsearch in this way:
global X_global
xmin = patternsearch(@ps_example,[pi pi]);
And draw the polling points:
[x y] = meshgrid(-15:.1:15);
z = NaN(size(x));
for k1=1:size(x,1)
for k2=1:size(x,2)
z(k1,k2) = ps_example([x(k1,k2) y(k1,k2)]);
end
end
contour(x,y,z,40)
hold on
plot(pi,pi,'ko')
plot(X_global(1,:),X_global(2,:),'.r')
plot(xmin(1),xmin(2),'+g')
hold off

Remember to restore the original funevaluate.m file!
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!