In the use of two-dimensional optimization algorithm, it is often necessary to call one-dimensional search algorithm to find the step, while one-dimensional search algorithm needs to determine the search interval. The method can not only be used as a one-dimensional search algorithm, but also can be used to determine the one-dimensional searching interval.
The principle of the search interval determined by the Retreat method is:
Suppose the one-dimensional objective function is a single-peak function, the initial point x0, the step h, and the iteration point x1= x0+h. The Lamda initial value is set to 1.
(1) if f (x0) > F (x1), then x2=x1+lamda*h. Find a Lamda, make F (x2) > F (x1), Output search interval [x1, X2].
(2) if f (x0) <= F (x1), then x2=x1-lamda*h. Find a Lamda, make F (x2) > F (x0), output search interval [x2, x0].
Individuals think only to determine the search interval, the step value will not be reduced, has been enlarged. The MATLAB code is as follows:
function [LOW,UP]=MINJT (fun,x0,h)
% fun is an anonymous function
lamda=1;
X1=x0;x2=x0+h;
If Fun (x1) >fun (x2)
x_panduan=x2;
While 1
x1=x2;x2=x1+lamda*h;
Lamda=1.1*lamda;
If Fun (x2) >fun (X_panduan) break
;
End
End
else
x_panduan=x1;
While 1
x1=x2;x2=x1-lamda*h;
Lamda=1.1*lamda;
If Fun (x2) >fun (X_panduan) break
;
End
End
End
low=min (X_PANDUAN,X2);
Up=max (X_PANDUAN,X2);
End
For example:
[Low,up]=minjt (@ (x) x^4-x^2-2*x-5,0,0.1)
Output:
Low =
0.1000
up =
1.6937