Operations Research Notes Main
Operations Research Notes Main
in Operations Research
J.C. Chrispell
Department of Mathematics
Indiana University of Pennsylvania
Indiana, PA, 15705, USA
E-mail: [email protected]
http://www.math.iup.edu/~jchrispe
ii
Preface
These notes will serve as an introduction to the basics of solving deterministic models in
operations research. Topics discussed will included optimization techniques and applications
in linear programming. Specifically a discussion of sensitivity analysis, duality, and the
simplex method will be given. Additional topics to be considered include non-linear and
dynamic programming, transportation models, and network models.
The majority of this course will follow the presentation given in the Operations Research:
Applications and Algorithms text by Winston [9]. I will supplement the Winston text with
additional material from other popular books on operations research. For further reading
you may wish to consult:
My Apologies in advance for any typographical errors or mistakes that are present in this
document. That said, I will do my very best to update and correct the document if I am
made aware of these inaccuracies.
-John Chrispell
iii
OR Notes Draft: September 28, 2012
iv
Contents
1 Introduction 1
1.1 Tabel and Chair Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
v
OR Notes Draft: September 28, 2012
7 Duality 41
7.1 A Motivating Example: My Diet Problem: . . . . . . . . . . . . . . . . . . . 41
7.1.1 Canonical Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9 Sensitivity Analysis 61
9.1 Sensitivity Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
9.1.1 Verify this graphically: . . . . . . . . . . . . . . . . . . . . . . . . . . 63
9.2 Sensitivity Analysis Using Matrices . . . . . . . . . . . . . . . . . . . . . . . 64
9.2.1 Illustrating Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
vi
OR Notes Draft: September 28, 2012
11 Network Flows 79
11.1 Dijkstra’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
12 Appendices 83
12.1 Homework 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
12.2 Homework 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
12.3 Homework 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
12.4 Homework 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
12.5 Homework 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Bibliography 115
vii
Chapter 1
Introduction
If you choose not to decide you still have made a choice.
−Neil Peart
Operations Research, at its heart, uses modeling to solve applied mathematical problems in
the hopes of making optimal decisions efficiently. The term Operations Research can trace
its roots back to World War II when a scientific approach was adopted to distribute resources
between various military operations (scientists doing research on military operations)[3, 9].
In order to do any scientific research on a problem a mathematical model is needed. The
WInston text states:
Mathematical Model: - is a mathematical representation of an actual situation that may
be used to make a better decision or simply to understand the actual situation better. The
goal with most models considered in this course will be to optimization some quantity (using
an objective function based on decision variables) subject to problem constraints.
Several examples where Operations Research techniques were implemented in order for
different organizations to obtain optimal solutions and distribution of resources (CITGO
Petroleum manufacturing, The San Francisco Police Department Scheduling, GE Capital
credit card bill repayment).
A furniture manufacturer produces two products: wooden tables and chairs. The
unit profit for the tables is $6, and the unit profit for the chairs is $8. In order
to simplify the problem assume that only resources used in the production of the
tables and chairs are wood (in board feet, bf ) and labor (in hours, h). It takes
6 bf and 1 hour labor to make a table, and 4 bf and 2 hours labor to make a
1
OR Notes Draft: September 28, 2012
chair. There are 20 bf of wood available and 6 hours of labor available. If you
wish to maximize profit what is the optimal distribution of these resources?
The idea now becomes to solve the given problem using a linear model or linear programming.
Thus, we need to translate the real world problem into a format with mathematical equations
that represent:
• Constraint set: We only have a limited number of resources available to use when
manufacturing the tabels and chairs.
For this example the objective function and the constraints will all be linear functions. We
should also impose non-negativity conditions on the resources and decision variables in this
instance. If we do not enforce these conditions it may be possible to achieve non-physical
solutions to the given problem.
The problem definition, and formulation are often the most difficult and import step in
finding an optimal solution. Lets define the decision variables x1 and x2 as the number of
tables and the number of chairs to produce respectively. It is sometimes useful to place all
the information into a table:
Thus, the goal is to obtain the largest profit from the objective function by:
subject to:
6x1 + 4x2 ≤ 20
x1 + 2x2 ≤ 6
x1 ≥ 0
x2 ≥ 0
2
OR Notes Draft: September 28, 2012
Lets assume that the number of chairs to be produced, x1 is on the x-axis and the number
of tables to be produced x2 is on the y−axis. First write the constraints as equalities, and
then finding the intercepts of the feasible region. Thus,
3
6x1 + 4x2 ≤ 20 =⇒ x2 = − x1 + 5 (1.1.1)
2
1
x1 + 2x2 ≤ 6 =⇒ x2 = − x1 + 3 (1.1.2)
2
x1 ≥ 0 x1 = 0 (1.1.3)
x2 ≥ 0 x2 = 0 (1.1.4)
(1.1.5)
Figure 1.1.1: Plot of the constraints for the table and chair example.
3
OR Notes Draft: September 28, 2012
If we now pick two values for the objective function we can determine its slope and a direction
of improvement. Let z be the value of the objective function:
z = 6x1 + 8x2
Thus, if z = 0 then
3
6x1 + 8x2 = 0 =⇒ x2 = − x1 ,
4
and if z = 8 we see
3
6x1 + 8x2 = 8 =⇒ x2 = − x1 + 1.
4
The direction of improvement is d = [4, 3]T , and is illustrated in Figure 1.1.2. The optimal
solution will be obtained at the corner or edge of the feasible region that is farthest away
from the origin on a line parallel to the objective function contours plotted for z = 0, and
z = 8. Specifically from the figure the objective function is maximized at point A when 2
tables and 2 chairs are manufactured using the resources available, and yields a profit of $28.
4
OR Notes Draft: September 28, 2012
The optimal solution could have also been found by testing the objective function at each
corner of the feasible region. Note if the same value of the objective function has been
obtained at multiple corners the optimal solution of would have been any convex combination
of the two corners. In this problem we are manufacturing discrete items (building a fraction
of a table or chair doesn’t make since) so we are lucky that we obtained an integer solution
to the mathematical model.
Here we will solved this simple Linear Program graphically. In the future we will use more
advanced algebraic techniques (such as the simplex method ) to obtain the optimal solution.
For more complicated problems it will become necessary to use software packages such as
LINGO. In the future we will also look to see how sensitive our optimal solution is to small
changes.
5
OR Notes Draft: September 28, 2012
6
Chapter 2
Our weary eyes still stray to the horizon. Though down this road we've been so many
times.
−Pink Floyd
Before looking into more complicated methods of solving linear programs we need to recall
some of the basics of linear algebra.
We will use the following notation. A matrix is a rectangular array of numbers, with a
typical m × n matrix A written in the form:
a11 a12 . . . a1n
a21 a22 . . . a2n
A = .. (2.0.1)
.. .. ..
. . . .
am1 am2 . . . amn
The element of a matrix in the ith row and j th column of matrix A will be denoted by aij .
Thus, if the matrix
1 1 2 3
A= 5 8 13 21
34 55 89 144
then a23 = 13.
We will think of a matrix with only one column as vectors (or column vectors). Similarly
a matrix with only one row will be a row vector. The number of rows in a vector will define
its dimension, and the number of columns in a row vector will define its dimension.
An m-dimensional vector (row or column) where all elements are zero will be called a
zerovector and denoted by 0. In two dimensions
0
0 = [0 0] and 0 =
0
7
OR Notes Draft: September 28, 2012
cation, matrix transposition and inner products. The use of matrices and vectors will allow
for mathematical models of linear systems to be developed and solved using linear algebra.
The three basic types of elementary row operations (ERO) are used when solving systems
of linear equation using the Gauss-Jordan Method.
2. Multiply any row of a matrix system by a nonzero scalar and then add that row to a
different row of the matrix.
8
OR Notes Draft: September 28, 2012
x1 − 2x2 + 3x3 = 9
−x1 + 3x2 = −4
2x1 − 5x2 + 5x3 = 17
We may write this linear system in the augmented matrix system notation as
1 −2 3 9
A|b = −1 3 0 −4
2 −5 5 17
9
OR Notes Draft: September 28, 2012
10
Chapter 3
Remember to remember me
−Wilco
• Decision variables.
• The objective function.
• The problem constraints.
It is also worthy to note that the coefficient of a variable in the objective function is referred
to as an objective function coefficient, and less obviously the coefficients in the constraint
functions are sometimes referred to as technological coefficients.
It will often be useful to denote the coefficients on the right-hand-side of the constraints with
rhs (representing the amount of a distinct resource that is available).
We will separate non-negativity of decision variables as a separate type of constraint, and
make note that decision variables may be unrestricted in sign.
Definitions:
11
OR Notes Draft: September 28, 2012
• For any linear function f (x1 , x2 , . . . , xn ) and any number b, the inequalities f (x1 , x2 , . . . , xn ) ≤
b and f (x1 , x2 , . . . , xn ) ≥ b are linear inequalities.
• Maximize or minimize a linear function of some decision variables (our objective func-
tion).
• The decision variables are subject to satisfying a set of constraints each of which is a
linear inequality.
• There is also a set of sign restrictions that will be satisfied. For example decision
variables may be non-negative or unrestricted in sign.
In all linear programs the objective function and constraints are effected proportionally
by the decision variables (a constant coefficient multiplies the variable in each). Linear
programming problems also have the benefit of each decision variable being independent of
others in its contribution to the objective function. Similarly linear constraints have the
benefit of independence. For example in the table and chair example we considered the
number of hours of labor required to make a chair did not effect the number of hours labor
required to manufacture a table. Thus, the left hand side of the labor constraint was the
additive sum of constants multiples of the decision variables.
In addition to the proportionality and additivity assumptions in order for LP’s to represent
real situations, the divisibility assumption. That is the decision variables must be allowed
to take on fractional values (we can not sell a fraction of a chair). In the future we may look at
integer programming as a way of handling problems that require a discrete valued solution.
We are also going to make a certainty assumption. That is that the model parameters
objective function coefficients, the right hand side of constraints and technological coefficients
are known with certainty.
Assuming that a point is a set of distinct values for each decision variable in an LP. The
feasible region is the collection of all possible points that satisfy the constraints and sign
restrictions on the decision variables. Points not within the feasible for a linear program are
considered infeasible.
The optimal solution for a maximization problem then becomes the point in the LP’s
feasible region that obtains the largest value of the objective function. Similarly for a mini-
mization problem the point inside the LP’s feasible region that obtains the smallest value of
the objective function is considered the optimal solution.
12
OR Notes Draft: September 28, 2012
max z = x1 + x2
s.t. x1 + 5x2 ≤ 25
6x1 + 5x2 ≤ 40
x1 ≤ 5
with x1 , x2 ≥ 0.
The graphical solution to the linear program is shown in Figure 3.1.1. Note the value of the
objective function is is 7.4, and that only two of the constraints are binding at the optimal
solution. We consider constraints binding if the left hand side of the constraint is equal
to the right hand side when an optimal solution is achieved. The constraint x1 ≤ 5 is an
example of a nonbinding constraint.
The feasible region for this LP is a convex set. A set of points is aConvex set provided a
line segment between any pair of points in the set is wholly contained in the set.
13
OR Notes Draft: September 28, 2012
For any convex set S, a point P 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
may also be called corner points. We make note that:
Any LP that has an optimal solution has an extreme point that is optimal.
See the Winston text for a proof of this result. It is an important result because it narrows
our search for an optimal solution down from the whole feasible region to just the extreme
points of the set.
A Minimization Problem
min z = x1 + x2
s.t. x1 + 4x2 ≥ 8
4x1 + x2 ≥ 6
with x1 , x2 ≥ 0.
Here we again solve the LP graphically. Note 14that the optimal solution is found at point
16 26
,
15 15
giving the objective function a value of 5 . The solution is illustrated in Figure 3.1.2.
Note that we could have used matrix notation to represent the previous problems. It will
sometimes be useful to write our linear programs in this form.
14
OR Notes Draft: September 28, 2012
We can note that any values in the optimal set will yield a value of 16 in the objective
function. Use the following link to explore this problem using an interactive java applet:
http://www.math.iup.edu/~jchrispe/MATH445_545/MultipleOptimalSolutionExample.html
Figure 3.2.3: Graphical solution to maximization LP with bounded Feasible Region and
multiple optimal solutions.
15
OR Notes Draft: September 28, 2012
Figure 3.2.4 shows the binding constraint contours and a plot of the objective functions
Figure 3.2.4: Plot of binding constraint contours and objective function contour when z = 10.
contour for a value z = 10. Note that there is no region that will satisfy all of the linear
programs constraints making this an infeasible LP.
Consider one last example (straight out of the Winston text). Solve again the following
linear program graphically.
max z = 2x1 − x2
s.t. x1 − x2 ≤ 1
2x1 + x2 ≥ 6
with x1 , x2 ≥ 0.
In Figure 3.2.5 it can be seen that the feasible region is unbounded in the direction of
increasing z contours. Thus the optimal solution is unbounded.
16
OR Notes Draft: September 28, 2012
Figure 3.2.5: Plot of the feasible region for the maximization problem. Note that the feasible
region is unbounded in the direction of increasing z contours.
This example is from the Winston text: Consider a chain of computer stores. The number of
skilled repair time the company requires during the next five months is given in the following
table:
At the beginning of January, 50 skilled technicians work for the company. Each skilled
technician can work up to 160 hours per month. To meet future demands, new technicians
must be trained. It takes one month to train a new technician. During the month of training
the trainee must be supervised for 50 hours by an experienced technician. Each experienced
technician is paid $2000 a month regardless of how much he works. During the month of
training the trainee receives $1000 for the month. At the end of each month 5% of the
companies experienced technicians quit to find other employment. Formulate an LP for the
company that will minimize the labor costs incurred and meet the service demands for the
next five months.
17
OR Notes Draft: September 28, 2012
18
Chapter 4
The tall one wants white toast, dry, with nothin' on it...
And the short one wants four whole fried chickens, and a Coke.
In this section our goal will be to consider setting up some common types of linear programs.
The list of examples given here is by no means exhaustive, and we should not for get about
the work scheduling problem stated in the previous section.
19
OR Notes Draft: September 28, 2012
The first step will be do define some decision variables. Here we will define
x1 as the number of pez packages to include in my diet per day
x2 as the number strawberry pop-tart packages to consume per day
x3 as the number of bowls of peanut butter crunch to consume per day
x4 as the number of chocolate chip cookies to consume each day
Our objective function can then be defined as:
which will minimize the cost of our diet. The next aim is to meet the special dietary needs.
Here a constraint is set up for each of the “nutrients” (calories, sugar, fat, and yellow 5).
It can also be noted that the decision variables will be non-negative in sign giving the
xi ≥ 0 for all i ∈ 1, 2, 3, 4
sign restriction.
This problem can be set up in vector notation using the above variable definitions and
defining
x1 0.20 2500
x2
, c = 0.50 , b = 8 , and
x= x3 0.70 10
x4 0.65 50
50 250 350 150
0.1 0.5 1 0.3
A= 0.01 0.3 1 0.7 .
5 0 4 1
The optimal diet can now be found by considering:
min z = cT x
s.t. Ax ≥ b
with x ≥ 0.
The optimal solution can be quickly found using the LINGO software package and the old
LINDO syntax. Open LINGO and type:
20
OR Notes Draft: September 28, 2012
Each tutor will work two consequtive 4 hour shifts. Formulate a linear program that can be
used to minimize the number of tutors needed to meet the cram-day demands.
Its always best to think about the decision variable first! Here we can think about the
starting shift for the tutors.
The objective of the linear program is to minimize the number of tutors needed to meet the
demands, and we make note that summing the decision variables will count the total number
of tutors used. We should also note that since we are only concerning ourselves with 8 hour
shifts for a single day, we only need to start tutors for the first five shifts. This give the
objective function:
X5
minimizez = xi
i=1
21
OR Notes Draft: September 28, 2012
Investment Cash Flow Year 0 Cash Flow Year 1 Cash Flow Year 2 Cash Flow Year 3
1 -6 -5 7 9
2 -8 -3 9 7
Assuming at time 0 that $10,000 is available to invest, and after one year there will be $7,000
available to invest. We will also assume an annual interest rate of 10% is available. We shall
also assume that any fraction of an investment may be purchased. Lets find a linear program
that will determine the maximum net present value obtained from the two investments.
Our goal is to maximize the net present value of the investments purchased so we should
find the net present value of each investment for use in our objective functions.
Net present value: We need to discount each of the cash flows back to the present using
a discount factor based on the interest rate. Note that
$1.00 Today −→ $1.00 + 0.10($1.00) = $1.00(1.10) One Year From Now
22
OR Notes Draft: September 28, 2012
Thus,
1
$1.00 one year from now −→ $1.00 ≈ $0.9090909 today.
1.10
We can use n
1
as a discount factor for rate r in year n.
1+r
Let N P V1 denote the net present value of investment 1.
1 2 3
1 1 1
N P V1 = −6000 + (−5000) + 7000 + 9000 ≈ 2001.503
1.1 1.1 1.1
Let N P V2 denote the net present value of investment 2.
1 2 3
1 1 1
N P V2 = −8000 + (−3000) + 9000 + 7000 ≈ 1969.947
1.1 1.1 1.1
The objective function for the linear program is then:
The constraints on the linear program are based on the amount of cash we have on hand for
each of the first two years, and the additional constraint that we may only purchase upto
100% of each of the two investments. This gives
as our constraints, and we have the sign restriction that x1 and x2 are non-negative:
x1 ≥ 0, and x2 ≥ 0.
Note we can solve this linear program graphically and Figure 4.3.1 illustrates the feasible
solution to the problem. We can see by looking for the optimal objective function contour
that the optimal investment involves 100% of investment 1 and 50% of investment 2 giving
the optimal net present value of the cash flow as:
Note that there are an infinite number of different problems that may be formulated as linear
programs. It is strongly recommended that the interested reader look over more examples
presented in [9] and other texts.
23
OR Notes Draft: September 28, 2012
Figure 4.3.1: Feasible region for the budgeting problem with an illustration of a z contour.
24
Chapter 5
−Van Halen
The linear programs that we have been able to solve with out the assistance of a software
package so far have all been in two variables. In general linear programs have many variables
and the goals of this chapter will be:
25
OR Notes Draft: September 28, 2012
Objective function: The problem could be written using the equivalent objective function:
Non-zero lower bounds: In the original statement of the problem we note that the 4th
constraint has:
x3 ≥ 5.
To convert this to a standard form constraint we make a change of variables and define:
x̂3 = x3 − 5
This allows us to replace x3 with x̂3 throughout and changes the constraint
x3 ≥ 5 −→ x̂3 + 5 ≥ 5 −→ x̂3 ≥ 0.
26
OR Notes Draft: September 28, 2012
Note we need to modify the other constraints and objective function as well. For our example
problem we may redefine
ẑ = −z − 35 −→ z = −ẑ − 35
for the modified objective function. For the moment we will leave upper bounds on variables
right in the coefficient matrix.
Free variables: In the given problem we make note that x2 is a free variable. Free variables
may be converted to non-negative constraints by defining
x2 = x02 − x002 with x02 , x002 ≥ 0.
and we will have x02 to handle the positive values of x2 and the new variable x002 will take
care of the negative pieces. There are other ways to handle free variables, and one is to use
a free variable as a way of eliminating a constraint (think about this for a future homework
assignment).
After applying all of the discussed techniques to our linear programming problem we are left
with the following LP:
Equality constraints: In order for the constraints we consider adding slack and excess
variables to enforce the equality constraint. For the constraint:
7x1 + x02 − x002 + 4x̂3 ≤ 6
let s1 be a slack variable such that s1 ≥ 0 and
7x1 + x02 − x002 + 4x̂3 + s1 = 6.
For the other two constraints we use excess variables e1 ande2 . Thus,
2x1 − 4x02 + 4x002 − 6x̂3 ≥ 32 =⇒ 2x1 − 4x02 + 4x002 − 6x̂3 − e1 = 32
and
6x1 + 3x02 − 3x002 − 4x̂3 ≥ 24 =⇒ 6x1 + 3x02 − 3x002 − 4x̂3 − e2 = 24
with e1 , e2 ≥ 0. We can now restate the full linear program in standard form:
minimize ẑ = −3x1 −4x02 + 4x002 +7x̂3
subject to 7x1 +x02 − x002 +4x̂3 +s1 = 6
2x1 −4x02 + 4x002 −6x̂3 −e1 = 32
6x1 +3x02 − 3x002 −4x̂3 −e2 = 24
27
OR Notes Draft: September 28, 2012
5.1.1 Example:
with x1 ≥ 1, x2 ≤ 7, and x3 ≥ 0.
We need to take this one more step and include slack variables. Thus,
minimize z = cT x,
subject to Ax = b, (5.2.1)
x ≥ 0.
Ax = b.
28
OR Notes Draft: September 28, 2012
To find a basic solution to Ax = b, we simply choose a set of n − m variables (and set these
to zero) to be the nonbasic variables or NBV. The remaining variables will be our basic
variables or BV that are used to satisfy the constraints.
Consider the following example:
x1 + x2 = 6
−x2 + x3 = 4
Here we get to pick one nonbasic variable as we have two equations and three unknowns.
Thus,
N BV = {x3 }, then BV = {x1 , x2 }.
The values of the basic variables x1 , and x2 are found by solving the two equations with x3
set to zero. Thus,
x2 = −4 and x1 = 10
If we choose x1 to be the nonbasic variable then the basic variables
x2 = 6 and x3 = 10.
We should note that not all sets of basic variables will yield a feasible solution to a set of
constraints.
Consider the constraints
x1 + 2x2 + 4x3 = 4
x1 + 4x2 + 8x3 = 6.
2x2 + 4x3 = 4
4x2 + 8x3 = 6
Definition 5.2.2 Any basic solution to (5.2.1) in which all variables are nonnegative is a
basic feasible solution.
When solving linear programs we are interested in sets of variables that will satisfy all of the
constraints given by Ax = b as well as also satisfying the nonnegativity constraint for the
linear program stated in standard form. We also know that
29
OR Notes Draft: September 28, 2012
Any LP that has an optimal solution has an extreme point that is optimal.
So a good place to start looking for these optimal extreme points is at basic feasible solutions.
It can be shown that:
Theorem 5.2.1 A point in the feasible region of a linear program is an extreme point if and
only if it is a basic feasible solution to the LP.
with x1 , x2 ≥ 0,
write the LP in standard form by adding two slack variables s1 and s2 . Standard form:
with x1 , x2 , s1 , s2 ≥ 0.
The feasible region for the linear program is shown if Figure 5.2.1. Note that all of the corner
extreme points correspond to a basic feasible solution to the linear program. We note that
the intersection at points E, and F are not basic feasible solutions because not all of the
basic variables satisfy the nonnegativity constraint for the linear program in standard form.
minimize z = cT x,
subject to Ax = b,
x ≥ 0.
30
OR Notes Draft: September 28, 2012
Figure 5.2.1:
This means we can move as far as we desire in the direction of d and still have a feasible
solution to the linear program.
Consider the following example
minimize z x1 + x2 ,
subject to 7x1 + 2x2 ≥ 28
2x1 + 12x2 ≥ 24
x1 , x2 ≥ 0.
minimize z x1 + x2 ,
subject to 7x1 + 2x2 − e1 = 28
2x1 + 12x2 − e2 = 24
x1 , x2 , e1 , e2 ≥ 0.
31
OR Notes Draft: September 28, 2012
Looking at the problem’s feasible region graphically we have the illustration in Figure 5.2.2.
Specifically the feasible region for the linear program can be made up of a convex combina-
tion of the basic feasible solution points plus a positive constant multiple of a direction of
unboundedness.
Note that moving from the point basic feasible solution at point
3.6 4.6
1.4 2.4
0 and moving toward point 9
0 14
yields a direction of unboundedness given by:
1
1
d1 =
9 .
14
Note that the direction of unboundedness is not unique, as
2
4
d2 = 22
52
is a direction of unboundedness found by heading from the basic feasible solution
12 14
0 4
toward interior point .
56 0
0 52
Specifically we could write the feasible set by letting α1 , α2 , α3 ∈ [0, 1] such that 3i=1 αi = 1,
P
and c a nonnegative constant then
3.6 12 0 1
1.4 0 14 1
S = α1
0 + α2 56 + α3 0 + c 9 .
0 0 144 14
See
32
OR Notes Draft: September 28, 2012
Figure 5.2.2: The feasible region is shown. Note that the region may be made up of a convex
combination of basic feasible solutions plus a direction of unboundedness.
http://www.math.iup.edu/~jchrispe/MATH445_545/DirectionOfUnboundedness.html
A cycling example
33
OR Notes Draft: September 28, 2012
Assume we break ties in the ratio test always choosing row 1 . Then the next tableau is
given by:
Now x3 enters in place of x1 again we assume row 1 is used as the tie breaker.
Continuing in the standard fashion would result in the cycle that was just observed. In order
to prevent cycling in the simplex method we need to consider other strategies for choosing
the variables that will enter and exit the basis at each pivot.
Cycling in the simplex method can be avoided by following Bland’s Rule. Assuming that
the slack excess and artificial variables are number consecutively after the decision variables:
34
Chapter 6
−The Kinks
Lets consider looking at the simplex algorithm using matrices and compare that with the
tableau format we have been using.
35
OR Notes Draft: September 28, 2012
In the first pivot x2 enters the basis replacing s2 . Here we have not explicitly shown the
ratio test. Thus,
The next iteration of the simplex method shows that it is desirable to have x1 enter the basis
and replace s3 . (Note again we are not showing the ratio text.) Doing this pivot yields:
Here we have obtained an optimal tableau. We can see here that z is maximized at $36,000
when x1 = 2 and x2 = 6.
A = [N |B]
36
OR Notes Draft: September 28, 2012
and similarly we separate the vectors x, and c into their basic and non-basic parts:
s1
xN x1
x= , where xN = and xB = s2
xB x2
s3
0
cN 3
c= , where cN = and cB = 0 .
cB 5
0
We can now make note of the correspondence between the simplex method as we know it in
tableau format, and the defined matrices. Any current basis may be written as:
xN T xB T RHS Basis
T −1
−cN T
+ cB B N 0 cB T B −1 b z
−1 −1
B N I B b xB
with
cN T =
3 5
cB T =
0 0 0
−cN T + cB T B −1 N =
−3 −5
T −1
cB B b = 0
4
−1
B b = 12
18
1 0
B −1 N = 0 2
3 2
37
OR Notes Draft: September 28, 2012
Ratio Test:
Note that both non-basic variables are attractive, and we choose x2 to enter the basis. Doing
the ratio test using the second column of B −1 N and the current right hand side vector B −1 b:
12 18
min = 6, =9
2 2
and we choose s2 to leave the basis. Note we have ignored the comparison of 4 over 0 in the
ratio test.
Compare the above values with the tableau:
Note we have now replaced s2 in the basis with x2 . Thus, xB = (s1 x2 s3 )T , and xN =
(x1 s2 )T we have:
1 0 1 0 0 1 0 0
N = 0 1 , B = 0 2 0 =⇒ B −1 = 0 1
2
0 .
3 0 0 2 1 0 −1 1
with
cN T =
3 0
cB T =
0 5 0
−cN T + cB T B −1 N = 5
−3 2
cB T B −1 b =
30
4
−1
B b = 6
6
1 0
B −1 N = 0 1
2
3 −1
38
OR Notes Draft: September 28, 2012
Ratio Test:
Note that the non-basic variable x1 should be picked to enter the basis. Doing the ratio test
using the first column of B −1 N and the current right hand side vector B −1 b:
4 6
min = 4, = 2
1 3
and we choose s3 to leave the basis. Note we have ignored the comparison of 6 over 0 where
x2 would potentially leave the basis in the ratio test.
Compare values with the Piviot 1 Tableau:
Note we have now replaced s3 in the basis with x1 . Thus, xB = (s1 x2 x1 )T , and xN =
(s3 s2 )T we have:
1
− 13
0 0 1 0 1 1 3
N= 0 1 , B = 0 2 0 =⇒ B −1 = 0 1
2
0 .
1 1
1 0 0 2 3 0 −3 3
with
cN T =
0 0
cB T =
0 5 3
Evaluating each of the expressions in the tableau we have:
−cN T + cB T B −1 N = 1 32
cB T B −1 b =
36
2
B −1 b = 6
2
1 1
−3 3
B −1 N = 0 1
2
1 1
3
− 3
Note that the non-basic variables are nolonger attractive and we have reached an optimal
solution to the problem with z = 36 when, x1 = 2 and x2 = 6.
Compare with the Pivot 2 Tableau:
39
OR Notes Draft: September 28, 2012
40
Chapter 7
Duality
As is often the case you may look at problems form many different perspectives. This
is the case with linear programs. Lets consider a problem form our past in two different
perspectives. So far we have been looking at linear programs in what we will call the primal
form.
Recall from earlier this semester that I have a really bad diet that requires that all of my
food come from my favourite food groups: pez candy, pop tarts, Cap’N crunch, and cookies.
I have the following foods available for my consumption: red pez, strawberry pop-tarts,
peanut butter crunch, and chocolate chip cookies. The red pez costs $0.20 per (per package),
strawberry pop-tarts cost $0.50 (per package), peanut butter crunch costs $0.70 per bowl,
and chocolate chip cookies cost $0.65 cents each. I must ingest at least 2500 calories a day
in order to maintain my sugary lifestyle. I must also meet the following requirements I need
8 oz. of sugar, 10 oz. of fat, and 50 mg of yellow-5 food coloring. Each of my chosen foods
has these required nutrients in the following quantities:
Food Calories Sugar (oz.) Fat (oz.) yellow-5 (mg) Price ($)
pez candy (per package) 50 0 .1 0.01 5 0.20
pop-tarts (per package) 250 0.5 0.3 0 0.50
Cap’N crunch (per bowl) 350 1 1 4 0.70
cookies (1 cookie) 150 0.3 0.7 1 0.65
How can I achieve my dietary constraints at a minimum cost?
41
OR Notes Draft: September 28, 2012
The first step will be do define some decision variables. Here we will define
x1 as the number of pez packages to include in my diet per day
x2 as the number strawberry pop-tart packages to consume per day
x3 as the number of bowls of peanut butter crunch to consume per day
x4 as the number of chocolate chip cookies to consume each day
Our objective function can then be defined as:
which will minimize the cost of our diet. The next aim is to meet the special dietary needs.
Here a constraint is set up for each of the “nutrients” (calories, sugar, fat, and yellow 5).
It can also be noted that the decision variables will be non-negative in sign giving the
sign restriction.
This problem can be set up in vector notation using the above variable definitions and
defining
x1 0.20 2500
x2
, c = 0.50 , b = 8 , and
x= x3 0.70 10
x4 0.65 50
50 250 350 150
0.1 0.5 1 0.3
A=
0.01 0.3 1 0.7 .
5 0 4 1
min z = cT x
s.t. Ax ≥ b
with x ≥ 0.
42
OR Notes Draft: September 28, 2012
A second way to consider the problem. Suppose that I know a nutrient salesman (Willy
Loman) who will sell me supplements that taste just as good as the items in my diet.
Specifically Mr. Loman sells calories, sugar, Fat, and yellow-5 and wants to sell me these
items in order to meet my daily needs at the maximum price I’m willing to pay. Then
defining the decision variables:
Writing this in matrix form in terms of the values defined for the primal problem we have:
max w = bT y
s.t. AT y ≤ c
with y ≥ 0
where
y = (y1 y2 y3 y4 )T .
These two linear programs have the same optimal solution values.
43
OR Notes Draft: September 28, 2012
The canonical form of a primal and its corresponding dual linear program are given as follows:
max w = bT y
min z = cT x
s.t. AT y ≤ c
s.t. Ax ≥ b
with y ≥ 0
with x ≥ 0.
Primal Dual
What if we don’t start in canonical form? Lets consider the constraints first:
min z = cT x
s.t. A1 x ≥ b1
A2 x ≤ b2
A3 x = b3
with x ≥ 0.
Transform the above problem into standard canonical form (ignoring that the RHS may be
negative for a moment).
min z = cT x
s.t. A1 x ≥ b1
−A2 x ≥ −b2
A3 x ≥ b3
−A3 x ≥ −b3
with x ≥ 0.
Taking the dual we have:
max w = bT1 y1 − bT2 y20 + bT3 y30 − bT3 y300
s.t. AT1 y1 − AT2 y20 + AT3 y30 − AT3 y300 ≤ c
with y1 , y20 , y30 , y300 ≥ 0.
Making the change of variables:
y2 = −y20 and y3 = y30 − y300
and we have:
max w = bT1 y1 + bT2 y2 + bT3 y3
s.t. AT1 y1 + AT2 y2 + AT3 y3 ≤ c
with y1 ≥ 0, y2 ≤ 0, y3 is free
44
OR Notes Draft: September 28, 2012
The following table summarizes the relationship between the primal and the dual problem.
45
OR Notes Draft: September 28, 2012
Examples:
• Problem 1:
max z = x1 + x2
s.t. x1 − x2 ≤ 1
with x1 , x2 ≥ 0
min w = y1
s.t. y1 ≥ 1
−y1 ≥ 1
with y2 ≥ 0.
• Problem 2:
46
Chapter 8
Read dozens of books about heroes and crooks, and I learned much from both of their
styles.
− Jimmy Buffet
Here we will consider the major results that relate the primal and the dual linear program-
ming problems.
47
OR Notes Draft: September 28, 2012
What is the dual of a problem that is written in our typical standard form?
min z = cT x
s.t. Ax = b
with x ≥ 0
max w = bT y
s.t. AT y ≤ c ( as x ≥ 0 in primal problem).
with y is free
max z = 2x1 + x2
s.t. x1 ≤ 1
x2 ≤ 1
with x1 and x2 ≥ 0
min w = y1 + y2
s.t. y1 ≥ 2
y2 ≥ 1
with y1 and y2 ≥ 0
Graphing the feasible region for each illustrates a nice relationship between the primal and
the dual problem. The following plot illustrates the feasible region for each:
48
OR Notes Draft: September 28, 2012
Both linear programs are optimal when an objective function value of 3 is obtained.
(z = 3, when x1 = 1, and x2 = 1)
(w = 3, when y1 = 2, and y2 = 1)
Theorem 8.2.1 (Weak Duality) Let x be a feasible point for the primal problem in stan-
dard form, and let y be a feasible point for the dual problem. Then,
z = cT x ≥ bT y = w.
Proof: From the dual problem’s constraints and the primal problems sign restrictions we
have
cT ≥ yT A and x ≥ 0.
Thus,
z = cT x ≥ (yT A)x = yT b = bT y = w
=⇒ z ≥ w
Note this means that for a general primal dual min max pair that a feasible solution for the
minimization problem will always have an objective function value that is greater than or
equal to the objective function value for a feasible point in the dual maximization problem.
Thus,
• If the primal is unbounded then the dual is infeasible. If the dual is unbounded then
the primal is infeasible.
– In general if the primal is infeasible the dual may be infeasible or unbounded.
• If x is a feasible solution to the primal problem, y is a feasible solution to the dual,
and cT x = bT y then x and y are optimal for their respective problems.
Example: Form last class we took the dual of the linear program:
max z = x1 + x2
s.t. x1 − x2 ≤ 1
with x1 , x2 ≥ 0
49
OR Notes Draft: September 28, 2012
It can be seen that this linear program is unbounded. Taking the dual gave us:
min w = y1
s.t. y1 ≥ 1
−y1 ≥ 1
with y1 ≥ 0.
Note that this LP is infeasible.
Theorem 8.3.1 (Strong Duality) If one of the problems has an optimal solution then so
does the other, and the optimal objective values are equal.
Proof: With out loss of generality we can make the following assumptions:
50
OR Notes Draft: September 28, 2012
cTB cTB B −1 N
=
cTB cTN
≤
= cT
Thus,
AT y∗ ≤ c
and we have a feasible solution for the dual.
We now need to compare the value of the dual’s objective function with the value of the
optimal primal objective function:
z = cT x∗ = cTB xB = cTB B −1 b
w = bT y∗ = y∗ T b = cTB B −1 b
So y∗ is feasible in the dual and has the same objective value as the optimal primal problem
objective value so y∗ is optimal for the dual.
51
OR Notes Draft: September 28, 2012
Primal Problem
Before starting into additional theory lets consider the following LP and for practice take its
dual.
Insight By Example
Lets consider working through an example start to finish in both the primal and dual for-
mulation and see how the two are related.
Primal Problem:
Adding excess variables and artificial variables to each of the primal constraints we may
obtain the following initial simplex tableau. Note we will use the two-phase simplex algorithm
52
OR Notes Draft: September 28, 2012
as we are using artificial variables. The objective function for the first phase of the algorithm
is:
min zp1 = a1 + a2
where the index on each artificial variable denotes the constraint to which it corresponds.
Adjust the initial Phase one tableau so that a1 and a2 are truly basic.
Here we see that x2 is attractive and should enter the basis by replacing a1 .
Next we see that x1 is attractive and should enter the basis in the place of a2 .
This completes the first phase of the two-phase simplex method. We can place back in the
original objective function, and drop the columns that correspond to the artificial variables.
This gives
Update the tableau so that the basic variables are represented by identity columns. Gives:
53
OR Notes Draft: September 28, 2012
We have achieved the optimal solution to the primal linear programming problem. The
minimum is achieved when z = 13.3 with x1 = 0.8 and x2 = 1.3 and x3 = 0.
max w = y1 + 6y2
s.t. − 2y1 + y2 ≤ 2
2y1 + 4y2 ≤ 9
y1 − y2 ≤ 3
with y1 , y2 ≥ 0
Here we need to add a slack variable to each of the constraints. This leads to the initial
tableau:
The optimal solution has been obtained with w = 13.3 where y1 = 0.1 and y2 = 2.2.
54
OR Notes Draft: September 28, 2012
Observations
Lets compare the optimal Tableau for each of the two problems:
• Note we can read the primal and dual solutions for the other problem using the reduced
costs in row zero of the optimal tableau.
– The optimal dual variable values are the same as the reduced costs of the slack
(and excess variables with with signs reversed).
55
OR Notes Draft: September 28, 2012
Complementary Slackness
We can line up the constraints and sign restrictions for each problem and note which one is
binding in each of the problems:
PRIMAL: min z = cT x
s.t. Ax = b
with x ≥ 0
DUAL: max w = bT y
s.t. AT y ≤ c
with y is free
• xj = 0 or
• the j-th dual slack variable is zero (the corresponding dual constraint is binding).
56
OR Notes Draft: September 28, 2012
xT (c − AT y) = 0.
as the primal and dual constraints ensure that the terms in the summation must be non-
negative. Thus, if the sum is zero then each term must be zero.
Theorem 8.3.2 (Complementary Slackness) Consider a pair of primal and dual linear
programs in standard form. If x is optimal for the primal and y is optimal for the dual then
xT (c − AT y) = 0
z = cT x ≥ yT Ax = yT b = w.
cT x = yT Ax =⇒ xT c = xT AT y
=⇒ xT c − xT AT y = 0
=⇒ xT c − AT y = 0
If we add excess variables to the constraints and place the problem into a tableau we have:
Note that in the above Tableau we do not have any basic variables yet. However, the
given tableau does show that the reduced costs for the problem are such that the optimality
conditions are satisfied. Lets consider making e1 and e2 basic (multiply row 1 and row 2 by
-1). This gives the following tableau.
57
OR Notes Draft: September 28, 2012
Note that:
• The optimality conditions are still satisfied. (Nothing is attractive to enter into the
basis in the simplex method as we know it.)
• The right hand side values are negative. This means that he current basis is infeasible
in the primal problem.
To move toward a feasible solution we could scan the RHS and see who is the most negative,
and work to get them out of the basis. Here we need a candidate to come in in there
place. Scan down the row corresponding to the mose negative RHS value and find negative
coefficients. If there is more than one we would do a ‘Ratio’ test (reduced cost divided by
the exiting row coefficient in the potential entering column) taking the minimum value to
be our entering variable.
After doing the update we can now see that the optimality conditions and the primal feasi-
bility conditions have now both been satisfied. Yielding the optimal solution of z = 20 when
x1 = 4 and x2 = 0. This technique is called the dual simplex method . We can verify that
this is indeed the solution to the problem by considering it graphically.
58
OR Notes Draft: September 28, 2012
A Second Example
Use the dual simplex method to solve the following linear program:
min z = 5x1 + 2x2 + 8x3
s.t. 2x1 − 3x2 + 2x3 ≥ 3
−x1 + x2 + x3 ≥ 5
with x1 , x2 , x3 ≥ 0.
Setting up the problem in tableau form using two excess variables:
Here we look to get e2 out of the basis. We see that x2 is the winner of the Ratio Test.
Note that after the pivot of the Dual Simplex algorithm there is no attractive candidate to
enter into the basis using our normal “Primal Simplex” algorithm (the optimality conditions
are still met). We now use Dual simplex to remove e1 from the basis. Note that x3 is the
only choice to replace e1 in the basis.
Note that the optimal solution of z = 31.6 is achieved when x1 = 0, x2 = 1.4 and x3 = 3.6.
We make note here that the Dual Simplex method is especially useful when doing sensitivity
analysis. If a change in the right hand side value of a constraint is made this method can be
used to update the current simplex solution to one that is feasible if the change causes the
primal problem to have negative right hand side values.
59
OR Notes Draft: September 28, 2012
60
Chapter 9
Sensitivity Analysis
Base Problem
Consider maximizing the profit from manufacturing two items on three different assembly
lines. The profit from manufacturing item 1 is three thousand dollars, and from item 2 is five
thousand dollars. Letting x1 and x2 be the number of each of these items to manufacture,
and letting the following constraints denote the number of hours that it takes to manufacture
each of the items at three different assembly lines with the given restrictions on the maximum
number of hours available on each line. This gives the following linear program:
maximize z = 3x1 + 5x2
subject to x1 ≤ 4
2x2 ≤ 12
3x1 + 2x2 ≤ 18
x1 , x2 ≥ 0.
Assuming you are renting time on each assembly line what is the most you should pay for
an additional hour of time on each of the assembly lines?
61
OR Notes Draft: September 28, 2012
Solution:
Using the simplex algorithm to solve the given linear program we see that after adding two
slack variables in the constraints the initial tableau for the given linear program is written
as:
The next iteration of the simplex method shows that it is desirable to have x1 inter the basis
and it will replace s3 . Doing this pivot yields:
Here we have obtained an optimal tableau. We can see here that profit is maximized at
$36,000 when x1 = 2 and x2 = 6 are manufactured between the different assembly lines.
Shadow prices:
We are often interested in the marginal value of each of the given resources and their impact
on the objective function. That is:
Shadow Price : measures the marginal value of a given resource or the amount
by which z will be increased by slightly increasing the amount of a given resource
being made available.
The shadow price for resource i is denoted by yi∗ and is the amount the objective function will
be increased if the amount of resource bi is slightly increased. The shadow price for resource
i is the zero row coefficient for the ith constraints slack variable in the optimal tableau.
62
OR Notes Draft: September 28, 2012
From our given example we can see that the shadow price for hours available for each
assembly line (marginal increase in the objective function for slight increases in the amount
the resource available) is:
3
y1∗ = 0, y2∗ = y3∗ = 1. (9.1.1)
2
http://www.math.iup.edu/~jchrispe/MATH445_545/ShadowPrices.html
An additional unit of labor on production line two will increase the profits by
$1500.
How far could we increase the value of b2 the amount of resource 2 and still stay optimal
with the current basis?
63
OR Notes Draft: September 28, 2012
We could increase the units of resource b2 up to 18 and keep the same basic
feasible solution. After which the constraint is no longer binding. Here the
optimal objective function would be fixed at z =45. At this point a new basic
feasible solution can be obtained, and a new set of shadow prices will come into
play.
Note that constraints that have zero shadow prices are not binding the objective function.
In the given example we note that the first constraint is not binding and increasing the value
of b1 will have no effect on the objective function’s optimal value. Resources for binding
constraints are sometimes called scarce goods, and resources for non-binding constraints
are called free goods.
• Shadow prices can be also thought of as the maximum price you would want to pay
for an additional unit of a given resource.
• Shadow prices help identify the parameters in the model that need to be estimated
carefully. If a shadow price is zero the model is not sensitive to (at least small) changes
in the given resource.
• You would want to monitor resources more closely if they have large shadow prices.
How far can b2 be changed and keep the same optimal basic feasible solution?
6 ≤ b2 ≤ 18
keeps the same basic feasible solution, and an increase of 6 or a decrease of 6 is allowed.
What information can we get out of LINDO/LINGO?
64
OR Notes Draft: September 28, 2012
With this in mind any change in the initial linear program can be thought of in terms of
these formulations. Specifically checking the feasibility, and optimality of any current basis
will come down to looking at:
B −1 b ≥ 0 for feasibility
and
−cN T + cB T B −1 N ≥ 0 for optimality in the maximization problem
• How much can the initial problem data be changed before the optimality conditions
no longer hold?
• If the current basis is no longer optimal we would apply primal simplex to restore it
to optimality.
• Changes in the data some times may affect the feasibility of the problem. How much
can they change before the constraints are violated?
We may use these formulations to do sensitivity analysis for a linear program allowing for
the appropriate changes in the optimal solution to be made based on changes in the original
problem parameters.
Consider the following linear program (A problem form the Nash and Sofer text):
65
OR Notes Draft: September 28, 2012
If the optimal solution to the problem is found the optimal basis xB = (x1 x2 x3 )T , and
xN = (s1 s2 s3 )T we have:
5 3
1 0 0 1 1 0 2
− 2
1
N = 0 1 0 , B = 1 3 2 =⇒ B −1 = − 32 3
2
−1 .
0 0 1 0 2 3 1 −1 1
with
cN T =
0 0 0
cB T =
3 13 13
4
cB T B −1 b =
Objective Value 3 13 13 3 = 64
1
Thus, x1 = 4, x2 = 3, and x3 = 1.
2. What are the optimal dual variables?
Dual Variables − cN T + cB T B −1 N
5
− 32
2
1 1 0 0
− 32 3
= 0 0 0 + 3 13 13
2
−1 0 1 0
1 −1 1 0 0 1
= 1 2 3
Note these are the shadow prices, and if the problem had more context they would tell
us the most we would wish to pay for an additional unit on the right hand side of each
of the constraints.
3. What is the solution obtained by decreasing the right-hand side of the second constraint
by 5?
Now we add a vector of the form: ∆b = (0, −5, 0)T to the initial b vector:
7 0 7
bnew = 15 + −5 = 10 .
9 0 9
66
OR Notes Draft: September 28, 2012
Thus, x1 = 23 2
, x2 = − 92 , and x3 = 6. Here the RHS is no longer feasible for the
problem as x2 < 0. So we can implement an iteration of the dual simplex method
to find a new basic feasible solution. We need to have a handle on the values of the
non-basic columsn which are given by
5
− 32
2
1
Non-Basic Columns B −1 N = − 23 3
2
−1
1 −1 1
− cN T + cB T B −1 N =
Dual Variables 1 2 3
We do the Ratio Test for an iteration of the dual simplex method giving:
1 2 3
min col1 = −3 = , col3 = =3
2
3 −1
So we pick x2 to leave the basis and we choose s1 to enter. This gives the new optimal
solution to be: xB = (x1 s1 x3 )T , and xN = (x2 s2 s3 )T
Where we now have:
1 1 0 1 0 0
B = 1 0 2 and N = 3 1 0 .
0 0 3 2 0 1
− cN T + cB T B −1 N = 2 7
Dual Variables 3
3 3
4
Current RHS B −1 b = 3 .
3
cB T B −1 bnew =
Objective Value 51
4. By how much can the right-hand side of the first constraint increase and decrease
without changing the optimal basis?
67
OR Notes Draft: September 28, 2012
Here we are looking at the first component of B −1 (b + b∆ ) and want to see what range
of values will keep the first component non-negative where:
∆b
b∆ = 0
0
Thus,
5
(7 + ∆b) − 23 (15) + (9) ≥ 0
2
5
− 32
2
1 7 + ∆b
−1 −3
B (b + b∆ ) = − 32 3
2
−1 15 =
2
(7 + ∆b) + 3
2
− (9) ≥ 0
(15)
1 −1 1 9
(7 + ∆b) − (15) + (9) ≥ 0
cB T B −1 b =
Objective Value 109 ,
− cN T + cB T B −1 N = − 43 49
Dual Variables 2 2
−12
As we now have an attractive entering variable we can do a Primal simplex pivot with
s1 entering the basis. The ratio test using:
5
− 32
2
1
Current Non-Basic Columns B −1 N = − 23 3
2
−1
1 −1 1
68
OR Notes Draft: September 28, 2012
and the Current RHS yields that x3 should leave the basis. This gives xB = (x1 x2 s1 )T ,
and xN = (x3 s2 s3 )T where
0 0 0 1 1 1
N = 2 1 0 and B = 1 3 0
3 0 1 0 2 0
We can look at the updated dual variables and see that:
cB T B −1 b = 261
Objective Value 2
,
The values of the decision variables are:
3
2
Current RHS B −1 b = 9
2
.
1
Thus, x1 = 23 , x2 = 29 , and x3 = 0, and the current dual variables are
− cN T + cB T B −1 N = 43 19
Dual Variables 2
3 2
Note that as the dual variable corresponding to s3 is zero it is also a potential candidate
to enter the basis giving us multiple optimal solutions.
6. How much can the objective coefficient of x1 increase and decrease without changing
the optimal basis?
Here we consider the value of the dual variables that is:
Dual Variables − cN T + cB T B −1 N =
1 2 3
Note that cN = 0 0 0 so we need only consider the following:
5 3
2
− 2
1 1 0 0
((3 + ∆c) 13 13) − 23 3
2
−1 0 1 0 ≥ 0
1 −1 1 0 0 1
5
− 32
2
1
=⇒ ((3 + ∆c) 13 13) − 23 3
2
−1 ≥ 0
1 −1 1
5 −3
=⇒ (3 + ∆c) + (13)( ) + (13) ≥ 0,
2 2
−3 3
(3 + ∆c) + (13)( ) − (13) ≥ 0,
2 2
(3 + ∆c) − 13 + (13) ≥ 0
This gives that
2 4
x ≥ − , x ≤ , and x ≥ −3.
5 3
4
so the coefficient on x1 in the objective function can be increased by at most 3
and
decreased by at most 52 if the same optimal basis is to be maintained.
69
OR Notes Draft: September 28, 2012
70
Chapter 10
Our opponent is an alien starship packed with atomic bombs, I said. We have a
protractor.
There are many instances where the problem considered involves more that a linear rela-
tionship between decision variables and our objective. Here we will examine some of the
preliminaries of non-linear programming starting with fitting functional models to sets of
data.
where
f : Rm+1 → R.
This may be a linear or non-linear problem depending on whether the function f is linear in
its components of the parameter vector x.
1
Here we will follow the presentation in Heath’s Text. [2]
71
OR Notes Draft: September 28, 2012
f (t, x) = x1 + x2 t + x3 t2 + . . . + xm tm−1
that best fits our set of n points we have to find the m coefficients for vector x that would
minimize our residual in the least squares sense described above.
This problem and others where the parameters x in f are linear combinations will result in
a matrix system of the form
Ax ∼
= b.
Lets work a couple of examples.
Example:
Consider finding the best fitting linear and quadratic function for the following set of points:
(1, 0), (2, 5), (3, 8), (4, 17), (5, 24)
f (t, x) = x1 + x2 t
r = b − Ax
72
OR Notes Draft: September 28, 2012
if we are going look at the minimum of squared Euclidean norm of this residual can consider
finding the minimum of
φ(x) = krk22
= rT r
= (b − Ax)T (b − Ax)
= bT b − 2bT Ax + xT AT Ax
If we use methods from multi variable calculus we know that the residual function will have
a potential minimum provided (necessary condition):
∇φ(x) = 0
0 = ∇φ(x)
= 0 − 2bT A + AT Ax + AT Ax
= −2bT A + 2AT Ax
=⇒ AT Ax = AT b
For this to indeed be a minimum note that we need the Hessian Matrix (matrix of second
partial derivatives) given by AT A to be positive definite. (This can be proved by showing
that AT A has rank n or that the columns are linearly independent). Note this system of
equations is known as the normal equations.
Looking back at our example we need to consider:
5 15 x1 54
=
15 55 x2 222
− 36
x1 5
x= =
x2 6
73
OR Notes Draft: September 28, 2012
Now lets consider fitting a quadratic function to the data. Thus we want to find the best fit
function of the form:
f (t, x) = x1 + x2 t + x3 t2
The new system matrix is:
t21
1 t1 y1
1 t2 t22 x1 y2
x2 ∼
Ax =
1 t3 t23 = y3 = b.
1 t4 t24 x3 y4
1 t5 t25 y5
Thus, the best fit quadratic function for the set of points is given by
5 12 11
f (t) = t2 + t −
7 7 5
Plotting our two found functions and the original data set gives:
74
OR Notes Draft: September 28, 2012
Non-linear Problems
In order to consider non linear problems we need to consider iterative methods that will help
us find the optimal solution to our data fitting problem.
Lets recall in one dimension that we can expand a function about a close point (x + h)
provided we know information about our function at point x. Thus a Taylor series expansion
is:
f (x) f 0 (x)h f 00 (x)h2
f (x + h) = + + + ···
0! 1! 2!
Truncate the expansion after the first term gives:
f (x + h) ≈ f (x) + f 0 (x)h
For a numerical scheme we could note that h is the distance between to points:
h = x1 − x
Thus, we can make a note that an approximation of the first derivative can be given by:
f (x + x1 − x) ≈ f (x) + f 0 (x)(x1 − x)
f (x1 ) − f (x)
=⇒ f 0 (x) ≈
(x1 − x)
Newton’s method is a way of iterating toward the root a function given that you have an
initial guess that is reasonably close to the root. To find the root of
f (x) = 0
we guess that x1 is our root. Then an iterative scheme for approaching a root would be
given by rearranging the first derivative approximation that we just found (with f (x1 ) ≈ 0)
to obtain:
f (xn−1 )
xn = xn−1 −
f 0 (xn−1 )
where we iterate from some initial guess until some predetermined tolerance is achieved.
In order to solve non-linear equations in multiple dimensions we can look at a generalization
of Newton’s method. Looking at a function f such that f : Rn → Rn , the truncated Taylor
series expansion is given by:
f (x + s) ≈ f (x) + Jf (x)s (10.1.1)
75
OR Notes Draft: September 28, 2012
Lets now consider newtons method for a function f : Rm → R. Here a two term in our
Taylor series expansion:
1
f (x + s) ≈ f (x) + ∇f (x)T s + sT Hf (x)s.
2
where Hf (x) is the Hessian matrix of second partial derivatives of f such that:
∂ 2 f (x)
Hf (x)i,j =
∂xi ∂xj
It follows that the function f (x + s) will have a minimum when
To see this you should look at this as if f is a quadratic function in s, and note that (10.1.2)
is the vertex of the function. This allows us the oppertunity to think of Newton’s Method
as:
76
OR Notes Draft: September 28, 2012
http://www.ccs.tulane.edu/~chiayu/
Here the goal will be to fit a set of swimming data with a best fit model of the following
form:
f (x, t̂) = (ax2 + bx + c) sin(kx + ω t̂)
where we need to find the values of a, b, c, k, and ω that will best fit our model.
In order to solve this problem lets assume that we are given a set of m points of the form
(ti , yi ) and we want to fit a nonlinear function with vector of parameters x ∈ Rk such that
the function f (t, x), is the best fit to the given data set where f : Rk+1 → R. Thus, our goal
is to minimize the residual r where r : Rk → Rm , and
Finding the first of these expressions is not troubling. Denote the Jacobian matrix of r(x)
by J(x) gives
∇φ(x) = JT (x)r(x).
For the second term we calculate the Hessian Matrix of φ as
m
X
T
Hφ (x) = J (x)J(x) + ri (x)Hri (x).
i=1
Calculating the Hri (x) is often difficult and computationally expensiveso it is often ignored
or dropped fom computations. The result in what is known as a Gauss-Newton Method
given by:
77
OR Notes Draft: September 28, 2012
Note the solve step looks like the normal equations for a nonlinear least squares problem.
The question now is what does J(x) look like for our given problem? This is the Jacobean
matrix of the residual vector. For the swimmers we have:
where we need to find the values of a, b, c, k, and ω that will best fit our model to a given
set of data along a swimmer. Lets let φ̂ = ω t̂ be a parameter all by itself and then back the
value of ω out of the time dependent data fit (as we are doing this for a moving swimmer).
Thus,
f (x̂, x) = (ax2 + bx + c) sin(kx + φ̂), and x̂ = (a, b, c, k, φ̂)T
So at any time we are looking at the residual vector for our m points where the components
of r(x) are:
ri (x̂) = yi − f (x̂, ti ) for i ∈ {1, 2, . . . , m}.
and the components of the residuals Jacobean are
∂ri (x̂)
J(x̂)i,1 = = −(t2i ) sin(kti + φ̂)
∂a
∂ri (x̂)
J(x̂)i,2 = = −ti sin(kti + φ̂)
∂b
∂ri (x̂)
J(x̂)i,3 = = − sin(kti + φ̂)
∂c
∂ri (x̂)
J(x̂)i,4 = = −(at2i + bti + c) cos(kti + φ̂)ti
∂k
∂ri (x̂)
J(x̂)i,5 = = −(at2i + bti + c) cos(kti + φ̂)
∂ φ̂
At the end of the day we will have a five by five matrix system to iterate on and find our
optimal parameters. Note as we are going to solve this over different time sets we will be
able to plot the value computed for φ̂ as a function of the different input times and back out
a value for ω the speed of the swimmer.
78
Chapter 11
Network Flows
It's hard to decide who's truly brilliant; it's easier to see who's driven, which in the long
−Michael Crichton
In this chapter a collection of Network Algorithms will be examined. The current treatment
will only serve to illustrate some of the other areas that can be explored in the world of
Operations Research.
79
OR Notes Draft: September 28, 2012
Example:
Use Dijkstra’s algorithm to find a shortest path tree rooted at node 1 in the network below.
Note that two of the arcs are bi-directional. Show at each iteration D(·), pred(·), and the
selected node i∗ , as well as the final shortest path tree.
5
- ∞5 -
∞
2 3 2 3
>
6
Z 2 >
6
Z 2
@ Z
@ Z ∞
~
6 @ 6 Z 6 @ 6 Z
~
Z Z
@ 1 4 @ 1 4
1 1 1 1
8
@
3 8
@
3
Q >
Q >
Q
3 Q
@
Q
3 Q
@
s ?
Q R ? 2
@
@ s ?
Q R ? 2
@
@
6 - 5 6 - 5
5 5
∞ ∞
Initialize
node 1∗ 2 3 4 5 6
D( ) 0 ∞ ∞ ∞ ∞ ∞
pred( )
Note: The ∗ denotes the node selected and p will denote a nodes predecessor.
6 2
5
- ∞ 4 5 -
11
3 2 3
>
6
Z 2 >
6 Z 2
∞
@ Z @ ∞
~
Z
~
6 @ 6 Z 6 @ 6 Z
Z Z
@ 1 4 @ 1 4
1 1 1 1
8
@
3 8
@
3
Q >
Q >
Q
3 Q
@
Q
3 Q
@
s ?
Q R ? 2
@
@ s ?
Q R ? 2
@
@
6 - 5 6 - 5
5 5
3 ∞ 3 8
node 1p 2 3 4 5 6∗ node 1 2∗ 3 4 5 6p
D( ) 0 6 ∞ ∞ ∞ 3 D( ) 0 4 11 ∞ 8 3
pred( ) 0 1 1 pred( ) 0 6 6 6 1
4 5
9 4 5 -
8
2
-
3 2 3
Z 2 >
6
Z 2
6 @ Z 9
~
>
@ Z ∞
6 6
6 6 Z @ ZZ
@ ~
Z
@ 1 4
@ 1 4 1 1
1 1
@
8
@ 8 3
@3
Q >
Q
Q
>
Q @
3 Q ? ? 2
3 Q ? @ ?
2
s
Q @
R
@
s
Q R
@
- 5 6 - 5
6
3 7
5
5
3 7
80
OR Notes Draft: September 28, 2012
node 1 2p 3 4 5∗ 6 node 1 2 3∗ 4 5p 6
D( ) 0 4 9 ∞ 7 3 D( ) 0 4 8 9 7 3
pred( ) 0 6 2 2 1 pred( ) 0 6 5 5 2 1
4 5
8 4 5 -
8
2
-
3 2 3
Z 2 6 >
Z 2
6
@ Z 9
~
>
@ Z
6 6
6 @ 6 Z ~
Z 9 @ Z
Z
@ 1 4
@ 1 4 1 1
1 1
Q @
8
@
3
8 3 >
Q
Q
>
Q @
@ 3 Q
3 Qs
Q ? @
R
@ ?
2
s ?
Q R ? 2
@
@
6 - 5 6 - 5
5 5
3 7 3 7
node 1 2 3p 4 5 6 node 1 2 3 4∗ 5p 6
D( ) 0 4 8 9 7 3 D( ) 0 4 8 9 7 3
pred( ) 0 6 5 5 2 1 pred( ) 0 6 5 5 2 1
The minimum distance spanning tree for the network is given by the final path shown in
red.
81
OR Notes Draft: September 28, 2012
82
Chapter 12
Appendices
Can you still have any famous last words if you're somebody nobody knows?
− Ryan Adams
12.1 Homework 1
Answer the following questions. Please include the questions with the solution. I do not
want to see scrap work.
1. Only three brands of beer (beer1, beer2, and beer3) are available for sale in Metropolis.
From time to time, people try one or another of these brands. Suppose that at the
beginning of each month, people change the beer they are drinking according to the
following rules:
• 30% of the people who prefer beer 1 switch to beer 2.
• 20% of the people who prefer beer 1 switch to beer 3.
• 30% of the people who prefer beer 2 switch to beer 3.
• 30% of the people who prefer beer 3 switch to beer 2.
• 10% of the people who prefer beer 3 switch to beer 1.
For i = 1, 2, 3, let xi be the number who prefer beer i at the beginning of this month
and let yi denote the number who prefer beer i at the beginning of next month. Use
matrix notation to relate x = (x1 x2 x3 )T and y = (y1 y2 y3 )T . Note that the following
equations will hold for the rules given above:
83
where we needed to find the number of people that stayed loyal to any particular type
over the course of the month. Let
0.5 0.0 0.1
A = 0.3 0.7 0.3 .
0.2 0.3 0.6
(AB)Ti,j = (AB)j,i
Xn
= Aj,k Bk,i
k=1
n
X
= ATk,j Bi,k
T
k=1
Xn
T
= Bi,k ATk,j
k=1
= (B AT )i,j
T
3. Model each of the following decision making situations as a linear program(LP). For
each LP clearly define your decision variables, objective function and constraints.
(a) Suppose that the latest scientific studies indicate that cattle need certain amounts
b1 , . . . , bm of nutrients N1 , . . . , Nm respectively. More over, these nutrients are cur-
rently found in n commercial feed materials F1 , . . . , F n as indicated by coefficients
aij , i = 1, . . . , m, j = 1, . . . , n, that denote the number of units of nutrientNi per
pound of feed material Fj . Each pound of Fj costs the rancher cj dollars. How
can a rancher supply these minimal nutrient requirements to his prize bull while
minimizing his feed bill?
Linear Program: The goal of the problem is to minimize the cost of the bulls
food while maintaining the bulls healthy diet.
OR Notes Draft: September 28, 2012
Let xj be the number of pounds that the farmer should purchase of commercial
feed Fj where , j = 1, . . . , n. Thus the farmer wishes to minimize the following
cost equation (where z denotes the farmers total cost):
n
X
Minimize: z = c1 x1 + c2 x2 + . . . + cn xn = cj x j
j=1
In order to meet the nutrient requirments the farmer needs to impose the following
constrictions on his cost equation:
where xj ≥ 0, j = 1, . . . , n
Let x = [x1 , x2 , · · · , xn ]T , and c = [c1 , c2 , · · · , cn ]T . We can also denote [b1 , b2 , · · · , bm ]T
by b, and coefficient matrix
a11 a12 a13 . . . a1n
a21 a22 a23 . . . a2n
a31 a32 a33 . . . a3n
by A.
.. .. .. . .. .
..
. . .
am1 am2 am3 . . . amn
Ax ≥ b
where xj ≥ 0, j = 1, . . . , n
(b) Suppose that a small chemical company produces one chemical product which it
stores in m storage facilities and sells in n retail outlets. The storage facilities are
located in different communities. The shipping costs from storage facility Fi to
retail outlet Oj is cij dollars per unit of the chemical product. On a given day,
each outlet Oj requires exactly dj units of the product. Moreover, each facility Fi
has si units of the product available for shipment. The problem is to determine
how many units of the product should be shipped from each storage facility to
each outlet in order to minimize the total daily shipping costs.
Linear Program: The goal of the problem is to minimize the cost of product
shipping while maintaining product invintory and not overdrawing from supply.
Let xij be the number of units of chemical shipped from facility Fi to retail outlet
Oj , where i ∈ {1, . . . , m}, and j ∈ {1, . . . , n}. Let z denote the total cost of
85
OR Notes Draft: September 28, 2012
shipping. Thus, the chemical company wishes to optimize the followin objective
function,
m X
X n
Minimize: z = cij xij
i=1 j=1
In minimizing the above equation the company must meet the following con-
straints:
x11 + x21 + . . . + xm1 = Pm
P
i=1 xi1 ≥ d1
m
x12 + x22 + . . . + xm2 = i=1 xi2 ≥ d2
.. .. ..
. Pm. .
x1n + x2n + . . . + xmn = i=1 xin ≥ dn
That is each outletj requires dj of chemical where j ∈ {1, . . . , n}. Each Facility i
also only has a limited supply of the chemical it can ship si where i ∈ {1, . . . , m}.
Thus, the problem has the constrictions:
Pn
x11 + x12 + . . . + x1n = x ≤ s1
Pnj=1 1j
x21 + x22 + . . . + x2n = j=1 x2j ≤ s2
.. .. ..
. Pn . .
xm1 + xm2 + . . . + xmn = j=1 xmj ≤ sm
86
OR Notes Draft: September 28, 2012
(c) An investor has decided to invest a total of $50,000 among three investment op-
portunities: savings certificates, municipal bonds, and stocks. The annual return
in each investment is estimated to be 7%, 9%, and 14%, respectively. The in-
vestor does not intend to invest her annual interest returns (that is, she plans
to use the interest to finance her desire to travel). She would like to invest a
minimum of $10,000 in bonds. Also, the investment in stocks should not exceed
the combined total investment in bonds and savings certificates. And, finally, she
should invest between $5,000 and $15,000 in savings certificated. The problem
is to determine the proper allocation of the investment capital among the three
investment opportunities in order to maximize her yearly return. Linear Pro-
gram: The goal of the problem is to maximize the return on investment subject
to several constraints.
Let xc be the amount to be invested in savings certificates.
Let xb be the amount to be invested in bonds, and
Let xs be the amount to be invested in stocks.
The goal of the problem is to now maximize the following return on investment
objective function given by z:
This can be solved using LINDO and the following values are obtained (See At-
tached LINDO print out ):
xc = $5,000
xb = $20,000
xs = $25,000
Table 12.1.1: Amount to Place in Each Investment
(d) The owner of a small chicken farm must determine a laying and hatching program
for 100 hens. There are currently 100 eggs in the hen house, and the hens can
be used either to hatch existing eggs or to lay new ones. In each 10-day period,
a hen can either hatch 4 eggs or lay 12 new eggs. Chicks that are hatched can
be sold for 60 cents each, and every 30 days an egg dealer gives 10 cents each
for the eggs accumulated to date. Eggs not being hatched in one period can be
kept in a special incubator room for hatching in a later period. The problem is
to determine how many hens should be hatching and how many should be laying
in each of the next three periods so that total revenue is maximized. Linear
87
OR Notes Draft: September 28, 2012
Program: The goal of the problem is to maximize the total revenu over the next
30 day period subject to several constraints.
Let Hhi be the number of hens hatching eggs in period i, i ∈ {1, 2, 3}.
Let Hli be the number of hens laying eggs in period i, i ∈ {1, 2, 3}.
Let Es0 be the number of eggs initially in storage (100 eggs).
Let Esi be the number of eggs in storage at the end of period i, i ∈ {1, 2, 3}.
The goal of the problem is to now maximize the profit made on the eggs and
chicks produced by the chickens defined by the objective function z. That is:
When the above program is optimized using LINDO(see the attached print out).
After solving the following values are obtained:
Hh1 = 25
Hh2 = 100
Hh3 = 100
Hl1 = 75
Hl2 = 0
H13 = 0
Es0 = 100
Es1 = 900
Es2 = 500
Es3 = 100
This is sensible, because the return from a hatched chicken is 60 cents, and that
of an egg is only 10 cents. Thus, a Hen laying 12 eggs a period can generate $1.20
and a Hen hatching 4 eggs can generate $2.40.
12.2 Homework 2
Answer the following questions. Please include the question with the solution (write or type
them out doing this will help you digest the problem). I do not want to see scrap work. Note
the problems are separated into two sections a set for all students and a bonus set for those
taking the course at the 545 level.
88
OR Notes Draft: September 28, 2012
All Students
1. Solve the following linear program graphically.
maximize z = x1 + 2x2
subject to 2x1 + x2 ≥ 12
x1 + x2 ≥ 5 (12.2.1)
−x1 + 3x2 ≤ 3
−2x1 + x2 ≥ −12
with x1 , x2 ≥ 0.
(a) Clearly label each of the constraints, and the feasible region.
(b) List all the extreme corner points.
(c) Write the feasible region as a convex convex set.
(d) State the optimal solution to the linear program.
(e) Comment about the solution to the liner program if the constraint −2x1 + x2 ≥
−12 is removed.
Solution:
Figure 12.2.1 shows the feasible region obtained from the linear programs con-
straints, as well as a contour of the optimal objective function. See
http://www.math.iup.edu/~jchrispe/MATH445_545/ProblemOneGraph.html
for an interactive version of the solution.
89
OR Notes Draft: September 28, 2012
The feasible region can be written as a convex set by defining α1 , α2 , and α3 such that
3
X
α1 , α2 , α3 ∈ [0, 1], and αi = 1.
i=1
Then using the extreme corner points A, B, and C any point in the feasible region of
the linear program is then given by:
feasible region = (x, y) (x, y) = α1 A + α2 B + α3 C.
The optimal solution to the linear program occurs at point B = 39 , 18 with a maxi-
5 5
mum objective function value of z = 15.
If the constrain −2x1 + x2 ≥ −12 is removed from the linear program then the solution
becomes unbounded with a direction of unboundedness being given by the vector:
3
d= .
1
2. You have $2000 to invest over the next five years. At the beginning of each year, you
can invest money in one or two year bank time deposits, yielding 8% (at the end of one
year) and 17% (at the end of the two years) respectively. Also you can invest in three-
year certificates offered only at the start of the second and third years, yielding 26%
(total) at the end of the third year. Assume that you invest all money available each
year, and want to withdraw all cash at the end of year 5. Formulate the situation as a
linear programming problem; carefully define your decision variables. Then solve the
problem using lindo or lingo (as we have done in class), and attach the lindo output.
Be sure to interpret your results. Solution: Let xi,j be the amount of money invested
in an account at the start of year i for j years. Then for example x5,1 is the amount of
money invested into an account for one year at the start of year five.
There will then be 11 possible decision variables:
decision variables = {x1,1 , x2,1 , x3,1 , x4,1 , x5,1 , x1,2 , x2,2 , x3,2 , x4,2 , x2,3 , and x3,3 }
The objective is to maximize the money received during the fifth year. Thus,
90
OR Notes Draft: September 28, 2012
91
OR Notes Draft: September 28, 2012
4. Write the following linear program in the standard form, posed as a maximization
problem. Do not use the substitution x2 = x02 − x002 , use the free variable instead to
state the problem using one less constraint.
Solution: Here we can start by adding a slack variable to the second constraint.
Thus,
maximize z = 6x1 − 3x2
subject to 2x1 + 5x2 ≥ 10
3x1 + 2x2 + s1 = 40
x1 , s1 ≥ 0 and x2 free .
We can now make note that the second constraint can be solved for x2 as
40 3 1 3 1
x2 = − x1 − s1 = 20 − x1 − s1 .
2 2 2 2 2
This expression for x2 can be placed into both the objective function and into the
remaining constraints. This gives:
maximize z + 60 = 21 x + 32 s1
2 1
11
subject to x + 52 s1 + s2 = 90
2 1
x1 , s1 , s2 ≥ 0.
x + cd ∈ S.
92
OR Notes Draft: September 28, 2012
Note we also need our new point “x + cd00 to be non-negative which is true as
x ∈ S, and d ≥ 0. Thus, x + cd ∈ S, and d is a direction of unboundedness.
12.3 Homework 3
Answer the following questions. Please include the question with the solution (write or type
them out doing this will help you digest the problem). I do not want to see scrap work. Note
the problems are separated into two sections a set for all students and a bonus set for those
taking the course at the 545 level.
All Students
1. Solve the following linear program.
minimize z = −x1 − 3x2
subject to x1 − 2x2 ≤ 4
−x1 + x2 ≤ 3
x1 , x2 ≥ 0.
Solution:
After adding two slack variables in the constraints the initial tableau for the given
linear program is written as:
93
OR Notes Draft: September 28, 2012
From the tableau it can be seen that it is favourable for x1 to enter into the basis; how-
ever, as both variables have negative coefficients in the x1 column for the constraints we
can see there is a direction of unboundedness. Thus, the linear program is unbounded,
and no minimum value of the objective function will be obtained. Specifically we can
see that the constraints give:
s1 = 10 + x1
x2 = 3 + x1
Note that if the value of s1 and x2 are both increased by one then increasing the value
of x1 by one will keep these constraints satisfied. Thus, from the feasible point:
0
3
x= 10
and for all c ≥ 0 we note that x+cd is feasible for the linear program and the objective
function is unbounded.
maximize z = x1 + x2
subject to x1 + x2 + x3 ≤ 1
x1 + 2x3 ≤ 1
x1 , x2 , x3 ≥ 0.
Solution: After adding in the slack variables we obtain the following standard form
initial tableau:
94
OR Notes Draft: September 28, 2012
Note that x1 and x2 are both attractive to the simplex method. Thus, using Bland’s
rule we will pick x1 as the entering variable. The ratio test has a tie between s1 and s2
as leaving variables. Here we will pick s1 as the leaving variable. The updated tableau
follows:
Here we see that we have obtained an optimal simplex tableau; however, we make note
that there are multiple optimal solutions as x2 is a non-basic variable that has a zero
coefficient in row zero of the tableau. Pivot x2 into the basis variables in place of x1
to obtain a second optimal solutions.
For α ∈ [0, 1] the optimal objective function value z = 1 is found with solutions of the
form:
95
OR Notes Draft: September 28, 2012
Solution: For this problem we need to add slack and excess variables. For use in
the Big-M method for solving this problem we also need to add an artificial variable
for the constraint with an excess variable that will allow us to have a starting basic
feasible solution. The problem written in standard form then becomes:
where M denotes a large positive constant. Note we have penalized the objective
function if a1 is a basic variable. The initial simplex tableau for the problem is:
z x1 x2 x3 s1 s2 e1 a1 RHS Basic
1 -4 -4 -1 0 0 0 -M 0 z
0 1 1 1 1 0 0 0 2 s1
0 2 1 0 0 1 0 0 3 s2
0 2 1 3 0 0 -1 1 3 a1
After adjusting the values of the top row using elementary column operations the
following tableau is obtained.
z x1 x2 x3 s1 s2 e1 a1 RHS Basic
1 2M-4 M-4 3M-1 0 0 -M 0 0 z
0 1 1 1 1 0 0 0 2 s1
0 2 1 0 0 1 0 0 3 s2
0 2 1 3 0 0 -1 1 3 a1
The simplex method now scans the coefficients in the zero row looking for the most
positive value (as this is a minimization problem). Here we see that x3 is the most
attractive. The ratio test shows that a1 should leave the basis. After the pivot we
obtain the tableau:
z x1 x2 x3 s1 s2 e1 a1 RHS Basic
−10 −11 −1 1
1 3 3
0 0 0 3
−M + 3
1 z
1 2 1 −1
0 3 3
0 1 0 3 3
1 s1
0 2 1 0 0 1 0 0 3 s2
2 1 −1 1
0 3 3
1 0 0 3 3
1 x3
This is an optimal solution as there is no longer any positive coefficients in the zero
row of the tableau. The optimal solution to the given linear program is z = 1 when:
96
OR Notes Draft: September 28, 2012
4. A cargo plane has three compartments that can be used for storing cargo: front,
center, and back. These compartments have the capacity limits on total weight and
space available given by the table below:
Compartment Weight (tons) Space (cu-ft)
Front 12 7,000
Center 18 9,000
Back 10 5,000
Also the weight of the cargo actually placed in the compartments must be in the same
proportion as the compartments’ weight capacity, in order to maintain the balance of
the plane. The following four cargoes have been offered for shipment on an upcoming
flight as space is available. Any portion of these cargos can be accepted. The objective
is to maximize the total profit for the flight.
Cargo Weight (tons) Volume (cu-ft) Profit ($/ton)
1 20 8,000 280
2 16 8,000 360
3 25 14,000 320
4 13 13,000 310
(a) Formulate as a linear program and solve using LINDO/LINGO (attach output).
Solution: Let xi,j be the amount of cargo i in tons to ship in compartment j
where i ∈ {1, 2, 3, 4} and j ∈ {f, c, b} (here f, c, and b denote front, center, and
back respectively. Thus, the objective function (maximize profit z) becomes:
X X X X
maxz = 280 x1,j +360 x2,j +320 x3,j +310 x4,j
j∈{f,c,b} j∈{f,c,b} j∈{f,c,b} j∈{f,c,b}
97
OR Notes Draft: September 28, 2012
Last the weight of the cargo must be in the same proportion as the compartments’
weigh capacity. There are several ways to write this constraint, here we inforce
the front to back and center to back ratio:
x1,f + x2,f + x3,f + x4,f 12 x1,c + x2,c + x3,c + x4,c 18
= , and =
x1,b + x2,b + x3,b + x4,b 10 x1,b + x2,b + x3,b + x4,b 10
x1,b = 0 + 0.6x3,b
x3,c = 7.5 − x3,b
x2,c = 6.0 + 1.6x3,b
x2,b = 10.0 − 1.6x3,b
x1,c = 4.5 − 0.6x3,b
x3,f = 12
with again all other decision variables set to zero. From the ratio test we see that
the maximum balue that x3,b can take on is 6.26. Thus, any solution written as
above with x3,b ∈ [0, 6.25] will yield the stated optimal solution of $13,260.00.
98
OR Notes Draft: September 28, 2012
1. Consider the simplex method, implemented with the usual rules, applied to a linear
program of the form:
maximize z = cT x,
subject to Ax ≤ b,
x ≥ 0.
• Can a variable xj that enters at one iteration leave at the very next iteration?
Either provide a numerical example (in two variables) in which this happens or
prove that it cannot occur. Solution: Yes a variable that enters the basis at
one iteration can leave the basis on the next iteration of the simplex method.
Consider the following example:
maximize z = 2x1 + x2
subject to x1 + 41 x2 ≤ 1
x1 − 3x2 ≤ 5
x1 − 2x2 ≤ 4
x1 , x2 ≥ 0.
After adding in the needed slack variables the initial simplex tableau is:
The first pivot of the simplex algorithm has x1 enter the basis in place of s1 .
Row z x1 x2 s1 s2 s3 RHS Basis
0 1 0 -0.5 2 0 0 2 z
1 0 1 0.25 1 0 0 1 x1
2 0 0 -3.25 -1 1 0 4 s2
3 0 0 -2.25 -1 0 1 3 s3
On the next pivot of the algorithm we see that x1 is replaced in the basis by x2 .
Row z x1 x2 s1 s2 s3 RHS Basis
0 1 2 0 4 0 0 4 z
1 0 4 1 4 0 0 4 x2
2 0 13 0 12 1 0 17 s2
3 0 9 0 8 0 1 12 s3
This is the optimal tableau, and the optimal solution to the stated maximization
problem is z = 4 when x1 = 0, and x2 = 4.
99
OR Notes Draft: September 28, 2012
• Can a variable xi that leaves at one iteration enter at the very next iteration of the
simplex method? Either provide a numerical example (in two variables) in which
this happens or prove that it cannot occur. Solution: A variable xi that leaves
at one iteration of the simplex method can not enter at the very next iteration of
the simplex method.
Before writing a proof lets recall the rules of the simplex method for a standard
form maximization problem.
(a) Scan the non-basic variables and find the one with the most negative coeffi-
cient in the current tableau (row zero of the tableau in our standard form).
This will give the greatest improvement to the objective function value z upon
entering the basis.
(b) Use the ratio test to determine the maximum amount that the incoming basic
variable may be with out causing other basic variables to take on negative
values.
(c) Use elementary row operations to make the incoming variable basic in the
updated tableau.
Proof: Assuming a standard form maximization problem, let xi be the variable
leaving the basis and xj be the variable entering the basis at some pivot of the
simplex method (Note Row: i out, Column j in). The relevant portion of a sim-
plex tableau is:
In the updated tableau we note that the zero row coefficient for xi (the variable
that just became non-basic) is given by:
−cj
>0
aj
As this value is positive in the current tableau, then xi will not enter the basis on
the next pivot of the simplex algorithm. This completes the proof.
100
OR Notes Draft: September 28, 2012
12.4 Homework 4
Answer the following questions. Please include the question with the solution (write or type
them out doing this will help you digest the problem). I do not want to see scrap work. Note
the problems are separated into two sections a set for all students and a bonus set for those
taking the course at the 545 level.
All Students
1. Use the simplex method in matrix form to solve the following linear program:
maximize z = 2x1 − x2 + x3
subject to 3x1 + x2 + x3 ≤ 60
x1 − x2 + 2x3 ≤ 10
x1 + x2 − x3 ≤ 20
x1 , x2 , x3 ≥ 0.
For a problem in the standard form given in class recall that any current tableau in
the simplex algorithm can be represented in matrix form using the basis as follows:
xN T xB T RHS Basis
T −1 T −1
−cN T + cB B N 0 cB B b z
−1 −1
B N I B b xB
Solution:
Lets first solve the problem using tableaus so we have something to use as comparison.
Row z x1 x2 x3 s1 s1 s3 RHS Basis
0 1 -2 1 -1 0 0 0 0 z
1 0 3 1 1 1 0 0 60 s1
2 0 1 -1 2 0 1 0 10 s2
3 0 1 1 -1 0 0 1 20 s3
101
OR Notes Draft: September 28, 2012
Here we have achieved the optimal solution with x1 = 15, x2 = 5, and x3 = 0 the
optimal objective is 25.
For this problem we make the following definitions in order to solve the problem using
the matrix simplex method:
x1 2
x2 −1
x3
1
60
x= 10
s1 , c = 0 , b =
s2
0
20
s3 0
and
3 1 1 1 0 0
A = 1 −1 2 0 1 0 .
1 1 −1 0 0 1
In order to implement the simplex algorithm in matrix format we break the given
coefficient matrix A into to parts: a basic part and a non-basic part. Thus,
A = [N |B]
In matrix form we start by defining xB = (s1 s2 s3 )T , and xN = (x1 x2 x3 )T we have:
3 1 1 1 0 0 1 0 0
−1
N= 1 −1 2 , B=
0 1 0 =⇒ B = 0 1 0 .
1 1 −1 0 0 1 0 0 1
with
cN T =
2 −1 1
cB T =
0 0 0
Evaluating each of the expressions in the tableau we have:
−cN T + cB T B −1 N =
−2 1 −1
cB T B −1 b =
0
60
−1
B b = 10
20
3 1 1
−1
B N = 1 −1 2
1 1 −1
Note that the non-basic variable x1 should be picked to enter the basis. Doing the
ratio test using the first column of B −1 N and the current right hand side vector B −1 b:
60 10 20
min = 20, = 10, = 20
3 1 1
102
OR Notes Draft: September 28, 2012
and we choose s2 to leave the basis. This leads to the new values for
xB = (s1 x1 s3 )T , and xN = (s2 x2 x3 )T we have:
0 1 1 1 3 0 1 −3 0
N = 1 −1 2 , B = 0 1 0 =⇒ B −1 = 0 1 0 .
0 1 −1 0 1 1 0 −1 1
with
cN T =
0 −1 1
cB T =
0 2 0
−cN T + cB T B −1 N =
2 −1 3
cB T B −1 b =
20
30
B −1 b = 10
10
−3 4 −5
B −1 N = 1 −1 2
−1 2 −3
Note that the non-basic variable x2 should be picked to enter the basis. Doing the ratio
test using the second column of B −1 N and the current right hand side vector B −1 b:
30 10
min = 7.5, =5
4 2
and we choose s3 to leave the basis. This leads to the new values for
xB = (s1 x1 x2 )T , and xN = (s2 s3 x3 )T we have:
0 0 1 1 3 1 1 −1 −2
N = 1 0 2 , B = 0 1 −1 =⇒ B −1 = 0 1
2
1
2
.
0 1 −1 0 1 1 0 − 12 1
2
with
cN T =
0 0 1
cB T =
0 2 −1
103
OR Notes Draft: September 28, 2012
−cN T + cB T B −1 N = 3 1 3
2
2 2
cB T B −1 b = 25
10
B −1 b = 15
5
−1 −2 1
B −1 N = 12 1
2
1
2
− 12 1
2
− 32
We note here that none of the reduced costs given in −cN T + cB T B −1 N are negative, and
we have reached the optimal solution z = 25 when
Find conditions on the parameters a, b, . . . , h so that the following statements are true.
(In the solution parameters that can take on any value will not be mentioned).
104
OR Notes Draft: September 28, 2012
12.5 Homework 5
The following question comes from Nash and Sofer’s text book.
105
OR Notes Draft: September 28, 2012
xN T xB T RHS Basis
T −1 T −1
−cN T + cB B N 0 cB B b z
B −1 N I B −1 b xB
where
6 −13 −3 1 0 0
B= 6 11 2 ,N = 0 1 0 ,
1 5 1 0 0 1
11 −101 0
b = 45 , cB = 87 , and cN = 0 .
12 23 0
Note that
5
B −1 b = 1 , and cTB B −1 b =
−372
2
It now becomes easy to use sensitivity analysis to answer the following questions.
• What is the solution of the linear program obtained by decreasing the right hand
side of the second constraint by 15?
Here we adjust the value of the original RHS b to the new value:
11
bnew = 30
12
We look to see if the RHS of the LP’s constraints are still feasible:
1 −2 7 11 35
B −1 bnew = −4 9 −30 30 = −134
19 −43 144 12 647
As the value for x2 = −134 it is no longer a feasible value. We make note that
the optimality condition is still satisfied. We can do a pivot of the Dual simplex
method in order to obtain a feasible solution. Here we scan the second row of
B −1 N in order to find negative values on which we can pivot. We conduct the
ratio test by looking at the minimum of the corresponding reduced cost divided
by the possible pivot entry. This gives,
1 −2 7 1 0 0 1 −2 7
B −1 N = −4 9 −30 0 1 0 = −4 9 −30 , and
19 −43 144 0 0 1 19 −43 144
106
OR Notes Draft: September 28, 2012
−cN T + cB T B −1 N =
−12 −4 −5
Ratio Test:
−12 −5 1
min = 3, = ,
−4 −30 6
this shows that s3 should enter the basis in the place of x2 . Doing this update
gives:
6 0 −3 1 0 −13
B= 6 0 2 , and N = 0 1 11
1 1 1 0 0 5
with
1 1 56
15 10
0 11 15
B −1 bnew = 2 3 67 , and cB T B −1 bnew = − 869
15
− 10 1 30 = 15 3
− 15 1
5
0 12 19
5
−cN T + cB T B −1 N = − 34 − 11 − 16
3 2
Here we have found a feasible and optimal solution to the updated problem with
the decision variables: x1 = 56
15
and x3 = 19
5
yielding an objective function value
of z = −869
3
.
• By how much can the right hand side of the second constraint increase and de-
crease without changing the optimal basis?
For this problem we need to consider keeping
B −1 b∆b ≥ 0,
where
11 0
b∆b = 45 + ∆b
12 0
by finding the values of x that satisfy the given inequality. This specifically gives:
1 −2 7 11 11 − 2(45 + ∆b) + 7(12) 0
−4 9 −30 45 + ∆b = −44 + 9(45 + ∆b) − 30(12) ≥ 0
19 −43 144 12 19(11) − 43(45 + ∆b) + 144(12) 0
107
OR Notes Draft: September 28, 2012
• What is the solution of the linear program obtained by increasing the coefficient
of x1 in the objective by 25?
Increasing the coefficient may allow for some other value to be more attractive
in the objective function. To see if this has occurred we need to recalculate the
value of the nonbasic variable reduced costs. After the adjustment
−76 0
cB = 87 , and cN = 0 =⇒ −cN T + cB T B −1 N = 13 −54 170
23 0
This shows that s3 is now the most attractive to enter into the basis. A pivot of
the standard simplex method is now done. Here
5 2
min ,
7 144
gives that x3 should leave the basis so the new basic and nonbasic variable sets are
xB = (x1 , x2 , s3 )T and xN = (s1 , s2 , x3 )T . Checking the optimality and feasibility
of this new solution gives:
−cN T + cB T B −1 N = − 679 233 85
72
− 72
− 72
and
11 13 353
144 144
0 11 72
B −1 b = 1
− 24 1
24
0 45 = 17
12
19 43 1
144
− 144 1 12 72
as the optimality and feasibility conditions respectively, and the optimal value of
the objective function is:
11 13
144 144
0 11
cB T B −1 b = − 24
1 1
0 45 = − 8977
24 36
19 43
144
− 144 1 12
353 17
with x1 = 72
≈ 4.9072, and x2 = 12
≈ 1.4167.
• By how much can the objective coefficient of x3 increase and decrease without
changing the optimal basis?
To solve this we keep N , B, and cN as given initially and consider finding values
of ∆c that keep
− cN T + cB T B −1 N ≤ 0T (12.5.3)
when the vector
−101
cB = 87 .
23 + ∆c
From (12.5.3) we have
1 −2 7 1 0 0 0
− 0 0 0 +(−101 87 (23+∆c)) −4
9 −30 0 1 0 ≤ 0
19 −43 144 0 0 1 0
108
OR Notes Draft: September 28, 2012
1 −2 7 0
=⇒ (−101 87 (23 + ∆c)) −4 9 −30 ≤ 0
19 −43 144 0
This gives the following bounds on ∆c:
12 −4 5
∆c ≤ , ∆c ≤ ∆c ≤
19 43 144
Thus the coefficient on x3 may vary as follows and the given basis will still be
optimal:
−4 5
0.09302 ≈ ≤ ∆c ≤ ≈ 0.04372.
43 144
• Would the current basis remain optimal if a new variable x4 were added to
the model with objective coefficient c4 = 46 and constraint coefficients A4 =
(12, −14, 15)T ?
Here we add a new entry in with the non-basic variables, and check the optimality
conditions. Thus,
−cN T + cB T B −1 N = −209 −12 −4 −5
These questions are a continuation of the problem listed above (Note they are still indepen-
dent questions):
1. Determine the solution of the linear program obtained by adding the constraint
5x1 + 7x2 + 9x3 ≤ 50.
For problems where new constraints are added we can add the as new rows to the
given optimal tableau. Update the tableau and do needed pivots in order to obtain
optimality. Thus,
109
OR Notes Draft: September 28, 2012
110
OR Notes Draft: September 28, 2012
A pivot of the dual simplex method is needed. Thus, we pivot s2 into the basis in the
place of e1 .
Note here we have found an updated optimal solution to the linear program with values
of x1 = 46
9
, x2 = 12 , x3 = 79
18
giving an objective value of z = −3346
9
.
3. Determine the solution of the linear program obtained by adding the constraint
x1 + x2 + x3 = 30.
This problem is approached in a manner similar to the previous only we use a penalty
of M in the objective function to insure that the added artificial variable doesn’t stay
in the optimal basis. Considering the problem in matrix form and adding an artificial
variable a1 into the base for the newly added constraint gives:
Thus,
6 −13 −3 0 1 −2 7 0
6 11 2 0 −4 9 −30 0
=⇒ B −1 =
B=
1 19 −43
5 1 0 144 0
1 1 1 1 −16 36 −121 1
1 0 0 −101
0 0
1 0 87
, cN = 0
N =
0
, cB =
0 1 23
0
0 0 0 M
111
OR Notes Draft: September 28, 2012
−cN T + cB T B −1 N =
−16 M − 12 36 M − 4 −121 M − 5
T −1
cB B b = 22 M − 372
5
1
B −1 b =
2
22
1 −2 7
−4 9 −30
B −1 N =
19 −43
144
−16 36 −121
Note that it is now attractive to have s2 enter the basis. Thus, conducting a pivot of
primal simplex gives
1 22
min ,
9 36
for the ratio test, and we see that x2 will leave.
Thus, 1 1
6 −13 −3 0 9
0 3
0
4 10
=⇒ B −1 = − 19 1 − 32 0
6 11 2 0
B= 1 5 1 0 −9 0 3
0
1 1 1 1 0 0 −1 1
1 −13 0 −101
0 0
11 0 0
N = , cB = , c = 87
0 5 1 23 N
0
0 1 0 M
and using the matrix formulations given we have:
−cN T + cB T B −1 N =
− 124 4 55
9
−4 M + 9
−M − 3
T −1
18 M − 3344
cB B b = 9
47
9
1
−1
B b = 9
61
9
18
1 2 1
9 9 3
− 49 1
− 10
B −1 N =
9 3
− 19 43
9
2
3
0 −4 −1
112
OR Notes Draft: September 28, 2012
We note here that we have reached a point where no variable is attractive to enter into
the basis; however, we still have a basic artificial variable. Thus, the solution to the
problem is not feasible.
113
OR Notes Draft: September 28, 2012
114
Bibliography
[1] H. A. Eiselt and C.-L. Sandblom. Linear programming and its applications. Springer,
Berlin, 2007.
[2] M.T. Heath. Scientific Computing: An Introductory Survey, 2nd Edition. McGraw-Hill,
New York, 2002.
[3] Frederick S. Hillier and Gerald J. Lieberman. Introduction to operations research. Holden-
Day Inc., Oakland, Calif., third edition, 1980.
[4] D. Luenberger. Linear and nonlinear programming. Addison-Wesley, Reading, Mass.,
second edition, 1984.
[5] David G. Luenberger and Yinyu Ye. Linear and nonlinear programming. International
Series in Operations Research & Management Science, 116. Springer, New York, third
edition, 2008.
[6] S. Nash and A Sofer. Linear and nonlinear programming. McGraw-Hill, New York, 1996.
[7] J. Reeb and S. Leavengood. Using the graphical method to solve linear programs. Ore-
gon State University: Extension Service, Performance Excellence in the Wood Products
Industry:1–24, 1998.
[8] Hamdy A. Taha. Operations research. An introduction. The Macmillan Co., New York,
1971.
[9] Wayne L. Winston. Operations research: applications and algorithms. Duxbury Press,
Boston, MA, 1987.
115
Index
feasible region, 12
free variables, 27
Gauss-Jordan Method, 8
Hessian matrix, 73
Jacobean matrix, 78
least squares, 71
Newton’s method, 75
non-linear least squares, 77
nonbasic variables, 29
normal equations, 73
objective function, 11
optimal solution, 12
primal problem, 41
116