Module 4
Module 4
Quadratic Programming
A Quadratic Programming problem is a non-linear programming problem
with a quadratic objective function and linear constraints.
𝑏1
𝑑11 𝑑12 ⋯ 𝑑1𝑛
𝑏2
𝐷= ⋮ ⋮ ⋱ ⋮ b=
⋮
𝑑𝑚1 𝑑𝑚2 ⋯ 𝑑𝑚𝑛
𝑏𝑚
MODM
1 0.5 2.5 𝑥1
f(x) = 𝑥1 𝑥2 𝑥3 0.5 −2 −1 𝑥2
2.5 −1 0 𝑥3
4
MODM
−3 0 0 𝑥1
f(x) = 𝑥1 𝑥2 𝑥3 0 2 0 𝑥2
0 0 −3 𝑥3
1 0 𝑥1 𝑥1
f(x) = 𝑥1 𝑥2
𝑥2 + 1 −2 𝑥2 + 10
0 0
5
MODM
To check the definiteness of a function
The definiteness of a function f(x) depends on the nature of A in xT A x
We can use the matrix minor test or Eigen value test to check the definiteness
of a function.
6
MODM
A function f(x) = xT A x is
7
MODM
Decide the definiteness of the function
f(x) = -3 x12 + 2 x22 – 3x32 – 10 x1x2 + 4 x2x3 + 6 x1x3
Solution –
Write the function as f(x) = xT A x
−3 −5 3 𝑥1
f(x) = 𝑥1 𝑥2 𝑥3 −5 2 2 𝑥2
3 2 −3 𝑥3
The Principal minors are,
𝐷1 = −3 = −3 ˂ 0
−3 −5
𝐷2 = = −31 ˂ 0
−5 2
−3 −5 3
Thus D1 < 0, D2 < 0, D3 > 0.
𝐷3 = −5 2 2 = 27 > 0
3 2 −3
This ensures that the function is indefinite.
8
MODM
Decide the definiteness of the function
f(x) = 2 + 2x1 + 3 x2 - x12 - x22
Solution –
Write the function in the form,
−1 0 𝑥1 𝑥1
f(x) = 𝑥1 𝑥2 𝑥 + 2 3 𝑥 +2
0 −1 2 2
By matrix minor test – D1 = -1 ˂ 0 ; D2 = 1 > 0
Alternate sign with first sign negative ⸫ Negative definite.
By Eigen value test – Eigen values are -1 , -1
Both are negative ⸫ Negative definite.
9
MODM
Decide the definiteness of the function
f(x) = x12 - 2x22
Solution –
Write the function as f(x) = xT A x
1 0 𝑥1
f(x) = 𝑥1 𝑥2
0 −2 𝑥2
By matrix minor test – D1 = 1 > 0 ; D2 = -1 ˂ 0
This ensures the function is indefinite.
By Eigen value test – Eigen values are 1 , -2
Positive and negative ⸫ Function is indefinite.
10
MODM
i) Wolfe’s method
ii) Beale’s method
11
MODM
4 0
Find the quadratic form of matrix A =
0 3
Solution –
Quadratic form, f(x) = xT A x
4 0 𝑥1
𝑥1 𝑥2
0 3 𝑥2
𝑥1 𝑥2 4𝑥1 + 0𝑥2
(0𝑥1 + 3𝑥2)
𝑥1 𝑥2 4𝑥1
3𝑥2
4x12 + 3x22
12
MODM
4 −5 7
Find the quadratic form of matrix A = −5 −6 8
7 8 −9
Solution –
Quadratic form, f(x) = xT A x
4 −5 7 𝑥1
f(x) = 𝑥1 𝑥2 𝑥3 −5 −6 8 𝑥2
7 8 −9 𝑥3
(4𝑥1 − 5𝑥2 + 7𝑥3 )
f(x) = 𝑥1 𝑥2 𝑥3 (−5𝑥1 − 6𝑥2 + 8𝑥3 )
(7𝑥1 + 8𝑥3 − 9𝑥3 )
f(x)=(4𝑥12 − 5𝑥1 𝑥2 + 7𝑥1 𝑥3 )+(−5𝑥1 𝑥2 − 6𝑥22 + 8𝑥2 𝑥3 )+(7𝑥1 𝑥3 + 8𝑥2 𝑥3 − 9𝑥32 )
f(x)=4𝑥12 − 6𝑥22 − 9𝑥32 − 10𝑥1 𝑥2 + 14𝑥1 𝑥3 + 16𝑥2 𝑥3
13
MODM
4 −5 7
Find the quadratic form of matrix A = −5 −6 8
7 8 −9
Solution – 𝑥1 𝑥2 𝑥3
4 −5 7
A = −5 −6 8
7 8 −9
• G. P. is used to minimize the functions that are in the form of POSYNOMIALS subject to
constraints of the same type.
• It differs from other optimization techniques in the way that it finds the optimal value of
the objective function first, instead of finding optimal values of the design variables first.
• It is advantageous in situations where the optimal value of the objective function may be
all that is of interest and the calculation of the optimum design vectors may be omitted.
15
MODM
The major disadvantage of G. P. is that it requires objective function and constraints in the
form of Posynomials.
Posynomials –
Consider for example the total cost as the objective function f(x) which is given by the sum
of several component costs Ui(x) as,
f(x) = U1 + U2 + --- + UN
In many cases, the component cost Ui can be expressed as power function of the type,
Ui = Ci x1a1i x2a2i --- xnani
where, coefficients Ci are positive constants
design parameters x1, x2, --- xn are positive variables
exponents aij are real constants (positive, negative or zero)
Function f(x), because of positive coefficients and variables and real exponents are called Posynomials.
16
MODM
17
MODM
Now,
Arithmetic mean ≥ Geometric mean
𝛿1 𝑢1 +𝛿2 𝑢2 +⋯𝛿𝑛 𝑢𝑛 𝛿 𝛿 𝛿
≥ 𝑢1 1 𝑢2 2 …𝑢𝑛𝑛
𝛿1 +𝛿2 +⋯+𝛿𝑛
𝛿
σ𝑛𝑖=1 𝛿𝑖 𝑢𝑖 ≥ ς𝑛𝑖=1 𝑢𝑖 𝑖 {𝛿1 + 𝛿2 + … +𝛿𝑛 = 1
Let, 𝑈𝑖 = 𝛿𝑖 𝑢𝑖 {Ɐ i
𝑈𝑖 𝛿𝑖 𝑈𝑖
σ𝑛𝑖=1 𝑈𝑖 ≥ 𝑛
ς𝑖=1 {⸪𝑢𝑖 =
𝛿𝑖 𝛿𝑖
18
MODM
𝑈1 𝑈2 𝑈𝑛
The equality hold when , = =… = K (say)
𝛿1 𝛿12 𝛿𝑛
From RHS
𝑛 𝑈𝑖 𝛿𝑖
ς𝑖=1 = 𝐾 𝛿1 𝐾 𝛿2 … 𝐾 𝛿𝑛 = 𝐾 (𝛿1 +𝛿2 + …+𝛿𝑛 ) = 𝐾
𝛿𝑖
LHS = RHS = K
⸫ Equality holds 19
MODM
1
Minimize 𝑓 𝑥 = 𝑥1 + 𝑥2 + ; 𝑥1 , 𝑥2 > 0
𝑥1 𝑥2
𝑓 𝑥 = 𝑈1 + 𝑈2 + 𝑈3
𝑈1 𝛿1 𝑈2 𝛿2 𝑈3 𝛿3 𝑈𝑖 𝛿𝑖
≥ {σ𝑛𝑖=1 𝑈𝑖 ≥ 𝑛
ς𝑖=1
𝛿1 𝛿2 𝛿3 𝛿𝑖
𝛿1 𝛿2 𝛿3
𝑥1 𝑥2 1
=
𝛿1 𝛿2 𝑥1 𝑥2 𝛿3
𝛿1 𝛿2 𝛿3
𝛿1 −𝛿3 𝛿2 −𝛿3
1 1 1
= 𝑥1 𝑥2
𝛿1 𝛿2 𝛿3
𝑥1 𝑥2 1
= =
1/3 1/3 (𝑥1 𝑥2 )1/3
𝑥1 = 𝑥2 and 𝑥1 𝑥2 2 = 1 𝑥1 3 =1 𝑥1 = 𝑥2 =1
22
MODM
Minimize 𝑓 𝑥 = 5x1 + 20x2 + 10x1-1x2-1 ; x1 , x2 ≥ 0
𝑓 𝑥 = 𝑈1 + 𝑈2 + 𝑈3
𝑈1 𝛿1 𝑈2 𝛿2 𝑈3 𝛿3 𝑈 𝑖 𝛿𝑖
≥ {σ𝑛𝑖=1 𝑈𝑖 ≥ 𝑛
ς𝑖=1
𝛿1 𝛿2 𝛿3 𝛿𝑖
𝛿1 𝛿2 𝛿3
5𝑥1 20𝑥2 10x1−1x2−1
=
𝛿1 𝛿2 𝛿3
𝛿1 𝛿2 𝛿3
𝛿1 −𝛿3 𝛿2 −𝛿3
5 20 10
= 𝑥1 𝑥2
𝛿1 𝛿2 𝛿3
1
𝑥1 = 4𝑥2 2𝑥2 = → 2𝑥1 𝑥2 2 = 1 8𝑥2 3 =1
𝑥1 𝑥2
⸫ 𝑥1 =2 𝑎𝑛𝑑 𝑥2 =1/2
25
MODM
• Goal Programming set some estimated targets for each goal and assign
priorities to them, i.e. to rank them in order of importance.
• In
the final solution all the goals may not be fulfilled to the fullest extent
however, the deviations will be the minimum possible.
MODM
A factory can manufacture 2 products A & B. The profit on one unit of A is
Rs. 80 and one unit of B is Rs. 40. The maximum demand of A is 6 units per
week and of B it is 8 units per week. The manufacturer has set up a goal of
achieving a profit of Rs. 640 per week. Formulate the problem as goal
programing and solve it.
Solution -
Let, x1 and x2 be the no. of units of A & B product per week respectively.
3 possibilities exists.
Goal will be …
i) Exactly achieved (u = 0 and v = 0)
ii) Overachieved (u = 0 and v > 0)
iii) Underachieved (u > 0 and v = 0)
4
𝐷
2 80𝑥1 + 40𝑥2 =640
𝑂 𝐴
0
0 1 2 3 4 5 6 7 8 9 10 𝑥1
MODM
If (x1, x2) falls in DEC, then profit is over and above 640. (u = 0 and v > 0)
If (x1, x2) falls in OADEB, then profit is less than 640. (u > 0 and v = 0)
MODM
Simplex Solution
Minimize Z' = u + v
S.T. 80 x1 + 40 x2 + u – v = 640
x1 + x3 = 6
x2 + x4 = 8
x1 , x2 , u, v ≥ 0
such that either u or v or both equal to zero
Cj 0 0 -1 -1 0 0
CB XB X1 X2 u v X3 X4 RHS Ɵ
-1 u 80 40 1 -1 0 0 640 8
0 X3 1 0 0 0 1 0 6 6
0 X4 0 1 0 0 0 1 8 ---
Cj – Zj 80 40 0 -2 0 0 -640
MODM
Cj 0 0 -1 -1 0 0
CB XB X1 X2 u v X3 X4 RHS Ɵ
-1 u 80 40 1 -1 0 0 640 8
0 X3 1 0 0 0 1 0 6 6
0 X4 0 1 0 0 0 1 8 ---
Cj – Zj 80 40 0 -2 0 0 -640
X1 enters ; X3 leaves ; u = u – 80 X1 ; X4 = X4
-1 u 0 40 1 -1 -80 0 160 4
0 X1 1 0 0 0 1 0 6 ---
0 X4 0 1 0 0 0 1 8 8
Cj – Zj 0 40 0 -2 -80 0 -160
X2 enters ; u leaves ; Divide u by 40 to get X2 ; X1 = X1 ; X4 = X4 – X2
0 X2 0 1 1/40 -1/40 -2 0 4
0 X1 1 0 0 0 1 0 6
0 X4 0 0 -1/40 1/40 2 1 4
Cj – Zj 0 0 -1 -1 0 0 0
No positive values in Cj – Zj ⸫ The solution is X1 = 6 and X2 = 4
MODM
Minimize Z' = u + v
S. T. Z + u – v = Goal
σ𝑛𝑗=1 aij xj = bi
u, v, xj ≥ 0
with either u or v or both equal to zero
Solution –
Expressing the given problem in goal problem Adding slack variables, the problem is expressed as
Minimize Z' = u Minimize Z' = u
S.T. 120 x1 + 90 x2 + u – v = 2100 S.T. 120 x1 + 90 x2 + u – v = 2100
6x1 + 3x2 ≤ 90 6x1 + 3x2 + x3 = 90
3x1 + 6x2 ≤ 72 3x1 + 6x2 + x4 = 72
x1, x2, u, v ≥ 0 x1, x2, u, v, x3, x4 ≥ 0
Such that either u or v or both equal to zero. Such that either u or v or both equal to zero.
MODM
Cj 0 0 -1 0 0 0
CB XB X1 X2 u v X3 X4 RHS Ɵ
-1 u 120 90 1 -1 0 0 2100 17.5
0 X3 6 3 0 0 1 0 90 15
0 X4 3 6 0 0 0 1 72 24
Cj – Z j 120 90 0 -1 0 0 -2100
X1 enters ; X3 leaves ; Divide X3 by 6 to get X1 ; u = u – 120 X1 ; X4 = X4 - 3X1
-1 u 0 30 1 -1 -20 0 300 10
0 X1 1 ½ 0 0 1/6 0 15 30
0 X4 0 4.5 0 0 -0.5 1 27 6
Cj – Z j 0 30 0 -1 -20 0 -300
X2 enters ; X4 leaves ; Divide X4 by 4.5 to get X2 ; u = u – 30 X2 ; X1 = X1 – 1/2 X2
-1 u 0 0 1 -1 -16.67 -6.66 120
0 X1 1 0 0 0 0.222 -0.111 12
0 X2 0 1 0 0 -0.111 0.222 6
Cj – Z j 0 0 0 -1 -16.67 -6.66 -120
No positive values in Cj – Zj ⸫ The algorithm terminates. The solution is X1 = 12 ; X2 = 6 and u = 120
MODM
In the previous example, the company sets two equally ranked goals, one to reach a profit goal of Rs. 1500
and other to meet a radio goal of 10. Find the optimal solution.
Solution –
Let, u1 = amount by which the profit goal is underachieved
v1 = amount by which the profit goal is overachieved
u2 = amount by which the radio goal is underachieved
v2 = amount by which the radio goal is overachieved
Goal programming model can be formulated as,
Minimize Z' = u1 + u2
S.T. 120 x1 + 90 x2 + u1 – v1 = 1500
x1 + u2 – v2 = 10
6x1 + 3x2 ≤ 90
3x1 + 6x2 ≤ 72
x1, x2, u1, v1, u2, v2 ≥ 0
Such that either u1 or v1 or both equal to zero
and either u2 or v2 or both equal to zero
MODM
Adding slack variables to assembly & finishing department constraints.
Minimize Z' = u1 + u2
S.T. 120 x1 + 90 x2 + u1 – v1 = 1500
x1 + u2 – v2 = 10
6x1 + 3x2 + x3 = 90
3x1 + 6x2 + x4 = 72
x1, x2, u1, v1, u2, v2, x3, x4 ≥ 0
Such that either u1 or v1 or both equal to zero
and either u2 or v2 or both equal to zero
Cj 0 0 -1 0 -1 0 0 0
CB XB X1 X2 u1 v1 u2 v2 X3 X4 RHS Ɵ
-1 u1 120 90 1 -1 0 0 0 0 1500 12.5
-1 u2 1 0 0 0 1 -1 0 0 10 10
0 X3 6 3 0 0 0 0 1 0 90 15
0 X4 3 6 0 0 0 0 0 1 72 24
Cj – Zj 121 90 0 -1 0 -1 0 0 -1510
X1 enters ; u2 leaves ; Divide u2 by key element to get X1 ; u1 = u1 – 120 X1 ; X3 = X3 - 6X1 ; X4 = X4 - 3X1
MODM
Cj 0 0 -1 0 -1 0 0 0
CB XB X1 X2 u1 v1 u2 v2 X3 X4 RHS Ɵ
-1 u1 0 90 1 -1 -120 120 0 0 300 2.5
0 X1 1 0 0 0 1 -1 0 0 10 ---
0 X3 0 3 0 0 -6 6 1 0 30 5
0 X4 0 6 0 0 -3 3 0 1 42 14
Cj – Zj 0 90 0 -1 -121 120 0 0 -300
v2 enters ; u1 leaves ; Divide u1 by key element to get v2 ; X1 = X1 + v2 ; X3 = X3 - 6v2 ; X4 = X4 - 3v2
0 v2 0 3/4 1/120 -1/120 -1 1 0 0 5/2
0 X1 1 3/4 1/120 -1/120 0 0 0 0 25/2
0 X3 0 -3/2 -1/20 1/20 0 0 1 0 15
0 X4 0 15/4 -1/40 1/40 0 0 0 1 69/2
Cj – Zj 0 0 -1 0 -1 0 0 0 0
No positive values in Cj – Zj ⸫ The algorithm terminates. The solution is X1 = 25/2 ; X2 = 0 and v2 = 5/2
MODM
A company manufactures tables & chairs. Each chair requires 4 man hours of labour
while each table requires 5 man hours of labour. If only 40 man hours are available each
week and the owner of the company would neither hire additional labour nor utilise
overtime, formulate the linear goal programming problem and solve it. Both the table &
chair fetch a profit of Rs. 100 each. The owner has a target to earn a profit of Rs. 2000
per week. Also he would like to supply 10 chairs if possible to a sister concern.
Solution –
The goal of the company and their assigned priorities are,
Priority Goal
1 To avoid hiring extra labour or utilise overtime
2 To reach a profit goal of Rs. 2000 a week
3 To supply 10 chairs a week to the sister concern
MODM
Let x1 and x2 denote the number of chairs and tables to be produced per week
If ui and vi represent the amount by which the ith goal is underachieved or overachieved
20
18
16
14
12 𝑣3
10
𝐺3
8
𝑢3 𝑣2
x1 = 10 ; x2 = 0
6 Zmin = (0, 1000, 0)
𝑣1
4
𝑢2
2
𝑢1
𝐺1 𝐺2
0
0 2 4 6 8 10 12 14 16 18 20 22 24 𝑥1
MODM
The main concept is to break the problems into sub-problems (called stages) and
combine their solutions to get the solution of larger problem.
MODM
The optimal policy must be one such that, regardless of how a particular
state is reached, all later decisions preceding from that state must be
optimal.
45
MODM
Use D.P. to solve the following problem Stage 2 - f2(K2) = min {x22 + f1(K1)}
x3 = K3 / 3 = 15 / 3 = 5
K2 = K3 – x3 = 15 – 5 = 10
x2 = K2 / 2 = 10 / 2 = 5
K1 = K2 – x2 = 10 – 5 = 5
x1 = K1 = 5
⸫ x1 = x2 = x3 = 5 & Z = f3(K3) = 75
47
MODM
Use D.P. to solve the following problem Stage 2 - f2(K2) = max {y2 f1(K1)}
Maximize Z = y1y2y3 = max {y2 K1}
S.T. y1 + y2 + y3 = 5 = max {y2 (K2 – y2)}
y1, y2, y3 ≥ 0 Differentiate w.r.t. y2 and equate it to zero
y2 (–1) + (1) (K2 – y2) = 0 → y2 = K2 / 2
Solution – Substituting the value of y2 in the equation of f2(K2)
State Variables K3 = y1 + y2 + y3 = 5 ⸫ f2(K2) = K2 / 2 (K2 - K2 / 2 ) = K22 / 4
K2 = y1 + y2 = K3 – y3
Stage 3 - f3(K3) = max {y3 f2(K2)}
K1 = y1 = K2 – y2 = max {y3 K22 / 4}
Stage 1 - = max{y3 (K3 – y3)2 / 4}
f1(K1) = max {y1} = K1 Differentiate w.r.t. y3 and equate it to zero
¼ {1 (K3 – y3)2 – y3 2 (K3 – y3)} = 0 → y3 = K3/3
48
MODM
Now, we know that K3 = 5
y3 = K3 / 3 = 5 / 3
K2 = K3 – y3 = 5 – 5 / 3 = 10 / 3
y2 = K2 / 2 = (10 / 3) / 2 = 5 / 3
K1 = K2 – y2 = 10 / 3 – 5 / 3 = 5 / 3
y1 = K1 = 5 / 3
49