Você está na página 1de 5

Computational Intelligence Topic Leap Frog

Assignment #4
Presented to
Assistant. Professor .Dr.Tehseen Jeelani
Karachi University
Institute
of

Business

Management

1|Page
Adnan Alam Khan Std_18090@iobm.edu.pk

Computational Intelligence Topic Leap Frog


Leap frog : we will introduce two computational intelligence (CI) algorithms that are inspired by
some interesting behaviours exhibited by frogs (Wang et al.2008; Mills et al. 2010; Rock et al.
2009; Reilly and Jorgensen 2011). These two algorithms are called shuffled frog leaping
algorithm (SFLA) and frog calling algorithm (FCA), respectively.
Shuffled Frog Leaping Algorithm (SFLA) is a population-based cooperative search metaphor
combining the benefits of the genetic-based memetic algorithm (MA) and the social behaviour
based particle swarm optimization (PSO). Such algorithms have been developed to arrive at
near-optimum solutions to complex and large-scale optimization problems which cannot be
solved by gradient-based mathematical programming techniques.
There are various names of leap frog mainly velocity of variant, time reversible, variant of
variant etc. In mathematics leapfrog integration is a method for numerically integrating
differential equations of the form. Leapfrog is time reversible because of the symmetric way in
which it is defined, unlike the other schemes. Time reversibility is important because it
guarantees conservation of energy, angular momentum. Leapfrog is only second order, but very
stable. It's extremely useful for second-order DEs in which
d2x/dt2 = f(x),
e.g. SHM, N-body, etc.
Suppose x is position, so d2x/dt2 is acceleration.
Procedure: define v = dx/dt at the midpoints of the steps, i.e. velocities staggered wrt positions.
Strengths of LF:
There are two primary strengths to Leapfrog integration when applied to mechanics problems.
The first is the time reversibility of the Leapfrog method. One can integrate forward n steps, and
then reverse the direction of integration and integrate backwards n steps to arrive at the same
starting position. The second strength of Leapfrog integration is its symplectic nature, which
implies that it conserves the (slightly modified) energy of dynamical systems.
Application of Leap frog in SHM:
As we know its second order integration method for oscillatory motion types examples where
2
its time step is t which is constant whose range is t. The equation for updating position and
velocity are
Xi=Xi-1 + vi-1/2t,
ai=F(Xi)
Vi+1/2 = vi-1/2+ait
Where Xi is position at step i , vi-1/2 is the velocity, or first derivative of , at step i+1/2 ai=F(Xi), is
the acceleration, or second derivative of , at step and is the size of each time step. However,
even in this synchronized form, the time step t must be constant to maintain stability.

2|Page
Adnan Alam Khan Std_18090@iobm.edu.pk

Computational Intelligence Topic Leap Frog

Interpretation of some basic methods.


Algorithm :
In order to implement SFLA, the following procedures need to be followed (Eusuff and Lansey
2003; Eusuff et al. 2006; Eusuff 2004):
Step 0: Setting im = 0 and iN = 0, where the number of memeplexes will be counted by im, and
the number of evolutionary steps is recorded by iN.
Step 1: Setting im = im + 1.
Step 2: Setting iN = iN +1.
Step 3: Constructing a submemeplex. The weights are allocated based on a triangular probability
distribution which is defined by Eq. 10.1 (Eusuff and Lansey 2003):
2( + 1 )
=
, = 1,2,3 . ,
( + 1)
Step 4: Improving the worst frogs location. In SFLA, the new position can be computed through
Eq. 10.2 (Eusuff and Lansey 2003):
D(iq=q)=DW+d
If D(iq=q) falls within the feasible space, then computing the new performance value f(iq=q);
otherwise going to Step 5. If the new f(iq=q) is better than the previous f (iq=q), then replacing the
old D(iq=q) with the new one and jumping to Step 7; otherwise, going to Step 5.
Step 5: If previous step (i.e., Step 4) could not generate a better solution, then computing the
step and the new position for frog based on the present global optimal solution.
Step 6: Censorship. If the frogs new location is either unsuitable or no good than the old one,
the spread of defective meme is terminated by stochastically generating a new frog at a suitable
position to replace the frog whose new position was not possible to move towards an optimum
value.
Step 7: Upgrading the memeplex.
Step 8: If iN<N, returning to Step 2.
Step 9: If im<m, returning to Step 1; otherwise performing shuffling operation to create new
memeplex sets.
Mathematical proof:
As we know that y`(t+h)(y(t+2h)-y())/h
Decentralize it as follows
Yn+1 = y n-1 + 2hf(tn,yn)
Whereas m=2 i-e its linear, two step method
a0=0 ;a1=1; b-1=-1 ; b0=2 ; and b1 =0

3|Page
Adnan Alam Khan Std_18090@iobm.edu.pk

Computational Intelligence Topic Leap Frog


It uses slope evaluated of odd values of n to advance the value at point at even values of n
and vica verca. The method analyse two values y0 & Y1 are required to initialize the solution of
uniquely but analytical problem only provided one.
The Leap-frog scheme for ut = ux is obtained by approximating both derivatives with a centered
approximation, i.e., for = h/k,
vn+1 j = vn1 j + (vnj+1 vnj1)
(a)
The local truncation error for the Leap-frog scheme (a) is given by
kT n j = u (xj, tn+1)- [u (xj+1, tn) u (xj1, tn)] u (xj, tn1)

We can therefore conclude that the Leap-frog approximation is accurate of order.


Implementation in MATLAB:
% % Program to illustrate solution of Time Dependent Schrodinger
equation
% % using leapfrog algorithm
% % Initialise and set up initial waveform
clear;
N=1000;
x= linspace(0,1,N);
% Set up intial wavepacket;
x_0=0.4;
C=10;
sigma_squared=1e-3;
k_0=500;
% Discretisation parameters
delta_x=1e-3;
delta_t=5e-8;
%
% Generate an intial wavepacket
%
psi=C*exp(-(x-x_0).^2/sigma_squared).*exp(1i*k_0*x);
%
% % Extract the real and imaginary parts of the wavefunction
%
R_initial=real(psi);
I_initial=imag(psi);
% Build a potential cliff . Create a region with a cliff at x=0.6. To
the
% left, V=0, to the right, V=-1e6.
V= zeros(1, N);
V(600:N) =-1e6;

4|Page
Adnan Alam Khan Std_18090@iobm.edu.pk

Computational Intelligence Topic Leap Frog


% Initialise current real and imaginary parts of psi
I_current=I_initial;
R_current=R_initial;
% Initial run of Im(psi) to start off leapfrog process;
% t=t+delta_t/2;
[I_next] = imag_psi(N, I_current, R_current, delta_t, delta_x, V);
% % Do the leapfrog!!
%
for time_step = 1:15000;
% evaluate R at delta_t, 2*delta_t, 3*delta_t.......
% Time is incremented by t=t+delta_t/2 every call;
[R_next]=real_psi(N, R_current, I_current, delta_t, delta_x, V);
R_current=R_next;
% evaluate I at (3/2)*delta_t, (5/2)*delta_t............
% Time is incremented by t=t+delta_t/2 every call;
[I_next] = imag_psi(N, I_current, R_current, delta_t, delta_x, V);
% calculate psi*psi with R(t) and I(t+delta_t/2) and I(t-delta_t/2)
prob_density=R_current.^2+I_next.*I_current;
I_current=I_next;
% Visualise results with movie. Plot every 10 calculations for speed
if rem(time_step, 10)== 0;
plot(x, prob_density,'-b','LineWidth',2);
title('Reflection from cliff');
axis([0 1 0 200]);
xlabel('x');
ylabel('Probability density');
drawnow;
end;
end;

5|Page
Adnan Alam Khan Std_18090@iobm.edu.pk

Você também pode gostar