Вы находитесь на странице: 1из 119

IE 400 - Principles of Engineering Management

Thanks to Niyazi Onur Bakır for the Slides

Fall 2010
Assumptions in LP problems

Three major assumptions are:


1 Proportionality and additivity The contribution of each
decision variable to the objective function or to each
constraint is proportional to the value of that variable. The
contribution from decision variables are independent from one
another and the total contribution is the sum of the individual
contributions.
2 Divisibility Each decision variable is allowed to take fractional
values.
3 Certainty All input parameters (coefficients of the objective
function and of the constraints) are known with certainty.

Other mathematical programming models may constructed


relaxing one or more of the assumptions above at the expense of
loosing tractability.
Modeling Examples
Transportation Problem There are two power plants generating
electricity and three factories that need electricity in their
production.

1500
MWa+s

1000
MWa+s

F1

PP1


750
MWa+s

F2

2000
MWa+s


PP2

750
MWa+s

F3


Capacity
 Demand

Modeling Examples

Transmission costs per MWatt

F1 F2 F3
PP1 50 100 60
PP2 30 20 35

How should we satisfy the demand of each factory from the two
power plants with minimum total cost?
The unknown values are the amount of electricity supplied from
each power plant to each factory.
Let xij denote the (unknown) # of MWatts of electricity
transmitted from PPi to Fj , i = 1, 2; j = 1, 2, 3.
Modeling Examples

Then the problem can be formulated as:


min 50x11 + 100x12 + 60x13 + 30x21 + 20x22 + 35x23
s.t.
Demand constraints
x11 + x21 = 1500
x12 + x22 = 750
x13 + x23 = 750
Capacity constraints
x11 + x12 + x13 ≤ 1000
x21 + x22 + x23 ≤ 2000
and
xij ≥ 0, i = 1, 2; j = 1, 2, 3.
Modeling Examples

Short-term Investment Planning You have 10, 000 TL at the


beginning of 2008 and would like to invest your money. Your goal
is to maximize your total amount of money at the beginning of
2011. You have the following options:

Option Duration (yrs) Total interest rate Available at the beginning of


1 2 26% 2008, 2009
2 1 12% 2008, 2009, 2010
3 3 38% 2008
4 2 27% 2009
Modeling Examples

2008
 2009
 2010
 2011


Let xt denote the total amount of money available for


reinvestment at the beginning of year t, t = 0, 1, 2, 3.
Let yit denote the amount of money invested in option i at the
beginning of year t, i = 1, 2, 3, 4, t = 0, 1, 2, 3.
Modeling Examples

With this information, the problem can be formulated as:


max x3
s.t.
x0 = 10, 000,
x0 = y10 + y20 + y30 ,
x1 = 1.12y20 ,
x1 = y11 + y21 + y41 ,
x2 = 1.26y10 + 1.12y21 ,
x2 = y22 ,
x3 = 1.38y30 + 1.26y21 + 1.27y41 + 1.12y22
x 0 , x 1 , x 2 , x3 ≥ 0
y10 , y20 , y30 , y11 , y21 , y41 , y22 ≥ 0
Modeling Examples

Blending Problem XYZ oil company produces three types of


gasoline by blending three types of crude oil:

Gas Sales price per barrel Crude oil Purchase price per barrel
1 70 1 45
2 60 2 35
3 50 3 25

The company can purchase up to 5000 barrels of each type of


crude oil daily. The production requirements are,

Gas Octane rating Sulfur content


1 at least 10 at most 1%
2 at least 8 at most 2%
3 at least 6 at most 1%
Modeling Examples
Crude oil specifications:

Crude oil Octane rating Sulfur content


1 12 0.5%
2 6 2.0%
3 8 3.0%

It costs $4 to transform one barrel of crude oil into one barrel of


gasoline.
The company can process up to 14, 000 barrels of crude oil daily.
The company has to meet the daily demand as well:
Gas Demand (barrels)
1 4000
2 5000
3 3000
Modeling Examples

How can the company maximize total profit while satisfying


demand and production requirements?
The decision variables are xij : # of barrels of crude oil i used daily
to produce gas j, i = 1, 2, 3, j = 1, 2, 3.
The objective function is more complicated than in previous
examples. The objective function has 3 pieces. First, sales,
Sales = 70(x11 + x21 + x31 ) + 60(x12 + x22 + x32 )
+50(x13 + x23 + x33 )
Purchase cost = 45(x11 + x12 + x13 ) + 35(x21 + x22 + x23 )
+25(x31 + x32 + x33 )
Modeling Examples

Process cost = 4(x11 + x12 + x13 + x21 + x22 + x23 + x31 + x32 + x33 )
Hence the objective is:
max 70(x11 + x21 + x31 ) + 60(x12 + x22 + x32 )
+50(x13 + x23 + x33 ) − 45(x11 + x12 + x13 )
−35(x21 + x22 + x23 ) − 25(x31 + x32 + x33 )
−4(x11 + x12 + x13 + x21 + x22 + x23 + x31 + x32 + x33 )
s.t.
Demand constraints
x11 + x21 + x31 = 4000,
x12 + x22 + x32 = 5000,
x13 + x23 + x33 = 3000,
Modeling Examples

Purchase constraints
x11 + x12 + x13 ≤ 5000,
x21 + x22 + x23 ≤ 5000,
x31 + x32 + x33 ≤ 5000,
Capacity constraint
x11 + x12 + x13 + x21 + x22 + x23 + x31 + x32 + x33 ≤ 14, 000
Octane requirements
12x11 +6x21 +8x31
Gas 1 x11 +x21 +x31 ≥ 10 =⇒
12x11 + 6x21 + 8x31 − 10(x11 + x21 + x31 ) ≥ 0
2x11 − 4x21 − 2x31 ≥ 0
Modeling Examples

Octane requirements (continued)


Gas 2 12x12 + 6x22 + 8x32 ≥ 8(x12 + x22 + x31 )
=⇒ 4x12 − 2x22 ≥ 0
Gas 3 12x13 + 6x23 + 8x33 ≥ 6(x13 + x23 + x33 )
=⇒ 6x13 + 2x33 ≥ 0
Sulfur requirements
Gas 1 0.005x11 + 0.02x21 + 0.03x31 ≤ 0.01(x11 + x21 + x31 )
=⇒ −0.005x11 + 0.01x21 + 0.02x31 ≤ 0,
Modeling Examples

Sulfur requirements (continued)


Gas 2 0.005x12 + 0.02x22 + 0.03x32 ≤ 0.02(x12 + x22 + x32 )
=⇒ −0.015x12 + 0.01x32 ≤ 0,
Gas 3 0.005x13 + 0.02x23 + 0.03x33 ≤ 0.01(x13 + x23 + x33 )
=⇒ −0.005x13 + 0.01x23 + 0.02x33 ≤ 0
Modeling Examples

Ex 5: Suppose that milk chocolate is produced with three


ingredients. One kg. of milk chocolate contains 0.5 kg. of milk,
0.4 kg of cocoa, and 0.1 kg of sweetener. Each of these three
ingredients needs to be processed before they can be used in the
production of milk chocolate. The facility has two departments
that can process these ingredients. The following table summarizes
the processing requirements.
Dept. 1 (hrs./kg.) Dept. 2 (hrs./kg.)
Milk 0.4 0.6
Cocoa 0.3 0.2
Sweetener 0.5 0.6

The available # of hours per week is 150 for each department.


Formulate an LP problem that maximizes the total # of kg.’s of
milk chocolate produced in a week.
Modeling Examples

Let xij denote the # of kg.’s of ingredient i processed in


department j, i = 1 (milk), 2 (cocoa), 3 (sweetener), j = 1, 2.
Furthermore, let y : # of kg.’s of milk chocolate produced in a
week. y satisfies:
y = min { x110.5
+x12 x21 +x22 x31 +x32
, 0.4 , 0.1 }

What is the problem here?


Modeling Examples

We need to maximize y , but we cannot use the equality provided


in the previous slide.The equation is nonlinear! .
We could apply the common modeling trick below:
max y
s.t.
x11 +x12
y≤ 0.5
x21 +x22
y≤ 0.4
x31 +x32
y≤ 0.1

What other constraints do we have?


Modeling Examples

We also have the following constraints:


Dept. 1 0.4x11 + 0.3x21 + 0.5x31 ≤ 150
Dept. 2 0.6x12 + 0.2x22 + 0.6x32 ≤ 150
xij ≥ 0 i = 1, 2, 3 j = 1, 2
With this example completed, we are now in a position to start
thinking about solution methodologies. The simplex method is the
most popular and oldest approach to solve linear programs.
However, before we start discussing the simplex method, we take a
look at simpler linear programs that include only two variables and
can be solved graphically.
Graphical Solution of 2-variable LP Problems

Consider the following LP:


max 3x1 + 2x2
s.t.

2x1 + x2 ≤ 100
x1 + x2 ≤ 80
x1 ≤ 40
x1 ≥ 0
x2 ≥ 0

How do we solve this?


Graphical Solution of 2-variable LP Problems
The solution can be obtained very easily drawing the plot below:

Figure: Graphical solution


Graphical Solution of 2-variable LP Problems
Consider the following linear
program,
min 50x1 + 100x2
s.t.

7x1 + 2x2 ≥ 28
2x1 + 12x2 ≥ 24
x1 , x2 ≥ 0
Graphical Solution of 2-variable LP Problems

Now consider yet another problem,


max x1 + 3x2
s.t.

x 1 + x2 ≤ 7
−x1 + 2x2 ≤ 8
x1 ≤ 4
x1 ≥ 0
x2 ≥ 0

The graphical solution to this problem is provided in the classroom,


but here is some discussion on how you could obtain the solution.
Graphical Solution of 2-variable LP Problems

First, consider the coefficients of x1 and x2 in the objective


function: 1 and 3, respectively. Now let:
 
1
c=
3

Note that as we move the isoprofit line in the direction of c, the


total profit increases.
For a maximization problem, the vector given by the coefficients of
x1 and x2 in the objective function is called the improving direction.
To solve an LP problem in two variables, we should try to push
isoprofit lines in the improving direction as much as possible while
still staying in the feasible region.
Graphical Solution of 2-variable LP Problems
In this example, the best feasible point we can achieve in this
direction is x ∗ (refer to the class notes). Note that x ∗ is given by
the intersection of the lines:
x1 + x2 = 7
−1/2x1 + x2 = 4
Solving this mini-system of linear equalities, we obtain:
 
∗ 2
x =
5

as the optimal solution! Then, the maximum achievable profit is


given by:
x1∗ + 3x2∗ = 2 + 3 · (5) = 17 TL
In other words, the optimal value of the LP problem is 17.
General Concepts in LP

Some properties and attributes of the feasible region are also


important in the later stages of this course where we start
discussing how to solve LPs involving more than 2 decision
variables.
A set of points S is a convex set if the line segment joining any
pair of points in S is wholly contained in S.
For any convex set S, a point P in S is an extreme point if each
line segment that lies completely in S and contains the point P
has P as an endpoint of the line segment. Extreme points are
sometimes called corner points, because if the set S is a polygon,
the extreme points of S will be the vertices, or corners of the
polygon.
Graphical Solution of 2-variable LP Problems

A company wishes to increase demand for its product through


advertising. Each minute of radio ad costs 1 units and each minute
of TV ad costs 2 units. Each minute of radio ad increases the daily
demand by 2 units and each minute of TV ad by 7 units. The
company would wish to place at least 9 minutes of daily ad in
total. It wishes to increase daily demand by at least 28 units. How
can the company meet its advertising requirements at minimum
total cost?

What are the decision variables?


Graphical Solution of 2-variable LP Problems

x1 : # of minutes of radio ads purchased.


x2 : # of minutes of TV ads purchased.
The problem can be formulated as follows:
min x1 + 2x2
s.t.
2x1 + 7x2 ≥ 28
x1 + x2 ≥ 9
x1 ≥ 0, x2 ≥ 0
The geometric solution is provided in the classroom.
Graphical Solution of 2-variable LP problems

Note that the vector given by the coefficients of decision variables


in the objective function is
 
1
c=
2

Note that the total cost increases in this direction. Since we have
a minimization problem, this is, hence, not the direction that we
want to move. We should move in the opposite direction, i.e. in
the direction of  
−1
−c =
−2
In other words, for a minimization problem, we go in the opposite
direction of c (i.e. in the direction of −c as much as possible while
still remaining in the feasible region.
Graphical Solution of 2-variable LP problems

The optimal solution is given by the intersection of the following


two lines:
2x1 + 7x2 = 28
x1 + x2 = 9
Solving for the system of two equations, we obtain x1∗ = 7 and
x2∗ = 2. Hence, the optimal solution is
 
∗ 7
x =
2

The optimal value is 7 + 2(2) = 11. Therefore, the total minimum


cost is 11 units. Also, note that both constraints are binding at the
optimum.
Graphical Solution of 2-variable LP Problems

Alternate or multiple optimal solutions Suppose in the previous


example that it costs 4 units to place a minute of radio ad and 14
units to place a minute of TV ad. Then the formulation could be
modified as:
min 4x1 + 14x2
s.t.
2x1 + 7x2 ≥ 28
x1 + x2 ≥ 9
x1 ≥ 0, x2 ≥ 0
Again, the graphical solution is provided in the classroom. After
plotting the objective function as well as the constraints, one could
readily see that any feasible point on the line segment between
points A = (x1 , x2 ) = (7, 2) and B = (x1 , x2 ) = (14, 0) is an
optimal solution with the same optimal value.
Graphical Solution of 2-variable LP Problems

At point A, 4(7) + 14(2) = 56


At point B, 4(14) + 14(0) = 56
The optimal value is 56. This is also true for any feasible point
between A & B. In this case, we say that LP has multiple or
alternate optimal solutions.
Mathematically speaking, we could represent the set of optimum
points as the convex combination of A & B, or the line segment
[A, B]

   
7 14
{λ + (1 − λ) : λ ∈ [0, 1]}
2 0
Graphical Solution of 2-variable LP problems

Alternative or Multiple Optimal Solutions An auto company


manufactures cars and trucks. Each vehicle must be processed in
the paint shop and body assembly shop. If the paint shop were
only painting trucks, 40 per day could be painted. If the paint shop
were only painting cars, 60 per day could be painted. If the body
shop were only producing cars, it could process 50 per day. If the
body shop were only producing trucks, it could process 50 per day.
Each truck contributes $300 to profit, and each car contributes
$200 to profit. Use linear programming to determine daily
production schedule that will maximize the company’s profits.
Decision variables?
Graphical Solution of 2-variable LP problems

The company must decide how many cars and trucks should be
produced daily.
x1 : # of trucks produced daily.
x2 : # of cars produced daily.
The company maximizes profits. In hundreds of dollars, the
objective function can be written as 3x1 + 2x2 .
There are two constraints based on the capacity of the paint and
body shops. For both departments, the fraction of day allocated to
truck and car production must not exceed 1. Hence the constraints
are:
1 1
40 x1 + 60 x2 ≤1
1 1
50 x1 + 50 x2 ≤1
Graphical Solution of 2-variable LP problems

Clearly, the LP problem is:


max 3x1 + 2x2
s.t.
1 1
40 x1 + 60 x2 ≤1
1 1
50 x1 + 50 x2 ≤1
x1 ≥ 0, x2 ≥ 0
The plot of the objective function and the feasible region should
reveal the fact that the objective function has the same slope with
one of the constraints, and it intersects an entire line segment
corresponding to the binding constraint.
Graphical Solution of 2-variable LP Problems

Unboundedness Consider the following LP problem,


max x1 + 3x2
s.t.
−x1 + 2x2 ≤ 8
x1 ≥ 0, x2 ≥ 0
After plotting the feasible region, one can observe that the
objective function can be increased by the moving in the improving
direction c as much as we want while still staying in the feasible
region. In this case, we say that the LP is unbounded.
For unbounded LP max problems, there is no optimal solution and
the optimal value is defined to be +∞. For a min problem, we say
that the LP is unbounded if we can decrease the objective function
as much as we want while staying in the feasible region. In this
case, the optimal value is −∞.
Graphical Solution of 2-variable LP problems

Unboundedness Another example of an unbounded feasible region


is as follows:
max 2x1 − x2
s.t.
x1 − x2 ≤ 1
2x1 + x2 ≥ 6
x1 ≥ 0, x2 ≥ 0
Again, after shifting the plot of the objective function in the
feasible region, one can observe that the objective function can be
shifted to assume arbitrarily large values.
Graphical Solution of 2-variable LP Problems

Infeasible LP problems Consider the following LP


max x1 + 3x2
s.t.
x1 + x2 ≤ 6
−x1 + 2x2 ≤ 8
x2 ≥ 6
x1 ≥ 0, x2 ≥ 0

After plotting the constraints, one can readily observe that a


feasible region does not exist. We say that the LP problem is
infeasible.
Graphical Solution of 2-variable LP Problems

Infeasible LP problems Suppose in the previous auto manufacturing


example that auto dealers require that the auto company produce
at least 30 trucks and 20 cars. The the problem becomes,
max 3x1 + 2x2
s.t.
1 1
40 x1 + 60 x2 ≤ 1
1 1
50 x1 + 50 x2 ≤1
x1 ≥ 30
x2 ≥ 20
x1 ≥ 0, x2 ≥ 0
Graphical Solution of 2-variable LP variables

The plot should immediately warn us of an infeasible problem. We


could also recognize that there is an infeasible solution by
immediately checking the paint shop constraint at the point
x1 = 30 and x2 = 20.
LP is infeasible because producing 30 trucks and 20 cars requires
more paint shop time than is available.
General Characterization of LP Problems

Every LP problem falls into one of the four cases:


Case 1 The LP problem has a unique optimal solution.
Case 2 The LP problem has alternative or multiple optimal
solutions. In this case, there are infinitely many optimal solutions.
Case 3 The LP problem is unbounded. There is no optimal
solution in this case.
Case 4 The LP problem is infeasible. There is no feasible solution.
Summary So Far

So far, we have seen the solution of LP problems with only two


decision variables.
Such problems can easily be solved graphically.
However, many LP problems include more than two variables. How
can we solve them?
We will learn how to solve more complex linear programs using the
simplex method. Simplex method is a solution algorithm that
searches for the optimal solution checking the extreme points of
the feasible region iteratively.
The Simplex Method
Last time, we began to solve linear programs using the graphical
method. During our discussion, we observed that the optimal
solution, if it exists, is either an extreme point or a linear
combination of two extreme points. This characteristic of LP
problems provide some analytical convenience in solving more
complex LP problems involving more than 2 decision variables.
Simplex method is the first method, invented in late 1940s to
exploit this characteristic of LP problems. Simplex method can be
used to solve very large LPs, involving thousands of constraints
and variables.
So far, we have seen simple LP problems with both equality and
inequality constraints. The decision variables were allowed to take
nonnegative values. However, in general, LP problems can also
have variables that are required to be nonpositive or those allowed
to be unrestricted in sign.
The Simplex Method

To use the simplex method, we need to convert the problem first


into the standard form. To convert an LP problem into the
standard form, each inequality constraint must be replaced by an
equality constraint.
We will illustrate the simplex method step by step, using the
example below,
max 5x1 + 4x2 + 3x3
s.t.

2x1 + 3x2 + x3 ≤ 5
4x1 + x2 + 2x3 ≤ 11
3x1 + 4x2 + 2x3 ≤ 8
x 1 , x 2 , x3 ≥ 0
The Simplex Method

To convert this problem into its standard form, we need to define


”slack” variables. For each inequality constraint, we define a slack
variable, as follows:

s1 = 5 − 2x1 − 3x2 − x3
s2 = 11 − 4x1 − x2 − 2x3
s3 = 8 − 3x1 − 4x2 − 2x3

Clearly, each slack variable corresponds to the difference between


the right hand side (RHS) and the left hand side (LHS) of each of
the first three constraints. This implies s1 , s2 , s3 ≥ 0 for every
feasible solution of the LP problem. In summary, if constraint i of
an LP is a ”≤” constraint, we convert it to an equality constraint
by adding a slack variable si to the i th constraint and adding the
sign restriction si ≥ 0.
The Simplex Method

Similarly, let us denote the objective function by:


z = 5x1 + 4x2 + 3x3 .
After the necessary conversions, we obtain what we call Dictionary
1:

Row 0 z = 5x1 + 4x2 + 3x3


Row 1 s1 = 5 − 2x1 − 3x2 − x3
Row 2 s2 = 11 − 4x1 − x2 − 2x3
Row 3 s3 = 8 − 3x1 − 4x2 − 2x3

To begin with, we need an initial feasible solution. How could you


obtain one?
The Simplex Method

A simple initial feasible solution can be obtained by setting the


original decision variables equal to 0. Hence, the first feasible
solution is:
x1 = 0, x2 = 0, x3 = 0,
s1 = 5, s2 = 11, s3 = 8.
The current value of the objective function is z = 0. Our goal is to
look for another feasible solution that yields a larger objective
function value (since this is a max. problem). To do so, we
consider increasing x1 , x2 and x3 from their current values. This
also increases the current z value.
By looking at row 0 above, we the see that increasing x1 by 1
increases z by 5. Similarly, increasing x2 by 1 and x3 by 1 increase
z by 4 and 3 respectively.
The Simplex Method

Ratio Test
It makes sense to increase the value of x1 because it offers the
highest amount of increase in z per unit of perturbation. As we
increase x1 , we keep x2 and x3 at their initial values of 0. In doing
so, we need to pay attention to the constraints as well. We cannot
perturb x1 in violation of the constraints. So the question is: How
much can we increase x1 ?
The new solution will still be feasible as long as each of the original
and slack variables is still non-negative. Now, going back to the
first dictionary,
s1 = 5 − 2x1 − 3x2 − x3 = 5 − 2x1 ≥ 0 =⇒ x1 ≤ 5/2
s2 = 11 − 4x1 − x2 − 2x3 = 11 − 4x1 ≥ 0 =⇒ x1 ≤ 11/4
s3 = 8 − 3x1 − 4x2 − 2x3 = 8 − 3x1 ≥ 0 =⇒ x1 ≤ 8/3.
The Simplex Method

Of the three bounds, the first one is the most restrictive.


Therefore, we can increase the value of x1 up to 5/2 while keeping
x2 and x3 at 0 to ensure feasibility. Now, we obtain a new feasible
solution at x1 = 5/2. The second feasible solution is:
x1 = 5/2, x2 = 0, x3 = 0,
s1 = 0, s2 = 1, s3 = 1/2.
And the current value of the objective function is:
z = 5 · ( 52 ) + 4 · (0) + 3 · (0) = 25
2 .

Note that the second feasible solution has indeed a larger objective
function value than the first feasible solution.
However, our search for the optimal solution is probably not over!
The Simplex Method

Now, we shall look for an even better solution than the second
feasible solution. Note that, in Dictionary 1, each of the variables
x1 , x2 and x3 was on the RHS and had a value of 0. As such, the
same was true for the objective function.
This enabled us to quickly identify which variables should be
increased from their current value of zero to obtain the largest
increase in the objective function value.
To do the same, we shall rearrange dictionary 1, so that only the
variables which are 0 in the second feasible solution will be on the
RHS. In feasible solution #2, x2 = 0, x3 = 0 and s1 = 0.
The Simplex Method

In row 1 of dictionary 1, s1 should move from the LHS to the RHS


and x1 should move from the RHS to the LHS. Mathematically
speaking,
s1 = 5 − 2x1 − 3x2 − x3
becomes

x1 = 5/2 − 3/2x2 − 1/2x3 − 1/2s1 (1)

The same should be repeated for other rows as well. Note that, s2
and s3 are still in the LHS and they should remain so. But x1
should no longer be on the RHS of rows 2 and 3. To this end, we
could substitute (??) in rows 2 and 3 of dictionary #1. In the end,
only x2 , x3 and s1 will appear on the LHS of rows 2 and 3.
The Simplex Method

Substituting,

s2 = 11 − 4x1 − x2 − 2x3
5 3 1 1
= 11 − 4( − x2 − x3 − s1 ) − x2 − 2x3
2 2 2 2
= 1 + 5x2 + 2s1

and

s3 = 8 − 3x1 − 4x2 − 2x3


5 3 1 1
= 8 − 3( − x2 − x3 − s1 ) − 4x2 − 2x3
2 2 2 2
1 1 1 3
= + x2 − x3 + s 1
2 2 2 2
We do the same for row 0 as well.
The Simplex Method
As a result,
z = 5x1 + 4x2 + 3x3
5 3 1 1
= 5( − x2 − x3 − s1 ) + 4x2 + 3x3
2 2 2 2
25 7 1 5
= − x2 + x3 − s 1 .
2 2 2 2
We are now ready to form the new dictionary (Dictionary #2):

25 7 1 5
Row 0 z = 2
− x
2 2
+ x
2 3
− s
2 1

5 3 1 1
Row 1 x1 = 2
− x
2 2
− x
2 3
− s
2 1

Row 2 s2 = 1 + 5x2 + 2s1

1 1 1 3
Row 3 s3 = 2
+ x
2 2
− x
2 3
+ s
2 1
The Simplex Method

Recall feasible solution #2:


25
x1 = 5/2, x2 = 0, x3 = 0, s1 = 0, s2 = 1, s3 = 1/2, z = 2 .

Observe that in dictionary #2, only variables with zero values are
on the RHS of each of the four rows.
By looking at row 0, we see that only increasing x3 from 0 yields
an even larger objective function value. This is not the case for the
other variables. As in the previous case, we first decide how much
x3 can be increased while keeping x2 and s1 at 0.
The Simplex Method

To see this,
5
x1 = 2 − 32 x2 − 12 x3 − 12 s1 = 5
2 − 21 x3 ≥ 0 =⇒ x3 ≤ 5.
s2 = 1 + 5x2 + 2s1 = 1 ≥ 0 =⇒ No restriction!
1
s3 = 2 + 12 x2 − 21 x3 + 32 s1 = 1
2 − 12 x3 ≥ 0 =⇒ x3 ≤ 1
Note that row #2 imposes no restriction on how much x3 can be
increased. Clearly, the most restrictive bound is given by row 3. It
says that you can increase x3 at most by 1 without violating
feasibility. With this in mind, the third feasible solution is:
x1 = 2, x2 = 0, x3 = 1,
s1 = 0, s2 = 1, s3 = 0,
25
with an objective function value of z = 2 + 12 x3 = 13. This is an
improvement!
The Simplex Method

We still need to continue because we can still observe an


improvement. Note that, as we increased x3 to 1, we forced s3
down to 0. This suggests that we need to interchange the roles of
s3 and x3 , i.e.,
1
s3 = 2 + 12 x2 − 21 x3 + 32 s1

=⇒ x3 = 1 + x2 + 3s1 − 2s3 . (2)

Substituting (??) in rows 1, 2 and 0, we get:

5 3 1 1
Row 1 =⇒ x1 = − x 2 − x3 − s 1
2 2 2 2
5 3 1 1
= − x2 − (1 + x2 + 3s1 − 2s3 ) − s1
2 2 2 2
x1 = 2 − 2x2 − 2s1 + s3 .
The Simplex Method

Row 2 =⇒ s2 = 1 + 5x2 + 2s1 (x3 does not appear, hence no change!)


25 7 1 5
Row 0 =⇒ z = − x 2 + x3 − s 1
2 2 2 2
25 7 1 5
= − x2 + (1 + x2 + 3s1 − 2s3 ) − s1
2 2 2 2
= 13 − 3x2 − s1 − s3 .

After all these arrangements, we end up with the following


dictionary (Dictionary #3):

Row 0 z = 13 − 3x2 − s1 − s3
Row 1 x1 = 2 − 2x2 − 2s1 + s3
Row 2 s2 = 1 + 5x2 + 2s1
Row 3 x3 = 1 + x2 + 3s1 − 2s3
The Simplex Method

Now, with x2 = 0, s1 = 0 and s3 = 0 we have a feasible solution


that yields an objective function value of 13. Checking row 0, we
immediately see that if we try to increase the values of any of
these variables, we decrease the objective function value.
Therefore, we can no longer increase the objective function value
among all feasible solutions. Hence, the third feasible solution
obtained in this process is actually an optimal value, i.e.,
x1∗ = 2, x2∗ = 0, x3∗ = 1,
s1∗ = 0, s2∗ = 1, s3∗ = 0.
Again, the optimal value z ∗ = 13.
The Simplex Method

In the previous example, we observe the following,


With the exception of z, the variables that appear on the LHS
of a dictionary are called basic variables. For example, in
dictionary #3, x1 , s2 , and x3 are basic variables.
All other variables that appear on the RHS of a dictionary are
called non-basic variables. Note that non-basic variables
necessarily have a value of 0 in a feasible solution
corresponding to a dictionary. For example, in dictionary #3,
x2 , s1 , and s3 are non-basic variables and x2 = s1 = s3 = 0.
Each of the three feasible solutions obtained above is called a
basic feasible solution (bfs). Therefore, a bfs has the property
that each non-basic variable has a value of 0. Moreover, two
consecutive bfs’s share all but one basic variable, and as such
they are called neighboring bfs’s.
The Simplex Method

The simplex method works only with bfs’s and ignores all other
feasible solutions.
Note that, a basic feasible solution ≡ corner point.
The Simplex Method

More formally, let’s consider an LP with n variables in its standard


form:
max c1 x1 + c2 x2 + . . . + cn xn
s.t.

a11 x1 +a12 x2 · · · +a1n xn = b1


a21 x1 +a22 x2 · · · +a2n xn = b2
................................
................................
am1 x1 +am2 x2 · · · +amn xn = bm
x1 , x2 , · · · xn ≥0
The Simplex Method

Define,
   

a11 a12 · · · a1n
 x1 b1
 a21 a22 · · · a2n   x2   b2 
A= x = b=
   

 ...................  ..  .. 
 .   . 
am1 am2 · · · amn xn bm

and,  
c= c1 c2 · · · cn

Then the problem in matrix notation can be stated as,

max cx s.t. Ax = b, x ≥ 0
The Simplex Method

In simplex algorithm, rather than exhaustively searching the


entirety of the feasible region for an optimum, we limit ourselves to
solutions in which n − m of the variables in Ax = b are equal to
zero. A basic solution to Ax = b is obtained by setting n − m
variables equal to 0 and solving for the values of remaining m
variables. This assumes that setting n − m variables equal to 0
yields unique values for the remaining m variables, or, equivalently,
the columns for the remaining m variables are linearly independent.

Definition (6)
Any basic solution to Ax = b in which all variables are nonnegative
is a basic feasible solution.Two bfs’s are neighbors if they share
m − 1 of their basic variables.
The Simplex Method
Why are basic feasible solutions important? The reason is,

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 LP’s feasible
region corresponding to each basic feasible solution. Also, there is
at least one bfs corresponding to each extreme point of the feasible
region.

In short, the simplex method is initiated with a bfs and iteratively


continues until no better bfs is found.
The Simplex Method
Consider the following linear program,
max z = cx s.t. Ax = b, x ≥ 0
where A is an m × n matrix with rank m, where m ≤ n. The
simplex algorithm is initiated by equalizing n − m of the variables
to 0, and solve for the rest of the variables. The variables which
are equalized directly to 0 are non-basic variables, while the rest
are basic variables. Let B and N denote the coefficients of basic
variables and non-basic variables in matrix A respectively. Then,
the constraints Ax = b can be rewritten as BxB + NxN = b. Since
xN = 0, then the initial basic feasible solution becomes
xB = B −1 b. In other words, our basic solution corresponding to
this choice of basic variables (basis) is:
 −1 
B b
x=
0
The Simplex Method
Let’s solve this simple linear program as an example,
min z = x1 + x2 s.t. x1 + 2x2 ≤ 4, x2 ≤ 1, and x1 , x2 ≥ 0
First we convert the problem to its standard form,

min z = x1 + x2

s.t. x1 + 2x2 + x3 = 4,
x2 + x4 = 1,
x 1 , x 2 , x3 , x4 ≥ 0
The Simplex Method
So A matrix in this problem is,
 
1 2 1 0
A = [a1 , a2 , a3 , a4 ] =
0 1 0 1

We first consider the bfs corresponding to B = [a1 a2 ], which


implies variables x1 and x2 are basic whereas x3 and x4 are
non-basic. The current objective function value that corresponds
to this bfs is,
  
−1 1 −2 4
z0 = cB B b = [1 1] =3
0 1 1

The values of x1 and x2 when we set x3 and x4 equal to 0 are,


      
x1 −1 1 −2 4 2
= b̄ = B b = =
x2 0 1 1 1
The Simplex Method
We have computed the solution that pertains to the current bfs.
The next step is to see whether this bfs is indeed the optimal
solution. To see this, we should convert the objective function to
include only the non-basic variables and the current objective
function value. Hence, the required representation is,
min 3 − x3 + x4
s.t. x3 − 2x4 + x1 = 2,
x4 + x2 = 1,
x 1 , x 2 , x3 , x4 ≥ 0
This suggests that the objective function value can be further
improved by increasing x3 . However, due the constraints, we
cannot let x3 increase indefinitely. To avoid violating the first
contraint, x3 is set to 2, which forces x1 to 0. In other words, x3
becomes basic, and x1 becomes non-basic rendering B = [a2 a3 ]
and objective function value 1.
The Simplex Method

How does the simplex method find alternate optimal solutions?


Consider the problem below:
max z = −2x1 + 2x2
s.t.
−x1 + x2 ≤ 2
x1 + x2 ≤ 4
x1 , x2 ≥ 0

This problem has alternate optimal solutions as graphically


depicted in the next slide. The optimal solution lies between the
points x1∗ = (0, 2) and x2∗ = (1, 3).
The Simplex Method
The Simplex Method

Let’s resolve the LP problem using the simplex method. The first
dictionary is:

Row 0 z = −2x1 + 2x2


Row 1 s1 = 2 + x1 − x2
Row 2 s2 = 4 − x1 − x2

Starting from our usual choice of a feasible solution, we set the


original decision variables to 0, and solve for slack variables
accordingly. This yields:
x1 = 0, x2 = 0,
s1 = 2, s2 = 4.
The objective function value becomes z = 0.
The Simplex Method

Our usual test for a max. problem suggests that we can improve
this objective function value further by perturbing x2 in the
positive direction while keeping x1 = 0.

s1 = 2 + x1 − x2 = 2 − x2 ≥ 0 =⇒ x2 ≤ 2
s2 = 4 − x1 − x2 = 4 − x2 ≥ 0 =⇒ x2 ≤ 4

The most restrictive bound is x2 ≤ 2. This means, we should


interchange the roles of x2 and s1 i.e., x2 becomes basic, and s1
becomes non-basic. The new row 1 is:
x 2 = 2 + x1 − s 1
And other rows are also obtained after rearrangement,
s2 = 4 − x1 − (2 + x1 − s1 )
s2 = 2 − 2x1 + s1
The Simplex Method

z = −2x1 + 2(2 + x1 − s1 ) = 4 − 2s1


Now, we can form the second dictionary.

Row 0 z = 4 − 2s1
Row 1 x2 = 2 + x1 − s1
Row 2 s2 = 2 − 2x1 + s1

The second feasible solution is x2 = 2, s2 = 2, x1 = 0, s1 = 0. The


objective function value is (0) + 2(2) = 4. Feasible solution 2 is
optimal since there is no nonbasic variable with a positive
coefficient on the RHS of row 0. However, note that,
z = 4 + 0.x1 − 2s1
The Simplex Method

x1 is currently 0 and it has a coefficient of 0 in row 0 of the last


dictionary. This implies that increasing x1 does not change the
value of z. Let us try to increase x1 while keeping s1 = 0:
x2 = 2 + x1 − s1 = 2 + x1 ≥ 0 =⇒ x1 ≥ −2 (no restriction)
s2 = 2 − 2x1 + s1 = 2 − 2x1 ≥ 0 =⇒ x1 ≤ 1
Increasing x1 to 1 and forcing s2 down to 0, we have the following
rearrangement of the rows in the previous dictionary,
x1 = 1 + 21 s1 − 12 s2
x2 = 2 + (1 + 21 s1 − 12 s2 ) − s1
x2 = 3 − 12 s1 − 21 s2
The Simplex Method

z = 4 − 2s1
The third dictionary is:
Row 0 z = 4 − 2s1

1 1
Row 1 x2 = 3 − 2 s1 − 2 s2

1 1
Row 2 x1 = 1 + 2 s1 − 2 s2

The feasible solution described in this dictionary is x1 = 1, x2 = 3


(basic variables), and s1 = s2 = 0 (nonbasic variables). The
objective function value is still z = 4.
The Simplex Method

Note that we have found another bfs with the same optimal value.
Therefore, we have alternate optimal solutions. Feasible solution 2
and 3 are both optimal solutions along with any feasible solution
that lies on the line segment joining them.
In addition, Dictionary 2 or Dictionary 3 can be used to find other
optimal solutions that are not necessarily bfs’s.
Consider Dictionary 2 below:

Row 0 z = 4 − 2s1
Row 1 x2 = 2 + x1 − s1
Row 2 s2 = 2 − 2x1 + s1
The Simplex Method

We know we can increase x1 from zero while keeping s1 = 0. Let


x1 = α. Since, we found earlier that x1 ≤ 1, 0 ≤ α ≤ 1. Then,
x2 = 2 + x1 − s1 = 2 + α (since s1 = 0)
s2 = 2 − 2x1 + s1 = 2 − 2α
z = 4 − 2s1 = 4
Since the objective function value is still 4, for any 0 ≤ α ≤ 1,
x1 = α, x2 = 2 + α, s1 = 0 and s2 = 2 − 2α
is an optimal solution.
The Simplex Method

Another way to represent this solution is a linear combination of


vectors below:

   
0 1
 2   3 
{(1 − α) 
 0  + α
   : α ∈ [0, 1]}
0 
2 0

For instance, for α = 12 , x1 = 21 , x2 = 52 , s1 = 0, and s2 = 1 is an


optimal solution.
The Simplex Method

Consider another problem with alternative optima. Recall the


Dakota furniture example from the previous lecture. We make a
slight change in the objective function and take a look at the
following modified problem,
max z = 60x1 + 35x2 + 20x3
s.t.
8x1 + 6x2 + x3 ≤ 48
4x1 + 2x2 + 1.5x3 ≤ 20
2x1 + 1.5x2 + 0.5x3 ≤ 8
x2 ≤ 5
x1 , x2 , x3 ≥ 0
As we will see, as a result of a slight change in the slope of the
objective function, we observe alternate optimal solutions.
The Simplex Method
The initial dictionary is,
Row 0 z = 60x1 + 35x2 + 20x3
Row 1 s1 = 48 − 8x1 − 6x2 − x3
Row 2 s2 = 20 − 4x1 − 2x2 − 1.5x3
Row 3 s3 = 8 − 2x1 − 1.5x2 − 0.5x3
Row 4 s4 = 5 − x2
x1 should enter the set of basic variables. Checking rows 1 to 3,
Row 1 =⇒ 48 − 8x1 ≥ 0 =⇒ x1 ≤ 6
Row 2 =⇒ 20 − 4x1 ≥ 0 =⇒ x1 ≤ 5
Row 3 =⇒ 8 − 2x1 ≥ 0 =⇒ x1 ≤ 4
Hence, x1 enters the set of basic variables and s3 leaves. Making
the appropriate rearrangements,
x1 = 4 − 0.5s3 − 0.75x2 − 0.25x3 .
The Simplex Method
s1 = 48 − 8(4 − 0.5s3 − 0.75x2 − 0.25x3 ) − 6x2 − x3
s1 = 16 + 4s3 + x3
s2 = 20 − 4(4 − 0.5s3 − 0.75x2 − 0.25x3 ) − 2x2 − 1.5x3
s2 = 4 + 2s3 + x2 − 0.5x3
s 4 = 5 − x2
z = 60(4 − 0.5s3 − 0.75x2 − 0.25x3 ) + 35x2 + 20x3
z = 240 − 30s3 − 10x2 + 5x3
The resulting second dictionary is,
Row 0 z = 240 − 30s3 − 10x2 + 5x3
Row 1 s1 = 16 + 4s3 + x3
Row 2 s2 = 4 + 2s3 + x2 − 0.5x3
Row 3 x1 = 4 − 0.5s3 − 0.75x2 − 0.25x3
Row 4 s4 = 5 − x2
The Simplex Method

The current feasible solution is x1 = 4, x2 = 0, x3 = 0 and


s1 = 16, s2 = 4, s3 = 0, s4 = 5. The positive coefficient in row 0
suggests that x3 should become basic. In this iteration,
non-negativity constraints for s2 and x1 should be checked,
Row 2 =⇒ 4 − 0.5x3 ≥ 0 =⇒ x3 ≤ 8
Row 3 =⇒ 4 − 0.25x3 ≥ 0 =⇒ x3 ≤ 16
Hence, x3 becomes basic forcing s2 to become nonbasic. In this
iteration,
x3 = 8 + 4s3 + 2x2 − 2s2 ,
s1 = 16 + 4s3 + (8 + 4s3 + 2x2 − 2s2 )
s1 = 24 + 8s3 + 2x2 − 2s2
The Simplex Method

x1 = 4 − 0.5s3 − 0.75x2 − 0.25(8 + 4s3 + 2x2 − 2s2 )


x1 = 2 − 1.5s3 − 1.25x2 + 0.50s2
z = 240 − 30s3 − 10x2 + 5(8 + 4s3 + 2x2 − 2s2 )
z = 280 − 10s3 − 10s2 .
And the new dictionary is,
Row 0 z = 280 − 10s3 − 10s2
Row 1 s1 = 24 + 8s3 + 2x2 − 2s2
Row 2 x3 = 8 + 4s3 + 2x2 − 2s2
Row 3 x1 = 2 − 1.5s3 − 1.25x2 + 0.5s2
Row 4 s4 = 5 − x2
The Simplex Method

The current feasible solution is x1 = 2, x2 = 0, x3 = 8 and


s1 = 24, s2 = s3 = 0, s4 = 5. None of the coefficients in row 0 is
positive. Hence, the current solution is optimal. However, the only
original decision variable that remains nonbasic has a 0 coefficient
in row 0. Therefore, introducing x2 to the set of basic variables
would not reduce the optimal value. This signals the existence of
alternate optimal solutions.
If we wish to make x2 basic, we could increase x2 to at most
2 8
1.25 = 5 = 1.6 (check the non-negativity constraint for row 3). x1
becomes non-basic.
The Simplex Method
After rearrangements for the rows, we obtain the following
dictionary,
Row 0 z = 280 − 10s3 − 10s2
Row 1 s1 = 27.2 + 5.6s3 − 1.6x1 − 1.2s2
Row 2 x3 = 11.2 + 1.6s3 − 1.6x1 − 1.2s2
Row 3 x2 = 1.6 − 1.2s3 − 0.8x1 + 0.4s2
Row 4 s4 = 3.4 + 1.2s3 + 0.8x1 − 0.4s2
This new dictionary describes another optimal solution
x1 = 0, x2 = 1.6, x3 = 11.2 and s1 = 27.2, s2 = s3 = 0, s4 = 3.4.
This suggests alternate optimal solutions between the extreme
points,
   
2 0
 0  and  1.6 
8 11.2
The Simplex Method

How does the simplex method detect an unbounded solution?


Consider the problem below,
max z = −x1 + 2x2
s.t.
−x1 + x2 ≤ 2
x1 , x2 ≥ 0
The graphical depiction, which is provided in the class, shows
readily that the feasible region and the solution is unbounded. Our
goal is to see this in simplex method. The first dictionary is:
Row 0 z = − x1 + 2x2
Row 1 s1 = 2 + x1 − x2
The Simplex Method

The first feasible solution is s1 = 2 (basic) and x1 = 0, x2 = 0


(nonbasic), with an objective function value of z = 0. In the
second iteration, we could increase x2 while keeping x1 at 0. The
bound on x2 in doing so is given by,
s1 = 2 + x1 − x2 = 2 − x2 ≥ 0 =⇒ x2 ≤ 2.
After rearranging rows,
x 2 = 2 + x1 − s 1
z = −x1 + 2(2 + x1 − s1 ) = 4 + x1 − s1
The current dictionary is,
Row 0 z = 4 + x1 − 2s1
Row 1 x2 = 2 + x1 − s1
The Simplex Method

The feasible solution is x2 = 2, x1 = s1 = 0. Since the coefficient


of x1 in row 0 is positive, we conclude that this solution is not
optimal. However, as we increase x1 , x2 increases as well (check
row 1).
Hence, x1 can be increased indefinitely without violating the
non-negative constraint for row 1. We still remain feasible.
Then, by row 0, as x1 ↑ +∞, z ↑ +∞. The LP problem is
unbounded. Note that we can use Dictionary 2 to obtain a feasible
solution with any sufficiently large objective function value. To see
this, let x1 = α ≥ 0. Then,
x2 = 2 + x1 − s1 = 2 + α,
z = 4 + x1 − s1 = 4 + α.
The Simplex Method

For instance, we can easily compute a feasible solution with an


objective function value of 100, i.e.,
z = 100 = 4 + α =⇒ α = 96, or
x1 = α = 96, x2 = 2 + α = 98, s1 = 0.
More generally,
x1 = α, x2 = 2 + α, s1 = 0,
is feasible for any α ≥ 0 with objective function value z = 4 + α.
As α ↑ +∞, z ↑ +∞.
The Simplex Method

Another LP problem with an unbounded optimal solution is as


follows: Breadco Bakeries bakes two kinds of bread: french and
sourdough. Each loaf of french bread can be sold for 36 cents, and
each loaf of sourdough bread for 30 cents. A loaf of french bread
requires 1 yeast packet and 6 oz of flour; sourdough requires 1
yeast packet and 5 oz of flour. At present, Breadco has 5 yeast
packets and 10 oz of flour. Additional yeast packets can be
purchased at 3 cents each, and additional flour at 4 cents/oz.
Formulate and solve an LP that can be used to maximize
Breadco’s profits.
Decision variables?
The Simplex Method

x1 : number of loaves of french bread baked


x2 : number of loaves of sourdough bread baked
x3 : number of yeast packets purchased
x4 : number of ounces of flour purchased
Breadco’s profits can be represented as,
z = 36x1 + 30x2 − 3x3 − 4x4
There are two constraints, one associated with the availability of
yeast, the other with the availability of flour. Those are,
x1 + x2 − x3 ≤ 5
6x1 + 5x2 − x4 ≤ 10
The Simplex Method

The problem is,


max z = 36x1 + 30x2 − 3x3 − 4x4
s.t.
x 1 + x 2 − x3 ≤ 5
6x1 + 5x2 − x4 ≤ 10
x 1 , x2 , x3 , x4 ≥ 0
The initial dictionary associated with this problem is,
Row 0 z = 36x1 + 30x2 − 3x3 − 4x4
Row 1 s1 = 5 − x1 − x2 + x3
Row 2 s2 = 10 − 6x1 − 5x2 + x4
The Simplex Method

Both x1 and x2 improve the objective function, but we choose to


make x1 basic first. From the non-negativity constraints imposed
by rows 1 and 2, we conclude that x1 can be increased by at most
10
6 . That pushes s2 out of the set of basic variables, and introduces
x1 into that set. Then,
5
x1 = 3 − 16 s2 − 65 x2 + 16 x4
s1 = 5 − ( 35 − 16 s2 − 65 x2 + 16 x4 ) − x2 + x3
s1 = 10 1 1 1
3 + 6 s 2 − 6 x2 + x3 − 6 x4

z = 36( 35 − 61 s2 − 56 x2 + 16 x4 ) + 30x2 − 3x3 − 4x4


z = 60 − 6s2 + 2x4 − 3x3
The new dictionary is,
The Simplex Method
Row 0 z = 60 − 6s2 − 3x3 + 2x4

10 1 1 1
Row 1 s1 = 3 + 6 s2 − 6 x2 + x3 − 6 x4

5 1 5 1
Row 2 x1 = 3 − 6 s2 − 6 x2 + 6 x4

Next, x4 enters into the basis. After necessary rearrangements are


made, the following dictionary is obtained,

Row 0 z = 100 − 4s2 − 2x2 + 9x3 − 12s1

Row 1 x4 = 20 + s2 − x2 + 6x3 − 6s1

Row 2 x1 = 5 − x2 + x3 − s1
The Simplex Method

The last dictionary does not describe an optimal solution either.


The original decision variable x3 has a positive coefficient. Hence,
it should be increased. Rows 1 and 2 do not impose any constraint
on x3 because it has positive coefficients in those rows, too.

This implies that the linear program is unbounded. The original


decision variable x3 can be increased indefinitely to attain any
objective function value.
The Simplex Method

The final problem for today is the minimization problem below,


min z = 2x1 − x2
s.t.
−x1 + x2 ≤ 2
x1 + x2 ≤ 4
x1 , x2 ≥ 0
The graphical description of the feasible region provided in the
classroom. To apply the simplex method, we have the first
dictionary as follows,
Row 0 z = 2x1 − x2
Row 1 s1 = 2 + x1 − x2
Row 2 s2 = 4 − x1 − x2
The Simplex Method
The initial feasible solution is x1 = x2 = 0 and s1 = 2, s2 = 4. We
need to increase x2 to decrease the objective function value. Row 1
imposes the most restrictive constraint, x2 ≤ 2. As such,
x 2 = 2 + x1 − s 1
s2 = 4 − x1 − (2 + x1 − s1 ) = 2 − 2x1 + s1
z = 2x1 − (2 + x1 − s1 ) = −2 + x1 + s1
The current dictionary is,
Row 0 z = −2 + x1 + s1
Row 1 x2 = 2 + x1 − s1
Row 2 s2 = 2 − 2x1 + s1
We can no longer decrease z. This is the optimal solution
(x1 = 0, x2 = 2 and s1 = 0, s2 = 2). The objective function value is
z = −2.
The Simplex Method: Two Phase (Stage)
What if an initial feasible dictionary is not readily available?
Stage I: Try to find an initial feasible dictionary (bfs)
Stage II: Starting with the bfs of Stage I, apply Simplex Method
till optimality.
max z = x1 − x2 + x3
s.t.
2x1 − x2 + 2x3 ≤ 4
2x1 − 3x2 + x3 ≤ −5
−x1 + x2 − 2x3 ≤ −1
x1 , x2 , x3 ≥ 0
If we define the slack variables s1 , s2 , and s3 associated with each
constraint, and start with our usual feasible solution, then we end
up with s1 = 4, s2 = −5, s3 = −1, x1 = x2 = x3 = 0. But slack
variables need to be non-negative as well. Therefore, this
dictionary does not yield a feasible solution.
The Simplex Method: Two Phase (Stage)

How should we initiate the simplex method with a feasible


solution? We define an artificial variable ”a” and modify the
constraints.
2x1 − x2 + 2x3 ≤ 4 + a
2x1 − 3x2 + x3 ≤ −5 + a
−x1 + x2 − 2x3 ≤ −1 + a
x1 , x2 , x3 , a ≥ 0
Note that if we can get a feasible dictionary for the constraints
above such that a = 0, then that gives us a feasible dictionary for
the original constraints.
The Simplex Method: Two Phase (Stage)

Therefore, we will try to minimize ”a”. We define an auxiliary LP:


min a
s.t.
2x1 − x2 + 2x3 − a ≤ 4
2x1 − 3x2 + x3 − a ≤ −5
−x1 + x2 − 2x3 − a ≤ −1
x1 , x2 , x3 , a ≥ 0
Let’s solve this problem. The initial dictionary is:
Row 0 z = a
Row 1 s1 = 4 + a − 2x1 + x2 − 2x3
Row 2 s2 = −5 + a − 2x1 + 3x2 − x3
Row 3 s3 = −1 + a + x1 − x2 + 2x3
The Simplex Method: Two Phase (Stage)

This dictionary is still infeasible since s1 = 4, s2 = −5 < 0 and


s3 = −1 < 0. But we now have the freedom to adjust the value of
”a” so that s1 , s2 , and s3 are all non-negative.
In order to make s2 and s3 non-negative, we need to increase the
value of a from 0. At the same time, our goal is to minimize a. In
other words, the question is: What is the smallest value of a such
that s1 , s2 and s3 are all non-negative while keeping x1 , x2 , and x3
at 0? We check the constraints imposed by the rows of the last
dictionary.
s1 = 4 + a ≥ 0 =⇒ a ≥ −4 (i.e., no restriction)
s2 = −5 + a ≥ 0 =⇒ a ≥ 5
s3 = −1 + a ≥ 0 =⇒ a ≥ 1.
The Simplex Method: Two Phase (Stage)

Therefore, a = 5 is the smallest value to have non-negative s1 , s2


and s3 . If a = 5, then s1 = 9, s2 = 0, and s3 = 4. As a result, s1 ,
a, and s3 are basic and s3 becomes nonbasic.
a = 5 + s2 + 2x1 − 3x2 + x3
s1 = 4 + (5 + s2 + 2x1 − 3x2 + x3 ) − 2x1 + x2 − 2x3
s1 = 9 + s2 − 2x2 − x3
s3 = −1 + (5 + s2 + 2x1 − 3x2 + x3 ) + x1 − x2 + 2x3
s3 = 4 + s2 + 3x1 − 4x2 + 3x3
z = a = 5 + s2 + 2x1 − 3x2 + x3 . Then the current dictionary is:
Row 0 z = 5 + s2 + 2x1 − 3x2 + x3
Row 1 s1 = 9 + s2 − 2x2 − x3
Row 2 a = 5 + s2 + 2x1 − 3x2 + x3
Row 3 s3 = 4 + s2 + 3x1 − 4x2 + 3x3
The Simplex Method: Two Phase (Stage)

Since we need to decrease the current objective function value, we


perturb x2 in the positive direction. Rows 1 to 3 impose
constraints on this move.
s1 = 9 − 2x2 ≥ 0 =⇒ x2 ≤ 4.5
5
a = 5 − 3x2 ≥ 0 =⇒ x2 ≤ 3

s3 = 4 − 4x2 ≥ 0 =⇒ x2 ≤ 1
The last constraint is the most restrictive one. x2 enters the basis,
while s3 leaves it. We make the necessary rearrangements,
x2 = 1 + 41 s2 + 34 x1 − 14 s3 + 34 x3
s1 = 9 + s2 − 2(1 + 41 s2 + 34 x1 − 41 s3 + 34 x3 ) − x3
s1 = 7 + 12 s2 − 32 x1 + 21 s3 − 25 x3
The Simplex Method: Two Phase (Stage)
a = 5 + s2 + 2x1 − 3(1 + 14 s2 + 34 x1 − 41 s3 + 43 x3 ) + x3
a = 2 + 14 s2 − 14 x1 + 34 s3 − 45 x3
z = 5 + s2 + 2x1 − 3(1 + 14 s2 + 34 x1 − 41 s3 + 34 x3 ) + x3
z = 2 + 41 s2 − 14 x1 + 34 s3 − 45 x3
The current dictionary is,
1 1 3 5
Row 0 z = 2 + 4 s2 − 4 x1 + 4 s3 − 4 x3

1 3 1 5
Row 1 s1 = 7 + 2 s2 − 2 x1 + 2 s3 − 2 x3

1 1 3 5
Row 2 a = 2 + 4 s2 − 4 x1 + 4 s3 − 4 x3

1 3 1 3
Row 3 x2 = 1 + 4 s2 + 4 x1 − 4 s3 + 4 x3
The Simplex Method: Two Phase (Stage)
The current solution is, s1 = 7, a = 2, x2 = 1 (basic variables)
whereas x1 = x3 = s2 = s3 = 0 (nonbasic variables). The objective
function value is z = 2. We could further increase x3 to decrease
the objective function further. Only the first two rows impose a
constraint on x3 .
s1 = 7 − 52 x3 ≥ 0 =⇒ x3 ≤ 14
5

a = 2 − 54 x3 ≥ 0 =⇒ x3 ≤ 8
5

Rearranging rows,
8
x3 = 5 + 15 s2 − 51 x1 + 35 s3 − 54 a
s1 = 7 + 12 s2 − 23 x1 + 12 s3 − 52 ( 85 + 15 s2 − 15 x1 + 53 s3 − 45 a)
s1 = 3 − x1 − s3 + 2a
x2 = 1 + 14 s2 + 34 x1 − 14 s3 + 34 ( 85 + 15 s2 − 15 x1 + 35 s3 − 45 a)
x2 = 11 2 3 1 3
5 + 5 s 2 + 5 x1 + 5 s 3 − 5 a
The Simplex Method: Two Phase (Stage)

z = 2 + 41 s2 − 14 x1 + 43 s3 − 54 ( 85 + 15 s2 − 51 x1 + 35 s3 − 45 a) = a
The associated dictionary is:
Row 0 z = a
Row 1 s1 = 3 − x1 − s3 + 2a

8 1 1 3 4
Row 2 x3 = 5 + 5 s2 − 5 x1 + 5 s3 − 5a

11 2 3 1 3
Row 3 x2 = 5 + 5 s2 + 5 x1 + 5 s3 − 5a

The basic variables assume values s1 = 3, x3 = 58 , x2 = 11 5 . The


nonbasic variables are x1 , s2 , s3 , a. The objective function value is
z = 0 for the auxiliary LP problem. Since a is left out of the basis,
and the objective function value is 0, we can remove a from further
consideration.
The Simplex Method: Two Phase (Stage)

When we remove a, we end up with a feasible dictionary for the


original LP problem. Let us now consider the original objective
function.
z = x1 − x2 + x3
But this objective function includes two variables that are basic in
the final dictionary of the auxiliary problem. However, row 0
should be expressed in terms of non-basic variables. We use the
expressions in rows 2 and 3 to do so.
z = x1 − x2 + x3 = x1 − ( 11 3 2 1
5 + 5 x1 + 5 s 2 + 5 s 3 )
+( 58 − 15 x1 + 15 s2 + 53 s3 )
= − 35 + 15 x1 − 51 s2 + 52 s3 .
The Simplex Method: Two Phase (Stage)

This leads to the first feasible dictionary of the original problem,


Row 0 z = − 53 − 1
5 s2 + 1
5 x1 + 2
5 s3

Row 1 s1 = 3 − x1 − s3

8 1 1 3
Row 2 x3 = 5 + 5 s2 − 5 x1 + 5 s3

11 2 3 1
Row 3 x2 = 5 + 5 s2 + 5 x1 + 5 s3

The basic variables are s1 , x3 and x2 . However, one could observe


that the solution described by this dictionary is not optimal. One
can pivot s3 into the basis and continue solving the problem.
The Simplex Method: Two Phase (Stage)

Artificial variables are also useful to detect infeasible problems.


Consider the LP problem below,
max z = x1 + 3x2
s.t.
x1 + x2 ≤ 6
−x1 + 2x2 ≤ 8
x2 ≥ 6
x1 , x2 ≥ 0
One can observe that this problem is infeasible after plotting the
constraints. If we wish to apply the simplex method, we see
immediately that the last constraint causes a problem. You cannot
define a slack variable and continue because the constraint is in
”≤” form rather than ”≥” form.
The Simplex Method: Two Phase (Stage)

First we transform the last ”≥” constraint into ”≤”.


−x2 ≤ −6
Then add slack and artificial variables to obtain the auxiliary
problem as follows,
min a
s.t.
x1 + x2 − a + s 1 = 6
−x1 + 2x2 − a + s2 = 8
x2 − a + s3 = −6
x1 , x2 , s 1 , s 2 , s 3 , a ≥ 0
The Simplex Method: Two Phase (Stage)

The initial dictionary for the auxiliary problem is,


Row 0 z = a
Row 1 s1 = 6 + a − x1 − x2
Row 2 s2 = 8 + a + x1 − 2x2
Row 3 s3 = −6 + a − x2
Since this solution is infeasible, we find the minimum value of a
that would make this problem feasible. Checking each row,
s1 = 6 + a ≥ 0 =⇒ a ≥ −6 (no restriction)
s2 = 8 + a ≥ 0 =⇒ a ≥ −8 (no restriction)
s3 = −6 + a ≥ 0 =⇒ a ≥ 6.
Hence, a enters the basis with a value of 6 and s3 leaves the basis.
Making the usual arrangements on the rows of the initial dictionary,
The Simplex Method: Two Phase (Stage)
Row 0 z = 6 + s3 − x2
Row 1 s1 = 12 + s3 − x1 − 2x2
Row 2 s2 = 14 + s3 + x1 − 3x2
Row 3 a = 6 + s3 − x2
The current feasible solution is x1 = x2 = 0, whereas
s1 = 12, s2 = 14, s3 = 0, a = 6. We wish to reduce z to zero if
possible (z = 6 at this point). x2 can be perturbed to reduce z
further. Checking the rows above,
s1 = 12 − 2x2 ≥ 0 =⇒ x2 ≤ 6
14
s2 = 14 − 3x2 ≥ 0 =⇒ x2 ≤ 3

a = 6 − x2 ≥ 0 =⇒ x2 ≤ 6
14
Therefore, we increase x2 to 3 . Making the necessary
arrangements,
The Simplex Method: Two Phase (Stage)
4 2 1 1
Row 0 z = 3 + 3 s3 − 3 x1 + 3 s2

8 1 5 2
Row 1 s1 = 3 + 3 s3 − 3 x1 + 3 s2

14 1 1 1
Row 2 x2 = 3 + 3 s3 + 3 x1 − 3 s2

4 2 1 1
Row 3 a = 3 + 3 s3 − 3 x1 + 3 s2

This dictionary is not optimal either. With the current feasible


solution of x1 = 0, x2 = 14 8 4 4
3 , s1 = 3 , s2 = 0, s3 = 0, a = 3 , z = 3 .
We realize that x1 could enter the basis here as well. Check rows 1
and 3,
8
s1 = 3 − 53 x1 ≥ 0 =⇒ x1 ≤ 85 .
The Simplex Method: Two Phase (Stage)

4
a= 3 − 13 x1 ≥ 0 =⇒ x1 ≤ 4.
Increasing x1 to 58 and making s1 nonbasic in the process, we
obtain the dictionary,

4 3 1 1
Row 0 z = 5 + 5 s3 + 5 s1 + 5 s2

8 1 3 2
Row 1 x1 = 5 + 5 s3 − 5 s1 + 5 s2

26 2 1 1
Row 2 x2 = 5 + 5 s3 − 5 s1 − 5 s2

4 3 1 1
Row 3 a = 5 + 5 s3 + 5 s1 + 5 s2
The Simplex Method: Two Phase (Stage)

This final dictionary is optimal. All the coefficients on the RHS of


row 0 are positive. This implies that the objective function value z
for the auxiliary problem cannot be reduced further from 45 .
However, since a is an artificial variable, it has to be zero for
feasibility. In this case, we say that the LP problem is infeasible.
To confirm infeasibility, we could substitute the current solution
into the original decision problem. Note that, x1∗ = 85 , x2∗ = 26
5 .
Check the first constraint in the original problem (x1 + x2 ≤ 6).
Clearly, x1∗ + x2∗ = 34
5 ≥ 6. The current solution is infeasible.
The Simplex Method

Here is a summary of the simplex method,


If ∃ a feasible solution, ∃ a corner point (bfs) solution.
If ∃ an optimal solution, ∃ a corner point (bfs) optimal
solution.
In max. problems, the variable with the most positive coefficient
enters the basis. Stop when all objective coefficients are
nonpositive.
In min. problems, the variable with the most negative coefficient
enters the basis. Stop when all objective coefficients are
nonpositive.
Improvement in objective after a simplex iteration
= |entering variable coefficient| x result of the ratio test
The Simplex Method

If the LP problem is unbounded, then ∃ an entering variable with


no leaving variable, i.e., the result of the ratio test is ∞.
The simplex method detects alternative optima when at the
optimal dictionary the coefficient of a nonbasic variable is zero in
the objective row and the result of the ratio test is > 0. Otherwise
the bfs does not change and is a unique optimum.
An LP problem may also be infeasible. Simplex method detects
infeasible LPs during the solution of the auxiliary problem. When
the auxiliary LP is solved, a positive objective function value is
obtained.
The Fundamental Theorem of LP

Consider the following LP problem:


max c1 x1 + c2 x2 + . . . + cn xn
s.t.

a11 x1 + a12 x2 + · · · + a1n xn ≤ b1


a21 x1 + a22 x2 + · · · + a2n xn ≤ b2
.................................
.................................
am1 x1 + am2 x2 + · · · + amn xn ≤ bm
x1 ≥ 0, . . . , xn ≥ 0
Every LP problem in this form has the following properties:
The Fundamental Theorem of LP

(a) If it has no optimal solution, then it is either infeasible or


unbounded.
(b) If it has a feasible solution, then it has a bfs
(c) If it has an optimal solution, then it has a bfs as an optimal
solution.
Simplex method can detect unboundedness. It can also detect
infeasibility when the optimal value of the auxiliary LP problem is
greater than 0. Otherwise, it generates dictionaries corresponding
to bfs’s and finds a bfs as an optimal solution.

Вам также может понравиться