Вы находитесь на странице: 1из 8

__________________________________________________________________

4
: c
.
4

, 890


()
________________

(...)

()

:
__ .
()
(...)
________________
()

2012 .

1.
:
.
2.
r

Y = F ( x )
r
, , x * R ,

r
r
F ( x * ) = min F ( x ) . (1)
r
xR

3.
r

x 0
r r r
x 0 , x1 , x 2 ,... .
r
r
x k x k +1 .
rk
(1) { x } ,

r
r
f ( x k +1 ) < f ( x k ), k = 0,1,... (2)
rk
{ x }
x k +1 = x k + k p k , k = 0,1, 2...,
r
r
p k - x k +1 x k , k - ,
r
r
, f ( x k +1 ) < f ( x k ), k = 0,1,... .
p k
k .

4.
:
- ;
- ;
- ;
- -;
- -;
- --;
- .
5.
m-: F.m
function res = F( x )
%
res=1-2*x(1)-2*x(2)-4*x(1)*x(2)+10*x(1)^2+2*x(2)^2;
end

6. .
1. .
%
disp(' : ')
x(:,1)=[3;4];
es1=10^-3;
es2=10^-8;
disp(' M=20. ')
M=20;
k=1;
while norm(mgradient(x(:,k)))>es1
if k<M
tk=0.5;
x(:,k+1)=x(:,k)-tk*mgradient(x(:,k));
while (F(x(:,k+1))-F(x(:,k)))>=0
tk=tk/2;
x(:,k+1)=x(:,k)-tk*mgradient(x(:,k));
end
if(norm(x(:,k+1)-x(:,k))>es2)||(norm(F(x(:,k+1))-F(x(:,k)))>es2)||...
(norm(x(:,k)-x(:,k-1))>es2)||(norm(F(x(:,k))-F(x(:,k-1)))>es2)
k=k+1;
else
break
end
else
break
end
end
%
disp(' ')
k=k
%
disp(' ')
xmin=x(:,k)
%
disp(' ')
fmin=F(xmin)

2. .
%
disp(' : ')
x(:,1)=[3;4];
es1=10^-3;
es2=10^-8;
disp(' M=20. ')
M=20;
k=1;
syms t;
while norm(mgradient(x(:,k)))>es1
if k<M
d=mgradient(x(:,k));
f=F(x(:,k)-t*d);
fdif=diff(f,t);
tk=solve(fdif);
x(:,k+1)=x(:,k)-tk*mgradient(x(:,k));
if(norm(x(:,k+1)-x(:,k))>es2)||(norm(F(x(:,k+1))-F(x(:,k)))>es2)||...
(norm(x(:,k)-x(:,k-1))>es2)||(norm(F(x(:,k))-F(x(:,k-1)))>es2)
k=k+1;
else
break
end

else
end

break

end
%
disp(' ')
k=k
%
disp(' ')
xmin=x(:,k)
%
disp(' ')
fmin=F(xmin)

3. .
%
disp(' : ')
x(:,1)=[3/10;10/3];
es1=10^-4;
es2=10^-4;
e(:,1)=[1;0];
e(:,2)=[0;1];
disp(' M=20. ')
M=20;
n=2;
j=0;
mstop=0;
while (j<M)&&(mstop==0)
k=0;
while k<=n-1
if norm(mgradient(x(:,n*j+k+1)))<es1
mstop=1;
xres=x(:,n*j+k+1);
break
else
tk=0.5;
d=mgradient(x(:,n*j+k+1));
x(:,n*j+k+2)=x(:,n*j+k+1)-tk*d(k+1)*e(:,k+1);
while(F(x(:,n*j+k+2))-F(x(:,n*j+k+1)))>=0
tk=tk/2;
x(:,n*j+k+2)=x(:,n*j+k+1)-tk*d(k+1)*e(:,k+1);
end
if (norm(x(:,n*j+k+2)-x(:,n*j+k+1))<es2)&&(norm(F(x(:,n*j+k+2))F(x(:,n*j+k+1)))<es2)...
&&(norm(x(:,n*j+k+1)x(:,n*j+k))<es2)&&(norm(F(x(:,n*j+k+1))-F(x(:,n*j+k)))<es2)
mstop=1;
xres=x(:,n*j+k+2);
break
else
k=k+1;
end
end
end
x(:,n*(j+1)+k+1)=x(:,n*j+k+1);
j=j+1;
end
if(mstop~=0)
xres=x(:,n*j+k+1);
end
xres=xres
fmin=F(xres)

4. -.
% -
disp(' -: ')
x(:,1)=[3/10;10/3];
es1=10^-4;
es2=10^-4;
e(:,1)=[1;0];
e(:,2)=[0;1];
disp(' M=20. ')
M=20;
n=2;
j=0;
mstop=0;
while (j<M)&&(mstop==0)
k=0;
syms t;
while k<=n-1
if norm(mgradient(x(:,n*j+k+1)))<es1
mstop=1;
xres=x(:,n*j+k+1);
break
else
d=mgradient(x(:,n*j+k+1));
f=F(x(:,n*j+k+1)-t*d(k+1)*e(:,k+1));
fdif=diff(f,t);
tk=solve(fdif);
x(:,n*j+k+2)=x(:,n*j+k+1)-tk*d(k+1)*e(:,k+1);
if (norm(x(:,n*j+k+2)-x(:,n*j+k+1))<es2)&&(norm(F(x(:,n*j+k+2))F(x(:,n*j+k+1)))<es2)...
&&(norm(x(:,n*j+k+1)x(:,n*j+k))<es2)&&(norm(F(x(:,n*j+k+1))-F(x(:,n*j+k)))<es2)
mstop=1;
xres=x(:,n*j+k+2);
break
else
k=k+1;
end
end
end
x(:,n*(j+1)+k+1)=x(:,n*j+k+1);
j=j+1;
end
if(mstop~=0)
xres=x(:,n*j+k+1);
end
xres=x(:,n*j+k+1)
fmin=F(xres)

5. -.
% -
disp(' -: ')
x(:,1)=[3;4];
es1=10^-8;
es2=10^-8;
disp(' M=20. ')
M=20;
n=2;
k=0;
mstop=0;
syms t
while norm(mgradient(x(:,k+1)))>=es1

if k>=M
xres=x(:,k+1);
mstop=1;
break
else
if k==0
d(:,1)=-mgradient(x(:,1));
f=F(x(:,1)+t*d(:,1));
fdif=diff(f,t);
tk=solve(fdif);
x(:,2)=x(:,1)+tk*d(:,1);
n1=norm(x(:,k+2)-x(:,k+1));
n3=norm(F(x(:,k+2))-F(x(:,k+1)));
if (n1<es2)&&(n3<es2)
xres=x(:,k+2);
mstop=1;
break
else
k=k+1;
end
else
if mod(k,n)~=0
beta(k)=norm(mgradient(x(:,k+1)))^2/...
norm(mgradient(x(:,k)))^2;
else
beta(k)=0;
end
d(:,k+1)=-mgradient(x(:,k+1))+beta(k)*d(:,k);
f=F(x(:,k+1)+t*d(:,k+1));
fdif=diff(f,t);
tk=solve(fdif);
x(:,k+2)=x(:,k+1)+tk*d(:,k+1);
n1=norm(x(:,k+2)-x(:,k+1));
n2=norm(x(:,k+1)-x(:,k));
n3=norm(F(x(:,k+2))-F(x(:,k+1)));
n4=norm(F(x(:,k+1))-F(x(:,k)));
if (n1<es2)&&(n3<es2)&&(n4<es2)&&(n2<es2)
xres=x(:,k+2);
mstop=1;
break
else
k=k+1;
end
end

end

end
if(mstop~=1)
xres=x(:,k+1);
end
k=k
xres=xres
fmin=F(xres)

6. --.
% --
disp(' --: ')
x(:,1)=[3;4];
es1=10^-4;
es2=10^-4;
A=[1 0;0 1];
disp(' M=20. ')
M=20;
n=2;

k=0;
mstop=0;
syms t
while norm(mgradient(x(:,k+1)))>=es1
if k>=M
xres=x(:,k+1);
mstop=1;
break
else
if k==0
d(:,1)=-A*mgradient(x(:,1));
f=F(x(:,1)-t*A*mgradient(x(:,1)));
fdif=diff(f,t);
tk=solve(fdif);
x(:,2)=x(:,1)-tk*A*mgradient(x(:,1));
%
n1=norm(x(:,k+2)-x(:,k+1));
n3=norm(F(x(:,k+2))-F(x(:,k+1)));
if (n1<es2)&&(n3<es2)
xres=x(:,k+2);
mstop=1;
break
else
k=k+1;
end
else
delg(:,k)=mgradient(x(:,k+1))-mgradient(x(:,k));
delx(:,k)=x(:,k+1)-x(:,k);
Akc=(delx(:,k)*(delx(:,k))')/((delx(:,k))'*delg(:,k))-...
(A*delg(:,k)*(delg(:,k))'*A)/((delg(:,k))'*A*delg(:,k));
A=A+Akc;
d(:,k+1)=-A*mgradient(x(:,k+1));
f=F(x(:,1)-t*A*mgradient(x(:,k+1)));
fdif=diff(f,t);
tk=solve(fdif);
x(:,k+2)=x(:,1)-tk*A*mgradient(x(:,k+1));
%
n1=norm(x(:,k+2)-x(:,k+1));
n2=norm(x(:,k+1)-x(:,k));
n3=norm(F(x(:,k+2))-F(x(:,k+1)));
n4=norm(F(x(:,k+1))-F(x(:,k)));
if (n1<es2)&&(n3<es2)&&(n4<es2)&&(n2<es2)
xres=x(:,k+2);
mstop=1;
break
else
k=k+1;
end
end
end
end
if(mstop~=1)
xres=x(:,k+1);
end
k=k
xres=xres
fmin=F(xres)

7.

:
:




-
-
--

xmin
[0.2502; 0.7561]
[0.2500; 0.7503]
[0.25; 0.75]
[0.25; 0.75]
[0.25; 0.75]
[0.25; 0.75]

fmin
6.9141e-005
1.0236e-007
0
1.7494e-009
0
0

c . -,
-- .