DSME 4020B Decision Modeling and Analytics Spring 2022: Sean ZHOU CUHK Business School Chinese University of Hong Kong
DSME 4020B Decision Modeling and Analytics Spring 2022: Sean ZHOU CUHK Business School Chinese University of Hong Kong
Sean ZHOU
CUHK Business School
Chinese University of Hong Kong
1
Lecture outline
• The Geometry of Linear Programming
2
The Geometry of Linear Programming
3
Geometry of Linear Programming
• How to visualize a linear program geometrically?
– Decision variables?
– Constraints?
– Objective?
• How to find the optimal solution geometrically (for simple
problems)?
• An example:
4
Geometry of LP – Decision Variables
• Each dimension represents a decision variable
n decision variables ⇒ an n-dimensional space
• Each point in the space represents a particular solution
x2
1 (1, 1)
0 1 x1 5
Geometry of LP – Constraints
• Constraint: x1 ≥ 0
• Inequality constraint x1 ≥ 0 defines a half space
X2 X1 ≥ 0
x1 = 0
0 X1
6
Geometry of LP – Constraints
• Constraint: x2 ≥ 0
• Inequality constraint x2 ≥ 0 defines a half space
X2 X2 ≥ 0
0 x2 = 0 X1
7
Geometry of LP – Constraints
• Constraint: 2x1 + x2 ≤ 3
• Inequality constraint 2x1 + x2 ≤ 3 defines a half space
X2
2x1+x2 = 3
(0, 3)
0 (1.5, 0) X1
2x1 + x2 ≤ 3
8
Geometry of LP – Constraints
• Constraint: x1 + 2x2 ≤ 3
• Inequality constraint x1 + 2x2 ≤ 3 defines a half space
X2
x1+2x2 = 3
(0, 1.5)
0 (3, 0) X1
x1 + 2x2 ≤ 3 9
Geometry of LP – Constraints
• The intersection of all the constraints ⇒ Feasible Region
X2
0 X1
10
Geometry of LP – Constraints
• Feasible Region: The set of all the allowed solutions; a region
(polygon) bounded by the constraints
– Each equality constraint defines a line
– Each inequality constraint defines a half-space
• Extreme Points: Corner points on the boundary of the feasible
region. E.g., (0, 0), (1.5, 0), (0, 1.5), and (1, 1)
• Infeasible problem: A problem with an empty feasible region
• Redundant constraint: Adding or removing the constraint does
not affect the feasible region, e.g., X2
𝑥1 + 𝑥2 ≤ 5
11
0 X1
Geometry of LP – Objective
• Objective: maximize x1 + x2
• Isoquant: A line on which all points have the same objective
value; all points are equally good on the objective function.
X2
x1 + x 2 = 0
0 X1
12
Geometry of LP – Objective
• Isoquant: x1 + x2 = 1
X2
x1 + x 2 = 1
(0, 1)
0 (1, 0) X1
Geometry of LP – Objective
• Isoquant: x1 + x2 = 1.5
X2
x1 + x2 = 1.5
0 X1
Geometry of LP – Objective
• Isoquant: x1 + x2 = 3
x1 + x 2 = 3
X2
No feasible
solution can
attain this value
0 X1
15
Geometry of LP – Optimal Solution
• Optimal Solution: The best feasible solution
• Theorem: For any feasible LP with a finite optimal solution
and at lest one extreme point, there exists an optimal
solution that is an extreme point
Max x1 + x2 X2
Optimal Solution:
(1, 1)
0 X1
x1 + x 2 = 2 16
Geometry of LP – Optimal Solution
• Optimal solutions may NOT be unique
X2
Max 2x1 + x2
0 X1
17
Geometry of LP – Optimal Solution
• Optimal solution may NOT be finite
-X1 + 2X2 ≤ 2
X2
Max x1 + x2
X1 - 2X2 ≤ 2
(0, 1)
0 (2, 0) X1
18
Geometry of LP – Optimal Solution
• Binding (or active) constraints: The constraints that are
satisfied as equality at the optimal solution
– All equality constraints are binding by definition
19
Geometry of LP – Optimal Solution
• Active constraints are the ones that pass through the optimal solution.
• Inactive constraints are the ones that do not pass through the optimal
solution.
• Why are binding/active constraints important?
20
Geometry of LP – Summary
• Decision variables
– Each decision variable forms a dimension
– n decision variables define an n-dimensional space
– A solution is a point in the space
• Constraints
– Each equality constraint defines a hyper-plane (line in a 2-D space)
– Each inequality constraint defines a half-space
– All constraints collectively define the feasible region
• Objective
– The objective function defines isoquants and a direction in the space
• To find the optimal solution, push along the direction defined by the
objective until we reach the boundary of the feasible region
• At the optimal solution, some constraints are binding (or active) while
others are not
21
Recap of Lecture 5
• Visualize the three components of a Linear Program
– Decision variables Dimensions of space
– Constraints Hyperplanes or half-spaces
– Objective Isoquant and the direction
• Feasible region and extreme (or corner) points
• Binding and non-binding constraints (at optimal solution)
• Slack of a constraint
22
Geometry of LP – Benefits
• An infinite number of feasible solutions
23
Geometry of LP – 3-Dimension
24
Solving Linear Programming
in Excel (Solver)
25
• Add Solver in Excel: File Option Add-Ins Manage Go
26
The Lego Game Revisited
• Products: Chair ($40) and Table ($50)
Chair Table Inventory
(C) (T)
Big
Brick 1 2 10
Small
Brick 4 3 30
28
• Initial input about decision variables: B5=0, C5=0
• Objective function:
– D12=B5*B12+C5*C12;
29
SUMPRODUCT
• SUMPRODUCT (array1, array2, array3,…): return the sum of the products
of corresponding range or arrays.
• All arrays must have same dimensions.
• Example: E2=SUMPRODUCT(A2:A5,B2:B5,C2:C5)
=A2*B2*C2 + A3*B3*C3 + A4*B4*C4 + A5*B5*C5
Choose
decision
variable
Add
constrain
Check if all
variables
are non-
negative
31
32
Example: Blending Model
Investment Problem of Pension Planners
The portfolio manager of Pension Planners has been asked to invest
$1 million of a large pension fund in six mutual funds with varying
potential returns and risks, as summarized in the Table below.
Fund
1 2 3 4 5 6
Price ($/share) 45 76 110 17 23 22
Exp Return (%) 30 20 15 12 10 7
Risk Category High High High Med Med Low
33
LP Model
Max 0.30F1 + 0.20F2 + 0.15F3 + 0.12F4 + 0.10F5 + 0.07F6
st
F1 + F2 + F3 ≥ 0.50
F1 + F2 + F3 ≤ 0.75
F4 + F5 ≥ 0.20
F4 + F5 ≤ 0.30
F6 ≥ 0.05
2F1 − F2 = 0 Optional :
3F1 − F3 = 0 remove one of
3F2 − 2F3 = 0
these constraints
2F4 − F5 = 0
F1 + F2 + F3 + F4 + F5 + F6 = 1
Fi ≥ 0 i = 1, 2, . . . , 6
34
35
Answer Report
Cell Name Original Value Final Value
$H$17 Objective LHS 0 0.168583333
36
Example: Nurse Scheduling
• University hospital requires different number of nurses
at different times
• Each nurse works for 8 consecutive hours per day
Period Time Min Number of Nurses Needed
1 12am – 4am 10
2 4am – 8am 25
3 8am – 12pm 35
4 12pm – 4pm 30
5 4pm – 8pm 40
6 8pm – 12am 20
37
Example: Nurse Scheduling
8pm – 4am
12am – 8am
4am – 12pm
8am – 4pm
12pm – 8pm
4pm – 12am
8pm – 4am
12am – 4am 4am – 8am 8am – 12pm 12pm – 4pm 4pm – 8pm 8pm – 12am
10 25 35 30 40 20
Monday Tuesday Wednesday
38
Example: Nurse Scheduling
• Decision variables?
– 𝑥𝑖 : number of nurses who start work in period 𝑖 , 𝑖 =
1,2, … , 6
• Objective?
– Minimize total number of nurses
• Constraints?
– Total staff requirement for each period
39
Example: Nurse Scheduling
𝑥6 + 𝑥1 𝑥1 + 𝑥2 𝑥2 + 𝑥3 𝑥3 + 𝑥4 𝑥4 + 𝑥5 𝑥5 + 𝑥6
8pm – 4am
𝑥6
12am – 8am
𝑥1
4am – 12pm
𝑥2
8am – 4pm
𝑥3
12pm – 8pm
𝑥4
4pm – 12am
𝑥5
8pm – 4am
12am – 4am 4am – 8am 8am – 12pm 12pm – 4pm
𝑥6
4pm – 8pm 8pm – 12am
10 25 35 30 40 20
Monday Tuesday Wednesday
40
Example: Nurse Scheduling
min x1 x2 x3 x4 x5 x6
subject to
x1 x6 10
x1 x2 25
x2 x3 35
x3 x4 30
x4 x5 40
x5 x6 20
xi 0, for all i 1,2,...,6
41
42
Nurse Scheduling: Optimal Solution
10 25 35 40 40 20
8pm – 4am
0
12am – 8am
10
4am – 12pm
15 Total no. = 85
8am – 4pm
20
12pm – 8pm
20
4pm – 12am
20
8pm – 4am
12am – 4am
0
4am – 8am 8am – 12pm 12pm – 4pm 4pm – 8pm 8pm – 12am
10 25 35 30 40 20
Monday Tuesday Wednesday
43
44
Nurse Scheduling: Alternative Solution
10 35 35 30 40 20
8pm – 4am
0
12am – 8am
10
4am – 12pm
25 Total no. = 85
8am – 4pm
10
12pm – 8pm
20
4pm – 12am
20
8pm – 4am
12am – 4am
0
4am – 8am 8am – 12pm 12pm – 4pm 4pm – 8pm 8pm – 12am
10 25 35 30 40 20
Monday Tuesday Wednesday
45