Simplex Method for Linear Programming

advertisement
Chapter 4 Simplex Method for
Linear Programming
Shi-Shang Jang
Chemical Engineering Department
National Tsing-Hua University
Example 1: Inspector Problem

Assume that it is desired to hire some inspectors for monitoring
a production line. A total amount of 1800 species of products
are manufactured every day (8 working hours), while two
grades of inspectors can be found. Maximum, 8 grade A
inspector and 10 grade B inspector are available from the job
market. Grade A inspectors can check 25 species/hour, with
an accuracy of 98 percent. Grade B inspectors can check 15
species/hour, with an accuracy of 95 percent. Note that each
error costs $2.00/piece. The wage of a grade A inspector is
$4.00/hour, and the wage of a grade B inspector is $3.00/hour.
What is the optimum policy for hiring the inspectors?
Problem Formulation








Assume that the x1 grade A inspectors x2 grade B inspects
are hired, then
total cost to be minimized
48 x1 +38  x2 +2580.022 x1 +1580.052  x2
=40 x1 +36 x2
manufacturing constraint
258 x1 +158 x2 1,800 200 x1 +120 x2 1,800
no. of inspectors available:
0 x1 8
0 x2 10
The Graphical Solution
15
10
X2=10
B(8,10)
C(3,10)
+3
X1
40
6X
+3
5X 1
=Z
2
40
6X
5
00
=6
+3
X1
=4
X2
5
=5
=2 Z
00
X1=8
0
38
Z=
(8,5/3)
5
10
Theorem

Property: If there exists an optimal solution
to a LP, then at least one of the corner point
of the feasible region will always qualify to be
an optimal solution.
Special Cases






Alternate Solutions (non-unique solutions)
Max x1+2x2
s.t. x1+2x210
x1+ x21
x24
x10, x20
X2
5
4
X2=4
X+
1
2X
2 =1
0
X+
1
X+
1 2
X
2X
=
2
6
2 =2
+X
X1
X1
=2 1
6
10
Special Cases - continued


Unbounded Optima : A system has a feasible
region with open boundaries such that the
optima may appear at the infinity.
Example: For the previous example, in case
the constraint x1+2x210 is not given, then
moving far away from the origin increases
the objective function x1+2x2, and the maxim
Z would be +
Unbounded Optima
5
x2=4
4.5
x1+2x2=15
4
3.5
x2
3
x1+2x2=10
2.5
2
x1+2x2=6
1.5
x1+2x2=2
1
0.5
0
0
x1+x2=1
1
2
3
4
5
x1
6
7
8
9
10
Example 2: Student Fab


The RIT student-run microelectronic
fabrication facility is taking orders for four
indigenously developed ASIC chips that can
be used in (1) touch sensors ($6, s4hr, m1hr,
v30), (2)LCD($10,s9hr, m1hr, v40), (3)
pressure sensors($9, s7hr, m3hr, v20), and
(4) controllers($20, s10hr, m8hr, v10).
Constraints : Student hr≦ 600, machine
hr≦420, space≦800
The LP Problem
max 6 x1  10x2  9 x3  20x4
x
s.t.4 x1  9 x2  7 x3  10x4  600
x1  x2  3 x3  8 x4  420
30x1  40x2  20x3  10x4  800
4-2 The Basic Approach

Standard Form of Linear Programming
min y  c1 x1  c2 x2    cn xn
x1 , x2 ,, xn
s.t. a11 x1  a12 x 2    a1n xn  b1
a 21 x1  a 22 x2    a 2 n xn  b2

a m1 x1  a m 2 x 2    a mn xn  bm
x1 , x2 ,, xn  0,
b1 , b2 , , bm  0, n  m
Handling of in-equality Constraints
Case 1: Slack Variable:
x1+2x2+3 x3 +4x425

–
Modified to
x1+2x2+3x3+4x4+ x5=25
x50 is a slack variable.
Case 2: Surplus Variable:
2 x1+ x2-3 x312

Modified to
2 x1+ x2-3 x3- x4=12
x40 is a surplus variable.
–
Handling of Equality Constraints



If s is unrestricted, i.e., s can be positive or
negative, then we set
s=s+-ssuch that s+0, s- 0.
Example
max z  x1  2 x 2  3 x3
s.t. x1  x 2  x3  7
x1  x 2  x3  2
3 x1  x 2  3 x3  5
x1 , x 2  0
Modify to
max z  x1  2 x 2  3 x 4  3 x5
s.t. x1  x 2  x 4  x5  x6  7
x1  x 2  x 4  x5  x7  2
3 x1  x 2  3 x 4  3 x5  5
x1 , x 2 , x 4 , x5 , x6 , x7  0
Definitions





Definition: A feasible region, denoted by S is the set of all
feasible solution. Mathematically, . S  x Ax  b, x  0
Definition: An optimal solution is a vector x*S, s.t. z0=cTx* is
maximum or minimum in where Z is termed by the optimal
value.
Definition: Alternate optimal solution is a set XS, s.t. all xX
has the same objective value z0 and for all xS, and z=cTx, z
z 0.
Definition: If the solution set of LP contains only one element,
it is termed the unique optimum.
Definition: If the optimum value z approaches to infinity, then
the LP is said to have unbounded optimum.
4-3 The Simplex Method
min y  c1 x1  c2 x2    c n x n
x1 , x2 ,, xn
s.t. a11 x1  a12 x2    a1n xn  b1
a 21 x1  a 22 x2    a 2 n xn  b2

a m1 x1  a m 2 x2    a mn xn  bm
x1 , x2 ,, xn  0
 Gauss  Jordan Elimination and
ArtificialVariable Approachfor theconstraints
x1    a1,m1 xm1    a1s x s    a1n xn  b1
x2    a 2,m1 xm1    a 2 s x s    a 2 n xn  b2

xm  a m,m1 xm1    a ms x s    a mn xn  bm
CanonicalForm
Definitions




Definition: A pivot operation is sequence of elementary row
operations that reduce the coefficients of a specified variable to
unity in one of the equation and zero elsewhere.
Definition: In the above canonical form, x1,,xm are termed the
basic variables or dependent variables, xm+1, ,xn are called
nonbasic variables or the independent variables.
Definition: The solution obtained from a canonical form is by
setting the nonbasic variable or independent variable to zero is
called a basic solution.
Definition: A basic feasible solution is a basic solution in which
the basic or dependent variables are non-negative.
Property
 Remark:
where
n
n!
no.of basic solutions   
 m  m!(n  m)!
basic xi  bi
 Definition:
, i  1,, m, nonbasic xi  0, j  m  1,, n
x B  x1 ,, xm , c B  c1 ,, cm 
Property: A feasible basic solution is a simplex of the feasible region.
Note: Given a canonical form and feasible basic solution,
m
then the objective function:
T
z  c B b B   ci bi
i 1
where xB is a basic variable.
Approach (Simplex Method):



Start with an initial basic feasible solution in
canonical form.
Improve the solution by finding another basic
feasible solution if possible.
When a particular basic feasible solution is found,
and cannot be improved by finding new basic
feasible solution, the optimality is reached.


Definition: An adjacent basic solution differs from a basic
solution is exactly one basic variable.
Question: If one wants to find an adjacent feasible basic
solution from one feasible basic solution (i.e., switch to
another simplex), which adjacent basic solution gives lowest
objective function?
Derivation of Inner Product Rule
x1    a1s x s  b1
x 2    a 2 s x s  b2

xm  a ms x s  bm
Supposing, one wants to replace one of the original basic variable with
nonbasic variable xs, we firstly, increase xs from zero to one,
then for all i=1,,m,
xi  bi  a is
xs  1
and, for all j=m+1, ,n, js. xj=0
Theorem 1 (Inner Product Rule)
z new   ci bi  ais   c s
m
i 1
m
Relative cost,
z  z new  z  c s   ci ais (inner product rule)
i 1
More: (1) In a minimization problem, a basic feasible solution is optimal
if the relative costs of its all nonbasic variable are all positive or zero.
(2) One should choose an adjacent basic solution from which the relative
cost is the minimum.
Corollary: The alternate optima exists if z=0.
Theorem 2: (The Minimum Ratio Rule )

Given a nonbasic variable xs is change into
the basic variable set, then one of the basic
variable xr should leave from the basic
variable set, such that:
 bi 
max x s  min ,
ais 0 a
 is 
i
The above minimum happens at i=r.
Corollary: The above rule fails if there exist unbounded optima.
Example: The LP Problem
max 6 x1  10x2  9 x3  20x4
x
s.t.4 x1  9 x2  7 x3  10x4  600
x1  x2  3 x3  8 x4  420
30x1  40x2  20x3  10x4  800
The Standard Form
max f  6 x1  10x2  9 x3  20x4
s.t.g1  4 x1  9 x2  7 x3  10x4  x5  600
g 2  x1  x2  3 x3  8 x4  x6  420
g 3  30x1  40x2  20x3  10x4  x7  800
Table 1(s=4,r=6,rc=2)
Basic={5 6 7};Nonbasic={1 2 3 4}
6
10
9
20
0
0
0
CB
Basis
x1
x2
x3
x4
x5
x6
x7
constraints
0
x5
4
9
7
10
1
0
0
600 (600/10=60)
0
x6
1
1
3
8
0
1
0
420(420/8=52.5)
0
x7
30
40
20
10
0
0
1
800(800/10=80)
6
10
9
20
-
-
-
Z=0
Z
Table 2(s=2,r=7,rc=3)
Basic={5 4 7};Nonbasic={1 2 3 6}
6
10
9
20
0
0
0
CB
Basis
x1
x2
x3
x4
x5
x6
x7
constraints
0
x5
2.75
7.75
3.25
0
1
-1.25
0
75(75/7.75=
9.6774)
20
x4
0.125
0.125
0.375
1
0
0.125
0
52.5(52.5/0.125=4
20)
0
x7
28.75
38.75
16.25
0
0
-1.25
1
275(275/38.75=
7.0798)
3.5
7.5
1.5
-
-
-2.5
-
Z=1050
Z
Table 3
Basic={5 4 2};Nonbasic={1 7 3 6}
6
10
9
20
0
0
0
CB
Basis
x1
x2
x3
x4
x5
x6
x7
constraints
0
x5
-3
0
0
0
1
-1
-0.2
20
20
x4
0.0323
0
0.3226
1
0
0.129
-0.0032
51.6129
10
x2
0.7419
1
0.4194
0
0
-0.0323
0.0258
7.0968
-2.0645
-
-0.1935
-
-
-1.6452
-2.2581
Z=1103.226
Z
2. The Two Phase Simplex MethodExample
min 3 x1  x2  x3
s.t.x1  2 x2  x3  11
 4 x1  x2  3 x3  3
2 x1  x3  1
x1 , x2 , x3  0
The Standard Form
min 3 x1  x2  x3
s.t. x1  2 x2  x3  x4  11
 4 x1  x2  2 x3  x5  3
2 x1  x3  1
x1 , x2 , x3 , x4 , x5  0
Two Phase Approach-Phase I
min x6  x7
s.t.x1  2 x2  x3  x4  11
 4 x1  x2  2 x3  x5  x6  3
 2 x1  x3  x7  1
Two Phase Approach-Phase I
Table 1
0
0
0
0
0
1
1
CB
Basis
x1
x2
x3
x4
x5
x6
x7
constraints
0
x4
1
-2
1
1
0
0
0
11(11/1=11)
1
x6
-4
1
2
0
-1
1
0
3(3/2=1.5)
1
x7
-2
0
1
0
0
0
1
1(1/1=1)
6
-1
-3
-
1
-
-
Z=4
Z
Two Phase Approach-Phase I
Final
0
0
0
0
0
1
1
CB
Basis
x1
x2
x3
x4
x5
x6
x7
constraints
0
x4
3
0
0
1
-2
2
-5
12
0
x2
0
1
0
0
-1
1
-2
1
0
x3
-2
0
1
0
0
0
-1
1
-
-
-
-
-
-
-
Z=0
Z
Two Phase Approach-Phase II
Table 1
-3
1
1
0
0
CB
Basis
x1
x2
x3
x4
x5
constraints
0
x4
3
0
0
1
-2
12(12/3=4)
1
x2
0
1
0
0
-1
1(1/0=)
1
x3
-2
0
1
0
0
1(1/-2<0)
-1
-
-
-
5
Z=2
Z
Two Phase Approach-Phase II
Final
-3
1
1
0
0
CB
Basis
x1
x2
x3
x4
x5
constraints
-3
x1
1
0
0
0.3333
-0.667
4
1
x2
0
1
0
0
-1
1
1
x3
0
0
1
0.6667
-1.333
9
-
-
-
-
-
Z=-2
Z
Example: Multi-Products
Manufacturing

A company manufactures three products: A, B, and
C. Each unit of product A requires 1 hr of
engineering service, 10 hr of direct labor, and 3lb of
material. To produce one unit of product B requires
2hr of engineering, 4hr of direct labor, and 2lb of
material. In case of product C, it requires 1hr of
engineering, 5hr of direct labor, and 1lb of material.
There are 100 hr of engineering, 700 hr of labor, and
400 lb of material available. Since the company
offers discounts for bulk purchases, the profit figures
are as shown in the next slide:
Example- Continued
Product A
Product B
Product C
Sales units
Unit profit
variable
s
Sales units
Unit profit
variables
Sales units
Unit profit
variables
0-40
10
X1
0-50
6
X5
0-100
5
X8
40-100
9
X2
50-100
4
X6
Over 100
4
X9
100-150
8
X3
Over 100
3
X7
Over 150
7
X4
Formulate a linear program to determine the most profitable product mix.
Problem Formulation
Let’s denote the variables as shown in the table, then
we have the following:
max 10X 1  9 X 2  8 X 3  7 X 4  6 X 5  4 X 6  3 X 7  5 X 8  4 X 9
X 1 ,, X 10
s.t.1( X 1  X 2  X 3  X 4 )  2( X 5  X 6  X 7 )  1( X 8  X 9 )  100
10( X 1  X 2  X 3  X 4 )  4( X 5  X 6  X 7 )  5( X 8  X 9 )  700
3( X 1  X 2  X 3  X 4 )  2( X 5  X 6  X 7 )  1( X 8  X 9 )  400
0  X 1  40
0  X 2  60

X9  0
MATLAB PROGRAM







f=[-10 -9 -8 -7 -6 -4 -3 -5 -4]';
A=[1 1 1 1 2 2 2 1 1; 10 10 10 10 4 4 4 5 5;3 3 3 3 2
2 2 1 1];
b=[100;700;400];
Aeq=[];beq=[];
LB=[0 0 0 0 0 0 0 0 0];
UB=[40 60 50 Inf 50 50 Inf 100 Inf];
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA]=LINPROG(
f,A,b,Aeq,beq,LB,UB)
Solution

X’= 40.0000 22.5000
0.0000

FVAL =-715.0000
EXITFLAG =1
OUTPUT =
iterations: 7
cgiterations: 0
algorithm: 'lipsol'
LAMBDA =
ineqlin: [3x1 double]
eqlin: [0x1 double]
upper: [9x1 double]
lower: [9x1 double]










0.0000
0.0000 18.7500
0.0000
0.0000
0.0000
3. Sensitivity Analysis



Shadow Prices: To evaluate net impact in
the maximum profit if additional units of
certain resources can be obtained.
Opportunity Costs: To measure the negative
impact of producing some products that are
zero at the optimum.
The range on the objective function
coefficients and the range on the RHS row.
Example

A factory manufactures three products, which
require three resources – labor, materials
and administration. The unit profits on these
products are $10, $6 and $4 respectively.
There are 100 hr of labor, 600 lb of material,
and 300hr of administration available per day.
In order to determine the optimal product mix,
the following LP model is formulated and
solve:
Basic LP Problem
max Z  10x1  6 x2  4 x3
s.t.x1  x2  x3  100 (labor)
10x1  4 x2  5 x3  600 (mat erial)
2 x1  2 x2  6 x3  300 (administration)
x1 , x2 , x3  0
Optimal Solution and Sensitivity
Analysis
x1=33.33, x2=66.67,x3=0,Z=733.33
 Shadow prices for row 1=3.33, row 2=0.67,
row 3=0
 Opportunity Costs for x3=2.67
 Ranges on the objective function coefficients:
6≦c1(10)≦15, 4≦c2(6)≦10,
-∞≦c3(4)≦6.67

Optimal Solution and Sensitivity
Analysis- Continued
60≦b1(100)≦150, 400≦b2(600)≦1000,
200≦b3(300)≦∞

100% Rules

100% rule for objective function coefficients
c j
 c
j

 100%
j
100% rule for RHS constants
b j
 b
j
j
 100%
Examples

Unit profit on product 1 decrease by $1, but increases by $1
for products 2 and 3, will the optimum change?(δc1=-1, Δc1=4, δc2=1, Δc2=4, δc3=1, Δc3=2.67)
1 1
1
 
 0.875  1
 4 4 2.67

Simultaneous variation of 10 hr decrease on labor 100 lb
increase in material and 50hr decrease on administration
 10 100  50


1
 40 400  100
Download