SlideShare a Scribd company logo
Optimization Project
Comparative study of Genetic Algorithm and
Particle Swarm Algorithm to optimize the cost
of production for a manufacturing firm
Problem Statement:
This is basically a cost optimization problem where a manufacturing firm has
entered into the contract to supply 50 refrigerators at the end of the first month,
50 at the end of the second month and 50 at the end of third. The cost of
producing x refrigerators in any month is given by $ (x2
+ 1000). The firm can
produce more number of refrigerators and can carry them to subsequent month.
It cost $20 per unit for any refrigerator to be carried from one month to the next
one.
Objective function:
Total Cost = Production Cost + Holding Cost
Let the number of refrigerators produced in first month = x1
Similarly the number produced in second month = x2
In third month = x3
Total cost = (x1
2
+ 1000) + (x2
2
+ 1000) + (x3
2
+ 1000) +20* (x1 - 50) + 20*(x1 + x2 -
100)
So the cost function becomes: x1
2
+ x2
2
+ x3
2
+ 40x1 + 20x2
Constraint Function:
 x1 -50 > = 0
 x1 + x2 -100 > = 0
 x1 + x2 + x3 -150 >=0
Aim of the Project:
The above problem has been taken up from book on Engineering Optimization by
Dr S.S. Rao.
The problem has been solved using two methodologies
 Classical Method
 Kuhn Tucker Method
 Non Classical method
 Genetic Algorithm
 Particle Swarm Algorithm
 Differential Evolution Algorithm
The solution of the problem obtained using the Kuhn Tucker condition was
x1= 50; x2 = 50; x3 = 50
The main purpose of our project is to compare the Non Classical methods.
Genetic Algorithm
MATLAB optimization toolbox was used to get the optimum value objective
function. For the purpose two .m files were made one containing the fitness
function and the other containing the constraint equations. Optimization toolbox
was used with the default initial population of 50. Comparison results are
presented using various selection methods which were covered in lecture class.
The functional evaluation during different generations is also presented here:
The optimized value of the cost function obtained was 10504.8 after using GA
where the classical method gave the value equal to 10500. By running several trial
with different initial population sizes the value improved and the optimum value
was more closer to 10500.
Particle Swarm Algorithm
The algorithm works on the principle of personal best and global best approach
and tries to capture the behavior of flocking birds in search of food. The algorithm
was coded to satisfy the constraints by modifying the existing code provided by Dr
Rajib Bhattacharya (Course Instructor: Optimization Methods). The code is given
below as:
clear all;
close all;
for p = 1:4
tm = cputime;
Generation f(x) constraint
1 1851.1 0
2 13441.6 0
3 10427.4 0
4 10498.7 0
5 10504.4 0
6 10504.8 0
numPart = 5; % number of particles
numVar =3; % Number of variables
fileName = 'objfunc';
w = 0.5; % Inertia weight
C1 = 2; % learning factor for local search
C2 = 2; % learning factor for local search
maxGen =500; % Maximum generation
lb = 50; % Lower bound of the variables
ub = 180; % Upper bound of the variables
X = lb + (ub-lb)*rand(numPart,numVar); % initialize X
V = lb + (ub-lb)*rand(numPart,numVar); % initialize V
for i=1:numPart
% f(i)=fitness(X(i,:));
f(i)=feval(fileName,X(i,:));
end
X = [V X f'];
Y = sortrows(X,2*numVar+1);
pbest = Y;
gbest = Y(1,:);
for gen=1:maxGen % generation loop
for part=1:numPart % Particle loop
for dim=1:numVar % Variable loop
V(part,dim)=w*V(part,dim)+C1*rand(1,1)*(pbest(part,numVar+dim)-
X(part,numVar+dim))+C2*rand(1,1)*(gbest(numVar+dim)-X(part,numVar+dim));
X(part,numVar+dim)=X(part,numVar+dim)+V(part,dim);
end
while(X(part,numVar + 1)< 0 || X(part,numVar + 2)< 0 || X(part,numVar
+ 3)<0 || X(part,numVar + 1) - 50 <= 0 || X(part,numVar + 1) + X(part,numVar
+ 2)-100 <= 0 || X(part,numVar + 1) + X(part,numVar + 2) + X(part,numVar +
3) -150 <=0)
for dim=1:numVar % Variable loop
V(part,dim)=w*V(part,dim)+C1*rand(1,1)*(pbest(part,numVar+dim)-
X(part,numVar+dim))+C2*rand(1,1)*(gbest(numVar+dim)-X(part,numVar+dim));
X(part,numVar+dim)=X(part,numVar+dim)+V(part,dim);
end
end
%
% fnew = fitness(X(part,numVar+1:numVar+dim));
fnew = feval(fileName,X(part,numVar+1:numVar+dim));
X(part,2*numVar+1)=fnew;
if (fnew<X(part,2*numVar+1))
pbest(part,:)=X(part,:);
end
end
Y = sortrows(X,2*numVar+1);
if (Y(1,2*numVar+1)<gbest(2*numVar+1))
gbest=Y(1,:);
end
first_var(gen) = gbest(4);
second_var(gen) = gbest(5);
third_var(gen) = gbest(6);
obj_value(gen,p) = gbest(7);
disp(['Generation ', num2str(gen)]);
disp(['Best Value ', num2str(gbest(numVar+1:2*numVar+1))]);
end
numPart = numPart + 15;
end
generations = 1:500;
% subplot(2,2,1)
% plot(generations,obj_value(:,1))
% hold on
% subplot(2,2,2)
% plot(generations,obj_value(:,2))
% hold on
% subplot(2,2,3)
% plot(generations,obj_value(:,3))
% hold on
% subplot(2,2,4)
% plot(generations,obj_value(:,4))
plot(generations,obj_value(:,1),'b',generations,obj_value(:,2),'g',generation
s,obj_value(:,3),'k',generations,obj_value(:,4),'r')
cpu_time = cputime-tm ;
The modified part has been highlighted above and based on the above code some
of the results were plotted which are shown as:
The graph shows how the values are evolved after each generation the code is
run. The constraints are always taken care of because of the highlighted
condition. The above suggests that the value are converged after 300 generations
and this being the major difference between Swarm Optimization and GA where
the values were getting converged quickly after the 6th
generation itself.
This figure shows the effect of number of particles in swarm optimization. It is
very clear that as the number of particles increase the value of the objective
function converges to the closer optimum value thereby improving the efficiency
of the algorithm. However the computational time also increases by increasing the
number of particles. Still the value of the objective function obtained using GA was
much better than the Swarm Optimization in this particular study.
The combined behavior can be seen as:
Differential Evolution Algorithm
The problem was solved using MS Excel and the results were obtained as:
X1 = 50.06253
X2 = 49.94802
X3 = 49.99007
Function value = 10524.4
Precision = 0.00001
However the important thing noted while solving the differential evolution
algorithm was that it took a lot of time for the algorithm to converge.
This completes the brief comparative study on variety of algorithms. To
summarize the discussions we can list few observations:
• In PSO the optimal solutions have converged after 300 generations & no. of
Particles = 50 whereas in Genetic Algorithm solutions converge after 6
iterations.
• In PSO greater is the particles no. greater is the precision obtained.
• As GA is inbuilt tool box it takes more time.

More Related Content

What's hot

Greedy Algorithms with examples' b-18298
Greedy Algorithms with examples'  b-18298Greedy Algorithms with examples'  b-18298
Greedy Algorithms with examples' b-18298
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Greedy method by Dr. B. J. Mohite
Greedy method by Dr. B. J. MohiteGreedy method by Dr. B. J. Mohite
Greedy method by Dr. B. J. Mohite
Zeal Education Society, Pune
 
Mathematical optimization and python
Mathematical optimization and pythonMathematical optimization and python
Mathematical optimization and python
Open-IT
 
Xmeasures - Accuracy evaluation of overlapping and multi-resolution clusterin...
Xmeasures - Accuracy evaluation of overlapping and multi-resolution clusterin...Xmeasures - Accuracy evaluation of overlapping and multi-resolution clusterin...
Xmeasures - Accuracy evaluation of overlapping and multi-resolution clusterin...
Artem Lutov
 
Chapter 2 Method in Java OOP
Chapter 2   Method in Java OOPChapter 2   Method in Java OOP
Chapter 2 Method in Java OOP
Khirulnizam Abd Rahman
 
Chapter 3 Arrays in Java
Chapter 3 Arrays in JavaChapter 3 Arrays in Java
Chapter 3 Arrays in Java
Khirulnizam Abd Rahman
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
Madhu Bala
 
Python programming –part 3
Python programming –part 3Python programming –part 3
Python programming –part 3
Megha V
 
Chapter 4 - Classes in Java
Chapter 4 - Classes in JavaChapter 4 - Classes in Java
Chapter 4 - Classes in Java
Khirulnizam Abd Rahman
 
Python programming- Part IV(Functions)
Python programming- Part IV(Functions)Python programming- Part IV(Functions)
Python programming- Part IV(Functions)
Megha V
 
Integration involving inverse trigonometric functions
Integration involving inverse trigonometric functionsIntegration involving inverse trigonometric functions
Integration involving inverse trigonometric functions
Durga Sadasivuni
 
Bloom filter
Bloom filterBloom filter
Bloom filter
wang ping
 
Functional programming principles
Functional programming principlesFunctional programming principles
Functional programming principles
Andrew Denisov
 
Accelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-LearnAccelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-Learn
Gilles Louppe
 
Programming Assignment Help
Programming Assignment HelpProgramming Assignment Help
Programming Assignment Help
Programming Homework Help
 
Greedy method1
Greedy method1Greedy method1
Greedy method1
Rajendran
 
Control System Homework Help
Control System Homework HelpControl System Homework Help
Control System Homework Help
Matlab Assignment Experts
 
4. functions
4. functions4. functions
4. functions
PhD Research Scholar
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
Rajendran
 
150970116028 2140705
150970116028 2140705150970116028 2140705
150970116028 2140705
Manoj Shahu
 

What's hot (20)

Greedy Algorithms with examples' b-18298
Greedy Algorithms with examples'  b-18298Greedy Algorithms with examples'  b-18298
Greedy Algorithms with examples' b-18298
 
Greedy method by Dr. B. J. Mohite
Greedy method by Dr. B. J. MohiteGreedy method by Dr. B. J. Mohite
Greedy method by Dr. B. J. Mohite
 
Mathematical optimization and python
Mathematical optimization and pythonMathematical optimization and python
Mathematical optimization and python
 
Xmeasures - Accuracy evaluation of overlapping and multi-resolution clusterin...
Xmeasures - Accuracy evaluation of overlapping and multi-resolution clusterin...Xmeasures - Accuracy evaluation of overlapping and multi-resolution clusterin...
Xmeasures - Accuracy evaluation of overlapping and multi-resolution clusterin...
 
Chapter 2 Method in Java OOP
Chapter 2   Method in Java OOPChapter 2   Method in Java OOP
Chapter 2 Method in Java OOP
 
Chapter 3 Arrays in Java
Chapter 3 Arrays in JavaChapter 3 Arrays in Java
Chapter 3 Arrays in Java
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
 
Python programming –part 3
Python programming –part 3Python programming –part 3
Python programming –part 3
 
Chapter 4 - Classes in Java
Chapter 4 - Classes in JavaChapter 4 - Classes in Java
Chapter 4 - Classes in Java
 
Python programming- Part IV(Functions)
Python programming- Part IV(Functions)Python programming- Part IV(Functions)
Python programming- Part IV(Functions)
 
Integration involving inverse trigonometric functions
Integration involving inverse trigonometric functionsIntegration involving inverse trigonometric functions
Integration involving inverse trigonometric functions
 
Bloom filter
Bloom filterBloom filter
Bloom filter
 
Functional programming principles
Functional programming principlesFunctional programming principles
Functional programming principles
 
Accelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-LearnAccelerating Random Forests in Scikit-Learn
Accelerating Random Forests in Scikit-Learn
 
Programming Assignment Help
Programming Assignment HelpProgramming Assignment Help
Programming Assignment Help
 
Greedy method1
Greedy method1Greedy method1
Greedy method1
 
Control System Homework Help
Control System Homework HelpControl System Homework Help
Control System Homework Help
 
4. functions
4. functions4. functions
4. functions
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
150970116028 2140705
150970116028 2140705150970116028 2140705
150970116028 2140705
 

Viewers also liked

Raportlunar 1
Raportlunar 1Raportlunar 1
Raportlunar 1
noi-sanse
 
1 вопрос.compressed
1 вопрос.compressed1 вопрос.compressed
1 вопрос.compressed
Ivan Davydov
 
Павел Рожков
Павел РожковПавел Рожков
Павел Рожков
Ivan Davydov
 
Powerpoint ingles paulanadyalaia
Powerpoint ingles paulanadyalaiaPowerpoint ingles paulanadyalaia
Powerpoint ingles paulanadyalaia
montseroquet
 
Unicef
UnicefUnicef
Unicef
montseroquet
 
Dream league marcos
Dream league marcosDream league marcos
Dream league marcos
montseroquet
 
подорож до міста звичайних дробів
подорож до міста звичайних  дробівподорож до міста звичайних  дробів
подорож до міста звичайних дробів
amatu16
 
Buletin 7
Buletin 7Buletin 7
Buletin 7
noi-sanse
 
Importance of Technology in Education
Importance of Technology in EducationImportance of Technology in Education
Importance of Technology in Education
Riza P. Abaño
 
Cheese
CheeseCheese
Cheese
montseroquet
 
1 q 2016-us-tile-industry-update
1 q 2016-us-tile-industry-update1 q 2016-us-tile-industry-update
1 q 2016-us-tile-industry-update
Cristiano Canotti
 
huruf
hurufhuruf
Destinos imperdíveis do Brasil
Destinos imperdíveis do BrasilDestinos imperdíveis do Brasil
Destinos imperdíveis do Brasil
Oi Brasil
 
Twitter
TwitterTwitter
Twitter
montseroquet
 
El banco de trujillo
El banco de trujilloEl banco de trujillo
El banco de trujillo
solmariaa
 
AGILENT INTERNSHIP PPT
AGILENT INTERNSHIP PPTAGILENT INTERNSHIP PPT
AGILENT INTERNSHIP PPTYasshpal singh
 
Babbel
BabbelBabbel
Babbel
montseroquet
 
Alba, mar and hatim
Alba, mar and hatimAlba, mar and hatim
Alba, mar and hatim
montseroquet
 

Viewers also liked (20)

Raportlunar 1
Raportlunar 1Raportlunar 1
Raportlunar 1
 
1 вопрос.compressed
1 вопрос.compressed1 вопрос.compressed
1 вопрос.compressed
 
Павел Рожков
Павел РожковПавел Рожков
Павел Рожков
 
Powerpoint ingles paulanadyalaia
Powerpoint ingles paulanadyalaiaPowerpoint ingles paulanadyalaia
Powerpoint ingles paulanadyalaia
 
IAB544 UK
IAB544 UKIAB544 UK
IAB544 UK
 
Unicef
UnicefUnicef
Unicef
 
Dream league marcos
Dream league marcosDream league marcos
Dream league marcos
 
подорож до міста звичайних дробів
подорож до міста звичайних  дробівподорож до міста звичайних  дробів
подорож до міста звичайних дробів
 
Buletin 7
Buletin 7Buletin 7
Buletin 7
 
Importance of Technology in Education
Importance of Technology in EducationImportance of Technology in Education
Importance of Technology in Education
 
Cheese
CheeseCheese
Cheese
 
1 q 2016-us-tile-industry-update
1 q 2016-us-tile-industry-update1 q 2016-us-tile-industry-update
1 q 2016-us-tile-industry-update
 
huruf
hurufhuruf
huruf
 
Destinos imperdíveis do Brasil
Destinos imperdíveis do BrasilDestinos imperdíveis do Brasil
Destinos imperdíveis do Brasil
 
Twitter
TwitterTwitter
Twitter
 
El banco de trujillo
El banco de trujilloEl banco de trujillo
El banco de trujillo
 
Khurram_Asghar 01
Khurram_Asghar 01Khurram_Asghar 01
Khurram_Asghar 01
 
AGILENT INTERNSHIP PPT
AGILENT INTERNSHIP PPTAGILENT INTERNSHIP PPT
AGILENT INTERNSHIP PPT
 
Babbel
BabbelBabbel
Babbel
 
Alba, mar and hatim
Alba, mar and hatimAlba, mar and hatim
Alba, mar and hatim
 

Similar to Optimization

Introduction to particle swarm optimization
Introduction to particle swarm optimizationIntroduction to particle swarm optimization
Introduction to particle swarm optimization
Mrinmoy Majumder
 
Ch 04
Ch 04Ch 04
Ch 04
Sou Tibon
 
ECONOMIC LOAD DISPATCH USING PARTICLE SWARM OPTIMIZATION
ECONOMIC LOAD DISPATCH USING PARTICLE SWARM OPTIMIZATIONECONOMIC LOAD DISPATCH USING PARTICLE SWARM OPTIMIZATION
ECONOMIC LOAD DISPATCH USING PARTICLE SWARM OPTIMIZATION
Mln Phaneendra
 
Unit-3 greedy method, Prim's algorithm, Kruskal's algorithm.pdf
Unit-3 greedy method, Prim's algorithm, Kruskal's algorithm.pdfUnit-3 greedy method, Prim's algorithm, Kruskal's algorithm.pdf
Unit-3 greedy method, Prim's algorithm, Kruskal's algorithm.pdf
yashodamb
 
Perspective in Informatics 3 - Assignment 2 - Answer Sheet
Perspective in Informatics 3 - Assignment 2 - Answer SheetPerspective in Informatics 3 - Assignment 2 - Answer Sheet
Perspective in Informatics 3 - Assignment 2 - Answer Sheet
Hoang Nguyen Phong
 
linear programming
linear programming linear programming
linear programming
DagnaygebawGoshme
 
Scientific calculator project in c language
Scientific calculator project in c languageScientific calculator project in c language
Scientific calculator project in c language
AMIT KUMAR
 
CH1.ppt
CH1.pptCH1.ppt
CH1.ppt
FathiShokry
 
PSO and Its application in Engineering
PSO and Its application in EngineeringPSO and Its application in Engineering
PSO and Its application in EngineeringPrince Jain
 
SBSI optimization tutorial
SBSI optimization tutorialSBSI optimization tutorial
SBSI optimization tutorial
Richard Adams
 
AMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptxAMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptx
bhavypatel2228
 
Unit.2. linear programming
Unit.2. linear programmingUnit.2. linear programming
Unit.2. linear programming
DagnaygebawGoshme
 
Operation research - Chapter 01
Operation research - Chapter 01Operation research - Chapter 01
Operation research - Chapter 01
2013901097
 
Ai_Project_report
Ai_Project_reportAi_Project_report
Ai_Project_reportRavi Gupta
 
LP linear programming (summary) (5s)
LP linear programming (summary) (5s)LP linear programming (summary) (5s)
LP linear programming (summary) (5s)
Dionísio Carmo-Neto
 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3rohassanie
 
Bt0080 fundamentals of algorithms1
Bt0080 fundamentals of algorithms1Bt0080 fundamentals of algorithms1
Bt0080 fundamentals of algorithms1
Techglyphs
 
Operations Research - Introduction
Operations Research - IntroductionOperations Research - Introduction
Operations Research - Introduction
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Programming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESProgramming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EES
Naveed Rehman
 

Similar to Optimization (20)

Introduction to particle swarm optimization
Introduction to particle swarm optimizationIntroduction to particle swarm optimization
Introduction to particle swarm optimization
 
Ch 04
Ch 04Ch 04
Ch 04
 
ECONOMIC LOAD DISPATCH USING PARTICLE SWARM OPTIMIZATION
ECONOMIC LOAD DISPATCH USING PARTICLE SWARM OPTIMIZATIONECONOMIC LOAD DISPATCH USING PARTICLE SWARM OPTIMIZATION
ECONOMIC LOAD DISPATCH USING PARTICLE SWARM OPTIMIZATION
 
Unit-3 greedy method, Prim's algorithm, Kruskal's algorithm.pdf
Unit-3 greedy method, Prim's algorithm, Kruskal's algorithm.pdfUnit-3 greedy method, Prim's algorithm, Kruskal's algorithm.pdf
Unit-3 greedy method, Prim's algorithm, Kruskal's algorithm.pdf
 
Perspective in Informatics 3 - Assignment 2 - Answer Sheet
Perspective in Informatics 3 - Assignment 2 - Answer SheetPerspective in Informatics 3 - Assignment 2 - Answer Sheet
Perspective in Informatics 3 - Assignment 2 - Answer Sheet
 
linear programming
linear programming linear programming
linear programming
 
Scientific calculator project in c language
Scientific calculator project in c languageScientific calculator project in c language
Scientific calculator project in c language
 
CH1.ppt
CH1.pptCH1.ppt
CH1.ppt
 
PSO and Its application in Engineering
PSO and Its application in EngineeringPSO and Its application in Engineering
PSO and Its application in Engineering
 
SBSI optimization tutorial
SBSI optimization tutorialSBSI optimization tutorial
SBSI optimization tutorial
 
AMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptxAMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptx
 
Unit.2. linear programming
Unit.2. linear programmingUnit.2. linear programming
Unit.2. linear programming
 
Operation research - Chapter 01
Operation research - Chapter 01Operation research - Chapter 01
Operation research - Chapter 01
 
Report Final
Report FinalReport Final
Report Final
 
Ai_Project_report
Ai_Project_reportAi_Project_report
Ai_Project_report
 
LP linear programming (summary) (5s)
LP linear programming (summary) (5s)LP linear programming (summary) (5s)
LP linear programming (summary) (5s)
 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3
 
Bt0080 fundamentals of algorithms1
Bt0080 fundamentals of algorithms1Bt0080 fundamentals of algorithms1
Bt0080 fundamentals of algorithms1
 
Operations Research - Introduction
Operations Research - IntroductionOperations Research - Introduction
Operations Research - Introduction
 
Programming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESProgramming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EES
 

More from Anshul Goyal, EIT

Resume_Goyal_Anshul_MS_Structural
Resume_Goyal_Anshul_MS_StructuralResume_Goyal_Anshul_MS_Structural
Resume_Goyal_Anshul_MS_StructuralAnshul Goyal, EIT
 
Transcript iit guwahati
Transcript iit guwahatiTranscript iit guwahati
Transcript iit guwahati
Anshul Goyal, EIT
 
Transcript UT Austin
Transcript UT AustinTranscript UT Austin
Transcript UT Austin
Anshul Goyal, EIT
 
Uncertainty quantification
Uncertainty quantificationUncertainty quantification
Uncertainty quantification
Anshul Goyal, EIT
 
Optimization
OptimizationOptimization
Optimization
Anshul Goyal, EIT
 

More from Anshul Goyal, EIT (9)

Resume_Goyal_Anshul_MS_Structural
Resume_Goyal_Anshul_MS_StructuralResume_Goyal_Anshul_MS_Structural
Resume_Goyal_Anshul_MS_Structural
 
Transcript iit guwahati
Transcript iit guwahatiTranscript iit guwahati
Transcript iit guwahati
 
Transcript UT Austin
Transcript UT AustinTranscript UT Austin
Transcript UT Austin
 
Uncertainty quantification
Uncertainty quantificationUncertainty quantification
Uncertainty quantification
 
Optimization
OptimizationOptimization
Optimization
 
Buckling_Carbon_nanotubes
Buckling_Carbon_nanotubesBuckling_Carbon_nanotubes
Buckling_Carbon_nanotubes
 
Modifed my_poster
Modifed my_posterModifed my_poster
Modifed my_poster
 
presentation_btp
presentation_btppresentation_btp
presentation_btp
 
thesis
thesisthesis
thesis
 

Recently uploaded

Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 

Recently uploaded (20)

Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 

Optimization

  • 1. Optimization Project Comparative study of Genetic Algorithm and Particle Swarm Algorithm to optimize the cost of production for a manufacturing firm
  • 2. Problem Statement: This is basically a cost optimization problem where a manufacturing firm has entered into the contract to supply 50 refrigerators at the end of the first month, 50 at the end of the second month and 50 at the end of third. The cost of producing x refrigerators in any month is given by $ (x2 + 1000). The firm can produce more number of refrigerators and can carry them to subsequent month. It cost $20 per unit for any refrigerator to be carried from one month to the next one. Objective function: Total Cost = Production Cost + Holding Cost Let the number of refrigerators produced in first month = x1 Similarly the number produced in second month = x2 In third month = x3 Total cost = (x1 2 + 1000) + (x2 2 + 1000) + (x3 2 + 1000) +20* (x1 - 50) + 20*(x1 + x2 - 100) So the cost function becomes: x1 2 + x2 2 + x3 2 + 40x1 + 20x2 Constraint Function:  x1 -50 > = 0  x1 + x2 -100 > = 0  x1 + x2 + x3 -150 >=0 Aim of the Project:
  • 3. The above problem has been taken up from book on Engineering Optimization by Dr S.S. Rao. The problem has been solved using two methodologies  Classical Method  Kuhn Tucker Method  Non Classical method  Genetic Algorithm  Particle Swarm Algorithm  Differential Evolution Algorithm The solution of the problem obtained using the Kuhn Tucker condition was x1= 50; x2 = 50; x3 = 50 The main purpose of our project is to compare the Non Classical methods. Genetic Algorithm MATLAB optimization toolbox was used to get the optimum value objective function. For the purpose two .m files were made one containing the fitness function and the other containing the constraint equations. Optimization toolbox was used with the default initial population of 50. Comparison results are presented using various selection methods which were covered in lecture class.
  • 4. The functional evaluation during different generations is also presented here: The optimized value of the cost function obtained was 10504.8 after using GA where the classical method gave the value equal to 10500. By running several trial with different initial population sizes the value improved and the optimum value was more closer to 10500. Particle Swarm Algorithm The algorithm works on the principle of personal best and global best approach and tries to capture the behavior of flocking birds in search of food. The algorithm was coded to satisfy the constraints by modifying the existing code provided by Dr Rajib Bhattacharya (Course Instructor: Optimization Methods). The code is given below as: clear all; close all; for p = 1:4 tm = cputime; Generation f(x) constraint 1 1851.1 0 2 13441.6 0 3 10427.4 0 4 10498.7 0 5 10504.4 0 6 10504.8 0
  • 5. numPart = 5; % number of particles numVar =3; % Number of variables fileName = 'objfunc'; w = 0.5; % Inertia weight C1 = 2; % learning factor for local search C2 = 2; % learning factor for local search maxGen =500; % Maximum generation lb = 50; % Lower bound of the variables ub = 180; % Upper bound of the variables X = lb + (ub-lb)*rand(numPart,numVar); % initialize X V = lb + (ub-lb)*rand(numPart,numVar); % initialize V for i=1:numPart % f(i)=fitness(X(i,:)); f(i)=feval(fileName,X(i,:)); end X = [V X f']; Y = sortrows(X,2*numVar+1); pbest = Y; gbest = Y(1,:); for gen=1:maxGen % generation loop for part=1:numPart % Particle loop for dim=1:numVar % Variable loop V(part,dim)=w*V(part,dim)+C1*rand(1,1)*(pbest(part,numVar+dim)- X(part,numVar+dim))+C2*rand(1,1)*(gbest(numVar+dim)-X(part,numVar+dim)); X(part,numVar+dim)=X(part,numVar+dim)+V(part,dim); end while(X(part,numVar + 1)< 0 || X(part,numVar + 2)< 0 || X(part,numVar + 3)<0 || X(part,numVar + 1) - 50 <= 0 || X(part,numVar + 1) + X(part,numVar + 2)-100 <= 0 || X(part,numVar + 1) + X(part,numVar + 2) + X(part,numVar + 3) -150 <=0) for dim=1:numVar % Variable loop V(part,dim)=w*V(part,dim)+C1*rand(1,1)*(pbest(part,numVar+dim)- X(part,numVar+dim))+C2*rand(1,1)*(gbest(numVar+dim)-X(part,numVar+dim)); X(part,numVar+dim)=X(part,numVar+dim)+V(part,dim); end end % % fnew = fitness(X(part,numVar+1:numVar+dim)); fnew = feval(fileName,X(part,numVar+1:numVar+dim)); X(part,2*numVar+1)=fnew; if (fnew<X(part,2*numVar+1)) pbest(part,:)=X(part,:); end end
  • 6. Y = sortrows(X,2*numVar+1); if (Y(1,2*numVar+1)<gbest(2*numVar+1)) gbest=Y(1,:); end first_var(gen) = gbest(4); second_var(gen) = gbest(5); third_var(gen) = gbest(6); obj_value(gen,p) = gbest(7); disp(['Generation ', num2str(gen)]); disp(['Best Value ', num2str(gbest(numVar+1:2*numVar+1))]); end numPart = numPart + 15; end generations = 1:500; % subplot(2,2,1) % plot(generations,obj_value(:,1)) % hold on % subplot(2,2,2) % plot(generations,obj_value(:,2)) % hold on % subplot(2,2,3) % plot(generations,obj_value(:,3)) % hold on % subplot(2,2,4) % plot(generations,obj_value(:,4)) plot(generations,obj_value(:,1),'b',generations,obj_value(:,2),'g',generation s,obj_value(:,3),'k',generations,obj_value(:,4),'r') cpu_time = cputime-tm ; The modified part has been highlighted above and based on the above code some of the results were plotted which are shown as:
  • 7. The graph shows how the values are evolved after each generation the code is run. The constraints are always taken care of because of the highlighted condition. The above suggests that the value are converged after 300 generations and this being the major difference between Swarm Optimization and GA where the values were getting converged quickly after the 6th generation itself.
  • 8. This figure shows the effect of number of particles in swarm optimization. It is very clear that as the number of particles increase the value of the objective function converges to the closer optimum value thereby improving the efficiency of the algorithm. However the computational time also increases by increasing the number of particles. Still the value of the objective function obtained using GA was much better than the Swarm Optimization in this particular study. The combined behavior can be seen as:
  • 9. Differential Evolution Algorithm The problem was solved using MS Excel and the results were obtained as: X1 = 50.06253 X2 = 49.94802 X3 = 49.99007 Function value = 10524.4 Precision = 0.00001 However the important thing noted while solving the differential evolution algorithm was that it took a lot of time for the algorithm to converge. This completes the brief comparative study on variety of algorithms. To summarize the discussions we can list few observations: • In PSO the optimal solutions have converged after 300 generations & no. of Particles = 50 whereas in Genetic Algorithm solutions converge after 6 iterations. • In PSO greater is the particles no. greater is the precision obtained. • As GA is inbuilt tool box it takes more time.