0% found this document useful (0 votes)
18 views60 pages

OR1 02 LPmodeling

Uploaded by

hamzatamer.88.10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views60 pages

OR1 02 LPmodeling

Uploaded by

hamzatamer.88.10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Operations Research I: Models & Applications


Linear Programming

Ling-Chieh Kung

Department of Information Management


National Taiwan University

OR I: Linear Programming 1 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Introduction

I Let’s study Linear Programming (LP).


I It is used a lot in practice.
I It also possesses useful mathematical properties.
I It is a good starting point for all OR subjects.
I We will study:
I What kind of practical problems may be solved by LP.
I How to formulate a problem as an LP.

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

I Linear Programming is the process of formulating and solving linear


programs (also abbreviated as LPs).
I An LP is a mathematical program with some special properties.
I Let’s first introduce some concepts of mathematical programs.

OR I: Linear Programming 4 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Basic elements of a program


I In general, any mathematical program may be expressed as

min f (x1 , x2 , ..., xn ) (objective function)


s.t. gi (x1 , x2 , ..., xn ) ≤ bi ∀i = 1, ..., m (constraints)
xj ∈ R ∀j = 1, ..., n. (decision variable)
I There are m constraints and n variables.
I x1 , x2 , ..., and xn are real-valued decision variables.
I We may write
 
x1
x =  ...  = (x1 , ..., xn )
 

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

I How about a maximization objective function?


I max f (x) ⇔ min −f (x).
I How about “=” or “≥” constraints?
I gi (x) ≥ bi ⇔ −gi (x) ≤ −bi .
I gi (x) = bi ⇔ gi (x) ≤ bi and gi (x) ≥ bi , i.e., −gi (x) ≤ −bi .
I For example:

max x1 − x2 min −x1 + x2


s.t. −2x1 + x2 ≥ −3 ⇔ s.t. 2x1 − x2 ≤ 3
x1 + 4x2 = 5. x1 + 4x2 ≤ 5
−x1 − 4x2 ≤ −5.

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

I For a mathematical program:


I A feasible solution satisfies all the constraints.
I An infeasible solution violates at least one constraint.
I For example:

min 2x1 + x2 I Feasible?


s.t. x1 ≤ 10 I x1 = (2, 3).
x1 + 2x2 ≤ 12 I x2 = (6, 0).
I x3 = (6, 6).
x1 − 2x2 ≥ −8
x1 ≥ 0
x2 ≥ 0.

OR I: Linear Programming 8 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Feasible region and optimal solutions

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

I At a solution, a constraint may be binding:1

Definition 1
Let g(·) ≤ b be an inequality constraint and x̄ be a solution. g(·) ≤ b is
binding at x̄ if g(x̄) = b.

I An inequality is nonbinding at a point if it is strict at that point.


I An equality constraint is always binding at any feasible solution.
I Some examples:
I x1 + x2 ≤ 10 is binding at (x1 , x2 ) = (2, 8).
I 2x1 + x2 ≥ 6 is nonbinding at (x1 , x2 ) = (2, 8).
I x1 + 3x2 = 9 is binding at (x1 , x2 ) = (6, 1).

1 Binding/nonbinding constraints are also called active/inactive constraints.


OR I: Linear Programming 10 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

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?

I Think about budget constraints.


I You want to spend $500 to buy several things.
I Typically, you cannot spend more than $500.
I But you may spend exactly $500.

OR I: Linear Programming 11 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Linear Programs

I A mathematical program I An example:

min f (x) min x1 + x2


s.t. gi (x) ≤ bi ∀i = 1, ..., m, s.t. x1 + 2x2 ≤ 6
2x1 + x2 ≤ 6
is an LP if f and gi s are all linear functions.
I Each of these linear functions may be expressed x1 ≥ 0, x2 ≥ 0.
as
n
X
a1 x1 + a2 x2 + · · · + an xn = aj xj ,
j=1

where aj ∈ R, j = 1, ..., n, are the coefficients.


I We may write a = (a1 , ..., an ) and f (x) = aT x.

OR I: Linear Programming 12 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Linear Programs

I In general, an LP may always be I Or by vectors:


expressed as
n min cT x
X
min cj xj s.t. aTi x ≤ bi ∀i = 1, ..., m.
j=1
Xn I ai ∈ Rn , bi ∈ R, c ∈ Rn .
s.t. Aij xj ≤ bi ∀i = 1, ..., m. I x ∈ Rn .
j=1 I Or by matrices:
I Aij s: constraint coefficients.
I bi s: right-hand-side values (RHS). min cT x
I cj s: objective coefficients. s.t. Ax ≤ b.

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

I Step 1: Draw the feasible region.


I Draw each constraint one by one, and then find the intersection.

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

I Step 5: Identify the binding constraints at an optimal solution.

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

I Step 7: Plug in an optimal solution obtained into the objective


function to get the associated objective value.
I In the example, 2x∗1 + x∗2 = 21.

OR I: Linear Programming 21 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Where to stop pushing?


I Where we push the isoquant line, where will be stop at?
I Intuitively, we always stop at a “corner” (or an edge).

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

Three types of LPs

I For any LPs, it must be one of the following:


I Infeasible.
I Unbounded.
I Finitely optimal (having an optimal solution).
I A finitely optimal LP may have:
I A unique optimal solution.
I Multiple optimal solutions.

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.

I If an LP is neither infeasible nor unbounded, it is finitely optimal.

OR I: Linear Programming 27 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Multiple optimal solutions


I A linear program may have multiple optimal solutions.

min x1 + 2x2
s.t. x1 + 2x2 ≥ 6
2x1 + x2 ≥ 6
x2 ≥ 0.

I If the slope of the isoquant line is identical to that of one constraint,


will we always have multiple optimal solutions?

OR I: Linear Programming 28 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Summary

I In solving an LP (or any mathematical program) in practice, we only


want to find an optimal solution, not all.
I All we want is to make an optimal decision.

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

I It is important to learn how to model a practical situation as an LP.


I Once you do so, you have “solved” the problem.
I This process is typically called LP formulation or modeling.
I Here we will give you some examples of LP formulation.
I Practice makes perfect!
I Then we formulate large-scale problems with compact formulations.

OR I: Linear Programming 31 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

A product mix problem

I We produce several products to sell.


I Each product requires some resources. Resources are limited.
I We want to maximize the total sales revenue with available resources.

OR I: Linear Programming 32 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Problem description

I We produce desks and tables.


I Producing a desk requires three units of wood, one hour of labor, and 50
minutes of machine time.
I Producing a table requires five units of wood, two hours of labor, and 20
minutes of machine time.
I We may sell everything we produce.
I For each day, we have
I Two hundred workers that each works for eight hours.
I Fifty machines that each runs for sixteen hours.
I A supply of 3600 units of wood.
I Desks and tables are sold at $700 and $900 per unit, respectively.

OR I: Linear Programming 33 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Define variables

I What do we need to decide?


I Let

x1 = number of desks produced in a day and


x2 = number of tables produced in a day.
I With these variables, we now try to express how much we will earn
and how many resources we will consume.

OR I: Linear Programming 34 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Formulate the objective function

I We want to maximize the total sales revenue.


I Given our variables x1 and x2 , the sales revenue is 700x1 + 900x2 .
I The objective function is thus

max 700x1 + 900x2 .

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 Collectively, our formulation is

max 700x1 + 900x2


s.t. 3x1 + 5x2 ≤ 3600 (wood)
x1 + 2x2 ≤ 1600 (labor)
50x1 + 20x2 ≤ 48000 (machine)
x1 ≥ 0
x2 ≥ 0.

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

Solve and interpret

I An optimal solution of this LP is (884.21, 189.47).


I So the interpretation is... to produce 884.21 desks and 189.47 tables?
I “Producing 884.21 desks and 189.47 tables” seems weird, but in fact:
I We may produce 884.21 desks and 189.47 tables per day in average
(i.e., roughly 88,420 desks and 18,947 tables per 100 days).
I We may suggest to produce, e.g., 884 desks and 189 tables.2
I It still supports our decision making.
I It may not really be optimal, but we spend a very short time to make a
good suggestion.
I “All models are wrong, but some are useful.”

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

Produce and store!

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

$9 × 620 + $1 × 150 + $2 × 200 + $3 × 170 = $6, 640.

3 Where does this inventory cost come from?


OR I: Linear Programming 40 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Problem description: timing

I Timing:

I Beginning inventory + production − sales = ending inventory.


I Inventory costs are calculated according to ending inventory.

OR I: Linear Programming 41 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Variables and objective function

I Let

xt = production quantity of day t, t = 1, ..., 4.


yt = ending inventory of day t, t = 1, ..., 4.
I It is important to specify “ending”!
I The objective function is

min 9x1 + 12x2 + 10x3 + 12x4 + y1 + y2 + y3 + y4 .

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

The complete formulation


I The complete formulation is

min 9x1 + 12x2 + 10x3 + 12x4 + y1 + y2 + y3 + y4


s.t. x1 − 100 = y1
y1 + x2 − 150 = y2
y2 + x3 − 200 = y3
y3 + x4 − 170 = y4
x1 ≥ 100
y1 + x2 ≥ 150
y2 + x3 ≥ 200
y3 + x4 ≥ 170
xt , yt ≥ 0 ∀t = 1, ..., 4.

OR I: Linear Programming 44 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Simplifying the formulation


I May we simplify the formulation?
I Inventory balancing and nonnegativity imply demand fulfillment!
I E.g., in day 1, x1 − 100 = y1 and y1 ≥ 0 means x1 ≥ 100.
I So the formulation may be simplified to

min 9x1 + 12x2 + 10x3 + 12x4 + y1 + y2 + y3 + y4


s.t. x1 − 100 = y1
y1 + x2 − 150 = y2
y2 + x3 − 200 = y3
y3 + x4 − 170 = y4
xt ≥ 0, yt ≥ 0 ∀t = 1, ..., 4.

I Identifying redundant constraints (removing them does not alter the


feasible region) helps reduce the complexity of a program.

OR I: Linear Programming 45 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Simplifying the formulation


I One may further argue that there is no need to have ending inventory
in period 4 (because it is costly but useless).
I So the formulation may be further simplified to

min 9x1 + 12x2 + 10x3 + 12x4 + y1 + y2 + y3


s.t. x1 − 100 = y1 , y1 + x2 − 150 = y2
y3 + x3 − 200 = y3 , y3 + x4 − 170 = 0
xt ≥ 0 ∀t = 1, ..., 4
yt ≥ 0 ∀t = 1, ..., 3.

I However, this is not always suggested (at this stage).


I It is not required because a solver will see this.
I It is too difficult if the instance scale is large.
I In summary, simplification is good but in most cases unnecessary.

OR I: Linear Programming 46 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Personnel scheduling

I We are scheduling employees in a department store.


I Each employee must work for five consecutive days and then take
rests for two consecutive days.
I The number of employees required for each day:

Mon Tue Wen Thu Fri Sat Sun


110 80 150 30 70 160 120

I There are seven shifts: Monday to Friday, Tuesday to Saturday, ...,


and Sunday to Thursday.
I We want to minimize the number of employees hired.

OR I: Linear Programming 47 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Personnel scheduling

I We may find a feasible solution easily.


I For example, we may assign 150 employees to work from Monday to
Friday and 160 to work from Saturday to Wednesday:

Mon Tue Wen Thu Fri Sat Sun


Demand 110 80 150 30 70 160 120
Shift 1 150 150 150 150 150
Shift 6 160 160 160 160 160
Total 310 310 310 150 150 160 160

I This solution is feasible but seems to be bad.

OR I: Linear Programming 48 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Decision variables and objective function

I Let Monday be day 1, Tuesday be day 2, etc.


I Let xi be the number of employees who starts to work from day i for
five consecutive days.
I xi is the number of employees assigned to shift i.
I The objective function is thus:

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.

I 80 employees are needed on Tuesday:

x1 + x2 + x5 + x6 + x7 ≥ 80.

I 120 employees are needed on Sunday:

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

I The complete formulation is

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

I Most problem instances in practice are of large scales.


I The number of variables and constraints are huge.
I Many variables may be grouped together:
I E.g., xt = production quantity of day t, t = 1, ..., 4.
I Many constraints may be grouped together:
I E.g., xt ≥ 0 for all t = 1, ..., 4.
I In modeling large-scale instances, we use compact formulations to
enhance readability and efficiency.
I We use the following three instruments:
I Indices (i, j, k, ...).
I Summation ( ).
P
I For all (∀).

OR I: Linear Programming 53 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Compact objective function


I The production-inventory problem:
I We have several periods. In each period, we first produce and then sell.
I Unsold products become ending inventories.
I We want to minimize the total cost.
I Indices: Because things will repeat in each period, it is natural to
use an index for periods. Let t ∈ {1, ..., 4} be the index of periods.
I For the objective function:

min 9x1 + 12x2 + 10x3 + 12x4 + y1 + y2 + y3 + y4 ,

if we denote the unit production cost on day t as Ct , t = 1, ..., 4, we


may rewrite it as
X4
min (Ct xt + yt ).
t=1

OR I: Linear Programming 54 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Compacting the constraints


I The original constraints:
I x1 − 100 = y1 , y1 + x2 − 150 = y2 , y2 + x3 − 200 = y3 , y3 + x4 − 170 = y4 .
I Let’s denote the demand on day t as Dt , t = 1, ..., 4:
I For t = 2, ..., 4 : yt−1 + xt − Dt = yt .
I We cannot apply this to day 1 as y0 is undefined!
I To group the four constraints into one compact constraint, we add an
additional decision variable y0 :

yt = ending inventory of day t, t = 0, ..., 4.

I Then the set of inventory balancing constraints are written as

yt−1 + xt − Dt = yt ∀t = 1, ..., 4.

I Certainly we need to set up the initial inventory: y0 = 0.

OR I: Linear Programming 55 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

The complete compact formulation


I The compact formulation is
4
X
min (Ct xt + yt )
t=1
s.t. yt−1 + xt − Dt = yt ∀t = 1, ..., 4
y0 = 0
xt , yt ≥ 0 ∀t = 1, ..., 4.
I Do not forget those for-all statements! Without them, the formulation
is wrong.
I Nonnegativity constraints for multiple sets of variables may be combined
to save some “≥ 0”.
I One convention is to:
I Use lowercase letters for variables (e.g., xt ).
I Use uppercase letters for parameters (e.g., Ct ).

OR I: Linear Programming 56 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Parameter declaration

I When creating parameter sets, we write something like

denote Ct as the unit production cost on day t, t = 1, ..., 4.


I Do not need to specify values, even though we have those values.
I Need to specify the range through indices.
I Parameter declarations should be at the beginning of the formulation.
I Parameters and variables are different.
I Variables are those to be determined. We do not know their values
before we solve the model.
I Parameters are given with known values.
I Parameters are exogenous and variables are endogenous.

OR I: Linear Programming 57 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Compact formulation for product mix


I Consider the product mix problem.
I Let n be the number of products and m be the number of resources.
I Let j and i be the indices for products and resources, respectively.
I We denote the unit sales price of product j as Pj , supply limit of
resources i as Ri , and unit of resource i required for producing one unit
of product j as Aij , where i = 1, ..., m, j = 1, ..., n.
I Let xj be the production quantity for product j, j = 1, ..., n.
I The compact formulation is
n
X
max Pj x j
j=1
Xn
s.t. Aij xj ≤ Ri ∀i = 1, ..., m
j=1

xj ≥ 0 ∀j = 1, ..., n.

OR I: Linear Programming 58 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Compact formulation for product mix

I Alternatively, let’s define J = {1, ..., n} as the set of products and


I = {1, ..., m} be the set of resources.
I The compact formulation is
X
max Pj x j
j∈J
X
s.t. Aij xj ≤ Ri ∀i ∈ I
j∈J

xj ≥ 0 ∀j ∈ J.

OR I: Linear Programming 59 / 60
Terminology Graphical approach Three types of LPs Simple formulation Compact formulation

Problems vs. instances


I A problem is an abstract description of a task to be completed or a
question to be solved.
I When we express everything with symbols, we have a problem.
I An instance is a concrete specification of a problem.
I When we plug in concrete values into symbols, we obtain an instance.
I A compact formulation like I A numeric formulation like

max 700x1 + 900x2


X
max Pj x j
j∈J s.t. 3x1 + 5x2 ≤ 3600
x1 + 2x2 ≤ 1600
X
s.t. Aij xj ≤ Ri ∀i ∈ I
j∈J 50x1 + 20x2 ≤ 48000
xj ≥ 0 ∀j ∈ J x1 ≥ 0, x2 ≥ 0

describes a problem. specifies an instance.

OR I: Linear Programming 60 / 60

You might also like