Gauss–Seidel optimization routines
This is simplest optimization routine. Using this algorithm optimization parameters are changed separately in each step. Only one parameter can be changed in one step while other are helt as constants.
Xk+1=Xk+ΔXk , k=0,1,2,…
ΔXk step of parameter Xk. Parameter is changed until function growth is noticed, and then next parameter follows and so on. After cycle with all parameters is completed, then step is changed to half of its value and repeat cycle again. Optimal point searching ends when there is no function increase and last point is held as optimal point.
Lets see how it works with following function:
![]()
Its plot:

Using MATLAB script we get results bellow. In each picture start coordinates are different.
Start coordinates. x=150; y=200;

Start coordinates x=50; y=150;

Other example

Start coordinates x=10; y=10;

Start coordinates x=100; y=200;

Third example
![]()

Start coordinates x=10; y=10;

Start coordinates x=50; y=200;

Matlab script
close all;
clear all;
clc;
[X,Y] = meshgrid(-100:1:100, -100:1:100);
Z =3*exp(-((X.^2)/78000) -((Y.^2)/20000))-5*exp(-(((X+31).^2)/123) -(((Y+20).^2)/5000));
xx=100;
yy=100;
contour3(Z,20);
hold on;
% figure(2); mesh(Z);
% figure
% plot3(X,Y,Z)
X=70; Y=100;
X1=0;Y1=0;
X0=X;
Y0=Y;
z=160; figure(1); plot(X,Y,’r*’), hold on;
X=X-xx; Y=Y-yy;
TT1 =3*exp(-((X.^2)/78000) -((Y.^2)/20000))-5*exp(-(((X+31).^2)/123) -(((Y+20).^2)/5053));
for i=1:50
z=z/2;
X=X-z;
Z2 =3*exp(-((X.^2)/78000) -((Y.^2)/20000))-5*exp(-(((X+31).^2)/123) -(((Y+20).^2)/5053));
if Z2>=TT1
TT=Z2;
X1=X;
end;
X=X+(2*z);
Z2 =3*exp(-((X.^2)/78000) -((Y.^2)/20000))-5*exp(-(((X+31).^2)/123) -(((Y+20).^2)/5053));
if Z2>=TT1
TT=Z2;
X1=X;
end;
TT1=TT;
X=X1;
X=X+xx; Y=Y+yy;
figure(1); plot3(X,Y,TT,’g*’), hold on;
XX=[X0 X];
YY=[Y0 Y];
line(XX,YY, ‘LineWidth’,1); hold on;
X0=X;
Y0=Y;
X=X-xx; Y=Y-yy;
Y=Y+z;
Z2 = 3*exp(-((X.^2)/78000) -((Y.^2)/20000))-5*exp(-(((X+31).^2)/123) -(((Y+20).^2)/5053));
if Z2>=TT1
TT=Z2;
Y1=Y;
end;
Y=Y-(2*z);
Z2 = 3*exp(-((X.^2)/78000) -((Y.^2)/20000))-5*exp(-(((X+31).^2)/123) -(((Y+20).^2)/5053));
if Z2>=TT1
TT=Z2;
Y1=Y;
end;
TT1=TT;
Y=Y1;
X=X+xx; Y=Y+yy;
figure(1); plot3(X,Y,TT,’*'), hold on;
XX=[X0 X];
YY=[Y0 Y];
line(XX,YY, ‘LineWidth’,3); hold on;
X0=X;
Y0=Y;
X=X-xx; Y=Y-yy;
end
% [X,Y] = meshgrid(-100:1:100, -100:1:100);
% figure
% contour3(Z,70);
figure
[X,Y] = meshgrid(-100:1:100, -100:1:100);
Z =3*exp(-((X.^2)/78000) -((Y.^2)/20000))-5*exp(-(((X+31).^2)/123) -(((Y+20).^2)/5053));
contour3(Z,100);
Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post | TrackBack URI for this post
New on WinAVR Tutorial
Running TX433 and RX433 RF modules with AVR microcontrollers,Sometimes in embedded design you may want to go wireless. Might be you will want to log various readi …Programming AVR ADC module with WinAVR,Most of AVR microcontrollers have Analog to Digital Converter (ADC) integrated in to chip. Such solut … |
New on WinARM Tutorial
What are differences between WinARM and WinAVR,Everyone who is working with AVR microcontrollers knows this powerful tool – WinAVR (http://win …LPC2000 watchdog timer,As in all microcontrollers watchdog timers purpose isto reset microcontroller after reasonable amount … |
