Uploaded by ryan5694

Management Science for Business - Ch 2 Notes (LP models, solution)

advertisement
Lectures 5-8 - Ch 2. LP model, graphical solution, computer solution
Business Decision Models – Linear programming (LP) problems/models
Many business decision problems involve making the best use of limited resources (such as labour,
money, materials, time, and space). A mathematical model for these problems often has one objective
function (such as maximize total profit or total number of customers or total return, or minimize cost or
financial risk) and constraints on how the resources are used. When the one objective function and
each of the many constraints are all linear then the mathematical model is called a linear programming
(LP) model or problem. In this course a model is the same as a problem and vice versa. In the next 6
lectures (ch. 2, 3, 5 in the textbook) we will study the following standard LP models or problems.
- Portfolio Selection Problem
- Media Selection Problem
- Marketing Research Problem
- Labour Planning Problem
- Transportation Problem
- Product Mix Problem
- Make-Buy Decision Problem
- Vehicle Loading Problem or Allocation Problem – one vehicle, two vehicles
We will always follow three steps.
Step A. Formulation
Formulate the LP model (state the decision variables, objective function, and constraints)
Step B. Solution
Solve the LP model (use the graphical method or the Simplex method in Solver in Excel)
Step C. Interpretation and sensitivity analysis
Interpret the solution and perform a sensitivity analysis
We begin our study of LP models or problems with a simple ‘product mix problem’.
Example 1. Product Mix problem (from ch. 2)
A furniture company must plan next week’s production of wood tables and chairs. The profit margin is
$7 per table and $5 per chair. (Real profit margins are much higher; this is just a very simple example to
help us learn about LP models.) Tables and chairs require the following production times in the
carpentry department and the painting department. Notice that the carpentry department and the
painting department are the ‘limited resources’.
Carpentry department
Painting department
Production time
Tables
Chairs
3 hours per unit 4 hours per unit
2 hours per unit
1 hour per unit
Department capacity
2,400 hours per week
1,000 hours per week
The marketing department requires that at least 100 tables be produced because the existing inventory
of tables is low, and that no more than 450 chairs be produced because the existing inventory of chairs
is high. How many tables and chairs should be produced next week?
Step A. Formulation <click here to go to the podcast>
The decision variables are how many tables and how many chairs to produce next week.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 1
Let
T = number of tables to produce next week
C = number of chairs to produce next week
Decision variables in other problems are: how much money should the financial planner invest
in stocks, in bonds, in real estate; how many customers who are women, men, single, married,
under 24 years, over 24 years should be interviewed in a survey. In these cases the objective
might be to maximize total return or minimize total risk or minimize total cost.
The objective is to earn as much profit as possible—i.e. maximize total profit margin.
Then the objective function is:
𝑃 = 7𝑇 + 5𝐶 dollars total profit margin. We want to maximize P.
The constraints are: the number of tables and chairs must be such that the maximum amounts
of carpentry time (2,400 hours per week) and painting time (1,000 hours per week) are not
exceeded, at least 100 tables are produced, and no more than 450 chairs are produced.
Then the constraints are:
3𝑇 + 4𝐶 ≤ 2,400 hours
2𝑇 + 1𝐶 ≤ 1,000 hours
1𝑇
≥ 100 units
1𝐶 ≤ 450 units
constraint on carpentry time
constraint on painting time
constraint on the number of tables
constraint on the number of chairs
Then the LP problem or the LP model is:
Maximize: 𝑃 = 7𝑇 + 5𝐶
Subject to
3𝑇 + 4𝐶
2𝑇 + 1𝐶
1𝑇
1𝐶
𝑇
𝐶
≤ 2,400
≤ 1,000
≥ 100
≤ 450
≥ 0
≥ 0
coefficients signs
(0)
(1)
(2)
(3)
(4)
(5)
(6)
decision variables
dollars of profit
carpentry hours per week
painting hours per week
demand for tables
demand for chairs
Objective function
Constraints
Non-negativity constraints
right-hand-sides
Notice:
- The coefficients are all constants. All the decision variable terms, the T’s and C’s, are of the first power.
That is, there are no 𝑇 2 or 𝐶 3 or 𝑇 × 𝐶, etc. This makes the objective function and the constraints linear.
- The signs in the constraints are ≤, ≥, (could also have =). All signs must include an equality (=).
- The solution to the LP problem is the values of the decision variables (T, C) and the objective function (P).
This completes Step A. Formulation.
Next we go to Step B. Solution … Solve the LP model (use the graphical method or the Simplex method
in Solver in Excel). After Step B we go to Step C. Interpretation and sensitivity analysis
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 2
Step B. Solution … Graphical solution of an LP problem <click here to go to the podcast>
Actual LP problems are large (i.e. many decision variables and many constraints) and, therefore,
computer methods are used to solve them (i.e. the Simplex method in Solver in Excel).
The graphical method can be used to solve very small problems. The graphical method gives us an
understanding of how the computer solves an LP problem. The graphical method also helps us
understand sensitivity analysis (Step C). Sensitivity analysis is an analysis of how small changes in the LP
problem affect the solution.
Graphical solution of an LP problem
LP problem
Maximize: 𝑃 = 7𝑇 + 5𝐶
Subject to
3𝑇 + 4𝐶
2𝑇 + 1𝐶
1𝑇
1𝐶
𝑇
𝐶
Step 1. Plot constraints
Step 2. Identify feasible region
Step 3. Plot the objective function
Step 4. Find visual optimal solution
Step 5. Find algebraic optimal solution
≤ 2,400
≤ 1,000
≥ 100
≤ 450
≥ 0
≥ 0
(0)
(1)
(2)
(3)
(4)
(5)
(6)
Step 1. Plot constraints
Step 2. Identify feasible region
2
3
4
1
5
Feasible region (yellow) – all the points that satisfy all the constraints
Corner points are the points 1, 2, 3, 4, 5 in the corners (where constraints intersect) of the feasible
region.
The optimal solution is always a corner point.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 3
Step 3. Plot objective function
In order to plot the objective function we need a value of P.
- We arbitrarily decide that we want the objective function to cross the T axis at T=300. (T = 300 is a
good value because it is near the middle of the feasible region. T = 100 is too low; T = 500 is too high.)
- So when T = 300 and C = 0, then P = 7×300 + 5×0 = 2100.
- Or we could arbitrarily decide that we want the objective function to cross the C axis at C=500.
- So when C = 500 and T = 0, then P = 7×0 + 5×500 = 2500.
We can pick any useful value of T, C, and P we like.
Notice that objective function lines are parallel/have the same slope (the line of P=2500 is parallel to the
line for P=2100) and the larger the value of P then further away from the origin (T=0, C=0) the objective
function is (the line for P=2500 is further away from (T=0, C=0) than the line for P=2100). Since we want
to maximize P we want to be as far away from the origin (T=0, C=0) as possible.
2 3
4
P = 2,500
P = 2,100
1
5
Step 4. Find visual optimal solution
Since we want to maximize P we “push” the objective function as far away from the origin as possible
(while keeping the same slope). The last point in the feasible region the objective function touches is
the optimal solution.
2 3
C ≈ 360
4
1
5
T ≈ 320
So the optimal solution is at corner point 4 where it looks like T ≈ 320 and C ≈ 360.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 4
Step 5. Find algebraic optimal solution
Corner point 4 is at the intersection of (1) and (2). These constraints are equal at corner point 4. So
(1) 3𝑇 + 4𝐶 = 2,400
(2) 2𝑇 + 1𝐶 = 1,000
2x(1) → 6𝑇 + 8𝐶 = 4,800
– 3x(2) → 6𝑇 + 3𝐶 = 3,000
0𝑇 + 5𝐶 = 1,800 → 𝐶 = 360
Substitute 𝐶 = 360 into (1) or (2): (1) → 3𝑇 + 4 × 360 = 2,400 → 𝑇 = 320
Substitute 𝑇 = 320 and 𝐶 = 360 into (0): 𝑃 = 7 × 320 + 5 × 360 → 𝑃 = 4,040
So the optimal solution is 𝑇 = 320, 𝐶 = 360, and 𝑃 = 4,040.
How ‘Solver’ in Excel finds the optimal solution
Solver in Excel uses a method called the ‘Simplex LP’ method. It starts from the origin (T=0, C=0) and
moves, in a very intelligent way, from corner point to corner point, calculates the values of the decision
variables and objective function at the corner point, and stops when it is no longer possible to improve
the objective function.
Corner point T = ? C = ? P=7T + 5C
origin
T=0
C=0
not feasible
1
T=100 C=0
P=700
5
T=500 C=0
P=3500
4
T=320 C=360 P=4040
3
T=200 C=450 P=3650
The simplex method will start at the origin
(T=0, C=0), then go to corner point 1, then go
to corner point 5 rather than 2 (because T is
more profitable than C (7T compared to 5C in
the objective function), then go to corner
point 4, and then stop because going to corner
point 3 causes the objective function P to
decrease. So the Simplex method only
evaluates three corner points (1,5,4).
2 3
4
1
5
Special situations <click here to go to the podcast>
Example 1 has a unique optimal solution (i.e. only one optimal solution). Three types of LP problems do
not have unique optimal solutions.
1. Some LP problems have alternative or multiple optimal solutions.
2. Some LP problems have no feasible solution.
3. Some LP problems are unbounded and, therefore, the optimal solution has an arbitrarily large
(maximization) or arbitrarily small (minimization) objective function value.
Two other special situations are:
4. Many large LP problems have a number of constraints that are redundant.
5. Degeneracy (This will not be discussed in this course. You are not responsible for degeneracy.)
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 5
Special Situation 1. LP problems with alternative or multiple optimal solutions
This occurs when the optimal solution is at a corner point where the objective function has exactly the
same slope as one of the constraints at the corner point.
Example 1 (continued)
Suppose objective function (0) changes from 𝑃 = 7𝑇 + 5𝐶 to 𝑃 = 6𝑇 + 3𝐶. Then the LP problem is:
Maximize: 𝑃 = 6𝑇 + 3𝐶
Subject to
3𝑇 + 4𝐶 ≤ 2,400
2𝑇 + 1𝐶 ≤ 1,000
1𝑇
≥ 100
1𝐶 ≤ 450
𝑇
≥ 0
𝐶 ≥ 0
(0) dollars of profit
(1) carpentry hours per week
(2) painting hours per week
(3) demand for tables
(4) demand for chairs
(5)
(6)
Notice that the slope in (0) is the same as the slope in (2); that is, the coefficients of T and C have same
relative proportions. 6 is twice 3 in (0), and 2 is twice 1 in (2).
If the optimal solution occurs at a corner point that involves constraint (2), then the objective function
line has the same slope as that constraint line, and, therefore, there are an infinite number of
alternative or multiple optimal solutions.
All points between
corner points
4 (T=320, C=360), and
5 (T=500, C=0)
have P = 3,000 and,
therefore, are optimal
2
solutions
3
4
1
5
Check: corner point 4 … T=320, C=360, P=6×320+3×360=3000
corner point 5 … T=500, C=0, P=6×500+3×0=3000
another point … T=400, C=200, P=6×400+3×200=3000
another point … T=430, C=140, P=6×430+3×140=3000
and so on. There are many alternative optimal solutions.
Note: It’s easy for you to see that there are alternative optimal solutions in this problem. For large
problems it’s not easy to see this and it’s not easy for the computer to see this.
Aside: We will see later (ch. 4) that if the shadow price of a binding constraint is zero, then it is very
likely that there are alternative optimal solutions.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 6
Special Situation 2. LP problems having no feasible solutions.
This occurs when there are so many constraints or the constraints are so severe that there are no values
of the decision variables that satisfy all the constraints. In other words, there is no feasible region.
Example 1 (continued)
Suppose constraint (3) changes from 𝑇 ≥ 100 to 𝑇 ≥ 600. Then the LP problem is:
Maximize: 𝑃 = 7𝑇 + 5𝐶
Subject to
3𝑇 + 4𝐶 ≤ 2,400
2𝑇 + 1𝐶 ≤ 1,000
1𝑇
≥ 600
1𝐶 ≤ 450
𝑇
≥ 0
𝐶 ≥ 0
Feasible region
for (1), (2), (4)
(0) dollars of profit
(1) carpentry hours per week
(2) painting hours per week
(3) demand for tables
(4) demand for chairs
(5)
(6)
Feasible region
for (3)
This is quite common for real problems. It is usually because there are insufficient resources to
accomplish the objective. When this happens you have to change some of the constraints (i.e. add
resources).
Note: In this course most example problems, practice problems, and exam problems have sufficient
resources and therefore have feasible and optimal solutions. So if your analysis tells you or the
computer tells you that there is no feasible solution then you most likely made a mistake in your
formulation of the problem. You most likely made a mistake in your objective function or in one or
more of your constraints. The most common mistake is the wrong sign in a constraint (e.g. you have a ≥
sign but the correct sign is ≤). But it is also possible that your formulation is correct and that the
problem simply has insufficient resources.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 7
Special Situation 3. Unbounded LP problems
When the feasible region for an LP problem is unbounded, the optimal solution can have an arbitrarily
large (maximization problem) or arbitrarily small (minimization problem) value.
Example 1 (continued)
Suppose the signs in constraints (1) and (2) change from ≤ to ≥. Then the LP problem is:
Maximize: 𝑃 = 7𝑇 + 5𝐶
Subject to
3𝑇 + 4𝐶 ≥ 2,400
2𝑇 + 1𝐶 ≥ 1,000
1𝑇
≥ 100
1𝐶 ≤ 450
𝑇
≥ 0
𝐶 ≥ 0
(0) dollars of profit
(1) carpentry hours per week
(2) painting hours per week
(3) demand for tables
(4) demand for chairs
(5)
(6)
feasible region is unbounded
Because the feasible region is unbounded, T can have an arbitrarily large value and, therefore, the
objective function 𝑃 = 7𝑇 + 5𝐶 will have an arbitrarily large value. In this problem P is total profit, and
total profit cannot be arbitrarily large.
Note: If your analysis tells you this or the computer tells you this (see p. 14) then you most likely made a
mistake in your formulation of the problem. Again, the most common mistake is the wrong sign in a
constraint (e.g. you have a ≥ sign but the correct sign is ≤).
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 8
Special Situation 4 Redundant constraints
A redundant constraint is a constraint that does not affect the size of the feasible region. The presence
of redundant constraints is common in large LP problems (i.e. many decision variables and many
constraints). Unfortunately it is usually impossible to determine whether a constraint is redundant.
Example 1 (continued)
Suppose constraint (3) changes from 𝑇 ≥ 100 to 𝑇 ≤ 100. Then the LP problem is:
Maximize: 𝑃 = 7𝑇 + 5𝐶
Subject to
3𝑇 + 4𝐶 ≤ 2,400
2𝑇 + 1𝐶 ≤ 1,000
1𝑇
≤ 100
1𝐶 ≤ 450
𝑇
≥ 0
𝐶 ≥ 0
(0) dollars of profit
(1) carpentry hours per month
(2) painting hours per month
(3) demand for tables
(4) demand for chairs
(5)
(6)
Now the feasible region is:
In this figure we see that constraints (1) and (2) have no effect on the size of the feasible region and,
therefore, constraints (1) and (2) are redundant. Because they are redundant we could drop them from
the LP problem. This would give us a smaller, easier to solve problem. But, unfortunately, it is usually
impossible to determine whether a constraint is redundant.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 9
<click here to go to the podcast>
Computer solution of LP Problems in Excel using Solver
Step A. Formulation: Standard worksheet format
Example 1 (continued)
LP problem for Example 1
Maximize: 𝑃 = 7𝑇 + 5𝐶
Subject to
3𝑇 + 4𝐶
2𝑇 + 1𝐶
1𝑇
1𝐶
𝑇
𝐶
≤ 2,400
≤ 1,000
≥ 100
≤ 450
≥ 0
≥ 0
(0)
(1)
(2)
(3)
(4)
(5)
(6)
The following is the standard way (i.e. layout, formulas, colours, borders) an LP problem is entered into Excel.
You must always use this format in this course. If you do more advanced, specialized work then you will learn
and use more specialized formats.
Decision variable names
‘Solver’ will place the answer here (yellow)
Calculated objective function value (green)
‘Shadow price’ will be discussed later in
chapter 4.
Constraint names
Calculated constraint left hand side values (blue)
Constraint right hand side values
The green cell and the blue cells MUST contain a formula.
Worksheet -- Formula view
After the LP problem is entered into Excel (Step A. Formulation), we use ‘Solver’ in Excel to solve for the
optimal solution (Step B. Solution) and to do a sensitivity analysis (Step C. Interpretation and sensitivity
analysis).
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 10
Step B. Solution: Loading Excel Solver – Appendix B (p. 569) <click here to go to the podcast>
Mac computer users
Excel 2011 or 2016 must be completely up-to-date. To update Excel do the following. Open Excel and click
File > Help > Check for updates. Get all the Excel updates. If you haven’t done this regularly it will need to
be done repeatedly (early updates must be done before later updates can be done) and could take 30
minutes. When Excel is completely up-to-date, click Tools > Add-Ins, and then click Solver. This adds Solver
to the ‘Data’ tab. From then each time you open Excel the Solver add-in will appear under the ‘Data’ tab.
i. Click Tools and then click Add-Ins.
ii. Click the Solver option to enable it. Then, click OK
iii. Solver will then appear under the Data tab.
PC computer users
Even if you are a Mac computer user, if
Solver is under the ‘Data’ tab at the right end after it has been added in.
you use the PC computers in the
i. In Excel click File and then the Options command.
university computer labs then you must
know how to add-in Solver on a PC.
ii. On the Excel Options dialog box, click the Add-Ins command
iii. Highlight Solver Add-In; click the (bottom middle) Go… button
iv. The Add-Ins dialog box will appear. Check Solver Add-In; click OK.
Solver is now loaded. Solver is now available in the Excel Data tab at the right end of the ribbon.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 11
Step B. Solution: Using Excel > Data > Solver
<click here to go to the podcast>
PC…
Mac…
Click Solver; then the Solver dialog box appears. Enter the data from the standard worksheet into the
Solver dialog box as follows.
See the ‘Solver Constraints’
dialog box on the next page
If you are having problems with Solver click the Options button and check the values (see next page).
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 12
Solver Constraints dialog box
Constraint sign
Cell reference for constraint left hand side
Cell reference for constraint right hand side
Solver Options dialog box
Do not change anything in this box unless you are having major problems with Solver.
The values and (unchecked) check boxes shown below in the ‘All Methods’ tab are good values to use in
this course.
We do not use
‘Evolutionary’ or
‘GRG Nonlinear’
so do not set any values in these tabs.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 13
Step B. Solution: The Excel Solver optimal solution
Solver has found that we should make 320 tables and 360 chairs.
The total profit is $4,040.
Solver message indicating an optimal solution has been found.
See the list below for the different Solver messages and their implications.
The answers are shown on the spreadsheet, but more detailed reports are available. Select the desired
reports before clicking OK. In this course we always use the Answer and Sensitivity Reports.
Some Solver messages
Message
Solver found a solution. All
constraints and optimality
conditions are satisfied.
Meaning
Perfect message. This is the
optimal solution to the LP
problem.
Solver could not find a feasible
solution.
There is no feasible region.
The objective cell values do
not converge.
Solver encountered an error
value in the objective cell or a
constraint cell.
The linearity conditions
required by this LP Solver are
not satisfied.
The feasible region is
unbounded.
The Simplex LP method is
specified but one or more
formulas in the LP problem
are not linear
Possible cause
Note that this does not mean that the LP
problem formulation is correct.
The LP problem formulation is incorrect. There
is likely a mistake in one or more of the
constraints.
The LP problem formulation is incorrect. There
is likely a mistake in the objective function.
There is likely a mistake in an Excel formula in
the objective function cell or a constraint LHS
cell.
Sometimes Solver gives this error even when all
the formulas are linear. It can happen when a
constraint has a formula on the LHS and also on
the RHS. In this case change the constraint so
that the RHS is a constant.
For more information see http://www.solver.com/content/basic-solver-solver-result-messages
Solver is developed and maintained by Frontline Systems Inc. at www.solver.com
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 14
Step C. Interpretation and sensitivity analysis (Aside: extra analysis)
Solver ‘Answer Report’:
Notice the 3 iterations. This means only
3 corner points were evaluated. These
were corner points 1, 5 and 4 (see page
5 in these notes). Also notice how fast
Solver is – 0.015 seconds.
Original solution (if there was one on the
worksheet) and final optimal solution for
decision variables and objective function.
Decision variables are ‘continuous’ not ‘integer’.
‘Slack’ in Excel Solver is:
-for <= constraint it is slack = RHS – LHS
-for >= constraint it is surplus = LHS – RHS
If constraint is ‘binding’, slack or surplus = 0.
If constraint is ‘not binding’, slack or surplus ≠ 0.
You should always edit the ‘Answer Report’ first to remove unnecessary values, add borders, and
improve the formatting.
Solver ‘Answer Report’ after editing:
Final optimal solution for decision variables and
objective function.
‘Slack’ in Excel Solver is:
-for <= constraint it is = RHS – LHS
-for >= constraint it is = LHS – RHS
If constraint is ‘binding’, slack = 0.
If constraint is ‘not binding’, slack ≠ 0.
Lectures 5-8 - Ch 2 Notes (LP model, graphical, computer) page 15
Download