i need Matlab Code (PSO) particale swarm optimization for Optimal location and sizing of DG IEEE 33 Bus System?
% PSO : Particle Swarm Optimization (VECTORIZED)
% particle swarm optimization (PSO) is a computational method
that
% optimizes a problem by iteratively trying to improve a
candidate
% solution with regard to a given measure of quality. PSO
optimizes
% a problem by having a population of candidate solutions, here
dubbed
% particles, and moving these particles around in the
search-space
% according to simple mathematical formulae over the particle's
position
% and velocity. Each particle's movement is influenced by its local
best
% known position but, is also guided toward the best known
positions
% in the search-space, which are updated as better positions are
found
% by other particles. This is expected to move the swarm toward the
best solutions.
%
% this function is written as a simple example of PSO
% in order to optimiza other functions you have to change the
objective
% function.
%
% to increase the efficieny of the PSO this version is a vectorized
version
% for MATLAB.
%
% -----------------------------------
% code: REZA AHMADZADEH (based on the original code by Wesam
Elshamy)
% ([email protected])
% -----------------------------------
clc;clear all;close all;
%% initialization
%
swarm_size = 64; % number of the swarm particles
maxIter = 50; % maximum number of iterations
inertia = 1.0;
correction_factor = 2.0;
% set the position of the initial swarm
a = 1:8;
[X,Y] = meshgrid(a,a);
C = cat(2,X',Y');
D = reshape(C,[],2);
swarm(1:swarm_size,1,1:2) = D; % set the position of the particles
in 2D
swarm(:,2,:) = 0; % set initial velocity for particles
swarm(:,4,1) = 1000; % set the best value so far
plotObjFcn = 1; % set to zero if you do not need a final plot
%% define the objective funcion here (vectorized form)
objfcn = @(x)(x(:,1) - 20).^2 + (x(:,2) - 25).^2;
tic;
%% The main loop of PSO
for iter = 1:maxIter
swarm(:, 1, 1) = swarm(:, 1, 1) + swarm(:, 2, 1)/1.3; %update x
position with the velocity
swarm(:, 1, 2) = swarm(:, 1, 2) + swarm(:, 2, 2)/1.3; %update y
position with the velocity
x = swarm(:, 1, 1); % get the updated position
y = swarm(:, 1, 2); % updated position
fval = objfcn([x y]); % evaluate the function using the position of
the particle
% compare the function values to find the best ones
for ii = 1:swarm_size
if fval(ii,1) < swarm(ii,4,1)
swarm(ii, 3, 1) = swarm(ii, 1, 1); % update best x position,
swarm(ii, 3, 2) = swarm(ii, 1, 2); % update best y postions
swarm(ii, 4, 1) = fval(ii,1); % update the best value so far
end
end
[~, gbest] = min(swarm(:, 4, 1)); % find the best function value in
total
% update the velocity of the particles
swarm(:, 2, 1) = inertia*(rand(swarm_size,1).*swarm(:, 2, 1)) +
correction_factor*(rand(swarm_size,1).*(swarm(:, 3, 1) ...
- swarm(:, 1, 1))) +
correction_factor*(rand(swarm_size,1).*(swarm(gbest, 3, 1) -
swarm(:, 1, 1))); %x velocity component
swarm(:, 2, 2) = inertia*(rand(swarm_size,1).*swarm(:, 2, 2)) +
correction_factor*(rand(swarm_size,1).*(swarm(:, 3, 2) ...
- swarm(:, 1, 2))) +
correction_factor*(rand(swarm_size,1).*(swarm(gbest, 3, 2) -
swarm(:, 1, 2))); %y velocity component
% plot the particles
clf;plot(swarm(:, 1, 1), swarm(:, 1, 2), 'bx'); % drawing swarm
movements
axis([-2 40 -2 40]);
pause(.1); % un-comment this line to decrease the animation
speed
disp(['iteration: ' num2str(iter)]);
end
toc
%% plot the function
if plotObjFcn
ub = 40;
lb = 0;
npoints = 1000;
x = (ub-lb) .* rand(npoints,2) + lb;
for ii = 1:npoints
f = objfcn([x(ii,1) x(ii,2)]);
plot3(x(ii,1),x(ii,2),f,'.r');hold on
end
plot3(swarm(1,3,1),swarm(1,3,2),swarm(1,4,1),'xb','linewidth',5,'Markersize',5);grid
end
if there any doubts please check it in youtube below mwntioned link
https://youtu.be/NL-R_qw2qbY
I need Matlab Code (PSO) particale swarm optimization for Optimal location and sizing of DG IEEE ...
I'm using MatLab and was told to implement Swallow swarm optimization (PSO) or Gravitational search Algorithm (GSA), for a problem of engineering in materials. It can be fluid flow, casting, rolling, etc. Something simple but well explained please.
i need matlab code for pareto ant colony optimization 3. Pareto Ant Colony Optimization In the initialization phase, ants are genera x = (0,...,0). The lifespan and the obj erences) p = (P1, ..., PK) are determined we do not explicitly mention the domain ra from the domain (0, 1). In the construction phase of the algo
I need to Solve ac optimal power flow in matlab code using gradient technique
they need matlab code please help i need the code i need picture for the graph i need it as soon as possible
I need a working MATLAB CODE for GAUSS SEIDEL ITERATIVE SCHEME the matlab code must compare with actual value and break if this condition is not met i will dislike think before answering a correct working matlab code must be given or else i will dislike badly
I need the Matlab code and the Solution to the problem.
Use matlab Need the matlab code Problem 3: (a) Use Fourier transform to find i(t) in the circuit below if v.( 10e2tu(t). Use MATLAB to solve your problem. (b) Plot the magnitude and phase spectrum of the current I(o). 2Ω 3 20 1 H Submit the solution in word file. The used MATLAB code should be included Due date: last day of classes
MATLAB I need the input code and the output. Thanks. 7. Modify the Euler's method MATLAB code presented in the Learning activity video called Using Euler's Method on Matlab (located in the Blackboard Modue#10:: Nomerical Solution to ODE: part 1) to plot and compare the approximate solution using the modified Euler method, for a step size of 0.1 and 0.01
Note: I need matlab code and it must be on first entry, output what the question needs and i need it without any false in the matlab pls program logic: • Find the index of minimum element with min() function. Make sure to take two outputs while using min(), the second output is the location of the minimum element. • replace the element at minimum index with mean(v) • find sum(v) and assign it to output program: function x =...
i need the code on matlab or octave for ploting this function in the interval [0,3] i also need a copy of the graph x2-2x + 1 f(x) = 2