Академический Документы
Профессиональный Документы
Культура Документы
Exercise 1
Simplex method
2
Problem 1.
Minimize the function f(x) = - x1 + x2 under following
restrictions:
2x1 - x2 ³ - 2
-x1 + 3x2 ³ - 2
-x1 - x2 ³ - 4
x1, x 2 ³ 0
Use the Simplex-algorithm.
3
Problem 1 - Solution
• Step 1. Problem is transformed:
– the goal function is multiplied by (–1). f*(x)=x1-x2 is to
be maximized then.
– The constraints are also multiplied by (-1). The direction
of the inequality sign changes:
• -2x1 + x2 £ 2
x1 - 3x2 £ 2
x1 + x2 £ 4
x1, x2 ³ 0
4
Problem 1 - Solution
• Step 2.
• The constraints are changed to equality constraints
by adding the slack variables x3, x4 and x5.
-2x1 + x2 + x3 = 2
x1 - 3x2 + x4 = 2
x1 + x2 + x5 = 4
x1, x 2, x 3, x 4, x 5 ³ 0
The goal function is changed to f* - x1 + x2 = 0
5
Problem 1 - Solution
• Step 3. A simplex tableau is derived:
basic Right
line f* x1 x2 x3 x4 x5
variables side
(0) f* 1 -1 1 0 0 0 0
(1) x3 0 -2 1 1 0 0 2
(2) x4 0 1 -3 0 1 0 2
(3) x5 0 1 1 0 0 1 4
6
Problem 1 - Solution
• Step 4.
• Optimality test: Are all the coefficients in the line
goal function (line 0) >=0 ? If not, the optimum is
not yet reached.
• Pivot column is the column where the goal function
has the most negative coefficient. x1 seems to be it
à It will be the next basic variable. Question is,
which basic variable will be swapped with it?
7
Problem 1 - Solution
• The search for the pivot row: Every element
in the right side column will be divided by the
corresponding pivot column element (if the
element is >0). The lowest value will be 2/1
= 2.
• The pivot row is the second row. The pivot
element value is 1 and x4 will be swapped
with x1. First the operations leading to this
must be accomplished.
8
Problem 1 - Solution
Pivot row is (2), column is (x1) and the pivot value is 1.
Row Basic f* x1 x2 x3 x4 x5 Right
variables side
(0) f* 1 -1 1 0 0 0 0 *1
(1) x3 0 -2 1 1 0 0 2 *2
(2) x4 0 1 -3 0 1 0 2 *1
(3) x5 0 1 1 0 0 1 4 *(-1)
9
Problem 1 - Solution
• Step 5.
• The elements in the pivot column are desired to be
zeros, except the pivot element which is desired to
be 1. This is done by Gaussian elimination
operations. The pivot row is first multiplied by 2
and it is added to line (1). After that pivot row is
mulplied by (-1) and it is added to row (3). Finally
the pivot row is added to the goal row.
10
Problem 1 - Solution
Row Basic f* x1 x2 x3 x4 x5 Right
variables side
(0) f* 1 0 -2 0 1 0 2 *1/2
(1) x3 0 0 -5 1 2 0 6 *5/4
(2) x1 0 1 -3 0 1 0 2 *3/4
(3) x5 0 0 4 0 -1 1 2 *1/4
Problem 1 - Solution
Row Basic f* x1 x2 x3 x4 x5 Right
variables side
(0) f* 1 0 0 0 1/2 1/2 3
(1) x3 0 0 0 1 3/4 5/4 17/2
(2) x1 0 1 0 0 1/4 3/4 7/2
(3) x2 0 0 1 0 -1/4 1/4 1/2
Problem 1 - Solution
• Basic variables are x1 = 3.5, x2 = 0.5 and x3 =
8.5
• Because the minimization was turned to
maximization by multiplying the goal
function by (-1) the optimum is also
multiplied by (-1). F* = -3
13
Problem 2
• Maximize f = x1 - 7x2 + 3x3 under following
restrictions:
• 2x1 + x2 - x3 £ 4 (resource 1)
4x1 - 3x2 £ 2 (resource 2)
-3x1 + 2x2 + x3 £ 3 (resource 3)
x1 , x 2 , x 3 ³ 0
• Use Simplex method. Define the shadow prices for
every resource and describe their importance
14
Basic Right
Row f x1 x2 x3 x4 x5 x6
variables side
(0) f 1 -1 7 -3 0 0 0 0 *3
(1) x4 0 2 1 -1 1 0 0 4 *1
(2) x5 0 4 -3 0 0 1 0 2 *0
(3) x6 0 -3 2 1 0 0 1 3 *1
Problem 3
MAX + +2
Subject to constraints:
• +2 20
2 +4 +2 60
• 2 +3 + 50
• , , 0
19
Problem 4
MAX = 2 + 4 + 3
Subject to constraints:
• 3 +4 +2 60
• 2 + +2 40
• +3 +2 80
• , , 0