How can I set meshsize respectively for each parameter on patternsearch?
5 次查看(过去 30 天)
显示 更早的评论
I am trying to optimize 4 parameters of the Page test using patternsearch. However, the estimated orders of the 4 parameters are different. See the initial parameters "param0" in the code below. In particular, I would like to set the meshsize to 10 for the first parameter, 10 for the second parameter, 0.1 for the third parameter, and 0.001 for the fourth parameter. My question is that is it possible to set the different meshsize for each parameter? Thank you so much in advance.
rand1 = rand(1)*1000; rand2 = rand(1)*1000; rand3 = rand(1); rand4 = rand(1)/100;
param0 = [round(max(rand1,rand2)), round(min(rand1,rand2)), round(rand3, 2), round(rand4, 5)];
options = optimoptions('patternsearch', 'PlotFcn', 'psplotbestx', 'MeshTolerance', 1, 'ScaleMesh', false, 'InitialMeshSize',10);
A = [];
b = [];
Aeq = [];
beq = [];
nlcon = [];
lb = [1 1 0.1 1/500000];
ub = [100000 100000 10 1/25000];
fun = @do;
[param, RSS, exitflag, ~] = patternsearch(fun, param0, A, b, Aeq, beq, lb, ub, nlcon, options);
0 个评论
采纳的回答
Alan Weiss
2020-6-5
编辑:Alan Weiss
2020-6-5
Usually it is better to set the scale within your objective function so that the optimization parameters are all of the same order of magnitude. For example,
function f = myfun(x)
x(1) = x(1)/1000;
x(2) = x(2)/1000;
x(3) = x(3) + 1000;
x(4) = (x(4) - 1000)*1000;
% Now put your code here
end
Alan Weiss
MATLAB mathematical toolbox documentation
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Direct Search 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!