Ludecomposition Computerized Method To Solve Linear Programming Problems 2168 9679 1000391
Ludecomposition Computerized Method To Solve Linear Programming Problems 2168 9679 1000391
&C ti
Abdulraheem and Mohammad, J Appl Computat Math 2018, 7:2
Journal of
d
on
ie
DOI: 10.4172/2168-9679.1000391
al M
of Appl
athem
Applied & Computational Mathematics
nal
ISSN: 2168-9679
at
ur
cs i
Jo
Abstract
The purpose of this work is to solve Linear Programming (LP) problems using LU factorization. LU method
is based on the fact that a square matrix can be factorized into the product of unit lower triangular matrix (L) and
upper triangular matrix (U), and the direct solution was obtained without iterations. Three different problem cases
were considered and solved using step-by-step calculations as well as using MATLAB. Results show this method is
superior than the traditional simplex method with cases of cycling.
Keywords: Linear programming; Algorithm; Matrix; Factorization; decomposition is based on the observation that systems of equations
Optimized involving triangular coefficient matrices are easier to deal with [7].
Definition of LU – factorization: If the n×n matrix can be written as the
Introduction product of a lower triangular matrix L and an upper triangular matrix
In mathematical optimization, Danzig’s simplex method (or U, then A=LU is an LU-factorization of A.
simplex algorithm) is popular for linear programming (LP) [1]. LP is Linear programing problem
a technique for solving a large number of maximization/minimization
problems that have the property that the constraints and the objective Linear Equations (LEs): By definition, all equations and inequalities
function are all linear functions of the input variables [2]. It’s widely in a LP must be linear: A linear equation in n variables x1,x2,x3,··· ,xn has
utilized optimization method for solving real-life problems because of the form:
its efficacy. LU-decomposition (where ’LU’ stands for ’lower upper’, a1x1+a2x2+a3x3+...+anxn=b (1)
and also called LU factorization) factors a matrix as the product
of a lower triangular matrix (L) and an upper triangular matrix (U) Where: The coefficients (a’s) are real numbers. The (x’s) are called
was introduced by mathematician Alan Turing in 1948 [3,4]. LU- the variables of the equation. Linear equations and inequalities are
decomposition is basically a modified form of Gaussian elimination. often written using summation notation, which makes it possible to
LU decomposition is an effective procedure for solving LP problems, write an equation in a much more compact form. The linear equation
this method can help in accelerating the computation. Over and above, above, for example, can be written as follows:
the development of computers and software packages has made LU n
decomposition easy and attractive method to solve large-scale LP
problems very quickly. The simplex algorithm can do the job well, but
∑a x
i =1
i i = b (2)
in some scenarios it suffers from what is called iteration cycling [5,6]. where i=1,2,3...n is a counter. The Decision Variables (DVs): The
Cycling is defined as “The phenomenon in which the same sequence variables in a LP are a set of quantities that need to be determined in
of basic feasible solutions is generated repeatedly (indefinitely) by the order to solve the problem. The variables are sometimes called DVs
simplex method [7-9]. In this paper, we use the LU- decomposition because the problem is to decide what value each variable should take.
method to solve this issue. In this method, the objective function is Typically, the variables represent the amount of a resource to use or
considered as a constraint which together with linear inequalities forms the level of some activity. Frequently, defining the variables of the
a system of linear inequalities. Through applying LU-decomposition problem is one of the hardest and/or most crucial steps in formulating
method, we get the exact solution without iterations. For the current a problem as a linear program. The variables will be represented-very
LP problem, three cases were discussed and explained through solving abstractly - as:
numerical examples by LU-decomposition later on in this paper.
X1,X2,...,Xn
Background
LU-decomposition
The LU-decomposition method first “decomposes” matrix A into *Corresponding author: Abdulraheem MZ, Department of Mathematics,
University of Business and Technology, Jeddah, 21361, Saudi Arabia, Tel:+966
A=L.U. More accurately, if A is an n×n matrix, L and U are also n×n 9200 00490; E-mail: [email protected]
matrices with forms like the following:
Received November 29, 2017; Accepted February 26, 2018; Published March
06, 2018
l11 0 0 0 u11 u12 u1n
Citation: Abdulraheem MZ, Mohammad K (2018) LU-Decomposition Computerized
=l21 1 0 0 0 u22 u2 n
L U Method to Solve Linear Programming Problems. J Appl Computat Math 7: 391. doi:
1 0 10.4172/2168-9679.1000391
ln1 ln 2 1 0 0 unn Copyright: © 2018 Abdulraheem MZ, et al. This is an open-access article
distributed under the terms of the Creative Commons Attribution License, which
For the system of equations Ax=b. The motivation for LU- permits unrestricted use, distribution, and reproduction in any medium, provided
the original author and source are credited.
Page 2 of 5
Page 3 of 5
−x1 −2x2+x3+Z ≤ 0 1 − 2 1 1 y1 − x1 − 2 x2 + x3 + z 0
y1
2x1+x2+x3 ≤ 14 0 − 3 3 2 y2
y2 −3x2 + 3x3 + 2 z 14
=
0 0 1 0 = y y3
x3 = 0
4x1+2x2+3x3 ≤ 28 3
8 104
0 0 0 8 z y4 z
3 3 3
2x1+5x2+5x3 ≤ 30
−x1,−x2,−x3 ≤ 0. On simplification we get
−1 − 2 1 1 − x1 − 2 x2 + x3 + z = 0 → x1 = 5 −3 x2 + 3 x3 + 2 z = 14 → x2 = 4
2 1 1 0 8 104
The coefficients Matrix A = We need to find L and U x3= 0 z= → z= 13
4 2 3 0 3 3
2 5 5 0 Case Two: Add the inequalities in the system till number of
inequalities equals the number of variables. We can add the inequalities
1 0 0 0 in the system as below: Consider the first constraint in given linear
l 1 0 0 programming problem.
such that: A=LU, where: L = 21
l31 l32 1 0
a21x1+a22x2+...+a2,n−1x2,n−1 ≤ b2
l41 l42 l43 1
Choose the non-zero coefficient in this inequality a2j 6= 0 and
u11 u12 u13 u14 add the inequality: a21xj ≤ b2 in the system, continuing in this way till
0 u22 u23 u24 number of inequalities reaches to the number of variables.
U = Multiplying out LU and setting the
0 0 u33 u34
The problem is: Maximize: Z=2x1+3x2
0 0 0 u44
Subject to
answer equal to A gives:
x1+x2 ≤ 1
-1 -2 1 1 u11 u12 u13 u14
2110 x1, x2 ≥ 0
l u l u + u l u + u l u + u
A = 21 11 21 12 22 21 13 23 21 14 24
=
4 230 l31u11 l31u12 + l32u22 l31u13 + l32u23 + u33 l31u14 + l32u24 + u34
The system of linear inequalities is:
2 550 l41u11 l41u12 + l42u22 l41u13 + l42u23 + l43u33 l41u14 + l42u24 + l43u34 + u44
−2x1 −3x2 +Z ≤0
Now we have to use this to find the entries in L and U, by running
along the top row to see that: x1 +x2 ≤1
u11 =
−1 u12 =
l21u11 =→
−2
2, l21 = −2 l21u12 + u22 = 1, → u22 =−3
u13 =
1
l21u13 + u23 = 1, → u23 =3
u14 =
1
l21u14 + u24 =0, → u24 =2
+x2 ≤1
l31u11 =4, → l31 =−4 l31u12 + l32u22 =2, → l32 =2 l31u13 + l32u23 + u33 =3, → u33 =1 l31u14 + l32u24 + u34 =0, → u34 =0
l41u 11 =→
2, l41 =
−2 l41u21 + l42u22 =5 → l42 =−
1
l41u13 + l42u23 + l43u33 =5 → l43 =8 l41u14 + l42u42 + l43u34 + u44 =0 → u44 =8
−x1, −x2 ≤0
3 3
−2 −3 1 −2 −3 1
1 0 0 0 -1 -2 1 1 1
-2 1 0 0 0 -3 3 2
In this case U = 0 −1 1 , and U = 0 −1
2 2 2 2
Thus:
= L = ,U now consider: LY=B by
-4 2 1 0 0 0 1 0 0 0 1 0 0 1
-2 -1/3 8 1 0 0 0 8/3 y1 0
now consider LY=B, where
= y2 , B 1
Y =
y1 0
14 y3 1
y2
forward substitution, where
= Y = ,B
1 0 0 y1 0
y3 28
−1
y4 30 2 1 0 y2 = 1 On simplification we get:
1
y1 0 − 2 1 y3
1 0 0 0 y1 0
-2 y 14 −2 y + y y1 = 0
1 0 0 = 2 =
1 2
−4 y1 + 2 y2 + y3
-4 2 1 0 y3 28 −1
1 y1 + y2 =1 → y2 =1
−2 y − y + 8 y + y 2
-2 -1/3 8 1 y4 30 1 2 3 4
3 −2 y2 + y3 =1 → y3 =3
x1
The two matrices are equal, on simplification we get: Finally, we will find the matrix
X = x2
z
Page 4 of 5
−2 − 3 1 −2 x1 − 3 x2 + z 0
x1 0
[L,U]=lu(A) %LU decomposition applied with Matlab
by solving the equation: UX Y= −1 1 −1 1
= 0 2 2 x2 =1 = 2 x2 + 2 z =1 Y=L\b %Forward substitution to find the value of Y.
0 0 1 z 5 3 z 3
On simplification we get X=U\Y %Back substitution to find the values of X.
−2 x1 − 3 x2 + z = 0 → x1 = 0 Solution:
−1 1 L =[-0.2500 -0.3750 1.0000 0
x2 + z =1 → x2 =1
2 2 0.5000 0 -0.1633 1.0000
z =3
1.0000 0 0 0
Case three: If there is less numbers of variables than that of
inequalities, then we introduce that much number of slack variables in 0.5000 1.0000 0 0]
the appropriate inequalities.
U =[4.0000 2.0000 3.0000 0
Problem
0 4.0000 3.5000 0
Maximize: Z=f(x1,x2)= 3x1+2x2
0 0 3.0625 1.0000
Subject to:
0
0 0 0.1633]
2x1+x2 ≤ 18
Y=[28.0000 ; 16.0000; 13.0000 ; 2.1224]
2x1+3x2 ≤ 42
X=[5 ; 4 ; 0 ; 13 ] % In this case x1=5m x2 =4 and Z=13
3x1+x2 ≤ 24
Case II
x1,x2 ≥ 0
A=[ -2 -3 1 ; 1 1 0 ; 0 1 0]
System of linear inequalities
b=[0 ; 1 ; 1]
−3x1 −2x2+Z ≤ 0
Solution
2x1+x2+x3 ≤ 18
L =[1.0 0 0; -0.50 -0.50 1.00; 0 1.00 0]
2x1+3x2 ≤ 42
U =[-2.0 -3.0 1.0; 0 1.0 0; 0 0 0.5000]
3x1+x2 ≤ 24
Y =[0 1.0000 1.5000]
−x1,−x2,−x3 ≤ 0.
X= [0 1 3]
Following the proposed methodology, we get the following
solution: x1=3,x2=12, and Z=33, solution using MATLAB will be Case III
provided in the later on. A=[ -3 -2 1 0 0
Computerized Solution of Lu Factorization 21010
To test the efficiency of the proposed approach i.e. LU Factorization, 23001
MATLAB 2014 was used. MATLAB has a set of useful functions for 31000
linear programming such as ‘Linprog’ function. However we will be
following a similar approach to the proposed methodology. A small 0 0 0 -1 0]
difference exists in the final steps as presented below. To demonstrate
b=[ 0; 18 ; 42 ; 24 ;0]
the approach Case 1 will be used. The matrix of coefficients 0A0 and
the right hand side of the system 0b0 are inputted. Then the function Solution
lu will be utilized. This function creates the lower and upper matrices.
0 0
L=
Final two steps include using the back slash of MATLAB which applied
matrix left division to find the value of matricesY and X, respectively. 1.0000 0 0 0 0
The final solution i.e. Z value can be found from the X matrix.
-0.6667 -0.2000 0.5714 1.0000 0
Case I
-0.6667 1.0000 0 0 0
Solution by MATLAB
-1.0000 -0.6000 1.0000 0 0
A=[ -1 -2 1 1
0 0 0 -1.0000 -1.0000
2110
U=
4 2 3 0 %Matrix A is defined, the last column represents has the
-3.0000 -2.0000 1.0000 0 0
objective
0 1.6667 0.6667 0 1.0000
2 5 5 0]; %function
0 0 1.4000 0 0.6000
b=[0 ; 14 ; 28 ; 30]; % The vector of Right hand side values
Page 5 of 5
-0.0083 1.0000 0 5. Zornig P (2006) Systematic construction of examples for cycling in the simplex
method. Computers & Operations Research 33: 2247–2262.
-0.0167 0.1887 1.0000 6. Hoffman A J (2003) Cycling in the simplex algorithm. Sel. Pap. Alan Hoffman
with Commentary.177.
u=-3.0000 -2.9500 50.0000 0.4000 1.0000
7. Larson R, Edwards B, Falvo D (2004) Elementary linear algebra.
0 -0.0221 3.4167 2.0033 0.0083
8. Taha HA (2007) Operations research: An Introduction. 557.