73 220 Lecture03
73 220 Lecture03
73 220 Lecture03
73-220
Lecture 03
TA’s Office Hours
● Additivity Assumptions
– Contributions of variables are independent.
● Divisibility Assumption
– Decision variables can take fractional values.
● Certainty Assumption
– Each parameter is known with certainty.
Characteristics of LPs
● Objective function and constraints are linear
functions.
– Understand a relationship is linear or not.
● Constraint types are ≤, = , or ≥.
– Again, don’t be fooled by the Management Scientist
input format.
● Variables can assume any fractional value.
● Decision variables are non-negative.
● Maximize or minimize a single objective.
Prelude to Linear Programming
8 small 6 large
blocks blocks
Table: Chair:
Profit = Profit =
$16 each $10 each
Select product mix to maximize profit using the available
resources. DO NOT MAKE MORE THAN 5 TABLES
Linear Programming
● Formulate as an LP
– Decision Variables, Objective Function, Constraints
● Solution Methods
– Computer: Excel Solver (today)
– Simplex (Not covered)
» Move from one corner point to another
» Theoretical basis to solve an LP model.
– Graphical (next class)
» Graph Constraints, Objective function
» Find a solution
Linear Programming Formulation
1
Step 1: Decision Variables
● The best way to determine the decision variables
is to put oneself in the shoes of the decision maker
and then ask the question “What do I need to
know in order to make this thing work?”
● Decision Variables
– T = # of tables
– C = # of chairs
– Note:
» Define decision variables explicitly.
» Always keep in mind the unit of the decision
variables. Here it is the # of T or C.
1
Step 2: Objective Function
● Objective Function
– Maximize profit = 16T + 10C
1
Step 3: Constraints
● Determine the Constraints
– Note that the left-hand side (LHS) and right-hand side (RHS) units
must agree with each other. This is a good way to verify whether
your constraints make sense or not.
1
LP Formulation
● Decision variables
– T: # of tables to make
– C: # of chairs to make
● Maximize z = 16T + 10C
● Subject to
– 2T + C < = 6 (large block constraint)
– 2T + 2C < = 8 (small block constraint)
– T<=5 (no more than 5 tables)
– T,C > = 0
1
Methods of Solution
1
Slack and Surplus Variables
● A linear program in which all the variables are non-negative
and all the constraints are equalities is said to be in standard
form.
Slack variables
1
Method 1 – Computer Solution
● Computer programs designed to solve LP problems
are now widely available.
● Most large LP problems can be solved with just a
few minutes of computer time.
● Small LP problems usually require only a few
seconds.
● Linear programming solvers are now part of many
spreadsheet packages, such as Microsoft Excel.
● Please go through the short tutorial re how to use
Excel Solver given in Appendix 2.3 (pp 88-93) in the
textbook.
1
Interpretation of Computer Output
1
Spreadsheet Model of Lego Problem
2
Spreadsheet Model
● The spreadsheet model: Please refer to Appendix 2.3 on
pp 88-93 for a quick tutorial.
Decision variable Table Chair
UnitProduced 2 2
2
Add Constraints
In the Solver dialogue window, clicking on “Add” invokes the
following “Add Constraint” dialogue window. You are required
to identify the left-hand side and right-hand side ranges, as well
as the type of the constraint (<, >, =, int, bin. For LP models,
only the first three types, int refers integer and bin refers binary,
which are for integer program models only). If you need add
another constraint, click on “Add”; if you input all constraints,
click on “OK” to return to the main dialogue window.
2
Solver Option:
Click on Options
on the right of the
main Solver
dialogue, you will
see the window
here. Place check
marks beside
Assume Linear
Model and
Assume Non-
negative, and
click on OK to
return to Solver
main window.
2
Answer Report
Click on Solve in the Solver main dialogue window, Solver will solve
the model and you may keep solver solution, and Answer and
Sensitivity Reports by highlighting the right report on the right box.
Microsoft Excel 10.0 Answer Report
Worksheet: [Lecture3.xls]Sheet1
Report Created: 9/19/2004 10:16:45 PM
Adjustable Cells
Cell Name Original Value Final Value
$B$9 UnitProduced Table 2 2
$C$9 UnitProduced Chair 2 2
Constraints
Cell Name Cell Value Formula Status Slack
$B$16 Small Used 8 $B$16<=$D$16
Binding 0
$B$17 Large Used 6 $B$17<=$D$17
Binding 0
$B$18 Table max Used 2 $B$18<=$D$18
Not Binding 3
2
Optimal Solution
● Three parts: decision variables, values of
decision variables, value of objective function
● Decision variables: basic (non-zero value),
non-basic (zero)
● Basic variables are “in the solution”; non-
basic are not
2
No Feasible Solution?
● Data entry error?
– Review spreadsheet; walk thru with someone
● Formulation error?
– Review formulation; walk thru with someone
● Truly infeasible?
2
Production Example
Ebel Mining Company owns two different mines that
produce a given kind of ore. The mines are located in
different parts of the country and hence have different
production quantities and ore qualities. After crushing
the ore is graded into 3 classes: high grade, medium grade
and low grade. Ebel has contracted to provide its parent
company with at least 12 tons of high grade, 8 tons of
medium grade and 24 tons of low grade ore per week. It
costs Ebel $20,000 per day to run the first mine and $16,000
per day to run the second. However, in a day’s operation, the
first mine produces 6 tons of high grade, 2 tons of medium
grade and 4 tons of low grade ore. The second produces 2
tons of high and medium grade per day and 12 tons of low
grade ore. How many days a week should each mine be
operated to fulfill Ebel’s commitment most economically?
2
Production Example
Decision Variables:
X1- # of days to run mine 1
X2 – # of days to run mine 2
Objective function
Minimize z=20,000X1 + 16,000X2
Constraints
High grade: 6X1 + 2X2 >= 12
Medium Grade: 2X1 + 2X2 >= 8
Low Grade: 4X1 + 12X2 >= 24
X1, X2 >= 0
2
Guidelines for Building “Good”
Spreadsheet Models
● Enter the Data First
– Any spreadsheet model is driven by the data
– It is easier (and usually better) to build the model
around the data
● Organize and Clearly Identify the Data
– Relevant data should be grouped (e.g. in tabular
form)
– All data should be labeled
– Units should be identified
● Enter Each Piece of Data into One Cell Only
– Refer to the original data as needed
– This makes the model much easier to modify (only
need to change data in one place) 3
Guidelines for Building “Good”
Spreadsheet Models
● Separate Data from Formulas
– Avoid putting numbers directly in formulas
– Put numbers in data cells and refer to them as needed
– This makes all data visible and easier to modify
● Keep It Simple
– Avoid “power functions” of Excel if possible
– Break out complicated formulas into subtotals
● Use Range Names
– Refer to data cells and blocks of cells using Excel’s
range name feature
– Range names make formulas and the Solver model
much easier to read
– Care must be taken not to overuse range names and to
make sure they remain correctly defined. 3
Guidelines for Building “Good”
Spreadsheet Models
● Use Relative and Absolute References to
Simplify Copying Formulas
– Whenever multiple related formulas will be
needed, try to enter the formula just once, and
then use Excel’s fill commands to replicate the
formula.
– This makes the model easer to build and also
reduces typos.
● Use Borders, Shading, and Colors to
Distinguish Cell Types
● Show Entire Model on Spreadsheet
– All data should be visible.
– All constraints should be on the spreadsheet (not 3
Three Tests for a “Good”
Spreadsheet Model
● You should be able to immediately
identify the data cells, changing
cells, and target cell.
● All elements of the model should
be visible on the spreadsheet
(including all constraints). You
should not have to look in the
Solver dialogue box to figure out
the model.
● Each equation should be simple 3
Next Class
● Homework:
– Review the Lego example discussed in class and work on the
production example in the lecture notes
– Understand the basic three-step approach to formulating an LP
model.
– Go through Appendix 2.1 and/or 2.3 in the textbook and learn how to
solve an LP model by using Solver and/or Management Scientist.
● Bring to class
– Notes for next class