limited finance test 2.5 hour
3QA3/2DA3
Management Science for Business
Lecture 02
C01: June 23, 2021
C02: June 24, 2021
Instructors:
Seyyed Hossein Alavi Zdravko Dimitrov
Linear Programming (LP)
Intended Learning Outcomes
3
At the end of this course, you will be able to
define mathematical programming and linear programming
concepts.
solve simple 2 variable questions with ‘graphical method’.
model LP questions on Excel and solve by using an add-in called
Solver.
Mathematical Programming
Many business problems are concerned with resource allocation
Resource, to manufacture products or provide services:
Machinery,
Labor,
Time,
Space, and
Raw Materials
Resource allocation
✓ Decision makers would like to explore all possible decisions or
alternatives to identify the best, or optimal, decision
✓To achieve this, the mathematical programming is commonly used
Programming: setting up and solving a problem mathematically
4
Linear Programming
Mathematical Programming
— A mathematical representation of business decision problems
Linear Programming (LP) is a powerful form of mathematical
programming
Widely used to construct a set of mathematical relationships to model real-
world problems, when
➢Objective along with all relationships in the problem can be linearly
described
LP problems deal with optimization!
Computationally, the LP models can be polynomially solved to
optimality.
5
What is Optimization?
The process of finding the optimum (Min/Max) for an objective
function by changing decision variables with respect to constraints.
Put yourself in the position of manager for:
Fortinos, Walmart, Loblaws, …
Supplier selection problem:
Decision variables: Which suppliers are selected
Number of products ordered from the selected suppliers
Constraints: No orders can exceed a supplier’s production capacity
Orders cannot exceed vehicles loading capacity
Objective:
Minimize the total cost of purchasing and transportation 6
Optimization Example
Maximize the profit
Minimize the cost
Minimizing the # of cashiers Objective function: MIN # of cashiers Decision variables: # of cashiers Constraints: # of cashiers > C , sum of salary < Budget
Maximizing the variety and # of items
Minimizing the distance between aisles
Minimizing the # of ON lights 7
More Examples
Crew Scheduling
Machine Scheduling
Location/Allocation problems
Covering problems
Transportation/Routing problems
Inventory management
8
Linear Programming
Linear programming (LP) is constructing a set of mathematical
relationships to model real-world problems.
It includes:
Objective function
Constraints
Decision variables
The objective function and all the constraints must be
expressed in terms of linear equations or inequalities.
9
LP Example
— Company manufactures two products A and B
— A requires 9 hours of labor and 5 units of material
— B requires 5 hours of labor and 7 units of material
— The company has 800 hours of labor and 200 units of material
— Profit: product A: $150/unit product B: $130/unit
Decision Variables:
How many A to produce? (𝑥1)
How many B to produce? (𝑥2)
10
LP Example - Objective
— Company sells two products A and B
— A requires 9 hours of labor and 5 units of material
— B requires 5 hours of labor and 7 units of material
— The company has 800 hours of labor and 200 units of material
— Profit: product A: $150/unit product B: $130/unit
Objective:
Maximize the profit
𝑀𝑎𝑥 150𝑥1 + 130𝑥2
11
Decision Variables:
𝑥1: How many A to produce? 𝑥2: How many B to produce?
LP Example - Constraints
— Company sells two products A and B — A requires 9 hours of labor and 5 units of material — B requires 5 hours of labor and 7 units of material — The company has 800 hours of labor and 200 units of material — Profit: product A: $150/unit product B: $130/unit
Constraints: Hours of labor
9𝑥1 + 5𝑥2 ≤ 800
Units of material
5𝑥1 + 7𝑥2 ≤ 200
Non-negativity constraints
𝑥1≥ 0, 𝑥2≥ 0
12
Decision Variables:
𝑥1: How many A to produce? 𝑥2: How many B to produce?
LP Example – The Model
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 150𝑥1 + 130𝑥2 Subject to
9𝑥1 + 5𝑥2 ≤ 800
5𝑥1 + 7𝑥2 ≤ 200
𝑥1 ≥ 0, 𝑥2 ≥ 0
13
Objective Function
Constraints
RHS
(Right-hand side)
Decision Variables
Non-negativity
Constraints
LP Example – The Model
Note: Solution may result in fractional values for the decision
variables!
View them as work-in-process inventory, carried forward to the next
period
Round off the fractional value, if necessary
Restrict the decision variables to be integers
→ integer programming problem → computational complexity will increase 14
Decision Variables:
𝑥1: Number of A to be manufactured 𝑥2: Number of B to be manufactured
LP Assumptions
1. Certainty All parameters are known.
2. Proportionality If the level of any activity is multiplied by a constant factor, then the contribution of
that activity in the objective function or constraints will be multiplied by the same factor.
3. Additivity Total of all activities equals the sum of individual activities.
4. Divisibility Non-integer variables are acceptable.
and of course “ Linearity “ !
15
Input data values,
coefficients used in the
• objective function, and
• constraints,
are known with certainty.
e.g.
Production of 1 unit of an
item uses 3 hours of a
particular resource,
→ making 10 units of that
item uses 30 hours of the
resource.
e.g.
One product worth $8 per unit is produced,
and
the other product worth $3 per unit is also
produced,
→ the total profit will be 8 plus 3.
LP Example – Why Linear?
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 150𝑥1 + 130𝑥2 Subject to
9𝑥1 + 5𝑥2 ≤ 800
5𝑥1 + 7𝑥2 ≤ 200 𝑥1 ≥ 0, 𝑥2 ≥ 0
• There is no non-linear term, such as
• 𝑥1𝑥2, 𝐿𝑜𝑔 𝑥, 𝑒 𝑥, sin 𝑥
• Exercise:
• 9𝑥1 + 𝑙𝑜𝑔𝑥2 ≤ 3
• 𝑥1 ≤ 2
𝑥2 • 𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑥1
2 + 3𝑥2 4
16
Solving LP
Graphical Solving For problems with at most 2 variables
Very limited
Good illustration
Algorithms: SIMPLEX
Interior-point methods …
Computer packages CPLEX GAMS
AMPL
Excel Solver
17
Graphical Solution
1. Draw all constraint to identify Feasible Region.
2. Draw the objective function contour lines (level, or iso line).
3. Identify the direction where we obtain a better objective value.
Move the contour line (in that direction) to find the last corner point (of the feasible region) that contour lines pass.
The point is called the Optimal Solution.
4. Find the value of the objective function for the optimal solution found.
18
The region which consists of all points, that
simultaneously satisfy all constraints in the problem.
Ex1: 1. Draw constraints
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 3𝑥 + 5𝑦 Subject to
𝑥 ≤ 4 2𝑦 ≤ 12
3𝑥 + 2𝑦 ≤ 18 𝑥 ≥ 0, 𝑦 ≥ 0
3 regular constraints and 1 pair of non-negativity constraint.
1. Draw all constraint to identify Feasible Region.
There are two variables:
We can plot each of the problem’s constrains on a two-dimension graph.
We plot one variable, x, on the horizontal axis of the graph, and
the other variable, y, on the vertical axis. 19
Ex1: 1. Draw constraints
20
𝑥 ≥ 0, 𝑦 ≥ 0 y
x
10 –
–
8 –
–
6 –
–
4 –
–
2 –
–
0 –| | | | | | | | | | | | 0 2 4 6 8 10
Feasible
Region
Ex1: 1. Draw constraints
21
𝑥 ≤ 4, 2𝑦 ≤ 12
Convert inequality to a linear equation: 𝑥 = 4, 𝑦 = 6
x
10 –
–
8 –
–
6 –
–
4 –
–
2 –
–
0 –| | | | | | | | | | | | 0 2 4 6 8 10
y = 6
x = 4
y
Feasible
Region
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 3𝑥 + 5𝑦 Subject to
𝑥 ≤ 4 2𝑦 ≤ 12
3𝑥 + 2𝑦 ≤ 18 𝑥 ≥ 0, 𝑦 ≥ 0
To draw a constraint which contains both variables, we need: 2 points for the line, and one identifying point
3𝑥 + 2𝑦 ≤ 18
1. Convert inequality to a linear equation:
3𝑥 + 2y = 18
2. Find two points:
✓ Normally, the two easiest points are the intersections between the linear
equation and two axes:
• If 𝑥 = 0, then 𝑦 = 9 ⇒ (0, 9)
• If 𝑦 = 0, then 𝑥 = 6 ⇒ (6, 0)
3. Draw a line through two points.22
Ex1: 1. Draw constraints
23
Ex1: 1. Draw constraints
y
x
10 –
9 –
8 –
7 –
6 –
5 –
4 –
3 –
2 –
1 –
0 –| | | | | | | | | | | | 0 1 2 3 4 5 6 7 8 9 10 11
(x = 0, y = 9)
(x = 6, y = 0)
3x+2y = 18
x = 4
y = 6
3𝑥 + 2𝑦 ≤ 18
24
y
x
10 –
9 –
8 –
7 –
6 –
5 –
4 –
3 –
2 –
1 –
0 –| | | | | | | | | | | | 0 1 2 3 4 5 6 7 8 9 10 11
(x = 0, y = 9)
(x = 6, y = 0)
3x+2y = 18
x = 4
y = 6
3𝑥 + 2𝑦 ≤ 18
Use (0,0) as a specifying point:
3𝑥 + 2𝑦 = 0 ≤ 18
Therefore, (0,0) belongs to the
feasible region.
Ex1: 1. Draw constraints- Specifying Point
25
Ex1: 1. Draw constraints- Feasible Region
Any point in the feasible region is a “feasible solution”
Ex1: 2. Draw Objective Contours
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 3𝑥 + 5𝑦 Subject to
𝑥 ≤ 4 2𝑦 ≤ 12
3𝑥 + 2𝑦 ≤ 18 𝑥 ≥ 0, 𝑦 ≥ 0
2. Draw the objective function contour lines (level lines or iso
lines)
Let 3𝑥 + 5𝑦 = 𝑍 and set 𝑍 to be an arbitrary value
Only one line is enough
26
27
Ex1: 2. Draw Objective Contours
y
x
10 –
9 –
8 –
7 –
6 –
5 –
4 –
3 –
2 –
1 –
0 –| | | | | | | | | | | | 0 1 2 3 4 5 6 7 8 9 10 11
Feasible
Region
3x+5y = 15
3𝑥 + 5𝑦 = 𝑍
28
Ex1: 2. Draw Objective Contours
y
x
10 –
9 –
8 –
7 –
6 –
5 –
4 –
3 –
2 –
1 –
0 –| | | | | | | | | | | | 0 1 2 3 4 5 6 7 8 9 10 11
Feasible
Region
3x+5y = 15
3x+5y = 30
3𝑥 + 5𝑦 = 𝑍
29
Ex1: 2. Draw Objective Contours
y
x
10 –
9 –
8 –
7 –
6 –
5 –
4 –
3 –
2 –
1 –
0 –| | | | | | | | | | | | 0 1 2 3 4 5 6 7 8 9 10 11
Feasible
Region
3x+5y = 15
3x+5y = 30
3x+5y = 35
3𝑥 + 5𝑦 = 𝑍
Ex1: 3. Examine Corner Points
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 3𝑥 + 5𝑦 Subject to
𝑥 ≤ 4 2𝑦 ≤ 12
3𝑥 + 2𝑦 ≤ 18 𝑥 ≥ 0, 𝑦 ≥ 0
3. Find the last corner point that contour lines pass.
Move the contour line to leave the feasible region.
It is guaranteed that the best solution is one of the corner points.
The last corner node is the Optimal Solution.
30
Ex1: 4. Optimal Solution
31
y
x
10 –
9 –
8 –
7 –
6 –
5 –
4 –
3 –
2 –
1 –
0 –| | | | | | | | | | | | 0 1 2 3 4 5 6 7 8 9 10 11
Feasible
Region
3x+5y = z
y = 6
3x+2y = 18
(𝑥, 𝑦) = 2,6 is the optimal solution
Objective function value = 3 × 𝑥 + 5 × 𝑦 = 36
(x = 2, y = 6)
Ex1: 4. Optimal Solution
32
(𝑥, 𝑦) = 2,6 is the optimal solution
Example 2: Flair Company
Flair Furniture Company produces tables and chairs:
Manager/Market restrictions:
Make no more than 450 chairs (the on-hand inventory of chairs is high)
Make at least 100 tables (the inventory of table is low)
33
Per Table Per Chair
Availability
Profit ($) 7 5
Carpentry Department
(labor hours) 3 4 2,400
Painting Department
(labor hours) 2 1 1,000
EX2: Flair Company LP Model
Decision Variables:
# of tables produced : T
# of chairs produced : C
Objective function:
Maximize the profit
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 7𝑇 + 5𝐶
34
EX2: Flair Company LP Model
Constraints:
Carpentry hour (the number of labor hours available at the department)
3𝑇 + 4𝐶 ≤ 2,400
Painting hour (the number of labor hours available at the department)
2𝑇 + 1𝐶 ≤ 1,000
Maximum chair
𝐶 ≤ 450
Minimum table
𝑇 ≥ 100
Non-negativity 𝑇 ≥ 0 𝐶 ≥ 0
35
EX2: Flair Company LP Model
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 7𝑇 + 5𝐶 Subject to
3𝑇 + 4𝐶 ≤ 2,400
2𝑇 + 1𝐶 ≤ 1,000
𝐶 ≤ 450
𝑇 ≥ 100
𝑇 ≥ 0
𝐶 ≥ 0
36
EX2: Flair Graphical LP Solution
37
N u
m b
e r
o f C
h a
ir s (
C )
Number of Tables (T)
1,000 –
–
800 –
–
600 –
–
400 –
–
200 –
–
0 –| | | | | | | | | | | | 0 200 400 600 800 1,000
Carpentry Constraint Line 3𝑇 + 4𝐶 = 2,400
EX2: Flair Graphical LP Solution
38
N u
m b
e r
o f C
h a
ir s (
C )
Number of Tables (T)
1,000 –
–
800 –
–
600 –
–
400 –
–
200 –
–
0 –| | | | | | | | | | | | 0 200 400 600 800 1,000
Region Satisfying 3𝑇 + 4𝐶 ≤ 2,400
(𝑇 = 300,𝐶 = 200)
(𝑇 = 0,𝐶 = 0)
EX2: Flair Graphical LP Solution
39
N u
m b
e r
o f C
h a
ir s (
C )
Number of Tables (T)
1,000 –
–
800 –
–
600 –
–
400 –
–
200 –
–
0 –| | | | | | | | | | | | 0 200 400 600 800 1,000
Carpentry Constraint 3𝑇 + 4𝐶 ≤ 2,400
Painting Constraint 2𝑇 + 1𝐶 ≤ 1,000
EX2: Flair Graphical LP Solution
40
N u
m b
e r
o f C
h a
ir s (
C )
Number of Tables (T)
1,000 –
–
800 –
–
600 –
–
400 –
–
200 –
–
0 –| | | | | | | | | | | | 0 200 400 600 800 1,000
Painting Constraint 2𝑇 + 1𝐶 ≤ 1,000
Carpentry Constraint 3𝑇 + 4𝐶 ≤ 2,400
Maximum Chairs Allowed Constraint 𝐶 ≤ 450
Feasible
Region
Infeasible Solution
Minimum Tables Required Constraint 𝑇 ≥ 100
EX2: Flair Graphical LP Solution
41
1
2 3
4
5
| | | | | | | | | |
0 200 400 600 800 1,000
800 –
–
600 –
–
400 –
–
200 –
–
0 –
N u
m b
e r
o f C
h a
ir s (
C )
Number of Tables (T)
Painting Constraint
Carpentry Constraint
Optimal Level Profit Line
Optimal Corner Point Solution
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 7𝑇 + 5𝐶 → 7𝑇 + 5𝐶 = 𝑍
EX2: Flair Graphical LP Solution
42
1
2 3
4
5
| | | | | | | | | |
0 200 400 600 800 1,000
800 –
–
600 –
–
400 –
–
200 –
–
0 –
N u
m b
e r
o f C
h a
ir s (
C )
Number of Tables (T)
Painting Constraint
3𝑇 + 4𝐶 ≤ 2,400
Carpentry Constraint
2𝑇 + 1𝐶 ≤ 1,000
Optimal Level Profit Line
Optimal Corner Point Solution
EX2: Flair Graphical LP Solution
Optimal solution:
Intersection of carpentry constraint and painting constraint:
Objective function value:
7𝑇 + 5𝐶 = 7 × 320 + 5 × 360 = $4,040
43
൝ 3𝑇 + 4𝐶 = 2,400
2𝑇 + 1𝐶 = 1,000 ⇒ 𝑇 = 320,𝐶 = 360
EX2: Flair Graphical LP Solution
44
Point 1 (T = 100, C = 0)
Profit = $7 x 100 + $5 x 0 = $700
Point 2 (T = 100, C = 450)
Profit = $7 x 100 + $5 x 450 = $2,950
Point 3 (T = 200, C = 450)
Profit = $7 x 200 + $5 x 450 = $3,650
Point 4 (T = 320, C = 360)
Profit = $7 x 320 + $5 x 360 = $4,040
Point 5 (T = 500, C = 0)
Profit = $7 x 500 + $5 x 0 = $3,500
Self Exercise
45
Maximize 𝑍 = 30𝑥 + 20𝑦
Subject to
2𝑥 + 𝑦 ≤ 1,000 𝑥 + 𝑦 ≤ 800
𝑥 ≤ 350
𝑥 ≥ 0
𝑦 ≥ 0
1. Draw the feasible region for this LP model and identify all the corner points
2. Draw at least one objective contour line and find the direction where the
value of 𝑍 increases
3. Find the corner point that maximizes the value of 𝑍 and report the point’s
coordinates and the optimal value of 𝑍.
Self Exercise
46
y
x
1,000 –
–
800 –
–
600 –
–
400 –
–
200 –
–
0 –| | | | | | | | | | | | 0 200 400 600 800 1,000
Feasible
Region
30x+20y = 12,000
30x+20y = 18,000
2𝑥 + 𝑦 = 1,000
𝑥 + 𝑦 = 800
➔ 𝑥∗=200, 𝑦∗ = 600
Special situations in LP
1) Alternate Optimal Solution
2) Redundant Constraints
3) Unbounded Solutions
4) Infeasibility
47
1- Alternate Optimal Solution
When there is more than one corner point that maximizes or
minimizes the objective function
Happens when the objective contour line is parallel to one of
the constraints (same slope)
𝑀𝑎𝑥 3𝑥1 + 4𝑥2 Subject to
𝑥2 ≤ 2 6𝑥1 + 8𝑥2 ≤ 24
𝑥1 ≤ 3
𝑥1 ≥ 0
𝑥2 ≥ 0
48
3
6 = 4
8
𝑆𝑙𝑜𝑝𝑒𝑠 = − 3
4
1- Alternate Optimal Solution
49
1
2 3
4
5
Feasible
Region
| | | | | | | | | |
0 200 400 600 800 1,000
800 –
–
600 –
–
400 –
–
200 –
–
0 –
Level Profit Line Is Parallel to Painting Constraint
Optimal Solution Consists of All
Points Between Corner
Points 4 and 5
Z = 7𝑇 + 5𝐶
Z = 6𝑇 + 8𝐶 3𝑇 + 4𝐶 ≤ 2,400
2- Redundant Constraint
A redundant constraint plays NO role in identifying the feasible region!
𝑀𝑎𝑥 𝑥1 + 𝑥2 Subject to
𝑥1 + 𝑥2 ≤ 4 𝑥2 ≤ 3
𝑥1 + 𝑥2 ≤ 6
𝑥1 ≤ 5 𝑥1 ≥ 0 𝑥2 ≥ 0
50
Redundant Constraints
𝑥1 ≤ 4 − 𝑥2 ≤ 4
2- Redundant Constraint
51
Carpentry Constraint is Redundant
Painting Constraint is Redundant
F e a s ib
le R
e g io
n
N u
m b
e r
o f C
h a
ir s (
C )
Number of Tables (T)
1,000 –
–
800 –
–
600 –
–
400 –
–
200 –
–
0 –| | | | | | | | | | | | 0 200 400 600 800 1,000
𝑇 ≤ 100𝑇 ≥ 100
3- Unbounded Solution
Objective function can be infinitely large (for MAX) or infinitely small (for Min)
𝑀𝑎𝑥 𝑥1 + 𝑥2 𝑥1 + 𝑥2 ≥ 4
−𝑥1 + 𝑥2 ≤ 4
𝑥1 ≥ 0
𝑥2 ≥ 0
Note: It depends on the objective function.
Unbounded Solution VS. Unbounded Feasible Region
52
3- Unbounded Solution
53
Unbounded
Feasible Region
10 –
9 –
8 –
7 –
6 –
5 –
4 –
3 –
2 –
1 –
0 –| | | | | | | | | | | 0 1 2 3 4 5 6 7 8 9 10
4- Infeasibility
An LP is infeasible if all constraints cannot be satisfied at the
same time
𝑀𝑎𝑥 𝑥1 + 𝑥2 𝑥1 + 𝑥2 ≤ 3
𝑥1 + 𝑥2 ≥ 5
𝑥1 ≥ 0
𝑥2 ≥ 0
No solution in this case!
54
4- Infeasibility
55
Region
Satisfying
Fourth
Constraint
Region
Satisfying
Three
Constraints
1,000 –
–
800 –
–
600 –
–
400 –
–
200 –
–
0 –| | | | | | | | | | | | 0 200 400 600 800 1,000
Two Regions
Do Not Overlap
Solving LP Using Excel Solver®
Modeling in Microsoft Excel
Excel Solver Activation:
Click ‘File’ and then the ‘Options’.
On the ‘Excel Options’ dialog box, click the ‘Add-ins’ command.
At the bottom, select “Excel Add-ins” for Manage and hit “Go…”.
The ‘Add-ins’ dialog box will appear. Check ‘Solver Add-in’; click the ‘OK’.
‘Solver’ is now loaded and is available in the Excel ‘Data’ tab.
57
Flair Furniture Company - Solver
Maximize 7𝑇 + 5𝐶 Subject to
3𝑇 + 4𝐶 ≤ 2,400
2𝑇 + 1𝐶 ≤ 1,000
𝐶 ≤ 450
𝑇 ≥ 100
𝑇 ≥ 0
𝐶 ≥ 0
58
Carpentry hour
Painting hour
Maximum chairs
Minimum tables
Flair Furniture Company - Solver
59 Screenshot 2-1A Formula View of the Excel Layout for Flair Furniture – Page 41
Flair Furniture Company - Solver
60
Flair Furniture Company - Solver
61
Screenshot 2-1C Solver Add Constraint Window – Page 45
Flair Furniture Company - Solver
62
Solver Options:
➢The values and check boxes
shown in the “All Methods” tabs
are good ones to use in tis
course.
Screenshot 2-1D Solver Options Window – Page 46
Flair Furniture Company - Solver
63 Screenshot 2-1E Excel Layout and Solver Solution for Flair
Furniture (Solver Results Window Also Shown) – Page 47
Solver Output for LP Situations1
1) Optimality “Solver found a solution. All Constraints and optimality conditions are satisfied.”
2) Non-linearity “The linearity conditions required by this LP Solver are not satisfied.”
3) Formulation Error “Solver encountered an error value in the Objective Cell or a Constraint Cell.”
4) Unbounded Solutions “The Objective Cell values do not converge”
5) Infeasibility “Solver could not find a feasible solution”
64 1 - Table 2.2 – Page 48
Logical functions in the model:
IF(), SUMIF(), LOOKUP(), …
Exam Sample Questions
65
Break-Even Point (quantity and dollar)
Developing Mathematical Formulation
Graphical Solution
4 Special Situations of LP
Solving LP with Solver®
Practice Problems
CHAPTER 2
Discussion Questions 3, 4, 7, 10, 11, 12
Problems 13, 17, 27, 29, 43
66