OR1 02 LPmodeling
OR1 02 LPmodeling
Ling-Chieh Kung
OR I: Linear Programming 1 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Introduction
OR I: Linear Programming 2 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Road map
I Terminology.
I The graphical approach.
I Three types of LPs.
I Simple LP formulations.
I Compact LP formulations.
OR I: Linear Programming 3 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Linear Programs
OR I: Linear Programming 4 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
xn
as a vector of decision variables (or a decision vector).
I f : Rn → R and gi : Rn → R are all real-valued functions.
I Mostly we will omit xj ∈ R.
OR I: Linear Programming 5 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Transformation
OR I: Linear Programming 6 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Sign constraints
I For some reasons that will be clear in the next week, we distinguish
between two kinds of constraints:
I Sign constraints: xi ≥ 0 or xi ≤ 0.
I Functional constraints: all others.
I For a variable xi :
I It is nonnegative if xi ≥ 0.
I It is nonpositive if xi ≤ 0.
I It is unrestricted in sign (urs.) or free if it has no sign constraint.
OR I: Linear Programming 7 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Feasible solutions
OR I: Linear Programming 8 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
I The feasible region (or feasible set) is the set of feasible solutions.
I The feasible region may be empty.
I An optimal solution is a feasible solution that:
I Attains the largest objective value for a maximization problem.
I Attains the smallest objective value for a minimization problem.
I In short, no feasible solution is better than it.
I An optimal solution may not be unique.
I There may be multiple optimal solutions.
I There may be no optimal solution.
OR I: Linear Programming 9 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Binding constraints
Definition 1
Let g(·) ≤ b be an inequality constraint and x̄ be a solution. g(·) ≤ b is
binding at x̄ if g(x̄) = b.
Strict constraints?
I An inequality may be strict or weak:
I It is strict if the two sides cannot be equal. E.g., x1 + x2 > 5.
I It is weak if the two sides may be equal. E.g., x1 + x2 ≥ 5.
I A “practical” mathematical program’s inequalities are all weak.
I With strict inequalities, an optimal solution may not be attainable!
I What is an optimal solution of
min x
s.t. x > 0?
OR I: Linear Programming 11 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Linear Programs
OR I: Linear Programming 12 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Linear Programs
I A ∈ Rm×n , b ∈ Rm .
OR I: Linear Programming 13 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Road map
I Terminology.
I The graphical approach.
I Three types of LPs.
I Simple LP formulations.
I Compact LP formulations.
OR I: Linear Programming 14 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Graphical approach
I For LPs with only two decision variables, we may solve them with the
graphical approach.
I Consider the following example:
max 2x1 + x2
s.t. x1 ≤ 10
x1 + 2x2 ≤ 12
x1 − 2x2 ≥ −8
x1 ≥ 0
x2 ≥ 0.
OR I: Linear Programming 15 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Graphical approach
max 2x1 + x2
s.t. x1 ≤ 10
x1 + 2x2 ≤ 12
x1 − 2x2 ≥ −8
x1 ≥ 0
x2 ≥ 0.
OR I: Linear Programming 16 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Graphical approach
I Step 2: Draw some isoquant lines.
I A line such that all points on it result in the same objective value.
I Also called isoprofit or isocost lines when it is appropriate.
I Also called indifference lines (curves) in Economics.
max 2x1 + x2
s.t. x1 ≤ 10
x1 + 2x2 ≤ 12
x1 − 2x2 ≥ −8
x1 ≥ 0
x2 ≥ 0.
OR I: Linear Programming 17 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Graphical approach
I Step 3: Indicate the direction to push the isoquant line.
I The direction that decreases/increases the objective value for a
minimization/maximization problem.
max 2x1 + x2
s.t. x1 ≤ 10
x1 + 2x2 ≤ 12
x1 − 2x2 ≥ −8
x1 ≥ 0
x2 ≥ 0.
OR I: Linear Programming 18 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Graphical approach
I Step 4: Push the isoquant line to the “end” of the feasible region.
I Stop when any further step makes all points on the isoquant line
infeasible.
OR I: Linear Programming 19 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Graphical approach
OR I: Linear Programming 20 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Graphical approach
I Step 6: Set the binding constraints to equalities and then solve the
linear system for an optimal solution.
I In the example, the binding constraints are x1 ≤ 10 and x1 + 2x2 ≤ 12.
I We may solve the linear system
x1 = 10
x1 + 2x2 = 12
in any way and obtain an optimal solution (x∗1 , x∗2 ) = (10, 1).
I For example, through Gaussian elimination:
1 0 10 1 0 10 1 0 10
→ →
1 2 12 0 2 2 0 1 1
OR I: Linear Programming 21 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
I Is this intuition still true for LPs with more than two variables? Yes!
I A more rigorous definition of “corners” exists.
OR I: Linear Programming 22 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Road map
I Terminology.
I The graphical approach.
I Three types of LPs.
I Simple LP formulations.
I Compact LP formulations.
OR I: Linear Programming 23 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 24 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Infeasibility
I An LP is infeasible if its feasible region is empty.
min 3x1 + x2
s.t. x1 + x2 ≤ 4
3x1 + x2 ≥ 9
x1 − x2 ≤ 0.
OR I: Linear Programming 25 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Unboundedness
I An LP is unbounded if for any feasible solution, there is another
feasible solution that is better.
max x1 + x2
s.t. x1 + 2x2 ≥ 6
2x1 + x2 ≥ 6.
OR I: Linear Programming 26 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Unboundedness
I Note that an unbounded feasible region does not imply an
unbounded LP!
I Is it necessary?
min x1 + x2
s.t. x1 + 2x2 ≥ 6
2x1 + x2 ≥ 6.
OR I: Linear Programming 27 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
min x1 + 2x2
s.t. x1 + 2x2 ≥ 6
2x1 + x2 ≥ 6
x2 ≥ 0.
OR I: Linear Programming 28 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Summary
OR I: Linear Programming 29 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Road map
I Terminology.
I The graphical approach.
I Three types of LPs.
I Simple LP formulations.
I Compact LP formulations.
OR I: Linear Programming 30 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Introduction
OR I: Linear Programming 31 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 32 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Problem description
OR I: Linear Programming 33 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Define variables
OR I: Linear Programming 34 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 35 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Formulate constraints
I For each restriction or limitation, we write a constraint:
Consumption per
Resource Total supply
Desk Table
Wood 3 units 5 units 3600 units
Labor 200 workers × 8 hr/worker
1 hour 2 hours
hour = 1600 hours
Machine 50 machines × 16 hr/machine
50 minutes 20 minutes
time = 800 hours
I The supply of wood is limited: 3x1 + 5x2 ≤ 3600.
I The number of labor hours is limited: x1 + 2x2 ≤ 1600.
I The amount of machine time is limited: 50x1 + 20x2 ≤ 48000.
I Use the same unit of measurement!
OR I: Linear Programming 36 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Complete formulation
I In any case:
I Clearly define decision variables in front of your formulation.
I Write comments after the objective function and constraints.
OR I: Linear Programming 37 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
2 Why not 885 desks and 190 tables or the other two ways of rounding?
OR I: Linear Programming 38 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
I When we are making decisions, we may also consider what will happen
in the future.
I This creates multi-period problems.
I In many cases, products produced today may be stored and then sold
in the future.
I Maybe daily capacity is not enough.
I Maybe production is cheaper today.
I Maybe the price is higher in the future.
I So the production decision must be jointly considered with the
inventory decision.
OR I: Linear Programming 39 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Problem description
I We produce and sell a product.
I For the coming four days, the marketing manager has promised to
fulfill the following amount of demands:
I Days 1, 2, 3, and 4: 100, 150, 200, and 170 units, respectively.
I The unit production costs are different for different days:
I Days 1, 2, 3, and 4: $9, $12, $10, and $12 per unit, respectively.
I The prices are all fixed. So maximizing profits is the same as
minimizing costs.
I We may store a product and sell it later.
I The inventory cost is $1 per unit per day.3
I E.g., producing 620 units on day 1 to fulfill all demands costs
I Timing:
OR I: Linear Programming 41 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
I Let
OR I: Linear Programming 42 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Constraints
I We need to keep an eye on our inventory:
I Day 1: x1 − 100 = y1 .
I Day 2: y1 + x2 − 150 = y2 .
I Day 3: y2 + x3 − 200 = y3 .
I Day 4: y3 + x4 − 170 = y4 .
I These are typically called inventory balancing constraints.
I We also need to fulfill all demands at the moment of sales:
I x1 ≥ 100, y1 + x2 ≥ 150, y2 + x3 ≥ 200, and y3 + x4 ≥ 170.
I Also, production and inventory quantities cannot be negative.
OR I: Linear Programming 43 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 44 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 45 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 46 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Personnel scheduling
OR I: Linear Programming 47 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Personnel scheduling
OR I: Linear Programming 48 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
min x1 + x2 + x3 + x4 + x5 + x6 + x7 .
OR I: Linear Programming 49 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Constraints
I Demand fulfillment:
I 110 employees are needed on Monday:
x1 + x4 + x5 + x6 + x7 ≥ 110.
x1 + x2 + x5 + x6 + x7 ≥ 80.
x3 + x4 + x5 + x6 + x7 ≥ 120.
I Nonnegativity constraints:
xi ≥ 0 ∀i = 1, ..., 7.
OR I: Linear Programming 50 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Complete formulation
min x1 + x2 + x3 + x4 + x5 + x6 + x7
s.t. x1 + x4 + x5 + x6 + x7 ≥ 110
x1 + x2 + x5 + x6 + x7 ≥ 80
x1 + x2 + x3 + x6 + x7 ≥ 150
x1 + x2 + x3 + x4 + x7 ≥ 30
x1 + x2 + x3 + x4 + x5 ≥ 70
x2 + x3 + x4 + x5 + x6 ≥ 160
x3 + x4 + x5 + x6 + x7 ≥ 120
xi ≥ 0 ∀i = 1, ..., 7.
OR I: Linear Programming 51 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Road map
I Terminology.
I The graphical approach.
I Three types of LPs.
I Simple LP formulations.
I Compact LP formulations.
OR I: Linear Programming 52 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Compact formulations
OR I: Linear Programming 53 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 54 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
yt−1 + xt − Dt = yt ∀t = 1, ..., 4.
OR I: Linear Programming 55 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 56 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
Parameter declaration
OR I: Linear Programming 57 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
xj ≥ 0 ∀j = 1, ..., n.
OR I: Linear Programming 58 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
xj ≥ 0 ∀j ∈ J.
OR I: Linear Programming 59 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation
OR I: Linear Programming 60 / 60