All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
What is the need of optimization? Process optimization is the discipline of adjusting a process so as to optimize (make the best or most effective use of) some specified set of parameters without violating some constraint. The most common goals are minimizing cost and maximizing throughput and/or efficiency.…
abhijeet dhillon
updated on 22 Nov 2019
What is the need of optimization?
Process optimization is the discipline of adjusting a process so as to optimize (make the best or most effective use of) some specified set of parameters without violating some constraint. The most common goals are minimizing cost and maximizing throughput and/or efficiency. This is one of the major quantitave tools in industrial decison making.
What is ga?
Genetic algorithm (GA) is a method for solving both constrained and unconstrained optimization problems based on a natural selection process that mimics biological evolution. The algorithm repeatedly modifies a population of individual solutions. At each step, the genetic algorithm randomly selects individuals from the current population and uses them as parents to produce the children for the next generation. Over successive generations, the population \"evolves\" toward an optimal solution.
You can apply the genetic algorithm to solve problems that are not well suited for standard optimization algorithms, including problems in which the objective function is discontinuous, nondifferentiable, stochastic, or highly nonlinear.
Following is a code which will give an idea regarding optmization:
close all
clc
%Defining our search space
x=linspace(0,0.6,150);
y=linspace(0,0.6,150);
%creating a 2Dmensional mesh
[xx yy]=meshgrid(x,y);
%Evaluating the stalagmite function;
for i=1:length(xx)
for j=1:length(yy)
input_vector(1)=xx(i,j);
input_vector(2)=yy(i,j);
f(i,j)=stalagmite(input_vector);
end
end
surfc(xx,yy,f)
xlabel(\'x value\')
ylabel(\'y value\')
shading interp
[inputs,fval]=ga(@stalagmite,2);
study2
for i=1:num_cases
[inputs,fopt(i)]=ga(@stalagmite,2,[],[],[],[],[0:0],[1:1]);
xopt(i)=inputs(1);
yopt(i)=inputs(2);
end
figure(2)
subplot(2,1,2)
hold on
surf(x,y,f)
shading interp
plot3(xopt,yopt,fopt,\'marker\',\'o\',\'markerfacecolor\',\'r\')
title(\'bounded input\')
subplot(2,1,2)
plot(fopt)
xlabel(\'iterations\')
ylabel(\'function minimum\')
study3
for i=1:num_cases
[inputs,fopt(i)]=ga(@stalagmite,2,[],[],[],[],[0:0],[1:1]);
xopt(i)=inputs(1);
yopt(i)=inputs(2);
end
figure(3)
subplot(2,1,2)
hold on
surf(x,y,f)
shading interp
plot3(xopt,yopt,fopt,\'marker\',\'o\',\'markersize\',\'5\',\'markerfacecolor\'\'r\')
title(\'bounded input with more iter\')
subplot(2,1,2)
plot(fopt)
xlabel(\'iterations\')
ylabel(\'function minimum\')
EXPLANATION OF THE CODE
In the beginning we have created one dimensional arrays using linspace in x and y respectively with 150 values ranging from 0 to 0.6.
Since the given function is in two variables and will require two variables on the graph we have used meshgrid command to create 2D arrays.
After that we have defined the stalagamite function which is dependent on the values of the 2D arrays.The function is :
function [f] = stalagmite(input_vector)
a=input_vector(1);
b=input_vector(2);
f1x =(sin(5.1*pi*a+0.5))^6;
f1y=(sin(5.1*pi*b+0.5))^6;
f2x=exp((-4*ln(2)*n(a-0.0667)^2/0.64);
f2y=exp((-4*ln(2)*(b-0.0667)^2/0.64);
f=-(f1x*f1y*f2x*f2y);
end
In study 1 we are plotting the global maxima and global minima which is tha maximum value and minmum value of the function for a particular value of x and y points.The following is the result:
STUDY 2
In the below graph we can see that three points have maximum value .GA algorithms runs the code by choosing random values,so by running the code several times we can run arrive the optimal solution. In the subplot we can see the solution is optimized but having more than one maxima
STUDY 3
In the below plot we have arrive to a optimized solution having only two maximum values having by increasing the iterationcount with the upper and lower bound values .Also from the subplot we can observe that the solution is giving with more iterations.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week 2 Air standard Cycle
Aim : Your code should create a PV diagram Your should output the thermal efficiency of the engine. Solution : The code for the PV diagram is as follows : import math import matplotlib.pyplot as plt #inputs p1=101325 t1=500 gamma=1.4 t3=2300 #Geometric dimensions : bore=0.1 stroke=0.1 con_rod=0.15…
18 Jun 2022 12:07 PM IST
Bird Strike - Project - 2
Aim : The final submission must include the input file, animation, and a report. - Since this is a quite difficult and involved project, students are advised to log their debugging process and include it in the report. The log is a description of the solution process and challenges encountered along the way. …
17 Apr 2022 05:21 AM IST
Week 1 Understanding Different Battery Chemistry
Aim : 1.Prepare a table which includes materials & chemical reactions occurring at the anode and cathode of LCO, LMO, NCA, NMC, LFP and LTO type of lithium ion cells.Give your detailed explanation on it 2.Compare the differences between each type of Li+ion batteries based on their characteristics Solution :…
08 Mar 2022 03:21 PM IST
Week - 10 Hyperelastic Material Models
Aim : Given the material data below, calculate the Mooney Rivlin and Ogden material constants and compare the both using stress-strain data from a Dogbone specimen tensile test with 100 percent strain. The given data is the engineering stress-strain in MPa/(mm/mm). The comparison should be shown from the d3hsp file and…
27 Feb 2022 05:08 AM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.