Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Single-Agent Finite Impulse Response Optimizer for solving constrained optimization problems. To validate the performance of this SAFIRO algorithm, we use a benchmark problem namely constrained

Single-Agent Finite Impulse Response Optimizer for solving constrained optimization problems. To validate the performance of this SAFIRO algorithm, we use a benchmark problem namely constrained box volume optimization problem.

hi , I've done matlab coding related to this topic the coding is below but it have some error , please figure out how to correct the error in the coding so that the graph will come out perfectly , thank you

clc clear all close all

nVar = 3; % number of variables VarMin = [0 0 0]; % lower bound of variable VarMax = [20 20 20]; % upper bound of varible

MaxIter =100; % max number of iterations nPop = 100; % population size w = 1; % inertia d = 0.99; % damping ratio of the inertia c1 = 3; % acceleration 1 c2 = 3; % acceleration 2

x0.position = []; x0.velocity = []; x0.fitness = []; x0.best.position =[]; x0.best.fitness =[]; x = repmat(x0,nPop,1); % Make a population x_best.fitness = -inf; % Generate initial population for i = 1: nPop % generate random solutions for k = 1:nVar x(i).position(k) = unifrnd(VarMin(k),VarMax(k)); end x(i).velocity = zeros([1 nVar]); % initial velocity x(i).fitness = objective_function(x(i).position); x(i).best.position = x(i).position; % update the local best x(i).best.fitness = x(i).fitness; % update the local best if x(i).best fitness> x_best.fitness x_best= x(i).best end B=zeros (MaxIter ,1); C=zeros (MaxIter ,nVar); for j =1:MaxIter for i=1: npop x(i).velocity = w*x(i).velocity + (1*rand ([1 nVar]).*(x(i).best.position - x(i).position)...+ (2*rand ([1 nVar]).(x_best.position - x(i).position); x(i.position = (x(i).position + x(i).velocity); for k = 1:nVar if x(i).position (k) < Varmin (k) x(i).position (k) = Varmin (k); end if x(i).position (k) > Varmin (k) x(i).position (k) = Varmin (k) end end x(i).fitness = objective_function (x(i).position); if x(i).fitness > x(i).best.fitness x(i).best.position > x(i).position; x(i).best.fitness > x(i).fitness; if x(i).fitness > x(i)x_best.fitness x_best = x(i).best; end end end w = w*d; B(j) = x_best.fitness; C(j,:) = x.best.position; disp (['Iteration 'num2str(j)';Best fitness = 'num2str (B(j))' ; optimal solution (L,W,H)= 'num2str (C(j,:)])); plot (B(1:j,1),'r');drawnow end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

Write an elaborate note on marketing environment.

Answered: 1 week ago

Question

Question What is the doughnut hole in HSA coverage?

Answered: 1 week ago