All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Introduction: Local maximum and minimum : Functions can have\"hills and valleys\":places where they reach a minimum or maximum values. It may not be the minimum or maximum for the whole function, but locally it is. Local Maximum: First we need to choose an interval, Then we can say that a local maximum is…
Muhammad MujahidAli Tadikala
updated on 01 Jan 2020
Introduction:
Local maximum and minimum :
Functions can have\"hills and valleys\":places where they reach a minimum or maximum values.
It may not be the minimum or maximum for the whole function, but locally it is.
Local Maximum:
First we need to choose an interval,
Then we can say that a local maximum is the point where:
The height of the function at \"a\" is greater than (or equal to) the height anywhere else in that interval.
Or, more briefly:
f(a) ≥ f(x) for all x in the interval
In other words, there is no height greater than f(a).
Note: f(a) should be inside the interval, not at one end or the other.
Local Minimum:-
Likewise, a local minimum is:
f(a) ≤ f(x) for all x in the interval
The plural of Maximum is Maxima
The plural of Minimum is Minima
Maxima and Minima are collectively called Extrema
Global (or Absolute)Maximum and Minimum :
The maximum or minimum over the entire function is called an \"Absolute\" or \"Global\" maximum or minimum.
There is only one global maximum (and one global minimum) but there can be more than one local maximum or minimum.
A Genetic algorithm is a method of solving optimization problems based upon the evaluation theory that was proposed by charles Darwin.
Matlab provides inbuilt functions that helps us to do quit comfortablly.
Writing a program for genetic algorithm to find gloabl maxima codes is given below by using Matlab:
clear all
close all
clc
%.........Step:1..........
%Defining one dimensional array.
x=linspace(0,0.6,150);
y=linspace(0,0.6,150);
%number of iterations
num_iterations = 100;
[xx, yy] = meshgrid(x,y);
%..........Step:2..........
%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)
shading interp
%..........Step:3..........
tic
%study 1 - statistical behaviour
for i=1:num_iterations
[inputs,fopt(i)] = ga(@stalagmite, 2);
xopt(i) = inputs(1);
yopt(i) = inputs(2);
end
study1_time = toc;
figure(1)
subplot(2,1,1)
hold on
surfc(x,y,-f)
shading interp
plot3(xopt,yopt,-fopt,\'marker\',\'o\',\'markersize\',5,\'markerfacecolor\',\'r\')
title(\'unbounded inputs\')
subplot(2,1,2)
plot(-fopt)
axis([0 100 0.4 0.6])
xlabel(\'iterations\')
ylabel(\'function minimum\')
%..........Step:4..........
tic
%study 2 - statistical behaviour - with upper and lower bounds
for i=1:num_iterations
[inputs,fopt(1)] = ga(@stalagmite,2,[],[],[],[],[0;0],[1;1]);
xopt(i) = inputs(1);
yopt(i) = inputs(2);
end
study2_time = toc;
figure(2)
subplot(2,1,1)
hold on
surfc(x,y,-f)
shading interp
plot3(xopt,yopt,-fopt,\'marker\',\'o\',\'markersize\',5,\'markerfacecolor\',\'r\')
title(\'bounded inputs\')
subplot(2,1,2)
plot(-fopt)
xlabel(\'iterations\')
ylabel(\'function minimum\')
%..........Step:5..........
%study 3 increasing GA iterations
options = optimoptions(\'ga\');
options = optimoptions(options,\'populationsize\',170);
tic
for i=1:num_iterations
[inputs,fopt(i)] = ga(@stalagmite,2,[],[],[],[],[0;0],[1;1],[],[],options);
xopt(i) = inputs(1);
yopt(i) = inputs(2);
end
study3_time = toc;
figure(3)
subplot(2,1,1)
hold on
surfc(x,y,-f)
shading interp
plot3(xopt,yopt,-fopt,\'marker\',\'o\',\'markersize\',5,\'markerfacecolor\',\'r\')
title(\'Bounded inputs with modified population size\')
subplot(2,1,2)
plot(-fopt)
xlabel(\'iterations\')
ylabel(\'Function minimum\')
Step:1
Creating one dimensional array\'s x and y.Based on this one-dimensional arrays.creating two-dimesnional array.
To create one dimensional array\'s here we are using command called linspace.
To create our two dimensional array\'s here we are using command called meshgrid.
Step:2
Evaluating the stalagmite function.
Each value of x&y basically creating an array as input vector.Now the input vector actually a row vector meaning it as two columns
Step:3
in this we are going to see the statistical behaviour of stalagmite function.
Mathematical model that actually helps us to generate the local minima and maximas.
Step:4
in this we are going to see the statistical behaviour of upper & lower bounds.
here we are using function called ga it is used to minimum the function using genetic algorithm.
[inputs, fopt(1)] = ga(@stalagmite,2,[],[],[],[],[0;0],[1;1])
stalagmite - fitnessfcn.
2-nvars,positive integer representing the number of variables in the problem.
[] - A,matrix for linear inequality constraints of the form.
[] - B,vector for linear inequality constraints of the form.
[] - Aeq,Matrix for linear equality constraints of the form.
[] - Beq,vector for linear equality constraints of the form.
[0;0] - vector of lower bounds.
[1,1] - vector of upper bounds.
Step:5
In this we will see the raise in the genetic algorithm iterations.
For that, We here are going to use new command called optimoptions it creates optimisation options specified as the output of optimoptions
Code for Solving the Stalagmite Function:
function [S] = stalagmite(input_vector)
a = input_vector(1);
b = input_vector(2);
f1 = (sin(5.1*pi*a+0.5))^6;
f2 = (sin(5.1*pi*b+0.5))^6;
f3 = exp(-4*log(2)*(a-0.0667)^2/0.64);
f4 = exp(-4*log(2)*(b-0.0667)^2/0.64);
S = -(f1*f2*f3*f4);
end
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...
case study on CI Engine Calibration using GT Power Understanding the SI and CI Engine Results
let us Compare SI vs CI Engines : Both the concepts relay on internal combustion engine. Pictorial Representation GT-SUITE : Detailed (SI Engine Vs CI Engine 1D Model) A model of a SI and CI engine running at 3600 and 1800rpm is given below. Air is allowed to enter through the inlet and moves along the runner…
02 May 2020 01:42 AM IST
Adding Advanced Features to the Basic Engine
22 Apr 2020 12:38 AM IST
Case Study on Calibration of Basic Single Cylinder SI Engine Using GT-Power
Assignment 2: Case study to Increase the power output at 3600 rpm by 10% IC Engine Calibration Using GT-Power for Basic Single Cylinder Engine (SI)-Spark Ignition : Introduction: Requirements: GT-ISE we need basic template to model the 1Cyl-SI engine 4 Stroke. They are - Inlet Environment/End…
14 Apr 2020 01:51 AM IST
Basic Understanding of GT Power
Q1. Explore the GUI of GT-SUITE and list down modules available with brief description. GT-SUITE: GT-Suite is a leading simulation tool with capabilities and integrated libraries, used to process any advance concepts. Overview of GT-SUITE Applications: GT-Suite is an advanced and multipurpose platform with many inbuild…
14 Apr 2020 01:46 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.