1
Decision Models and Analytics
02. Linear Programming
Professor Jiawei Zhang
Agenda 2
Decision Modeling Process
Linear programming
– Mathematical formulation
– Basic concepts
– Excel solver
Examples
– Wyndor Glass Company
Reading from Optimization Modeling
– Chapters 2.1 and 2.2
Templates: WyndorGlassCompany_template.xls
Wyndor Glass Company 3
The Wyndor Glass Company produces high-quality glass products,
including windows and glass doors that feature handcrafting and the finest
workmanship.
Although the products are expensive, they fill a market niche by providing
the highest quality available in the industry for the most discriminating
buyer.
The company has three plants
– Plant 1 produces aluminum frames and hardware.
– Plant 2 produces wood frames
– Plant 3 produces produces the glass and assembles the windows
and doors.
Adapted from Frederick S. Hillier and Mark S. Hillier, Introduction to Management Science: A Modeling
and Case Studies Approach with Spreadsheets, 5/e, p 23-25.
Wyndor Glass Company 4
Because of declining sales for certain products, top management has
decided to revamp the company’s product line.
Unprofitable products are being discontinued, releasing production
capacity to launch two new products that have been recently developed:
• An 8-foot glass door with aluminum framing.
• A 4-foot × 6-foot double-hung, wood-framed window.
Wyndor Glass Company 5
It is estimated that each door will require one hour of production time in
Plant 1 and three hours in Plant 3.
For each window, about two hours will be needed in Plant 2 and two hours
in Plant 3.
The production facilities in Plant 1 needed for the 8-foot glass doors will
be available approximately 40 hours per week. (The rest of the time Plant 1
will continue with current products.)
The production facilities in Plant 2 will be available for the 4-foot × 6-foot
double-hung windows about 90 hours per week.
The facilities needed for both products in Plant 3 will be available
approximately 180 hours per week.
Wyndor Glass Company 6
By analyzing the cost data and pricing decision, the Accounting
Department estimates the profit from the products. The projection is that
the profit per unit will be $300 for the doors and $500 for the windows.
With the limited production capacity, management now needs to decide
what should be the product mix—the number of units of each produced
per week—for the two new products.
Decision Modeling: Seven-Step Process 7
1. Managerial problem definition
2. Data collection & analysis
3. Model formulation
4. Solution method
5. Model validation
• Incorporated all relevant factors & interrelationship?
• Model provides reasonable solutions?
• The solution improves upon what was actually done?
• What if assumptions are changed?
6. Solution interpretation & recommendations
7. Implementation
Structuring the Decision Problem 8
Decisions to be made
Performance measure
Things that restrict your choices
9
Mathematical Formulation
Input parameters:
Decision variables:
Objective function:
Constraints:
LP Component 1: Input Parameters 10
Represent parameters that are given to the management
Assumed to be deterministic
Wyndor Glass Co:
- Unit profit of the products
- Capacity at each of the three plants
-…
LP Component 2: Decision Variables 11
Represent parameters under management’s control, to be decided by
management
Should be defined so as to describe all possible alternative decisions
Examples:
– whether to support an R&D project or not
– number of salespeople to hire
– production level in a given period
– amount to buy from a given supplier
– how much to bid
Together, the values of the decision variables define a policy or a
plan of action.
LP Component 3: Objective Function 12
Defines the goal of the problem, the target to be optimized
Provides a criterion to compare alternate solutions
Expressed as a linear function of the decision variables
Example:
Profit Maximize
Cost Minimize
Risk Minimize
Market Share Maximize
Objective function is an outcome variable, can be controlled through
decision variables, not directly
LP Component 4: Constraints 13
Describe what’s actually feasible:
- technically
quantity produced cannot exceed production capacity
- legally
employees may not work more than 8 hours per shift
- logically
all parts of the budget must add up to 100%
Must be expressed in terms of the decision variables, in a linear form.
Spreadsheet Model for LP 14
Four types of cells
– Input cells
– Changing/Decision cells
– Objective cell
– Constraints
Excel Solver
Open file WyndorGlassCompany_template.xls
15
Input Cells
• Enter all the relevant data for the problem onto the spreadsheet.
• Ensure consistent utilization of rows and columns throughout the
spreadsheet for organizing the data.
• It is a good idea to color code these “input cells” (e.g., light blue).
16
Changing Cells
Add a cell in the spreadsheet for every decision that needs to be made.
It is a good idea to color code these “changing cells” (e.g., yellow with
border).
17
Objective Cell
Develop an equation that defines the objective of the model.
Typically, this equation involves the data cells and the changing cells in
order to determine a quantity of interest (e.g., total profit or total cost).
Total Profit: G12 = C4*C12+D4*D12
18
Constraints
For any resource that is restricted, calculate the amount of that resource used in
a cell on the spreadsheet (an output cell).
Define the constraint in three consecutive cells. If Quantity A <= Quantity B,
put these three items (Quantity A, <=, Quantity B) in consecutive cells.
E7: = C7*C12+D7*D12
19
Simplification: Use the $ Sign
It is cumbersome to type
E7: = C7*C12+D7*D12
E8: = C8*C12+D8*D12
E9: = C9*C12+D9*D12
A useful trick to simplify this: type one formula
E7: = C7*$C$12 + D7 *$D$12
and copy to E8:E9.
Here C7 is a relative cell reference, while $C$12 is an
absolute/anchored reference (and thus will not be adjusted when we
copy the cell).
A shortcut to add the $ sign: select cell C12 and press the F4 key once
(for Windows).
Later we will use $ sign to fix only the column/row, not both.
20
Simplification: Use sumproduct Function
If we had 50 products to consider in this example, then the formula
that computes the resource utilization or total profit will be just too
long.
We can simplify
E7: = C7*$C$12 + D7*$D$12
by using
E7: = sumproduct (C7:D7, $C$12:$D$12)
21
A Trial Solution
If 40 doors and 30 windows are produced, then all constraints are satisfied
and the total profit is $27000.
Can we do better? What is the best product mix?
22
Spreadsheet Model
Decision Variables: C12:D12
Objective: maximize G12
Constraints:
1. Plant Capacity: (input parameters are on the right-hand side)
E7<= G7
E8<= G8
E9<= G9
or simply
E7:E9<= G7:G9
2. Non-negativity:
C12:D12>= 0
23
Load Solver Add-in
Windows:
1. In Excel 2010 and later, go to File > Options
2. Click Add-Ins, and then in the Manage box, select Excel Add-ins,
and click Go.
3. In the Add-Ins available box, select the Solver Add-in check box,
and then click OK.
4. After you load the Solver Add-in, the Solver command is available
in the Analysis group on the Data tab.
24
Load Solver Add-in
Mac OS:
1. On the Tools menu, select Excel Add-Ins.
2. In the Add-Ins available box, select the Solver Add-In check box,
and then click OK.
If Solver Add-in is not listed in the Add-Ins available box, click
Browse to locate the add-in.
If you get a prompt that the Solver add-in is not currently installed
on your computer, click Yes in the dialog box to install it.
3. After you load the Solver add-in, the Solver button is available on
the Data tab.
25
Solver
• Choose “Solver” from the Data menu or Tools menu, depending on
version
• Select the cell you wish to optimize in the “Set Objective” box
• Choose “Max” or “Min”
• Enter the location of the decision variables in the “By Changing
Variable Cells” box
• To begin entering constraints, click the “Add” button to the right of the
constraints window
• Fill in the entries in the resulting Add Constraint dialogue box
26
Identifying Objective and Changing Cells
Choose “Solver”
from the Data menu
or the Tool menu
depending on
version.
Select the cell you
wish to optimize in
the “Set Objective”
box: G12
Choose “Max” or
“Min”
Enter all the
changing cells in the
“By Changing
Variable Cells” box:
C12:D12
27
Adding Constraints
To begin entering constraints, click the “Add” button to the right of the
constraints window.
Fill in the entries in the resulting Add Constraint dialogue box.
28
Adding Constraints
The constraint
E7:E9<= G7:G9
is the same as three constraints
E7<= G7
E8<= G8
E9<= G9
But much more convenient to use.
29
Some Important Options
Check the “Make Unconstrained Variables Non-Negative” box.
– It adds non-negativity constraints to all the changing cells.
Choose “Simplex LP” from “Select a Solving method”
– It tells the Solver that this is a linear programming model.
30
The Complete Solver Dialogue Box
31
The Solver Results Dialogue Box
32
An Optimal Solution
The best product-mix is to produce 30 doors and 45 windows!
Capacities at plants 2 and 3 are 100% utilized.
The profit will be $31500.
33
Model Validation
Which assumptions are made in this model?
Are these assumptions reasonable?
What if you relax these assumptions?