Change fminsearch() stepsize
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Xiaofei Yu
am 13 Sep. 2020
Kommentiert: Walter Roberson
am 19 Okt. 2021
Dear Sir/Madam
I am trying to use fminsearch() function for certain optimization problem. I hope to change the intial step size of the function.
I tried the following code
options = optimset('fminsearch');
options.DiffMinChange=100;
options.DiffMaxChange=200;
[deltarR1, fmin1]=fminsearch(@XYZR_MeasureDefine,Deltar,options,XYZRcoodinate,BfieldData,NVBfield,[1,1,1]);
%Deltar is the intial guess, Bfield Data, NVfield, [1,1,1] are other constant parameters
In principle , this 'options' should set the stepsize from 100 to 200. The stepsize actually does not change when I run the code.
Any suggestion?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 13 Sep. 2020
fminsearch() does not use an initial step size. fminsearch() builds an initial simplex by taking taking the initial coordinates and systematically multiply one of them by 1.05, unless the coordinate was 0 in which case it uses 0.00025
DiffMinChange and DiffMaxChange are not optimset options(); they are optimoptions(), and opotimoptions is not used for fminsearch .
3 Kommentare
Allen Goldstein
am 18 Okt. 2021
This is a real problem for me. I have a 2D problem where most of the surface is flat except for a hole in the surface. Think of it as trying to find a whirlpool somewhere in a lake. The 1.05 multiplier is just too small. Any suggestions to increase it or use another method?
Walter Roberson
am 19 Okt. 2021
If your surface is flat except within a region, and the task is to find the region, then it follows that the derivative outside of the hole is 0 and that there is a discontinuity in the derivative at the edge of the hole. None of the fmin* functions can be used in such cases: fminunc() and fmincon() work with derivatives explicitly, and although fminsearch() does not use derivatives, fminsearch() will give up the search immediately after the first probes find that all sampled locations have the same value.
Changing the 1.05 multiple for fminsearch() would not help your situation -- not unless the math was such that you could guarantee that at least one of the points
D = 1.10;
(x0, y0, z0, ... w0)
(x0*D, y0, z0, ... w0)
(x0, y0*D, z0, ... w0)
(x0, y0, z0*D, ... w0)
,,,
(x0, y0, z0, .... w0*D)
would be within the hole, for some constant D.
... and if that is the case, then you can use the existing fminsearch() in a loop, working through the above coordinate list as your starting point, testing to see if you get a result, and so on.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!