W
-
2
L//ieorP/oqra
n
n
l
i
i
/ S im p l e x M e t h o d
• Simt:lc-x: A linear-programming algorithm that can
solve problems having more than two decision
variables.
• The simplex technique involves generating a series
of solutlons in tabular form, called tableaus. This
process continues as long as a positive (negative) rate
of”profit (cost) exists.
• The simplex method is an iterative algorithm (a
systematic solution procedure ihat keeps repeating a
fixed series of steps, called, an iteration.
i
n
e
a
r
P
r
o
g
r
a
m
m
i
n
g S.a.k Variables
•A mathematical representation of surplus
resources.” In real life problems, it's unlikely that
all resources will be used completely, so there
usually are unused resources.
• Slack variables represent the unused resources
between the left-hand side and right-hand side
of each inequality.
5.
Simplex algorithm
Initialization: sempto start iterations,
including
finding an initial
solution
Optimality test: is the current solution
optimal?
if no if yes stop
6.
The simplex methodin tabular
form
1. Initialization:
a.transform all the constraints to equality by
introducing slack, surplus, and artificial variables as
follows:
Consti‘aint type Variable to bc
added
+ slack (s)
—Surplus (s) + artificial
(A)
7.
Basic
varlable
X; X„ S;S„ A . . .. A, RHS
S
Coefficient of the constraints
b l
A
Z Objective function coefficient
In different signs
Z
valrte
Simplex method in tabular form
b. Construct the initial simplex
tableau
8.
Simplex method intabular
form
2. Test for optimality:
Case : Maximization problem
the current basic feasible solution is optimal
if every coefficient in the objective function
row is negative
Case 2: Minimization problem
the current BF solution is optimal if every
coefficient in the objective function row
is positive.
9.
›
a
a
.r
ptex method intabular form
3. Iteration
Step l: determine the entering basic variable by
selecting the variable (automatically a nonbasic
variable) with the most negative value (in case of
maximization) or with the most positive (in case
of minimization) in the last row (Z-row). Put
a box around the column below this variable, and
call it the “pivot column”
10.
) 6 ’’
I
O
’a
.mp ix method in tabular form
Detennine the leaving basic variable by applying
the minimum ratio test as following:
• Step 2:
1.Pick out each coefficient in the pivot column that is
strictly positive (>0)
2. Divide each of these coefficients into the right hand
side
entry for the same row
3. Identify the row that has the smallest of these ratios
4.The basic variable for that row is the leaving variable, so
replace that variable by the entering variable in the basic
variable column of the next simplex tableau. Put a box
around this row and call it the “pivot row”
11.
6 ’ce
’ simplexmethod in tabular form
• Step 3: Solve for the new BF solution by using
elementary row operations (multiply or divide a row
by a nonzero constant; add or subtract a multiple of one
row to another row) to construct a new simplex tableau,
and then remrn to the optimality test. The specific
elementary row operatlons are:
Dlvide the pivot row by the “pivot number (the number
in the intersection of the pivot row and pivot column)
For each other row that has a negative coefficient in the
pivot column, add to this row the product of the absolute
value of this coefficient and the new pivot row.
For each other row that has a positive coefficient in the
pivot column, subtraci from this row the product of the
absolute value of this coefficient and the new pivot row.
12.
Simplex method
• Example(All constraints are <)
Solve the following problem using the simplex method
• Maximize
Z = 3X l + 5X2
Subject to
XP :i 4
2 X2 :i 12
3X; +2X2 :?
18
Xi
X2 s
13.
Simplex method
• Solution
•Initialization
Standard form
Maximize Z,
Subject to
Z - 3X -
5X2
= 0
X, + S1
2 X2
3X +2X2
X, ,
X , S
+ S2
= 4
12
+ S3
18
14.
2. Initial tableau
vai•i•ib1e
S1
Pivot
column
Leavin
g
variable
Initial tableau
Enterin
g
variabl
e
S S,
S, RHS
Pivot
number
Pivot row
l8
15.
a
( * ’’s:xpIex
tableau
Notes:
• The basic feasible solution at the initial tableau
is (0, 0, 4, 12, 18) where:
X, = 0, X2 = 0, S1 — 4, S2 — 12, S3 = 18, and Z —
0
Where SI , S2, and S are basic
variables XI and X2 are nonbasic
variables
• The solution at the initial tableau is associated
to the origin point at which all the decision
16.
Optimality
test
• By investigatingthe last row of the initial
tableau, we find that there are some negative
numbers. Therefore, the current solution is not
optimal.
17.
I inea P
r
o
g
r
a
mm
i
i
›
g
i t e ra t i o n
• Step 1: Determine the entering variable by
selecting the variable with the most negative in
the last row.
• From the initial tableau, in the last row (Z row),
the coefficient of X, is -3 and the coefficient of
X2 is -5; therefore, the most negative is -5.
consequently, X2 is the entering variable.
• X2 is surrounded by a box and it is called the
pivot column
Basic
variable
X1 X2 S;St J3 RHS
S'
• Step 3: solving for the new BF solution by using
the eliminatory row operations as following:
i New pivot row = old pivot row :
— pivot number
Note that X becomes in the
basic variables list instead of St
20.
1 0 10 0 4
0”(0 1 0 1/2 0 6)
1 0 1 0 0 4
3 2 0 0 1 18
2 (0 1 0 1/2 0 6
)
2. For the other row apply this rule:
New row old row — the coefficient of this row in the pivot column (new pivot
row).
For S
for Z
-3 -5 0 0 0 0
-5(0 1 0 1/2 0 6)
21.
Basic
variable
Xl X2 Si
S2
RHS
S11 0 1 0 0 4
X2 ’' 0 1 0 1/2 0 6
3/2 0
I This solution is not optimal, since there is a negative numbers in the last
row
The most negative
value; therefore,
X1 is the entering
variable
The smallest ratio
is 6/3 =2;
therefore, St is the
leaving variable
22.
Iteration
• Apply thesame rules we will obtain this
solution:
variable
S
S RHS
l/2
7/2
This solution is optimal; since there is no negative
solution in the last row: basic variables are X= 2, X2 = 6 and
S1 = 2; the nonbasic variables are S2= St = 0
Z = 36
23.
met:hod in caseof Artificial
variables
• Solve the following linear programming problem
by using the simplex method:
• Min X + X2
/2 + '
4 X2 < 4 X, +
3X2 > 20 Xl
+ X2
X„ X2 >
24.
• Solution
Step :staildaid
foiin
Z,
s.t.
Xx X2
M A A,
, X2 ,S
/2 + ' 4 X2 + S1
+ 3X2
+ X2
S2, Au A2
S2 +
+ A2
0
4
Old (Z row):-2 -3 0 0 -M -M 0
M (Al row): M 3M 0 -M M o 20M
M (A2 row): M M 0 0 0 M l0M
New (Z iow):2M-2 4M-3 0 -M 0 0 30M
6 “26 Linear Programming
• To coaect this violation before starting the
simplex algorithm, the elementary row operations
are used as follows:
In our case, it will be positive since M is negative in the Z
row, as following:
bIt e c o mz e reo s
27.
Basic X X;S; S, A; A, RHS
variables 1 t) ()
Sl l/2 1/4 1 0 0 0 4
A; 1 3 0 -1 1 0 20
At 1 1 0 0 0 1 10
Z 2M-2 4M-3 I) -M 30M
• The initial tableau will
be:
• Since there is a positive value in the last row, this solution is not
optimal
• The entering variable is X2 (it has the most positive value in the last
row)
• The leaving variable is A (it has the smallest ratio)
28.
Basic
variables
X;
°
X2
;
Sl
«
S,
0
A;
M
A,
M
RHS
S 1
5 120 l 1/12 -1/12 0 7/3
X2
1
/
3 1 0 -1/3 1/3 0 20/3
A2
2 3 0 0 ^ -i/s i 10/3
Z /
J
— 0 0 1 3M-1 I -4 3M 0 20 10
3M
• First iteration
• Since there is a positive value in the last row, this solution is not
optimal
• The entering variable is X1 (it has the most positive value in the last
row)
•
29.
• Second iteration
variables
SA;
A
RHS
-
1/2
(
/
2
1/2 - 1/2
3
/
2
This solution is optimal, since there is no positive value in the last
row. The
optimal solution is:
X1 — 5
, X2 — 5
,SP — ‹
30.
• In thefinal tableau, if one or more artificial
variables (A„ A2, ...) Still basic and has a nonzero
value, then the problem has an infeasible
solution.
• All other notes are still valid in the Big M
method.