An Algorithm for Simplex Tableau Reduction

advertisement
An Algorithm for Simplex Tableau Reduction
Algoritem za zmanjšanje tabele simpleksov
Talib Damij1 and Janez Grad2
1
2
University of Ljubljana Faculty of Economics, Kardeljeva ploščad 17, 1000 Ljubljana, Slovenia (e-mail:
talib.damij@uni-lj.si)
University of Ljubljana School of Public Administration, Gosarjeva ul. 5, 1000 Ljubljana, Slovenia (e-mail:
janez.grad@vus.uni-lj.si)
Povzetek: Standarna metoda simpleksov je iteracijski postopek za reševanje LP, ki uporablja t. i. tabelo
simpleksov za predstavitev in shranjevanje vrednosti vseh spremenljivk (vhodnih, dopolnilnih in
umetnih) linearnega modela.
Na vsakem koraku iteracijskega postopka reševanja LP se vrednosti v celotni tabeli simpleksov
transformirajo v nove vrednosti, kar zahteva mnogo računalniškega pomnilnika. Zaradi tega se v
programskih rešitvah uporablja revidirana metoda simpleksov, ki nima tovrstnih zahtev.
V tem prispevku je predstavljen algoritem, ki tabelo simpleksov zoži na obseg vhodne matrike
linearnega modela. Hkrati pa s tem algoritem na vsakem koraku iteracije izvede hitrejšo transformacijo
spremenljivk v tabeli, kar je njegova pomembna dodatna značilnost v postopku reševanja LP.
Abstract The simplex method is an iterative process which uses a simplex tableau to store all the
variables of a linear model. The whole tableau has to be stored and transformed at each iteration. This
fact requires a large amount of computer storage. For this reason, it is the revised simplex method
rather than the standard simplex method that is used in computer programs for solving LP problems.
This work introduces an algorithm, which is capable of reducing a simplex tableau to the dimensions of
the input matrix of the linear model discussed. Using this algorithm also means a faster transformation
of simplex tableau at each iteration, which is important in solving linear programming problems.
Key Words: Linear Programming, Simplex, Algorithm
1. Introduction
The simplex method is the most general method used for numerical solution of linear programming
problems or LP problems. With this method any LP problem with an optimal solution can be solved,
which is of great importance for the method itself, as well as its use in different optimization problems
in economies and industry. The simplex method is in fact an iterative process well suited to computer
processing, yet applied to large problems it is a great computer storage consumer. The method is often
introduced in so-called simplex tableau form in which all the variables need to be included and the
whole tableau calculated and stored at each iteration. This approach requires quite a large amount of
computer storage and this is one of the main disadvantages of this method. Therefore users prefer to
choose other methods which are more complex but use a smaller amount of storage, as for example the
revised simplex method (RSM), where no such computations are needed.
Within each iteration of RSM two systems of linear equations have to be solved. The efficiency of the
RSM depends on the approach of implementing this task in each iteration [1]. On the large sparse
problems an iteration of the RSM takes less time than an iteration of the standard simplex method. The
sparsity and the special structure of data that can be exploited within the RSM make the RSM superior
against the standard simplex method. However, it would be wrong to believe that the RSM is always
faster than the standard simplex method. An iteration of the RSM can take longer than an iteration of
the standard simplex method whenever the basis matrix is completely dense [1].
In this paper we show how the simplex process can be modified and thereby its storage requirements
reduced to the amount needed only for the input matrix of the set of linear inequalities. Accordingly,
the simplex method is presented only to the extent needed to follow the simplex tableau reduction
process, while a detailed description of the theoretical foundations of this method can be found in [1],
or other publications.
2. General Simplex Method
2.1. Definition of the LP problem
In this paper we restrict ourselves to an LP problem of the following form:
s
c x
minimize
j
j1

s
subject to
a
j1
j
ij
x j  b i ; i  1,..., m

(1)
x j  o ; j  1,..., s
where xj are unknown variables, and bi are non-negative. By introducing slack variables xj; j = s+1,..., d
and artificial variables xj, j = d+1,..., d+m, into (1), and stating that n = d+m, we get the form
minimize
subject to
cx
Ax=b
x≥o
(2)
where c and x are vectors of order n, b is a vector of order m, and A is a (m x n) matrix. Furthermore, c j
= o, j = s+1,..., d and cj = M, j = d+1,..., n, where M is a prescribed large enough value. The LP
problem (2) can be further rewritten in the form
minimize
cx
n
subject to
x
j 1
j
p j  po
(3)
xo
where po = b, and pj = [a1j, a2j,..., amj]T with pd+1 = [1,o,...o]T,..., pn = [o,o,...,1]T.
Note that for the sake of convenience here we name the slack variables related to the ≤ type of
inequalities in (1) artificial variables.
3. The Algorithm
3.1. Initialization – determination of the initial basis, i.e. basic variables
State A in (2) as
A = [F, D, B]
where F is the matrix of input vectors p j, j = 1,..., s, D is the matrix of slack vectors pj, j = s+1,..., d, and
B is the (unity)identity matrix composed of basis vectors, i.e. the artificial vectors p j, j = d+1,..., n. For
the elements dij of D we have dii = -1, and dij= o, for i ≠ j.
This means that the column vectors composing D and B and the corresponding components c j of the
objective function are prescribed in advance and we may confine ourselves to the LP solving process
carried out only on matrix F. Namely, matrix B is only needed for defining the initial basis. Regarding
matrix D, at each iteration we define one of its vectors, say p r, transform it and store it in F to replace p k
that enters the basis. pr may enter the basis at some later stage of the iteration process. From the
computational point of view this means less computer storage for storing the simplex tableau and less
computer time for its transformation. Therefore in the algorithm A, i.e. F, is defined as an m x s matrix.
The initialization process proceeds as follows.
(i)
read m, s, (cj, j = 1,..., s), (bi, i = 1,..., m), ((aij, i =1,..., m), j = 1,..., s), M
(ii)
Build a vector q of order m with components q i = type of the i–th constraint of (1), i.e. “≥”,
“=” or “≤”: read (qi, i = 1, 2, ... m).
(iii)
Compute the values of d and n defined in 2.1;
d=s
for i = 1 to m
if (qi = “≥”) then
d=d+1
end if
end for
n=d+m
(iv)
Create vectors vB and cB involving subscripts of the basic vectors within the simplex tableau
and the corresponding coefficients of the objective function, respectively:
for i = 1 to m
v iB  d  i
c iB  M
end for
(v)
Create vectors v and c involving subscripts of the input and artificial vectors within the
simplex tableau, and the corresponding coefficients of the objective function, respectively:
for i = 1 do d
vi = i
if (i > s) then
ci = o
end if
end for
3.2. Successive improvements of feasible solutions towards an optimal solution
3.2.1.
(i)
Definition of vector pk that enters the new basis
Compute zo, zj and zj – cj, for j = 1,..., s, where zo is the value of the objective function and zj
stands for pj expressed by basis vectors:
for j = 1 to s
zj = o
for i = 1 to m
z j  z j  c iB  a i, j
end for
InBase = True
for i = 1 to d
if (j = vi) then
InBase = False
exit for
end if
end for
if (Not InBase) then
zj = z j – c i
else
zj = o
end if
end for
zo = o
for i = 1 to m
z o  z o  c iB  p io
end for
(ii)
Define k of vector pk that enters the basis
z k  max z j , for z j  o
a)
1 js
If no zj > o, j = 1,..., s, then the existent solution is the optimal solution and the process is
stopped.
b) for i = 1 to d
if (k = vi) then
h=i
exit for
end if
end for
Namely, subscript i of vi = k shows the real location of the pivot column within A [1].
3.2.2.
Definition of pr that leaves the existent basis
Subscript r defines the pivot row within A [1].
Search for subscript r satisfying

o
p or
po
 min i , for a ik  o
a rk
1i  m a ik
(4)
Three possibilities occur:
(i)
There exists one and only one value of r among i, where 1 ≤ i ≤ m, so that (4) holds.
Then
u  v Br shows the real location of pr (=pu) that leaves the basis, and r shows the pivot
row;
u  v Br
The process continues at 3.2.3.
(ii)
There exists no aik > o, for i = 1, 2,..., m. In this case the problem is unbounded and the
process is stopped;
(iii)
If (4) is true for more than one value of r, then the case of degeneracy occurs, and the process
continues as follows:
Degeneracy.
In case of degeneracy we iteratively, for j = 1, 2,..., d, divide the components of vector p j by the
elements of A in the k-th column, and search for
 . The process stops when  and pr have been
found and defined.
e=1
for g = 1 to d
(i)
if (vg < o) then
COMMENT. In this case pj is one of the basis vectors.
j = -vg
a) Build a vector p with its components pi = o, i = 1,..., m, i ≠ j, and p j = 1.
b) Search for subscript r satisfying
o    min p i / a ik  p r / a rk , for a ik  o
1i  m
(ii) else if (vg ≤ s) then
COMMENT. In this case pj is the j-th column vector of A.
j = vg
Search for subscript r satisfying
o    min a ij /a ik  p r / a rk , for a ik  o
1i  m
(iii) else if (vg ≤ d) then
COMMENT. In this case pj is one of the slack vectors.
a) Define subscript j by the following procedure
for i = e to m
if (qi = “≥”) then
e=i+1
j=i
exit for
end if
end for
b) Build a vector p with its components pi = o, i = 1,..., m, i ≠ j, and p j = -1.
c)
Search for subscript r satisfying
o    min p i / a ik  p r / a rk , for a ik  o
1i  m
end if
(iv) if (  is True for one and only one i, 1 ≤ i ≤ m) then
COMMENT. In this case pr has been defined.
u  v Br
exit for
end if
end for
3.2.3. Transformation of vector po and matrix A, i.e. vectors pj, j = 1, 2,..., s
Compute
(i)
p or  p or / a rk
(ii)
for j = 1,..., s, j ≠ k
arj = arj / ark
for i = 1,..., m, i ≠ r
(iii)
p io  p io - p or  a ik
and
a ij  a ij - a rj  a ik , for j  1,..., s, j  k
3.2.4.
Storing pr into pk in A for possible further use in the iteration process.
Set
cbr  c Br ;
v Br  h;
c Br  c h ;
v h  - r;
The value –r in vh shows column r with the basis vector ph in it.
Now the exchange and replacement of column vectors in A takes place.
At the beginning of the problem solving process, matrix A has the same structure as matrix F, i.e. it
consists of vectors pj corresponding to the input variables xj, j = 1,..., s. At each iteration some defined
exchange and replacement of vectors of A occurs. This is done in order to attain the following
objectives:
- to exploit the storage capacity within A taken by p k, after pk has been transformed into a form with
p ik  o, i  1,..., m, i  k, and p kk  1
-
to save the necessary characteristics of the slack vector pr that are needed for its possible later use
as a pivot column vector pk
-
to save the necessary characteristics of vector pr that has left the basis, in case pr is not an artificial
vector
The process of replacement of pk by pr is as follows:
(i)
if (qr = “≥” and cbr = M) then
COMMENT. In this case vector pr is an artificial vector and is erased as it cannot return into
the basis. A slack vector ps+r is built up to the position of an auxiliary vector p, then
transformed in accordance with the particular iteration and stored in the k-th column of A.
a) Build up ps+r within an auxiliary vector p, where pi = o, i = 1,..., m, i ≠ r, and p r = -1
b) Transform components of p accordingly:
pr = pr / ark
p i  p i - p r  a ik , i  1,..., m, and i  r
c)
Store p into the k-th column of A:
a ik  p i , i  1,..., m
d) Mark up the location of ps+r by storing value k into the r+s-th component of vector v:
vr+s = k
(ii) else if (qr = “=” or “≤” and cbr = M) then
COMMENT. Vector pr is an artificial vector and is no longer used within the process after
leaving the basis.
ark = 1
aik = o,
i = 1,..., m, i ≠ r.
(iii) else if (cbr < M) then
COMMENT. In this case u = vB shows the real location (column) of p r (=pu) that leaves the
basis. pu is a basis vector with its components
p iu  o, i  1,..., m, i  r , and p ur  1 . In
addition, pu is not one of the artificial vectors and can again enter the basis in later stages of
the iteration process. Therefore it is transformed accordingly and saved in the location of p k
within A.
a) Build up pu within an auxiliary vector p, where pi = o, i = 1,..., m, i ≠ r, and pr = 1.
b) Transform components of p accordingly:
pr = pr / ark
pi  p i - p r  a ik , i  1,..., m, and i  r
c)
Store p in the k-th column of A:
aik = pi, i = 1,..., m
d) Mark up the location of pu by storing k in the u-th component of vector v: vu = k
end if
(iv)
Continue the process at 3.2.1.
4. Example
Minimize
2X1  6X 2  8X 3  5X 4
Subject to
4X1  X 2  2X 3  2X 4  80
2X1  5X 2
 4X 4  40
2X 2  4X 3  X 4  120 , where X j  o, j  1,..., 4
and in accordance with (2)
4X1  X 2  2X 3  2X 4 - X 5  X 6
2X1  5X 2
 4X 4
2X 2  4X 3  X 4
4.1. Initialization – determination of the initial basis
(i)
Read the input data:
m (=3), s (=4), c, b, A, M (=10)
(ii)
Read q, i.e. q = [“≥”, “≤”, “=”]
(iii)
Compute
d=5
n=5+3=8
(iv)
Create
 80
 X7
 40
 X8
 120
vB = [6, 7, 8]
cB = [10, 10, 10]
(v)
Create
v = [1, 2, 3, 4, 5]
c = [2, 6, 8, 5, 0]
4.2. Successive improvements of feasible solutions. Iteration 1
Definition of vector pk that enters the basis
4.2.1.
(i)
vB
cB
k
A
6
10
p6
80
4
1
2
2
10
p
7
40
2
5
0
4
p
8
120
0
2
4
1
zo
2400
58
74
52
65
7
8
po
10
zj-cj
z2 – c2 = 74,
(ii)
k = 2,
4.2.2.
Definition of vector pr that leaves the basis
r
v
1
2
3
4
5
c
2
6
8
5
0
h=2
  40/5  8, r  2, u  v B2  7
4.2.3.
Transformation of po and pj, j = 1,..., s
po
6
4.2.4.
A
p
p2
72
8
18/5
2/5
1
5
2
0
6/5
4/5
p8
104
-4/5
2
4
-3/5
Storing pr in pk for possible use in the iteration process
Set
cbr  c B2  10
v B2  2
c B2  6
v2  - 2
As
q2 = “≤” and cbr = 10
pr is an artificial vector and is no longer used in the process. Store a unit vector into p k = p2.
4.3. Iteration 2
4.3.1.
(i)
vB
6
2
8
cB
po
10
6
10
k
A
18/5
0
2
6/5
8
2/5
1
0
4/5
104
-4/5
0
4
-3/5
142/5
0
52
29/5
p
72
p
2
p
8
zo
(ii)
p2
6
k = 3,
1808
zj-cj
z3 – c3 = 52,
r
v
1
-2
3
4
5
c
2
6
8
5
0
h=3
4.3.2.
  104/4  26, r  3, u  v 3B  8
4.3.3.
po
A
6
p
p2
20
8
4
2/5
0
1
2
0
3/2
4/5
p3
26
-1/5
0
4
-3/20
4.3.4.
cbr  c 3B  10
v 3B  3
c B3  8
v3  - 3
q3 = “=” and cbr = 10
As
pr is an artificial vector and is no longer used in the process. Store a unit vector in p k = p3.
4.4. Iteration 3
4.4.1.
(i)
vB
cB
po
p3
k
6
20
A
6
10
p
4
0
0
3/2
2
6
p2
8
2/5
1
0
4/5
8
3
26
-1/5
0
1
-3/20
zo
456
194/5
0
0
136/10
3
p
zj-cj
(ii) k = 1, z1 – c1 = 194/5, h = 1
4.4.2.
  20/4  5, r  1, u  v1B  6
r
v
1
-2
-3
4
5
c
2
6
8
5
0
4.4.3.
po
p
A
1
5
4
0
0
3/8
2
6
27
2/5
-1/5
1
0
0
1
13/20
-3/40
p
p3
4.4.4.
cbr  c1B  10
v1B  1
c1B  2
v1  - 1
q1 = “≥” and cbr = 10
As
a slack vector ps+r = p5 is built up and stored in pk = p1:
p5
p5
-1
(a)
p1
-1/4
0
0
(b)
2/20
-1/20
(c)
A
-1/4
0
0
3/8
2/20
-1/20
1
0
0
1
13/20
-3/40
(d)
v5 = 1
4.5. Iteration 4
4.5.1.
(i)
vB
1
cB
2
po
p
1
2
A
5
-1/4
0
0
3/8
2
6
p
6
2/20
1
0
13/20
v
-1
-2
-3
4
5
3
8
p3
27
-1/20
0
1
-3/40
c
2
6
8
5
0
zo
262
-3/10
0
0
-19/20
(ii)
zj-cj
No zj – cj, j = 1,..., s is greater than zero. Therefore the obtained solution is the optimal
solution, and the process ends.
5. Conclusion
Using the algorithm introduced above leads to the reduction of simplex tableau. This means a smaller
amount of computer storage is needed to store the tableau and also a faster transformation of simplex
tableau at each iteration. This fact could be very important particularly in solving large problems of
linear programming.
References
1. Chvatal V (1983) Linear Programming. W. H. Freeman and Company, New York
2. Vadnal A (1971) Solved Problems of Linear Programming. Sigma, Ljubljana, Slovenia
Download