Optimization Google Book
Optimization Google Book
8. Optimization
Hechninues
and Applications)
Anup goel
Technical Publications
NUMERICAL METHODS & OPTIMIZATION
All publishing rights (printed and ebook version) reserved with Technical Publications. No part of this book
should be reproduced in any form, Electronic, Mechanical, Photocopy or any information storage and
retrieval system without prior permission in writing, from Technical Publications, Pune.
Published by :
a) TECHNICA ®) Amit Residency, Office No.1, 412, Shaniwar Peth, Pune - 411030, M.S. INDIA
Z Ph.: +91-020-24495496/97, Email : [email protected]
«KK
(Nl
O7 89333221788
(i)
SYLLABUS
Unit - I : Roots of Equation and Error Approximations
Roots of Equation
Error Approximations
Types of Errors: Absolute, Relative, Algorithmic, Truncation, Round off Error, Error Propagation,
Concept of convergence-relevance to numerical methods. (Chapters-2, 3)
Modern Optimization Techniques: Genetic Algorithm (GA), Simulated Annealing (SA). (Chapter-s)
Introduction to finite difference method, Simple Laplace method, PDEs- Parabolic explicit solution,
Elliptic explicit solution. (Chapters-6, 7)
Regression Analysis
Introduction to multi regression analysis, Lagrange’s Interpolation, Newton's Forward interpolation,
Inverse interpolation (Lagrange’s method only). (Chapters-s, 9)
Double Integration
Trapezoidal rule, Simpson's 1/3" Rule (Chapter-10)
(iv)
TABLE OF CONTENTS
Chapter-0 Introduction to Numerical 2.1.1 Algebraic and Transcendental Equations. . . 2 - 2
Methods (0 - 1) to (0 - 4)
2.2 Types of Root... 2... eee eee 2-3
0.1 Introduction .. 0.0.0... eee eee 0-2 2.3 Methods to Obtain the Root of Equation ....... 2-3
0.2 Procedure of Numerical Techniques .......... 0-2 2.4 Bisection Method or Half Interval Method ..... 2-4
0.3 Purpose to Study Numerical Methods ......... 0-2 2.5 Solved Examples ...............022-000005 2-6
0.4 Fields of Applications of Numerical Methods... 0-2 2.6 Newton-Raphson Method.................- 2-23
0.5 Types of Numerical Methods................ 0-4 2.6.1 Convergence and Divergence in
Newton-Raphson Method............. 2-23
Chapter-1 Introduction to MATLAB 2.7 Solved Examples 2.2... 00.00.00
cece eee 2-24
(1 - 1) to (1 - 30)
2.8 Successive Approximation Method .......... 2-48
1.1 Introduction to MATLAB .................. 1-2
2.8.1 Convergence and Divergence in Successive
1.2 The MATLAB System......... 000000000008 1-2 Approximation Method. ..............- 2-49
1.3 MATLAB Window. .......0..0.00 00000. e eee 1-3 2.9 Solved Examples ......... 0000.00 eee eee 2-49
1.4 Various Commands used in Command Window. | - 4 2.10 Engineering Applications based Examples ... 2 - 59
1.5 Matrices in MATLAB .................22-- 1-8 2.11 University Questions with Answers......... 2-66
1.12.2 Linsolve . 0... 00.0. cee eee eee 1-29 3.3.3.2 Absolute Error in Multiplication and
Division ................2..-0000- 3-4
3.4.1 Error Propagation in Arithmetic Operations 5.7.1 Constructing Linear Programming Model . . 5 - 6
5.7.2 Methods to Solve LP Problems .......... 5-6
3.5 Concept of Convergence for Iterative Methods . . 3 - 7
5.8 Graphical Method... 0.2.0.0... 0.000. 5-7
3.6 Solved Examples
5.8.1 Terminology of Graphical Method for LP... 5 - 7
3.7 University Questions with Answers .........3-16
5.9 Steps in Graphical Method of LP............. 5-7
4.6 Gauss Elimination Method ................-- 4-6 5.15.1 Simulated Annealing (SA)............ 5-59
4.7 Solved Examples............00 000002 eeee 4-7 5.15.2 Genetic Algorithm (GA) ............. 5- 60
6.12 Runge-Kutta Fourth Order Method ......... 6-40 8.6 Solved Examples 0.0.2.0...
00000 cece eee 8-14
6.13 Solved Examples ............2..00-02005 6-43 8.7 Fitting a Power Equation ................-. 8-21
6.14 University Questions with Answers......... 6-67 8.8 Fitting a Curve of the Form y=ab*.......... 8-21
10.9 Solved Examples ......0... 000000 e eee eee 10-31 10.14 Simpson's (1/3) Rule ............005- 10 - 64
10.10 Gauss-Legendre Quadrature Methods ..... 10-38 10.15 Solved Examples ..............22..04. 10 - 66
10.11 Solved Examples 10.16 University Questions with Answers....... 10 - 80
[Gauss-Legendre Two Point Formula] .... . 10-41
Optimization
Syllabus Terminology of Linear
: 5-4
5.6
Programming
Introduction to optimization, Classification, Constrained
optimization (maximum two constrains): Graphical and
Simplex method, One Dimensional unconstrained
optimization: Newton's Method. Three Stages of a Linear
5.7 5-5
Programming Problem
Modern Optimization Techniques: Genetic Algorithm
(GA), Simulated Annealing (SA).
5.8 Graphical Method 5-7
May-15, Marks 4
Contents Steps in Graphical Method of LP 5-7
5.1 Introduction 5-2 Solved Examples 5-8
yl G eee
Simplex Method 5 - 20
Engineering Applications of
Solved Examples 5-22
9-2 Optimization 3-2
yay el ese Ele ers One-Dimensional Unconstrained
Optimization 9-54
Classification of Optimization
5.3 5-2 Solved Examples 5-54
Problems
(5
- 1)
Numerical Methods and Optimization Optimization
¢ Optimization is the act to obtain the best result under certain given conditions.
« The ultimate goal of any design, construction or maintenance of any engineering system is to either minimize
the effort required or to maximize the desired benefit.
e This can be expressed as a function of certain decision variables.
¢ Optimization can be defined as the process of finding the conditions that give the maximum or minimum value
of a function.
f(x)
e From Fig. 5.1, it can be seen that if a point x' is
the minimum value of function f(x), then the f(x)
same point also has the maximum value of the
negative of the function, — f(x).
¢ Thus, optimization can be taken to mean
Tx! Minimum of [f(x)]
minimization without the loss of generality, since t x
the maximum of a function can be found by 0 xT
_- 4% Maximum of [= f(x)]
seeking the minimum of negative of the same
function.
* Aircraft and aerospace structures have to be designed in such a way that the aircraft has minimum weight.
¢ Several civil engineering structures such as frames, bridges, foundations, towers, etc. have to build with
maximum strength and minimum cost.
¢ In metal-cutting processes, several machining conditions have to be selected for minimum production cost.
e Design of pumps, turbines and heat transfer equipment for maximum efficiency.
¢ Planning the best strategy to obtain maximum profit in the presence of a competitor.
¢ Optimization problems can be classified on the basis of various criteria such as type of constraints, design
variables, structure of problem, type of equations involved, etc.
Numerical Methods and Optimization Optimization
¢ The problems that are subjected to one or more constraints known as constrained optimization problems.
For example :
3x) + X9 < 21
Xj, Xo 20
ii) Unconstrained optimization : Iv
e The problems that do not involve any constraints are known as unconstrained optimization problems.
For example :
e It includes the problems in which it is required to find the values of a set of design parameters that make
some prescribed function of these parameters subjected to minimum constraints.
ii) Trajectory or dynamic optimization problem
e It includes the problems in which it is required to find the values of a set of design parameters that are all
continuous functions of other parameter. This minimizes an objective function subjected to set of
constraints.
e If any one of the functions among the objective and constraint functions is non-linear, then the problem is
known as non-linear programming (NLP) problem.
ii) Linear programming problem
elf the objective function and all the constraints are linear functions of the design variables, then the
mathematical programming problem is known as linear programming (LP) problem.
iii) Quadratic programming problem
e It is a non-linear programming problem with quadratic objective function and linear constraints.
Numerical Methods and Optimization 5-4 Optimization
e If all the design variables of an optimization problem are permitted to take any real value, then the problem
is called as real-valued programming problem.
e It is already discussed that, the problems that are subjected to one or more constraints known as constrained
optimization.
¢ The equation of constraints can be linear or non-linear.
e In this chapter we will mainly concentrate on linear programming (LP) problems or linear constraints.
¢ The linear programming problems can be solved by either graphical method or simplex method.
¢ The resources to run a company are never available in unlimited quantities. There is always a restriction.
« Each resource like money, material, labour, equipment, etc. is available in specific limit.
¢ The main problem faced by the management is to decide the manner in which these limited resources should to
used.
¢ These limited resources are properly used to achieve the desired objective i.e. profit maximization or cost
minimization.
« Linear programming technique helps the management in decision making process.
¢ It is one of the most popular techniques of operation research.
¢ I¢ is mathematical technique for alloting limited resources of a firm in an optimum manner.
« This technique is used in almost every functional area of business production, finance, marketing, etc. type of
industry.
e The essential requirements of the variables is that they should be inter-related in terms of consumption of
resources and their relation should be linear.
Numerical Methods and Optimization 5-5 Optimization
e The decision variable must be either zero or positive but never negative. If 'x' and 'y' are the decision
variables then,
x 20 and y =0 or x,y =0
(ii) Constraints
* The word constraint means restriction. It represents mathematical equation as the limitations imposed by the
problem characteristics.
mx+n-y <T
e For the above case, if each unit of product P gives profit of '% a' and each unit of product Q gives profit of
'%. b', then the objective of manufacturer (profit maximization) is,
The time constraint for production and painting can be given as,
e It can be used when constraints are of greater than or equal to (2) type and less than or equal to (S) type.
Numerical Methods and Optimization 5-7 Optimization
e It is an iterative process where optimum solution is obtained from a series of arithmetical steps.
e It is suitable for complicated programming problems which includes two or more decision variables.
Graphical Method
e Graphical method makes use of graphical analysis and it is used to solve a problem which involves only two
decision variables but any number of constraints.
¢ Both maximization and minimization problems can be solved by graphical methods.
e It can be used when constraints are of greater than or equal to (>) type and less than or equal to (<) type.
e It requires drawing two axes to represent two unknowns, representation of constraints, identification of feasible
region, drawing objective function line and evaluation of co-ordinates of the vertex to obtain the values of
unknowns,
¢ Though graphical method can deal with any number of constraints, each constraint is shown as line on a graph,
too many constraints make the graph complicated.
(i) Constraints
e It represents an upper limit on the availability of a resource or a lower limit on necessary level to obtain.
(ii) Graph of linear equality and inequality
« It is important to note that, a graph of two variable linear equation is always a straight line.
(vii) Find co-ordinates of farthest or nearest point (as per the requirement) which represents values of decision
variables.
(viii) Using the values of decision variables find the total profit / cost from the optimal solution.
Advantages
Graphical method used for solving LP problem are having following advantages :
e As compare to simplex method, graphical method is simple to understand and easy to use.
¢ In this method, redundant (useless) constraints are automatically eliminated.
¢ In this method, multiple solutions, unbonded solutions and infeasible solutions get highlighted very clearly.
Disadvantages / Limitations
Graphical method used for solving LP problem are having following disadvantages :
¢ This method is restricted to two variables only. For more than two variables simplex method is used.
¢ Graphical method is suitable for any number of constraints but, since each constraint is shown as a separate line
on a graph, number of lines make the graph difficult to read.
6x + 4y < 3600
and 2x + 4y < 2000
xy eo
Sol. :
6x + 4y = 3600 i)
Numerical Methods and Optimization 5-9 Optimization
2x + dy = 2000 (ii)
e As these constraint represent linear equations, they will represent straight line when plotted on the graph.
¢ All points on the line will satisfy equality and all points below the line will satisfy inequality part of the
constraints.
e We know that, to plot a straight line of any constraint we need to find two points that lie on the line.
Initially we will draw line AB for equation (i) and line CD for equation (ii).
(— >)
y axis y axis
1000 1000
900 A
800 800
B D
0 200 400 600 800 1000 x axis 0 200 400 600 800 1000 x axis
(a) (b)
Fig. 5.2
From Fig. 5.2 (a) it is clear that, any point on line AB or below line AB will give feasible solution for the
constraint 6x + 4y < 3600. Shaded area in Fig. 5.2 (a) represents feasible region defined by the inequality
6x + 4y £3600.
From Fig. 5.2 (b) it is clear that, any point on line CD or below line CD will give feasible solution for the
constraint 2x + 4y < 2000. Shaded area in Fig. 5.2 (b) represents feasible region defined by the inequality
2x + 4y < 2000.
Numerical Methods and Optimization 5-10 Optimization
oO (0, 0) Z=25x0+20x0 0
e As the problem is of maximization, the maximum value of profit occurs at corner point E (400, 300).
2x + 4dy = 80 ++ (i)
4x + 2y = 100 .. (ii)
¢ Initially, we will draw line AB for equation (i) and line CD for equation (ii).
B (40, 0) Z=2x40+3x0 80
e As the objective is minimization, the value of decision variable which gives minimum cost is at point E. The
co-ordinates of point E are (20, 10). It means,
Ex. 5.3: 4 company manufactures two types of rods R, and R». The respective profits are = 40 and % 30 per rod
respectively, Rod Ry requires twice as much time as required for Ry. If all rods were of Ry type, the company could make
1000 rods per day. The material of both type of rods is same and it is enough to produce 800 rods /day (both R, and R»
type). The outer box of rods are made by two different local suppliers. The supplier of rod R, can deliver 400 boxes / day
whereas supplier of rod Rz can deliver 700 boxes/day. To maximize the profit what quantity of each rod should be
produced ?
Sol. :
« Let,
=Q2Uxt(ty
elt is given that, if all rods were of R2 type then the company could make 1000 rods/day. It means, daily
y = 700 ws (iv)
e As each rod R; and R> gives a profit of € 40 and & 30 respectively, the objective function can be written as,
2x +y = 1000 ws (vi)
e Initially, we will draw line AB for equation (vi) and line CD for equation (vii).
ein this case, we have to draw two more lines for y axis
constraints, 1200
x = 400 (line FG) and y = 700 (line HI). 4000 A x = 400
oO (0, 0) Z=40x0+30x0 0
e As the objective is maximization, the value of decision variable which gives maximum profit is at point E. The
co-ordinates of point E are (200, 600). It means,
3x + Xo < 2]
X) +X. = 9
Xj, X22 O SPPU : May-15, Marks 6
Sol. :
xy + 4x, = 24 s (i)
Step - 2 : Calculate the optimal value of decision variables and maximum profit
~
Xp AXIS
24
B X4 axis
Ne 15 18 21 24 27
/
Fig. 5.5
« Now, we have to find the co-ordinates of all corner points O, A, G, H and D. Also calculate the value of
objective function for each corner point. Refer following table :
0 (0, 0) Z=2x0+5%x0 0
(0, 6) Z=2x0+5%x6 30
G (4, 5) Z=2x4+5x5 33
H (6, 3) Z=2x6+5%x3 27
D (7, 9) Z=2x7+5x0 14
Numerical Methods and Optimization 5-15 Optimization
e As the objective is maximization, the value of decision variable which gives maximum profit is at point G. The
co-ordinates of point G are (4, 5). It means,
Ex. 5.5: Raj engineering works manufactures two types of springs, helical compression and helical tension. The raw
material of spring is purchased from outside. The time required for manufaciuring of each compression spring is 0.1 hours
and for tension spring is 0.2 hrs. Manufacturing capacity of 500 hours is available per week.
The market for the two types of springs has been surveyed which suggests maximum weekly sale of 1200 compression
springs and 2100 tension springs. Profit for each spring is estimated as = 12 for compression spring and % 16 for tension
spring. Find the optimal product mix (quantity of each spring) by using graphical method of LP.
Sol. :
xy 20 (Non-negativity constraint)
Z = 12x + loy
y = 2100 . (Vi)
« Initially, we will draw line AB for equation (iv), line CD for equation (v) and line EF for equation (vi).
Draw line AB as shown in Fig. 5.6. Also, we have to draw two more lines for constraints x = 1200 (line CD) and
y = 2100 (line EF).
¢ To satisfy all constraints, the feasible solution must lie within the shaded area defined by the corner points O,
E, G, H and C.
Numerical Methods and Optimization 5-16 Optimization
a y axis
~
4000
3500
3000 x = 1200
D J
2500
F
J
2100 @
2000
0.1x+0.2y=500
1500
1000
500
Cc
x axis
QO 500 1000] 1500 2000 2500 3000 3500 4000 4500 5000
1200
/
Fig. 5.6
Step - 3 : Calculate the optimal value of decision variables and maximum profit
« In this case, we have to find the co-ordinates of all corner points O, E, G, H and C. Also calculate the value of
objective function for each corner point. Refer following table :
e As the objective is maximization, the value of decision variable which gives maximum profit is at point G or at
point H.
e The co-ordinates of point G are (800, 2100). It means,
OR
¢ The co-ordinates of point H are (1200, 1800). It means,
Sol. :
¢ To plot constraints on graph, temporarily neglect inequalities and consider the constraints as following equations :
x+y =9 -» (i)
r >
,o
“ x+y = 9
Lf
9%
20x+50y = 360
2
F G
y=3
2
D x
XS 0 2 4 6 8B10 12 14 16 18 20 SS
Fig. 5.7
Numerical Methods and Optimization 5-18 Optimization
Step 3 : Calculate the optimal value of descision variables and maximum profit
e Now, find the co-ordinates of all corner points B, E, F, G. Also calculate the objective function for E each
corner point. Refer following table.
¢ As objective is maximization, the value of decision variable which gives maximum profit is at point H. The
co-ordinates of point H are (4, 6). It means x = 4, y = 6 and corresponding Z = 1040. .. Ans.
Sol. :
Step 1: Plot the graph for the given inequalities
¢To plot constraints on graph, temporarily neglect inequalities and consider the constraints as following
equations :
x+2y = 40 @
3x+y = 30 .. (ii)
4x+3y = 60 .. (ili)
e Initially, we will draw line AB for equation (i) and line CD for equation (ii) and EF for equation (iil).
( »
y axis
607
507
407
3049
Ale Yfpsiiss 60
20-+€\ “S PEEP A ELS SE
Lp: 30 yj 40
‘ j
10+ VV
a
1
1
I i]
1 DY NF + + + + X axis
10 20 30 40 50 60
NS /
Fig. 5.8
Fig.5.8 shows the solution region extending beyond the corner points C, G and B (for minimization purpose)
formed by the straight lines representing the constraints x + 2y > 40, 3x+y 230 and 4x+ 3y 260
Step : 2 Calculate the optimal value of decision variables and minimum cost.
Now, we have to find the co-ordinates for all corner points C, G and B. Also calculate the value of objective
function for each corner point.
As the objective is minimizaion, the value of decision variable which gives minimum cost is point G. The
co-ordinates of point G are (5, 18). It means.
elt is already discussed that, graphical method of linear programming is used when a problem includes two
variables only.
¢ If a linear programming problem includes three or four variables then graphical method is not suitable. In this
condition, simplex method is used.
¢ This method sets up equations of the constraints and of the objective function which are entered in a matrix and
completed by creating an initial feasible solution.
« After this, number of iterations are made to improve the initial feasible solution.
¢ This procedure is continued till the optimum solution is reached.
6x + 4y < 3600
xy 20
Now to convert inequality constraint into equality constraint slack variable is added in the equation 1.e.
and 2x + 4y + S, = 2000
It is important to note that, the coefficient of slack variables are considered as zero in the equation of profit (for
maximization) or in the equation of cost (for minimization).
¢ If the constraint equations are of greater than or equal to (2) type then the slack variables are subtracted Le.
6x + dy = 3600
and 2x + dy > 2000
Now to convert inequality constraint into equality constraint slack variable is subtracted i.e.
6x + 4y —S, = 3600
and 2x + 4y —S, 2000
6x + 4y = 3600
where, (— M) = Coefficient of artificial variable which do not have any physical meaning
(iv) Row of Cj
e This row in the simplex table contains the coefficients of the variables in the objective function.
e The terms in this row indicates the contribution per unit to the objective function of each of the variables.
(v) Row of Z;
e A row in the simplex table whose elements represent the decrease in the value of objective function
(contribution loss per unit).
e The value of replacement ratios will be obtained by dividing the elements in solution column by the
elements in key column.
e The row which contains smaller value of replacement ratio is considered as key row.
X,. Xo 0
IM
Use simplex method to calculate x,, x. and maximize profit Z. SPPU : May-10, Marks 12, April-16, 17, Marks 10
Sol. :
Step - 1: Convert inequality constraint into equality constraint by adding slack variables
Row of (Z.—
Cj) = -6 -4 0 0
“ st nd . .
Coefficient of slack variables in equation of Z Variable of 1” and 2 constraint equations
Z = 6x, + 4x,
+ 0S, +08, i.€. 2X4 + 3X9 +S, + 0S,
= 100
and 4x, + 2x5 + 0S, + Sp = 120
« The row of Z; represents the decrease in value of objective functions. It is called as contribution loss per unit.
It is given as,
Row of Z| = ¥ Element in Xj, X9, 5;, S55 column x Element in objective column)
Row of Z;
(for x}-column)
= 9) (2x0+4x0) = 0 Objective Column | we |X| Xe
0 2 3
RowofZ; = }(3x0+2x0) = 0 0 4 2
(for x9 -column)
Row of Z; = })(1x0+0x0) = 0
(for S; column)
« Row of (Z; -C;) called as index row is the difference between values of Zj and corresponding values of C, in
Iteration 1
Step - 3 : Identify the key column and key row from the simplex table
e The maximum negative value from row of (Z; -C; )is (— 6).
e¢ The column which contains maximum negative value is called as key column. In this case, key column is the
column containing x, variable.
¢ To find the key row in the table, calculate the ratio of element in solution column to the element in key column
i.e.
(Ratio); = 100 = 50
2
(Ratio), = ” = 30
The key row is the row which contains the lower value of ratio. As 30 < 50 ie. (Ratio), < (Ratio);, key row is
the 2™ row which contains Sy variable. Refer following table :
a Remaining element
Key element
(Intersection of
Key column key column and key row)
¢ The intersection element obtained by key column and key row is known as key element. Here, it is 4.
e The remaining element in a key column except key element is called as remaining element. Here, it is 2.
R, => R, —2R>
100-—2x 30 = 40
Numerical Methods and Optimization 5-25 Optimization
2-2x1= 0
3-2x0.5 = 2
1-2x0 = 1
0-2x0.25 = — 0.5
e¢ Now replace the objective column element in the key row by the objective row element in key column. It
means, replace 0 by 6.
Also replace variable column element in key row by variable of profit element in key column. It means, replace
5S by xy.
« Now the table will be as follows :
0 Ss} 40 0 2 — 0.5
6 x 30 1 0.5 0.25
« Again calculate the value of elements in row of Z; and elements in row of (Z; —C; ) by applying the procedure
as in Step - 2.
Note ; If all the elements in row of (Z, — C.) are positive then optimum solution is reached, If any one value in
(Z - C) row is negative (less than zero) then there is scope for improvement.
«In this case, there is one negative term means there is scope for improvement or optimum solution is not yet
reached.
Iteration 2
Step - 5 : Identify the key column and key-row from the new simplex table
¢ The maximum negative value from row of (Z; -C;) is (— 1). Now, this column becomes key column which
contains x7 variable.
« To find the key row calculate the ratio as follows :
(Ratio); = 40 _ 59
2
. — 30 _
(Ratio). = 05 60
As 20 < 60, key row is the first row which contains S, variable.
Numerical Methods and Optimization 5-26 Optimization
Rati
(Ratio); = —=20
5
(Ratio)> = 05
30 60
As 20 < 60, key row is the first row which contains S, variable.
« The intersection element is a key element i.e. 2 and the remaining element in key column Le. remaining
element is 0.5.
[~ Key element
ft Remaining element
Key column
* The new key row elements are obtained by dividing all the elements in key row by key element i.e.
Ry => Ro -0.5R,
30- 0.5 20 = 20
1-05x0 = 1
05-05x1 = 0
0-0.5%* 05 = - 0.25
4 Xo 20 0 1 0.5 — 0.25
6 % 20 1 0 = 0.25 0.375
+ Now again calculate the value of elements in Z| row and (2; —C; ) row, by applying the procedure as in
Step - 2.
« As all the elements in (Z; -C ) row are positive, optimum solution is reached.
*. Final optimum solution is,
Xx = 20 and x, = 20 « Ans.
Z = 200 . Ans.
Sol. :
Step - 1 : Convert inequality constraint into equality constraint by adding slack variables
Z = 1600x+1500y
+ 0S; +0S>
Step - 2 : Form a simplex table
0 3 500 5 4 1 0
0 So 1800 15 16 0 1
Numerical Methods and Optimization 5-28 Optimization
Row of Z => 0 0 0 0
Iteration 1
Step - 3 : Identify the key column and key row from the simplex table
*« The maximum negative value from the row of (Z; ~C)) is (— 1600). So key column is the column containing
x variable.
¢ To find key row, calculate the ratio of element in solution column to the element in key column i.e.,
(Ratio), = == 100
(Ratio),
is
o
l
As 100 < 120, ie. (Ratio); < (Ratio), key row is the 1 row which contains $8, variable. Refer following table :
/- Key element
0 So 4800 | $15:
eh
| 16 0 4 420 | <== Remaining row
Row of Z; — 0 \ 0 0 0
t L Remaining element
Key column
tale
5 5 5
e The new remaining row elements are obtained as,
R5 > R> -I5R,
15-15x1=0
16-15
x 0.8
ll
&
0-15 02 = -3
1-15x0 = 1
¢ Now replace the objective column element in key row by the objective row element in key column. It means
replace 0 by 1600 and similarly replace S; by x. Now the table will be as follows :
0 Sp 300 0 4 3 | 1
Row of Zj => 1600 1280 320 0
* Now calculate again the value of elements in row of Zz, and row of (Z; ~C)).
for
y column — Zj = S$ (0.8 1600+ 4x0) = 1280 Z -C = 1280 — 1500 = — 220
Iteration 2
Step - 5 : Identify the key column and key row from the new simplex table
* The maximum negative value from row of (2; -Cj) is (220). So key column is the column containing
y variable.
« To find key row, calculate the ratio of element in solution column to the element in key column i.e.,
100
Rati
(Ratio); = —=
08 125
(Ratio), = = = 75
As 75 < 125, key row is the second row which contains $4 variable. Refer following table :
300
4
95, 4Ong 425,
4
Be
4
075, 1-005.
4
« The new remaining row elements are obtained as,
iz Remaining 9 element
i \_ Key element
Key column
100 —0.8x 75 = 40
1-08x0 = 1
08-08x1= 0
0.2 — 0.8
x (— 0.75) = 0.8
« Now replace the objective column element in key row by objective row element in key column.
It means replace 0 by 1500 and similarly replace Sj by y.
Numerical Methods and Optimization 5-31 Optimization
1500 y 75 0 1 = 0.75 1
Now again calculate the value of elements in row of Z; and row of (2; ~C)).
+ As all the elements in (2; —Cj) row are positive, optimum solution is reached.
x = 40 and
y = 75 +. Ans,
The maximum profit (2) is,
Zz 1,76,500 a Ans.
Ex. 5.10: Maximize the function Z = 3x + 2y, subjected to following three conditions using simplex method.
xtys4, x-ysS2, x20, y20 SPPU : May-02, Marks 10
Sol. :
Step - 1 : Convert inequality constraint into equality constraint by adding slack variable
xtyt+tS,; =4 or xt+ty+5,+0S9=4
Z = 3x+2y+0S, +08,
Step - 2 : Form a simplex table
0 S 4 1 1 1 0
Numerical Methods and Optimization 5-32 Optimization
0 S> 2 1 -l 0 I
Row of (Z)) > 0 0 0 0
for x column
> Zj)=E (1x0+ 1x0)=0 (2, - Cj)=0-3=-3
for$; column
+ Z; = (1x 0+ 0x0)=0 (2; - Cj)=0-0=0
Iteration 1
Step - 3 : Identify the key column and key row from the simplex table
¢ The maximum negative value from the row of (Z; — C; ) is (-3). So key column is the column containing
x variable.
¢ To find key row, calculate the ratio of element in solution column to the element in key column i.e.
(Ratio), 4
me
|
(Ratio)> =2
lr
As2 <4, the key row is the second row which contains $, variable. Refer following table :
[ Remaining element
Row of (Z)) 0 \ 0 0 0
Row of (Z)\— C) -3 =f 0 0
tt LL Key element
Key column
R, > R, -R>
Applying this equation on all elements of remaining row i.e.
4-2 =2
1-1 = 0
1-(-1) = 2
1-0 = 1
0-1=-1
¢ Now replace objective column element in key row by the objective row element in key column.
It means, replace 0 by 3 and similarly replace S, by x.
0 Sy 2 2 l -1
3 x 2 cal 0 1
e Now calculate again the values of elements in row of Zz and row of (Zj - Cj).
Iteration 2
Step - 5 : Identify the key column and key row from the new simplex table
« The maximum negative value from row of (Z| — Cj) is (-5). So key column is the column containing
y variable.
Numerical Methods and Optimization 5-34
To find key row, calculate the ratio of element in solution column to the element in key column i.e.
(Ratio); =
(Ratio), =
As | <2, key row is the first row which contains $, variable. Refer following table :
a Key element
Row of (4 -C)) 0 -5 0 3
tt \ Remaining element
Key column
2 y 1 0 1 0.5 ti
Numerical Methods and Optimization 5-35 Optimization
3 x 3 I 0 0.5 0.5
* Now again calculate the value of elements in row of (Z) and row of (Zj —Cj).
fory column
> Z)=¥ (1x2+ 0x3)=2 (Z;-C))=2-2=0
e As all the elements in (Z; -C , ) tow are positive, optimum solution is reached.
x = 3andy=1 . Ams.
The maximum profit (Z) is,
Z = 3x + 2y = 3x 34+2x1
Z= il Ans.
X11 xX, 20
Sol. :
Step - 1 : Convert inequality constraint into equality constraint by adding slack variables.
2x,
+ 3x2+S = 60 or 2x; + 3x9 + 0S; +5. +0S3= 60
0 S| 40) 2 l 1 0 0
0 S3 60 ‘4 3 0 1 0
Numerical Methods and Optimization 5 - 36 Optimization
0 S3 24 1 l 0 0 1
Iteration - 1
Step - 3 : Identify the key column and key row from the simplex table
e The maximum negative value from the row of (Z;- C, )is (-3).
« To find key row, calculate the ratio of elements in solution column to element in key column.
: 40 : 60 : 24
(Ratio), = = 20, (Ratio) = =30. (Ratio); =T =24
[ Key element
0 S, 40 @) 1 1 0 0 20 |= Key row
0 82 24 ca 1 0 0 1 24 |= Remaining
b row2
Row of (2) —» 0 \ 0 i) 0 0
Row of (Z;-C)) -3 -2 0 0 0
t LL Remaining elements
Key column
For this case, key element is 2 and remaining elements are 2 and 1.
Numerical Methods and Optimization 5-37 Optimization
—40 = 20, 2
==1, 1
==0.5, 1
==0.5, 0
==0, 0
—=
2 0, 2° 2 ° 2 o> 2 0 2 0
« The new remaining row | and remaining row 2 elements are obtained as,
60-2x20= 20 24-20=4
2-2x1=2 1-1=0
3-2x05=2 1-0.5=0.5
0-2x05=-1 0-0.5=-0.5
1-2x0=1 0-0-0
0-2x0=0 1-0-1
e Now replace objective column element in key row by objective row element in key column.
It means, replace 0 by 3 and similarly 5, by x,.
Now the table will be as follows :
for xX, column > Zj = (0.534 2x04 0.5x0)=1.5 (Z; —C; j=1.5-2=-0.5
e In this case there is a negative term. It means, there is scope for improvement or optimum solution is not yet
reached.
Iteration - 2
Step - 5: Identify the key column and key row from the new simplex table
Numerical Methods and Optimization 5-38 Optimization
«The maximum negative value from row of (Z;—C;) is -0.5. So key column is the column containing
X2 variable.
¢ To find key row, calculate the ratio of element in solution column to element in key column.
Remaining
0 Sp 20 2 -1 -1 0 10 |= ow?
tt \ Key element
Key column
For this case, key element is 0.5 and remaining elements are 0.5 and 2.
4g
0.5
09
0.5
05.) 05) 09
0.5 0.5 0.5
04 0.5
« The new remaining row | and remaining row 2 elements are obtained as,
R, = R,;-O5R; and R, = R,-2R;
20-0.5x8=16 20-2x8=4
1-0.5x0=1 2-2x0=2
0.5—0.5x1=0 2-2x1=0
0.5-0.5x1=0 —1-2xl=—
0 —0.5x0=0 —1-2x0=-1
0 —0.5x0=0 0-2x0=0
e Now, replace the objective column element in key row by the objective row element in key column.
It means replace 0 by 2 and similarly replace 5, by x,.
Numerical Methods and Optimization 5-39 Optimization
3 x 16 I 0 0 0 0
0 S> 4 2 0 3 aT 0
2 X> 8 0 1 | 0 0
« Now again calculate the value of elements in row of Zj and row of (Z; - Cj ).
« All the elements in (2; — Cj ) row are positive, hence optimum solution is reached.
x, = 16 and
x, =8 «. Ans,
Ex. 5.12 : 4A company is manufacturing two different types of products A and B. Each product has to be processed on two
machines MI and M2. Product A requires 2 hours on machine MI and ! hour on machine M2, product B requires I hour
on machine MI and 2 hours on machine M2. The available capacity of machine MI is 104 hours and that of machine M2
is 76 hours. Profit per unit for product A is = 6 and that for product B is & 11.
i) Formulate the problem. ii) Find the optimal solution by simplex method. SPPU : May-09, Marks 10, May-16, 17, Marks 8
Sol. :
Maximize Z = 6x + lly
Numerical Methods and Optimization 5-40 Optimization
0 S| 104 2 1 1 0
0 S) 16 1 2 0 |
Row of (Zj) > 0 0 0 0
Row of (Z;
— Cj) > -6 | -ll 0 0
¢ Now calculate the values of elements in row of Zj and row of (Z; - Cj).
for
x column — Z; = }}(2x0+1x0) = 0 (Z| - C))=0-6=-6
for
y column —> Z; = Siax0+ 2x0)= 0 (2 - Cj) =0-11=-11
for S; column > Z) = ¥ (1x04 0x0) = 0 (2) - C))= 0-0-0
for Sp column —> Z; = ¥(Ox0+ 1x0) = 0 (Z; - C))=0-0=0
Iteration - 1
Step - 4: Identify the key row and key column from the simplex table,
« The maximum negative value from the row of (Z, —C; ) is (-11). So the key column is the column containing
y variable.
¢ To find key row, calculate the ratio of elements in the solution column to the elements in the key column.
As 38 < 104, the key row is the second row containing 82 variable.
Refer following table :
Numerical Methods and Optimization 5-41 Optimization
Row of (Z) _ 0 0 0 0
tt LL Key element
Key column
R, > Ry -R
104
— 38 = 66
2-05 = 105
I-1l1=0
1-0 =1
0-05 = -0.5
* Now replace objective column element in key row by the objective row element in key column.
It means replace 0 by 11 and similarly replace S by y.
Now the table will be as follows :
0 S 66 1.5 0 1 -0.5
11 y 38 0.5 1 0 05
Numerical Methods and Optimization 5-42 Optimization
e Now calculate the values of elements in row of Zj and row of (Z; —Cj).
e In this case, there is one negative term. It means there is still scope for improvement or optimum solution is not
yet reached.
Iteration - 2
Step - 6 : Identify the key column and key row from new simplex table
e The maximum negative value from the row of (Zj - Cj ) is (-0.5).
As 44 < 76, the key row is the first row containing S; variable.
For this case key element is 1.5 and remaining element is 0.5.
f Key element
t L Remaining element
Key column
| _ 0.6667, a =~ 0.3334
malin
lo
Ig
ll
Il
z
in
« The new remaining row elements are obtained as,
Ry => Ry -0.5 R;
38 — 0.5 x 44 16
0.5 -0.5 x 1 0
1-05x0 = 1
6 x 44 1 0 0.6667 — 0,3334
ll y 16 0 1 0.3333 0.6667
e Now again calculate the values of elements in the row of Zj and row of (Zj - Cc; ).
x = 44 and
y = 16 ++» Ans.
Ex. 5.13: The Sun Industry Ltd. produces two products A and B. Product A is sold at % 50,000/- and Product B at
& 12,000/ per piece. Each product passes through three processes. The table below presents the time required for each
product and total time available for each process per month. Determine the quantity of products to be produced so as to
maximize sale.
Hrs. Required
Process Available hrs/month
Product A Product B
Process - | 75 15 1000
Sol. :
Step - 2 : Convert inequality constraint into equality constraint by adding slack variables
0 S| 1000 75 15 l 0 0
0 $2 1500 100 30 0 1 0
0 S; 750 45 10 o|o/]41
Numerical Methods and Optimization 5-45 Optimization
Now, calculate the value of elements in row of Zj and row of (Z, - Cj).
for
y column — Zj = Sasx0+ 30x04+10 x 0)=0 (Zj -C)) = 0 — 12,000 = —12,000
Iteration - 1
Step - 4: Identify the key row and key column from the simplex table
* The maximum negative value from the row of (Z; — Cj ) is (-50,000).
So the key column is the column containing x variable.
¢ To find key row, calculate the ratio of elements in solution column to the elements in the key column.
As 13.3334 < 15 < 16.6667, the key row is the first row containing 8; variable. Refer following table :
[ Key element
Row of (Z)) —» 0 0 0 0 0
Row owof(Z-—C)—»
of (Z,—C, » \\0
| 50,000 — 12,000 0 0
t NS Remaining element
Key column
For this case, 75 is the key element and remaining elements are 100 and 45.
¢ Now replace the objective column element in key row by the objective row element in the key column.
It means, replace 0 by 50,000 and similarly replace S, by x.
Now the table will be as follows :
0 S2 166.66 0 10 -1.33 1 0
0 8; 149.997 0 1 — 0.5985 | 1 0
* Now calculate the value of elements in row of Z; and row of (Z; —C; ).
for x column —> 2; = ¥(1x50000+4 0 x04+0 x 0) = 50,000 (Zj —Cj) = 50,000— 50,000= 0
fory column — Z; = ¥' 0.250000 + 10x0+1 x 0)= 10,000 (Z, —C;) = 10,000 - 12,000 = -2,000
e In this case there is one negative value in row of (Z; -C}). It means there is still scope for improvement or
optimum solution is not yet reached.
Iteration - 2
Step - 6 : Identify the key column and key row from new simplex table
¢ The maximum negative value from row of (2; -C)j) is (-2000). So the key column is the column containing
y variable.
¢ To find the key row, calculate the ratio of elements in solution column to the elements in key column.
Remaining element
[- Key element
tf a Remaining element
Key column
e For this case, key element is 10 and remaining elements are 0.2 and 1.
* Now again calculate the value of elements in the row of Zj and (Z; - Cj ).
for Sp column — Zi = > 0.02 «50,000+ 0.1%12 000 (Zj —C)) = 200 — 0 = 200
+ (—0.1)x0) = 200
x = 10 and y= 16 «» Ans.
Maximum profit (7) is,
Z = 50,000x 10 + 12,000x 16
Z = 6,92,000 = + Ans,
The value of y = 16.666 = 16 because if we consider it as 17, then it will not satisfy the given equation of
constraints. So the final value of y is 16.
Sol. :
-M Ay 40 1 2 -1 0 1 0
—M Ao 50 2 1 0 | -1 0 -I
Row of (Zj) > -3M -3M M M |-M | -M
* Now calculate the value of elements in row of Zj and row of (Z; -Cj ).
Numerical Methods and Optimization 5-50 Optimization
Iteration - 1
Step - 3 : Identify the key row and key column from simplex table
+ The maximum negative value in the row of (Z| — Cj) is (- 3M+2). So the key column is column containing
x variable.
« To find the key row, calculate the ratio of element in solution column to element in key column.
Objecti
yective Variabl
anable Soluti
olution x y $4 Ss Ay Ap
column | column | column
of (Z))
Row —= -3M\\ -3M M M -M —M
} \ Key element
Key column
R; => Ry -R3
Numerical Methods and Optimization -51 Optimization
40 — 25 15
I-1
2-05
-1-0
0 - (0.5)
1-0
0-05 — 0.5
* Now replace the objective column element in key row by the objective row element in key column.
It means replace (— M) by (— 2) and similarly replace A, by x.
Now the table will be as follows :
¢ Now calculate the value of elements in row of Z; and row of (Z; - Cj).
+ In this case, there is one negative value in row of (Z;—Cj). It means there is still scope for improvement or
Iteration - 2
Step - 5 : Identify the key column and key row from new simplex table
e The maximum negative value from the row of (Z: - Cc) is 2— 1.5 M. So the key column is column containing
y term.
e To find the key row, calculate the ratio of element in the solution column to the element in the key column.
. 25 : 15
(Ratio); = 06> 50, (Ratio), = Ls 10
As 10 < 50, the key row is the second row containingS variable. Refer following table :
Remaining element
ia Key ey element
e
Key column
« For this case, key clement is 1.5 and remaining clement is 0.5.
$5
LS <9, LS8 9, 3-1,
OLS =hLS ~ 0.6667, 2215 = 0.3334, |L5 = 0.6667, 255 = - 0.3334
* The new remaining row element is obtained as,
R, => R, -0.5 R>
1-05x0 = |
05-05x1= 0
« Now replace the objective column element in key row by the objective row element in key column.
It means, replace (— M) by (— 3) and similarly replace S by y.
Now the table will be as follows :
« Now again calculate the value of elements in row of Zj and row of (Z; -C;).
for Sp column — Z; = ¥[(-0.6667)x(-2)+ 0.3334 x(-3)] = 0.3332 (Z; -C;) = 0.3332 —0 = 0.3332
for Ay column —> Z) = }\[(-0.3333) x(-2)+0.6667 x(-3)] = -1.3335 (Zj ~Cj) = -1.3335 - (-M) = M~ 1.3335
for Ay column > Z; = }\[0.6667 x(—2)+ (-0.3334) x(-3)] = 0.3332. (Z; ~C)) = -0.3332 - (-M) = M-0.3332
* As all the elements in row of (Z; —C; ) are positive, optimum solution is reached.
Ex. 5.15: Two products P; and Py are to be manufactured hy a firm. Profits on P, and Py are & 30 and 20 respectively.
The products are to be processed on two machines, ie. first on milling machine and other on surface grinder. The
capacities and the time required to produce a unit are as follows :
PR P, Capacity
How many products of type P, and Py should he manufactured to get maximum profit ? (use Simplex Method)
Sol. :
Ix + ly = 1000
x,y 20
elt is already discussed that, if the optimization problems do not have any constraints then they are called as
unconstrained optimization problems.
« In one-dimensional optimization, the function depends on a single dependent variable.
¢ Now we will discuss the techniques to find optimum (maximum or minimum) of a function for single variable.
Newton's Method
Solved Examples
Ex. 5.16: Using Newton's method calculate the maximum value of the equation 2 sinx—0.1 x2. Take initial guess as 2.5
and do 3 iterations.
Numerical Methods and Optimization 5-55 Optimization
f (x) = 2sinx-0.1 x?
Differentiating w. r. t. x,
f’ (x) = 2cosx-—0.1
x 2x =2 cos x —0.2x
Differentiating w. r. t. X again,
Iteration - 1
Xy = 2.5
Iteration - 2
Replace x; by x> x; = 0.9951
Step (i) : Calculate new value of root
= — 0.0903
Ex. §.17 : Using Newton's method find the maximum value for the equation x? —5x? + 3x. Take initial guess as zero upto
accuracy 0.001, SPPU : May-15, Marks 5
Differentiating w. r. t. x again,
r"\(x) = 6x — 10
Iteration - 1
xy = 0
=
f(x; )
—-———
= J-—__ = 03
3
2 FG) 10)
Step (ii) : Check for the accuracy
Iteration - 2
Replace x, by x; .. x) = 0.3,
f(x; ) 0.27
= 03-—=_ = 0.3329
f"(x)) (-8.2)
Step (ii) : Check for the accuracy
Iteration - 3
Replace x; by x, 2. x, = 0.3333
Ex. 5.18 : Determine the maximum value of root of equation 0.5/x — sin x by Newton's method. Take initial guess as 2
and do 4 iterations. SPPU : May-16, Marks 5
f(x) = 0.51x
- sin x, x} =2,n=4
Differentiate w. r. t. x,
Differentiate w. r. t. x again,
Numerical Methods and Optimization 5-58 Optimization
Iteration - 1
x, = 2
=x - FG) _ 0.9261 _
0.9814
2 Fray 0.9092
Iteration - 2
Replace x; by x2 -. x, = 0.9814
f'(x,) — 0.0458
= - = 0.9814— = 1.0365
*2 LEHR) 0. 8312
Iteration - 3
f'(x) ) 0.00076
= xX - = 1.0365-— = 1.0356
*2 MFG) 0.8606
Iteration - 4
Replace x; by x ..x; = 1.0356
Step (i) : Calculate the new value of root
_
f(x; ) 4.60% 106
= 1.0356-———__- = 1.0355
£"(x, ) 0.8601
X27 = Kj
Numerical Methods and Optimization 5-59 Optimization
e There are various techniques available to solve the different types of optimization problems.
« These are given under the heading of classical methods and modern methods as shown in Fig. 5.9.
Optimization techniques
U
uy U
Classical methods Modern methods
/
Fig. 5.9 : Optimization techniques
e The desire to optimize the objectives and goals of any engineering system while satisfying the physical
limitations led to the development of new class of mathematical programming techniques.
e These new modern techniques have came into existence since the last decade.
e In this chapter, we shall learn only about two modern techniques i.e. simulated annealing (SA) and genetic
algorithms (GA).
¢ The method of the simulated annealing comes under the modern optimization technique and based on the
assumptions of critically heated solids.
¢ We know that annealing in metallurgy is done to remove residual stresses, improve grain structure and to
minimize defects in the material.
¢ The concept of slow cooling from annealing to remove defects in metallurgy is implemented in the simulated
annealing algorithms.
Numerical Methods and Optimization 5-60 Optimization
¢ It is implemented as a slow decrease in the probability of accepting worse solutions as it explores the solution
space.
«In simulated annealing, the system is expected to explore initially towards broad region of the search space
containing good solutions and then drift towards narrower regions.
e For example, if the objective is to minimize the function f (x). The simulated annealing algorithm starts with
the initial vector x, and then successively generates improved points x7 ,X3.,.... moving towards the global
minimum solution.
e At each iteration of the simulated annealing algorithm, a new point is randomly generated.
¢ The distance of the new point from current point depends upon the probability distribution.
e The SA algorithm accepts all new points that minimize the objective to explore globally for better solution.
« Also, it accepts the points that maximize the objective to avoid being trapped in local solutions in early
iterations.
¢ Genetic algorithm is also a modern optimization technique that is based on some biological molecular
phenomena.
e This concept uses the principle of natural genetics and natural selection that includes reproduction, crossover,
mutation for genetic search.
e The genetic algorithm repeatedly modifies a population of individual solution.
« At each step, the GA randomly selects the individuals from the current population and uses them as a parents to
produce children for next generation.
« Over so many successive generation, the population evolves towards an optimal solution.
¢ Before starting genetic algorithm, user have to define the objective function, genetic representation and genetic
operators.
e These are the most important aspects of using genetic algorithm.
Numerical Methods and Optimization 5-61 Optimization
1) Initialization of an algorithm
2) Creation of new population
3) Termination of algorithm
1) Initialization of an algorithm :
e It takes place by creating a random initial population.
e According to the fitness value, parent members are selected. Thus, member (designs) with higher fitness
values have greater chance of being selected.
e These parent members are used to produce children by mutation and cross-over.
e Hence, the current population is replaced with new population.
For example : Consider two individual members (designs) of length 10. Binary digits along the length of
the member are swapped to produce new generation.
Parent
lay ={0 01 0111011}
3) Termination of Algorithm :
e The algorithm stops when any one of the following condition is achieved :
© Specified number of generations are achieved.
° Time limit is achieved.
° There is no improvement in the objective function in the given time interval, ete.
¢ Genetic algorithm produces number of solutions after each iteration instead of only one solution.
¢ It can solve any optimization problem which can be described with the chromosome encoding.
e Genetic algorithm can solve problems with discontinuous, non-differential and non-linear objective function.
e These algorithms are easily transferred to simulations and models.
¢ Time required for simulation of complex problems is more. Hence it cannot assure constant response time.