How can I set meshsize respectively for each parameter on patternsearch?

4 Ansichten (letzte 30 Tage)
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);

Akzeptierte Antwort

Alan Weiss
Alan Weiss am 5 Jun. 2020
Bearbeitet: Alan Weiss am 5 Jun. 2020
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

Weitere Antworten (0)

Produkte


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by