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!