0% found this document useful (0 votes)
76 views5 pages

Ludecomposition Computerized Method To Solve Linear Programming Problems 2168 9679 1000391

Problems LU Descpmposition

Uploaded by

TalianaAlarcón
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views5 pages

Ludecomposition Computerized Method To Solve Linear Programming Problems 2168 9679 1000391

Problems LU Descpmposition

Uploaded by

TalianaAlarcón
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

omputa

&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

Research Article Open Access

LU-Decomposition Computerized Method to Solve Linear Programming


Problems
Abdulraheem MZ* and Mohammad K
Department of Mathematics, University of Business and Technology, Jeddah, Saudi Arabia

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.

J Appl Computat Math, an open access journal Volume 7 • Issue 2 • 1000391


ISSN: 2168-9679
Citation: Abdulraheem MZ, Mohammad K (2018) LU-Decomposition Computerized Method to Solve Linear Programming Problems. J Appl Computat
Math 7: 391. doi: 10.4172/2168-9679.1000391

Page 2 of 5

The Objective Function: The objective of a LP problem will be to Z − (c1 x1 + c2 x2 +  + cn −1 xn −1 ) ≤ 0


maximize or to minimize some numerical value. The objective function
a21x1 + a22 x2 +  + a2, n −1 x2, n −1 ≤ b2
indicates how each variable contributes to the value to be optimized in
solving the problem. The objective function takes the following general a31x1 + a32 x2 +  + a3,n −1 x3, n −1 ≤ b3
form: (9)
    
n an1 x1 + an 2 x2 +  + an , n −1 xn , n −1 ≤ bn
Maximize or Minimize: Z = ∑c x =
i =1
i i c1 x1 + c2 x2 + ... + cn xn (3)
− x1 − x2  − xn −1 ≤0
Where: ci is the objective function coefficient corresponding to the ith Consider the system of n linear equations in variables: AX=B, such
variable, and xi is the ith decision variable. The Constraints: Constraints that:
are the possible values that the variables of a LP problem may take.
They typically represent resource constraints, or the minimum or  a11 a12  a1 , n − 1 0 
 
maximum level of some activity or condition. They take the following  a21 a22  a2, n − 1 0 
general form: Subject to: = A  a31 a32  a3 , n − 1 0 
 
n     0 
∑ i =1
a j ,i X i ≤ b j (4)
a a 
 n1 n 2 an , n −1 0 
a1i =−ci,1≤i≤n−1
where:
 x1   0 
j=1,2,3,··· ,m and i=1,2,3...n xi is the ith decision variable, aj,i is the    b 
coefficient on Xi in constraint j , and finally bj is the right-hand-side  x2   1 
coefficient on constraint j.  x3   b2 
= X =  B   In this way, the objective function is
The Non-negativity Constraints: The variables of LP must always    
take non-negative values (they must be greater than or equal to zero). x   b 
 n −1   n −1 
The non-negativity constraints are part of all LP formulations, and
 Z  b n 
always included in an LP formulation. They are written as follows:
considered as a constraint and z is considered as a variable.
Xi ≥ 0,i=1,2,3,...,n.
1 0  0 0  u11 u12  u1n 
LP problem-standard form l 1  0 0   0 u  u 
= A  21  × 22 2n 
An LP problem is in standard form if it seeks to maximize the    1 0      
objective function subject to the constraints:    
ln1 ln 2   1 0 0  unn 
Z=a1x1+a2x2+...+anxn (5)
When we obtained an LU – decomposition of a matrix A, we
Subject to the constraints: can solve the system of n linear equations in n variables AX=B very
a11x1 + a12 x 2 + ... + a1nxn ≤ b1 effectively in the following two steps:
a 21x1 + a 22 x 2 + ... + a 2nxn ≤ b 2
(6) i. Forward substitution: Write Y=UX and solve LY=B for Y, it
 starts at the top of the matrix, because L is lower triangular matrix.
am1x1 + am 2 x2 + ... + amn xn ≤ bn
ii. Back substitution: Solving UX =Y for X, the matrix U is
Where xi ≥ 0, and bi ≥ 0. upper triangular The column matrix X is the solution of the originated
system because: AX=LUX=LY=B .
Methods
Numerical Examples Explanation
Consider the following LP problem: The objective is to Maximize
For the current LP problem in this paper, three cases were
n −1 (7) considered.
Z= ∑c x = i i c1 x1 + c2 x2 + ... + cn −1 xn −1

i =1 Case One: The number of inequalities is equal to the number of


variables.
Subject to:
Case Two: The number of inequalities is less than the number of
a21x1 + a22 x2 +  + a2, n −1 xn −1 ≤ b2 variables.

a3 x1 + an 2 x2 +  + a3, n −1 xn −1 ≤ b3 Case Three: The number of variables is less than the number of
 (8) inequalities.
∑i=2 i i i 
n
a x ≤ ~ b 
a x + a x +  + a If there is a zero row in U, then the presented LP problem has an
n , n −1 xn −1 ≤ bn
 n1 1 n 2 2
 infeasible solution, thus, the process can be stopped.
 x 1 , x2 ,  , xn −1 ≥ 0
Case One: In this case LU factorization is applied to the system of
To find Z, we will rewrite the above LP problem in the form of less linear equations: AX=B. Firstly, we get the matrix as an initial iteration
than or equal (≤) inequalities as follows: and then the matrix as final iteration. Maximize: Z=x1+2x2 −x3 Subject

J Appl Computat Math, an open access journal Volume 7 • Issue 2 • 1000391


ISSN: 2168-9679
Citation: Abdulraheem MZ, Mohammad K (2018) LU-Decomposition Computerized Method to Solve Linear Programming Problems. J Appl Computat
Math 7: 391. doi: 10.4172/2168-9679.1000391

Page 3 of 5

to the constraints: y1 = 0 − 2 y1 + y2 = 14, → y2 = 14


2x1+x2+x3 ≤ 14 1 104
−4 y1 + y2 + y3 = 28, → y3 = 0 − 2 y1 − y2 + 8 y3 + y4 =
3 3
4x1+2x2+3x3 ≤ 28
 x1 
2x1+5x2+5x3 ≤ 30 x1,x2,x3 ≥ 0  
x
Finally, we will find the matrix  2  to solve UX+Y by back
 x3 
To solve this case by LU Factorization Method, we will write the LP substitution:  
Problem as follows:  z 

−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 

J Appl Computat Math, an open access journal Volume 7 • Issue 2 • 1000391


ISSN: 2168-9679
Citation: Abdulraheem MZ, Mohammad K (2018) LU-Decomposition Computerized Method to Solve Linear Programming Problems. J Appl Computat
Math 7: 391. doi: 10.4172/2168-9679.1000391

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

J Appl Computat Math, an open access journal Volume 7 • Issue 2 • 1000391


ISSN: 2168-9679
Citation: Abdulraheem MZ, Mohammad K (2018) LU-Decomposition Computerized Method to Solve Linear Programming Problems. J Appl Computat
Math 7: 391. doi: 10.4172/2168-9679.1000391

Page 5 of 5

0 0 0 1.0000 -0.1429 0 0 -0.3113 -0.2913 0.0151


0 0 0 0 -0.1429 y =[
0 0 0]
Y=[0 42 49.2 -1.7143 -1.7143 ] x =[
0 0 0 0 0]
X=[6.0 6.0 30.00 0 12.00 ] This result is obtained without iterations, and the optimal solution
is reached directly.
It should be noticed in MATLAB the A matrix can be a rectangular
matrix i.e. with a dimension of m rows and n columns. Numerically, it Conclusion
is shown that non-square matrices don’t limit the applicability of this
method. Comparing to the complex algorithm, LU factorization method
has simple and lesser computations. LU factorization method becomes
A Case with Cycling very mechanistic after practice and the algorithm used is very compact.
Moreover, cycling is not an issue for LU Decomposition. LU method
As mentioned earlier in the introduction, Cycling is one of the
is as more efficient than the simplex algorithm. Support these results.
main limitations in Simplex. The authors are aware that his problem is
Remarkably, LU is an effective method in practice, particularly when
addressed by many researchers. In this section one example from the
the scale of the problem is small. In LU factorization method, the slack
work of Zornig will be solved using the proposed LU-decomposition
variables only if the number of variables is less than the number of
methodology. This particular problem cycles every 4 iterations to its
inequalities, this not shown to be a problem when using MATLAB.
initial form.
59 2 One limitation of this approach is that there are scenarios the LU
Maximize: Z =3 x1 + x − 50 x3 − 0.4 x4 s.t
20 factorization did not work properly. In such cases, a new row is added
1 1 with one of the following constraints: xi ≥ 0 until the solution provides
x1 + x2 + 3 x3 + 2 x4 ≤ 0 all decision variables are non-negative.
40 400
1 9 2 References
x1 + x2 − 0.5 x3 + x4 ≤ 0
20 200 25 1. Murty KG(1983) Linear programming. John Wiley and Sons. p: 512.

x1 , x2 x3, x4 ≥0 2. Darst R (1990) Introduction to linear programming: applications and extensions.


p: 141 .
Applying the proposed approach by MATLAB the following is
3. Poole D (2014) Linear algebra: A Modern Introduction.
obtained:
4. Turing A (1948) Rounding-off errors in matrix processes. The Quarterly Journal
l=1.0000 0 0 of Mechanics and Applied Mathematics 1: 287-308.

-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.

9. Dantzig GB, Thapa MN (2006) Linear programming 2: Theory and Extensions.


Springer Science & Business Media.

J Appl Computat Math, an open access journal Volume 7 • Issue 2 • 1000391


ISSN: 2168-9679

You might also like