Лабораторная работа: Градієнтні методи
void main ()
{int k, i,N,N0,N1,l1,l2;
double a,b,d,ymin,xmin1,xmin2,e2,dalph;
double x [3000] [2]; double y [10];
clrscr ();
x [0] [1] =-1;
x [0] [2] =0;
e2=0.0001;
double z1,z2,y1,y2,e,p,alpmin,g1,g2;
int m;
cout<<"Metod naiskor. spuska"<<endl;
k=0; N0=0; N1=0;
z1=df1 (x [0] [1],x [0] [2]);
z2=df2 (x [0] [1],x [0] [2]);
N1=N1+2;
dalph=2.2;
mm1:
m = 0;
y1=f (x [k] [1],x [k] [2]); N0++;
metka:
y2=f (x [k] [1] - (m+1) *dalph*z1,x [k] [2] - (m+1) *dalph*z2);
N0++;
if (y2<y1)
{m++; y1=y2; goto metka; }
else
{b= (m+1) *dalph;
if (m==0)
{a=0; }
else {a= (m-1) *dalph; }