Operations Research: Simplex Method

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Operations Research

Simplex Method

The Use of Simplex Method

http://www.solver.com/xlspremsolv4.htm 2
The Use of Simplex Method

Convert an LP Model to Standard Form


Before the simplex algorithm can be used to solve an LP, the
LP must be converted into a problem where all the
constraints are equality and all variables are nonnegative.
An LP in this form is said to be in STANDARD FORM.

Consider the following example:

Leather Limited manufactures two types of leather belts: the


deluxe model and the regular model. Each type requires 1
square yard of leather. A regular belt requires 1 hour of skilled
labor and a deluxe belt requires 2 hours of skilled labor. Each
week, 40 square yards of leather and 60 hours of skilled labor
are available. Each regular belt contributes $3 profit and each
deluxe belt $4. Write an LP to maximize profit.
4
How to Convert an LP to Standard Form
The decision variables are:
x1 = number of deluxe belts produced weekly
x2 = number of regular belts produced weekly

the appropriate LP is:

max z = 4x1 + 3x2


s.t. x1 + x2 40 (leather constraint)
2x1 + x2 60 (labor constraint)
x1, x2 0
To convert the leather and labor () constraints to equalities,
we define for each constraint a slack variable si (si = slack
variable for the i-th constraint). A slack variable is the
amount of the resource unused in the i-th constraint.
5

How to Convert an LP to Standard Form


The LP not in standard form is:
max z = 4x1 + 3x2
s.t. x1 + x2 40 (leather constraint)
2x1 + x2 60 (labor constraint)
x1, x2 0

The same LP in standard form is:


max z = 4x1 + 3x2
s.t. x 1 + x 2 + s1 = 40
2x1 + x2 + s2 = 60
x1, x2, s1, s2 0
In summary, if a constraint i of an LP is a constraint, convert it
to an equality constraint by adding a slack variable si to the i-th
constraint and adding the sign restriction si 0.
6
How to Convert an LP to
Standard Form
A constraint can be converted to an equality constraint. Consider
the formulation below:

min z = 50 x1 + 20x2 + 30x2 + 80 x4

s.t. 400x1 + 200x2 + 150 x3 + 500x4 500


3x1 + 2x2 6
2x1 + 2x2 + 4x3 + 4x4 10
2x1 + 4x2 + x3 + 5x4 8
x1, x2, x3, x4 0

To convert the i-th constraint to an equality constraint, define


an excess variable (sometimes called a surplus variable) ei (ei will
always be the excess variable for the i-th constraint). We
define ei to be the amount by which i-th constraint is over
satisfied. 7

How to Convert an LP to
Standard Form
Transforming the LP on the previous slide to standard form yields:

min z = 50 x1 + 20x2 + 30x2 + 80 x4


s.t.
400x1 + 200x2 + 150x3 + 500x4 - e1 = 500
3x1 + 2x2 - e2 =6
2x1 + 2x2 + 4x3 + 4x4 - e3 = 10
2x1 + 4x2 + x3 + 5x4 - e4 = 8
xi, ei 0 (i = 1,2,3,4)
In summary, if the i-th constraint of an LP is a constraint, it can
be converted to an equality constraint by subtracting the excess
variable ei from the i-th constraint and adding the sign restriction
ei 0.
8
How to Convert an LP to
Standard Form
If an LP has both and constraints, apply the previous procedures
to the individual constraints. Consider the example below.

NON-STANDARD FORM STANDARD FORM

max z = 20x1 + 15x2 max z = 20x1 + 15x2


s.t. x1 100 s.t. x1 + s1 = 100
x2 100 x2 + s2 = 100
50x1 + 35x2 6000 50x1 + 35x2 + s3 = 6000
20x1 + 15x2 2000 20x1 + 15x2 - e4 = 2000
x1, x2 0 x1, x2, s1, s2, s3, e4 0

Preview of the Simplex


Algorithm
Suppose an LP with m constraints and n variables has been
converted into standard form. The form of such an LP is:

max ( or min) z = c1x1 + c2x2 + +cnxn

s.t. a11x1 + a12x2 + + a1nxn =b1


a21x1 + a22x2 + + a2nxn =b2
. . .
. . .
am1x1 + am2x2 + + amnxn =bm
xi 0 ( i = 1,2, , n)
10
Preview of the Simplex
Algorithm
a11 a .... a x1 b1
12
1n

a21 a
22
.... a
2n
x2 b2
If we define: A x b
.... .... .... .... .... ....
a a .... a x b
m1 m2 mn n m
The constraints may be written as a system of equations Ax = b.
Consider a system Ax = b of m linear equations in n variables
(where n m).

A basic solution to Ax = b is obtained by setting n m variables


equal to 0 and solving for the remaining m variables. This
assumes that setting the n m variables equal to 0 yields a
unique value for the remaining m variables, or equivalently, the
columns for the remaining m variables are linearly independent.
11

Preview of the Simplex


Algorithm
To find a basic solution to Ax = b, we choose a set of n m variables
(the non-basic variables, or NBV) and set each of these variables equal
to 0. Then we solve for the values of the n (n m) = m variables (the
basic variables, or BV) that satisfy Ax = b.

Different choices of nonbasic variables will lead x1 + x2 =3


to different basic solutions. Consider the basic
solutions to the system of 2 equations shown to - x2 + x3 = -1
the right:

The number of nonbasic variables = 3 2 = 1. x1 + x2 =3


Setting, for example, NBV = {x3} (as shown to
- x2 + 0 = -1
the right, then BV = {x1, x2}. We can obtain
the values for these basic variables by setting
x3 = 0. Solving we find x1 = 2, x2 = 1. Thus, x1
= 2, x2 = 1, and x3 = 0 is a basic solution.
12
Preview of the Simplex
Algorithm
If NBV = {x1} and BV = {x2, x3} are chosen instead, the basic solution
becomes x1 = 0, x2 = 3, and x3 = 2.

If NBV = {x2} and BV = {x1, x3} are chosen instead, the basic solution
becomes x1 = 3, x2 = 0, and x3 = -1.

Some sets of m variables do not yield a x1 + 2x2 + x3 = 1


basic solution. Consider the linear
system shown to the right: 2x1 + 4x2 + x3 = 3

If NBV = {x3} and BV = {x1, x2} the x1 + 2x2 = 1


corresponding basic solution would be:
2x1 + 4x2 = 3

Since this system has no solution, there is no basic solution


corresponding to BV = {x1, x2}.

13

Preview of the Simplex


Algorithm
Any basic solution in which all variables are nonnegative is called a
basic feasible solution (or bfs). For the basic solutions on the
previous slides, x1 = 2, x2 = 1, x3 = 0 and x1 = 0, x2 = 3, x3 = 2 are basic
feasible solutions, but the basic solution x1 = 3, x2 = 0, x3 = -1 fails to
be a bfs (because x3 < 0).
The following two theorems explain why the concept of a basic
feasible solution is of great importance in linear programming:

Theorem 1 The feasible region for any linear programming problem


is a convex set. Also, if an LP has an optimal solution, there must be
an extreme point of the feasible region that is optimal.

Theorem 2 For any LP, there is a unique extreme point of the LPs
feasible region corresponding to each basic feasible solution. Also,
there is at least one bfs corresponding to each extreme point in the
feasible region.
14
Preview of the Simplex
Algorithm
The relationship between X2
extreme points and basic D

60
feasible solutions outlined in
Theorem 2, is seen in the

50
Leather Limited problem. The
Labor Constraint
LP (with slack variables) was:
B

40
max z = 4x1 + 3x2
Feasible Region
s.t. x1 + x2 + s1 = 40

30
2x1 + x2 + s2 = 60
Leather Constraint
x1, x2, s1, s2 0 E

20
Both inequalities are satisfied in

10
the shaded area. The extreme
points are of the feasible region C A
are B, C, E, and F. F 10 20 30 40 50 X1

15

Preview of the Simplex


Algorithm
Basic Nonbasic Basic Feasible Corresponds to Corner
Variables Variables Solution Point
x1 , x2 s1, s2 s1 = s2 = 0, x1 = x2 = 20 E
x1 , s 1 x2 , s 2 x2 = s2 = 0, x1 = 30, s1 = 10 C
x1 , s 2 x2 , s 1 x2 = s1 = 0, x1 = 40, s2 = - 20 Not a bfs since s2 < 0
x2 , s 1 x1 , s 2 x1 = s2 = 0, s1 = - 20 x2 = 60 Not a bfs since s1 < 0
x2 , s 2 x1 , s 1 x1 = s1 = 0, x2 = 40, s2 = 20 B
s1, s2 x1 , x2 x1 = x2 = 0, s1 = 40, s2 = 60 F

The table above shows the correspondence between the basic


feasible solutions to the LP and the extreme points of the feasible
region. The basic feasible solutions to the standard form of the LP
correspond in a natural fashion to the LPs extreme points.
16
Preview of the Simplex
Algorithm
Adjacent Basic Feasible Solutions

For any LP with m constraints, two basic feasible solutions are said
to be adjacent if their sets of basic variables have m 1 basic
variables in common.

For example in the Leather Limited LP on the previous slide, the


bfs corresponding to point E is adjacent to the bfs corresponding
to point C. These points share (m 1 = 2 - 1 = 1) one basic variable,
x1. Points E (BV = {x1,x2}) and F (BV = {s1,s2}) are not adjacent since
they share no basic variables.

Intuitively, two basic feasible solutions are adjacent if they both lie
on the same edge of the boundary of the feasible region.

17

Preview of the Simplex


Algorithm
General description of the simplex algorithm solving an LP in
a maximization problem:

Step 1 Find a bfs to the LP. We will call this bfs the initial bfs. In
general, the most recent bfs will be called the current bfs, so at
the beginning of the problem, the initial bfs is the current bfs.

Step 2 Determine if the current bfs is an optimal solution to the LP.


If it is not, find an adjacent bfs that has a larger z-value.

Step 3 Return to Step 2, using the new bfs as the current bfs.

18
The Simplex Algorithm (max LPs)
The Simplex Algorithm Procedure for maximization LPs
Step 1 Convert the LP to standard form
Step 2 Obtain a bfs (if possible) from the standard form
Step 3 Determine whether the current bfs is optimal
Step 4 If the current bfs is not optimal, determine which nonbasic
variable should become a basic variable and which basic
variable should become a nonbasic variable to find a bfs
with a better objective function value.
Step 5 Use Elementary Row Operations (EROs) to find a new bfs
with a better objective function value. Go back to Step 3.

In performing the simplex algorithm,


write the objective function in the form: z c1x1 c2x2 - - cnxn = 0
We call this format the row 0 version of the objective function (row 0
for short).
19

The Simplex Algorithm (max LPs)


Consider the simplex algorithm applied to the maximization below:

The Dakota Furniture company manufactures desk, tables, and


chairs. The manufacturer of each type of furniture requires
lumber and two types of skilled labor: finishing and carpentry.
The amount of each resource needed to make each type of
furniture is given in the table below.
Resource Desk Table Chair

Lumber 8 board ft 6 board ft 1 board ft

Finishing hours 4 hours 2 hours 1.5 hours

Carpentry hours 2 hours 1.5 hours 0.5 hours

20
The Simplex Algorithm (max LPs)
At present, 48 board feet of lumber, 20 finishing hours, 8
carpentry hours are available. A desk sells for $60, a table for
$30, and a chair for $ 20.

Dakota believes that demand for desks and chairs is unlimited,


but at most 5 tables can be sold.

Since the available resources have already been purchased,


Dakota wants to maximize total revenue.

21

The Simplex Algorithm (max LPs)


Define:
x1 = number of desks produced
x2 = number of tables produced
x3 = number of chairs produced.

The LP is: max z = 60x1 + 30x2 + 20x3


s.t. 8x1 + 6x2 + x3 48 (lumber constraint)
4x1 + 2x2 + 1.5x3 20 (finishing constraint)
2x1 + 1.5x2 + 0.5x3 8 (carpentry constraint)
x2 5 (table demand constraint)
x1, x2, x3 0
22
The Simplex Algorithm (max LPs)
Step 1 - Convert the LP to Standard Form
Basic
Canonical Form 0 Variable

Row 0 z 60x1 30x2 20x3 =0 z=0

Row 1 8x1 + 6x2 + x3 + s 1 = 48 s1 = 48

Row 2 4x1 + 2x2 + 1.5x3 + s2 = 20 s2 = 20

Row 3 2x1 + 1.5x2 + 0.5x3 + s3 =8 s3 = 8

Row 4 x2 + s4 =5 s4 = 5

If we set x1 = x2 = x3 = 0, we can solve for the values s1, s2, s3, s4. Thus, BV =
{s1, s2, s3, s4} and NBV = {x1, x2, x3 }. Since each constraint is then in canonical
form (BVs have a coefficient = 1 in one row and zeros in all other rows) with a
nonnegative right hand side (rhs), a bfs can be obtained by inspection.

23

The Simplex Algorithm (max LPs)


Step 2 Obtain a Basic Feasible Solution

To perform the simplex algorithm, we need a basic (although not


necessarily nonnegative) variable for row 0. Since z appears in
row 0 with a coefficient of 1, and z does not appear in any other
row, we use z as the basic variable. With this convention, the basic
feasible solution for our initial canonical form has:

BV = {z, s1, s2, s3, s4} and NBV = {x1, x2, x3 }.

For this initial bfs, z = 0, s1= 48, s2= 20, s3 = 8, s4 =5, x1= x2 = x3 = 0.
As this example indicates, a slack variable can be used as a basic
variable if the right hand side (rhs) of the constraint is nonnegative.

24
The Simplex Algorithm (max LPs)
Step 3 Determine if the Current BFS is Optimal
Once we have obtained a bfs, we need to determine whether it is
optimal. To do this, we try to determine if there is any way z can be
increased by increasing some nonbasic variable from its current value
of zero while holding all other nonbasic variables at their current
values of zero. Solving for z in row 0 yields:

Z = 60x1 + 30x2 + 20x3


For each nonbasic variable, we can use the equation above to
determine if increasing a nonbasic variable (while holding all other
nonbasic variables to zero) will increase z. Increasing any of the
nonbasic variables will cause an increase in z. However increasing x1
causes the greatest rate of increase in z. If x1 increases from its
current value of zero, it will have to become a basic variable. For this
reason, x1 is called the entering variable. Observe x1 has the most
negative coefficient in row 0. 25

The Simplex Algorithm (max LPs)


Step 4 - We choose the entering variable (in a max problem) to the
nonbasic variable with the most negative coefficient in row 0 (ties
broken arbitrarily). We desire to make x1 as large as possible but as
we do, the current basic variables (s1, s2, s3, s4) will change value.
Thus, increasing x1 may cause a basic variable to become negative.

RATIO
From row 1 we see that s1 = 48 8x1. Since s1 0, x1 48 / 8 = 6
From row 2, we see that s2 = 20 4x1. Since s2 0, x1 20 / 4 = 5
From row 3, we see that s3 = 8 2x1. Since s3 0, x1 8 / 2 =4
From row 4, we see that s4 = 5. For any x1, s4 will always be 0

This means to keep all the basic variables nonnegative, the largest
we can make x1 is min {6, 5, 4} = 4.
26
The Simplex Algorithm (max LPs)
The Ratio Test

When entering a variable into the basis, compute the ratio:

rhs of row / coefficient of entering variable in row

For every constraint in which the entering variable has a positive


coefficient. The constraint with the smallest ratio is called the
winner of the ratio test. The smallest ratio is the largest value of
the entering variable that will keep all the current basic variables
nonnegative.

Make the entering variable x1 a basic variable in row 3 since this


row (constraint) was the winner of the ratio test (8/2 =4).

27

The Simplex Algorithm (max LPs)


To make x1 a basic variable in row 3, we use elementary row
operations (eros) to make x1 have a coefficient of 1 in row 3
and a coefficient of 0 in all other rows. This procedure is
called pivoting on row 3; and row 3 is called the pivot row.
The final result is that x1 replaces s3 as the basic variable for
row 3. The term in the pivot row that involves the entering
basic variable is called the pivot term.

Step 5 - The Gauss-Jordan method using eros and simplex


tableaus shown on the next slide makes x1 a basic variable.

28
The Simplex Algorithm (max LPs)
ero 1 z x1 x2 x3 s1 s2 s3 s4 rhs ero
0 1 -60 -30 -20
1 8 6 1 1 48
2 4 2 1,5 1 20
3 1 0,75 0,25 0,5 4 row 3 multiplied by 1/2
4 1 1 5
ero 2 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240 60 times row 3 added to row 0
1 8 6 1 1 48
2 4 2 1,5 1 20
3 1 0,75 0,25 0,5 4
4 1 1 5
ero 3 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240
1 -1 1 -4 16 - 8 times row 3 added to row 1
2 4 2 1,5 1 20
3 1 0,75 0,25 0,5 4
4 1 1 5
ero 4 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240
1 -1 1 -4 16
2 -1 0,5 1 -2 4 - 4 times row 3 added to row 2
3 1 0,75 0,25 0,5 4
4 1 1 5

29

The Simplex Algorithm (max LPs)


The result is:
Basic
Canonical Form 1
Variable
Row 0 z + 15x2 - 5x3 + 30s3 = 240 z = 240

Row 1 - x3 + s1 - 4s3 = 16 s1 = 16
Row 2 - x2 + 0.5 x3 + s2 - 2 s3 =4 s2 = 4
Row 3 x1 + 0.75x2 + 0.25x3 + 0.5s3 =4 x1 = 4
Row 4 x2 + s4 =5 s4 = 5
In canonical form 1, BV = {z, s1, s2, x1, s4} and NBV = {s3, x2, x3 }.
yielding the bfs z = 240, s1 = 16, s2 = 4, x1 = 4, s4 = 5, s3 = x2 = x3 = 0.
The procedure from going to one bfs to a better adjacent bfs is
called an iteration (or sometime pivot) of the simplex algorithm.
30
The Simplex Algorithm (max LPs)
Returning to Step 3, we attempt to determine if the current bfs is optimal.

Rearranging row 0 from Canonical Form 1, and solving for a yields:

z = 240 15x2 +5x3 -30s3

The current bfs is NOT optimal because increasing x3 to 1 (while


holding the other nonbasic variable to zero) will increase the value of
z. Making either x2 or s3 basic will caused the value of z to decrease.
Step 4 - Recall the rule for determining the entering variable is the
row 0 coefficient with the greatest negative value. Since x3 is the only
variable with a negative coefficient, x3 should be entered into the
basis.

31

The Simplex Algorithm (max LPs)


Begin iteration (pivot) 2
Performing the ratio test using x3 as the entering variable
yields the following results (holding other NBVs to zero):

From row 1, s1 0 for all values of x3 since s1 = 16 + x3


From row 2, s2 0 if x3 > 4 / 0.5 = 8
From row 3, x1 0 if x3 >4 / 0.25 = 16
From row 4, s4 0 for all values of x3 since s4 = 5
This means to keep all the basic variables nonnegative, the
largest we can make x1 is min {8,16} = 8. So, row 2 becomes
the pivot row.

Step 5 - Now use eros, to make x3 a basic variable in row 2.


32
The Simplex Algorithm (max LPs)
ero 1 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240
1 -1 1 -4 16
2 -2 1 2 -4 8 multiplied row 2 by 2
3 1 0.75 0.25 0.5 4
4 1 1 5
ero 2 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 5 10 10 280 add 5 times row 2 to row 0
1 -1 1 -4 16
2 -2 1 2 -4 8
3 1 0.75 0.25 0.5 4
4 1 1 5
ero 3 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 5 10 10 280
1 -2 1 2 -8 24 add row 2 to row 1
2 -2 1 2 -4 8
3 1 0.75 0.25 0.5 4
4 1 1 5
ero 4 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 5 10 10 280
1 -2 1 2 -8 24
2 -2 1 2 -4 8
3 1 1.25 -0.5 1.5 2 add -1/4 times row 2 to row 3
4 1 1 5

33

The Simplex Algorithm (max LPs)


The result is:
Canonical Form 2 Basic
Variable
Row 0 z + 5x2 + 10s2 + 10s3 = 280 z = 280

Row 1 - 2x2 + s1 + 2s2 - 8s3 = 24 s1 = 24


Row 2 - 2x2 + x3 + 2s2 - 4s3 =8 x3 = 8
Row 3 x1 + 1.25x2 - 0.5 s2 + 1.5s3 =2 x1 = 2
Row 4 x2 + s4 =5 s4 = 5

In Canonical Form 2, BV = {z, s1, x3, x1, s4} and NBV = {s3, s2, x2 },
yielding the bfs z = 280, s1 = 24, x3 = 8, x1 = 2, s4 = 5, s2 = s3 = x2 = 0.

34
The Simplex Algorithm (max LPs)
Solving for z in row 0 yields: Z = 280 - 5x2 - 10s2 -10s3

We can see that increasing x2, s2, or s3 (while holding the other
NBVs to zero) will not cause the value of z to decrease. The
solution at the end of iteration 2 is therefore optimal. The
following rule can be applied to determine whether a canonical
forms bfs is optimal:

A canonical form is optimal (for a max problem) if each nonbasic


variable has a nonnegative coefficient in the canonical forms row
0.

35

Other Example Maximization


Problem
Maximize Z = 3x1 + 5x 2 ,
Subject to
x1 4
2 x2 12
3x1 + 2 x2 18
and
x1 0, x2 0
36
Convert LP Model to Standard Form
Original Form Augmented Form
of Model of the Model
Slack variables
Max Z = 3 x1 + 5 x2 Max Z = 3 x1 + 5 x2
s.t. s.t.
x1 4 x1 + s1 =4
2 x2 12 2x2 + s2 = 12
3 x1 + 2 x2 18 3 x1 + 2 x2 + s3 = 18
and and
x1 0, x2 0 x1 , x2 0, s1 , s2 , s3 0
37

Simplex in Tabular Form


(a) Algebraic Form
(0) z 3 x1 5 x2 = 0
(1) x1 + s1 = 4
(2) 2x2 +s2 = 12
(3) 3 x1 + 2 x2 +s3 = 18
(b) Tabular Form
Basic Coefficient of: Right
Variable Eq. Z x1 x2 s1 s2 s3 Side
z (0) 1 -3 -5 0 0 0 0
s1 (1) 0 1 0 1 0 0 4
s2 (2) 0 0 2 0 1 0 12
s3 (3) 0 3 2 0 0 1 18
38
Simplex in Tabular Form

Basic Coefficient of:


RHS
Variable Eq. Z x1 x2 s1 s2 s3
z (0) 1 -3 -5 0 0 0 0
s1 (1) 0 1 0 1 0 0 4
s2 (2) 0 0 2 0 1 0 12
s3 (3) 0 3 2 0 0 1 18

39

Iteration 0
The most negative coefficient
Itera- BV Coefficient of:
RHS
tion Eq. Z x1 x2 s1 s2 s3
z (0) 1 -3 -5 0 0 0 0
s1 (1) 0 1 0 1 0 0 4
0 s2 (2) 0 0 2 0 1 0 12
s3 (3) 0 3 2 0 0 1 18

12 18
=6 =9
minimum 2 2
40
Iteration 1
The most negative coefficient
Itera- BV Coefficient of:
RHS
tion Eq. Z x1 x2 s1 s2 s3
z (0) 1 -3 0 0 5/2 0 30
s1 (1) 0 1 0 1 0 0 4
1 s2 (2) 0 0 1 0 0 6
s3 (3) 0 3 0 0 -1 1 6

4 6
=4 =2
minimum 1 3
41

Iteration 2
None of the coefficient is negative
Itera- BV Coefficient of:
RHS
tion Eq. Z x1 x2 s1 s2 s3
z (0) 1 0 0 0 3/2 1 36
s1 (1) 0 0 0 1 1/3 -1/3 2
2 s2 (2) 0 0 1 0 0 6
s3 (3) 0 1 0 0 -1/3 1/3 2

The optimal solution


x1 = 2, x2 = 6
42
Summary
Optimality Test
The current BF solution is optimal if and only if every
coefficient in row 0 is non-negative.
Pivot Column 0
A column with the most negative coefficient
Minimum Ratio Test
Pick out each coefficient in the pivot column that is
strictly positive (>0).
Divide each of these coefficient into the right side entry
for the same row.
Identify the row that has the smallest of these ratios.
The basic variable for that row is the leaving basic variable,
so replace that variable by entering basic variable in the
basic variable column of the next simplex tableau.
43

The Simplex Algorithm (min LPs)


Two different ways the simplex min z = 2x1 3x2
method can be used to solve
minimization problems. Consider s.t. x1 + x2 4
the LP shown to the right:
x1 x2 6
x1, x2 0
Method 1
The optimal solution is the point max -z = -2x1 + 3x2
(x1,x2) that makes z = 2x1 3x2 the
s.t. x1 + x2 4
smallest. Equivalently, this point
makes max -z = - 2x1 + 3x2 the largest. x1 x2 6
This means we can find the optimal
x1, x2 0
solution to the LP by solving the LP
shown to the right.

44
The Simplex Algorithm (min LPs)
In solving this modified LP, use z as the basic variable in row 0. After
adding slack variables s1 and s2 to the constraints we obtain the
initial tableau.
Initial Tableau
Row -z x1 x2 s1 s2 rhs BVs
0 1 2 -3 0 0 0 -z=0
1 0 1 1 1 0 4 s1 =4
2 0 1 -1 0 1 6 s2 = 6

ero1 -z x1 x2 s1 s2 rhs
0 1 2 -3 0 0 0
1 0 1 1 1 0 4
2 0 2 0 1 1 10
ero 2 -z x1 x2 s1 s2 rhs BVs
0 1 5 0 3 0 12 - z = 12
1 0 1 1 1 0 4 x2 = 4
2 0 2 0 1 1 10 s2 = 10

45

The Simplex Algorithm (min LPs)


The optimal solution (to the max problem) is -z = 12, x2 = 4, s2 = 10, x1
= s1 = 0. Then the optimal solution to the min problem is z = -12,
x2=4, s2 = 10, x1 = s2 = 0. The min LP objective function confirms
this: z = 2x1-3x2 =2(0) 3 (4) = -12.

In summary, multiply the objective function for the min problem by


-1 and solve the problem as a maximization problem with the
objective function z. The optimal solution to the max problem will
give you the optimal solution for to the min problem. Remember
that (optimal z-value for the min problem) = - (optimal z-value for
the max problem).

46
The Simplex Algorithm (min LPs)
Method 2

A simple modification of the simplex algorithm can be used to


solve min problems directly. Modify Step 3 of the simplex
algorithm as follows: If all nonbasic variables (NBV) in row 0
have nonpositive coefficients, the current bfs is optimal. If
any nonbasic variable has a positive coefficient, choose the
variable with the most positive coefficient in row 0 as the
entering variable.
This modification of the simplex algorithm works because
increasing a nonbasic variable (NBV) with a positive
coefficient in row 0 will decrease z.

47

Alternate Optimal solutions


For some LPs, more than one extreme point is optimal. If an
LP has more than one optimal solution, it has multiple
optimal solutions.

If there is no nonbasic variable (NBV) with a zero coefficient


in row 0 of the optimal tableau, the LP has a unique
optimal solution. Even if there is a nonbasic variable with a
zero coefficient in row 0 of the optimal tableau, it is
possible that the LP may not have alternative optimal
solutions.

48
Unbounded LPs
For some LPs, there exist points in the feasible region for
which z assumes arbitrarily large (in max problems) or
arbitrarily small (in min problems) values. When this
occurs, we say the LP is unbounded.
An unbounded LP occurs in a max problem if there is a
nonbasic variable with a negative coefficient in row 0
and there is no constraint that limits how large we can
make this NBV.

Specifically, an unbounded LP for a max problem occurs when a


variable with a negative coefficient in row 0 has a non positive
coefficient in each constraint

49

The LINGO Computer Package


LINGO, Optimization Modeling Software is a user friendly computer
package that can be used to solve linear, non linear, and integer
programming problems. (http://www.lindo.com/)

The Dakota Furniture LP will solved using LINGO as an example


x1 = number of desks produced
x2 = number of tables produced
x3 = number of chairs produced.
The LP is: max z = 60x1 + 30x2 + 20x3
s.t. 8x1 + 6x2 + x3 48 (lumber constraint)
4x1 + 2x2 + 1.5x3 20 (finishing constraint)
2x1 + 1.5x2 + 0.5x3 8 (carpentry constraint)
x2 5 (table demand constraint)
x1, x2, x3 0
50
The LINGO Computer Package

LINGO assumes all variables are nonnegative, so nonnegative constraints are


not necessary. To be consistent with LINGO, the objective function row is
labeled row 1 and constraints rows 2-5.
View the LINGO Help file for syntax questions

51

The LINGO Computer Package

Slack or excess variables

Optimal z-value will be reduced


if the NBV is increased by 1 unit
(and all other NBVs remain 0).

52
References
Operations Research: Applications and Algorithms,
Wayne L. Winston
Introduction to Operations Research, Hillier & Lieberman,
McGraw-Hill Int.
Operations Research An Introduction, Hamdy A. Taha,
Maxwell Macmillan Int. Edition.

53

You might also like