03_lp2
TRANSCRIPT
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 1/35
Lecture 3 – Classic LPExamples
Topics
•Employee scheduling problem
•Energy distribution problem
•Feed mix problem
•Cutting stock problem
•Regression analysis
•Model Transformations
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 2/35
Macrosoft has a 24-hour-a-day, 7-days-a-week tollfree hotline that is being set up to answer questionsregarding a new product. The following tablesummarizes the number of full-time equivalent
employees (FTEs) that must be on duty in each time block.
Interval Time FTEs1 0-4 15
2 4-8 103 8-12 404 12-16 705 16-20 40
6 20-0 35
Employee Scheduling
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 3/35
•Macrosoft may hire both full-time and part-time
employees. The former work 8-hour shifts and thelatter work 4-hour shifts; their respective hourly wages are $15.20 and $12.95. Employees may start work only at the beginning of 1 of the 6 intervals.
•Part-time employees can only answer 5 calls in thetime a full-time employee can answer 6 calls. (i.e., apart-time employee is only 5/6 of a full-timeemployee.)
•At least two-thirds of the employees working at anyone time must be full-time employees.
Formulate an LP to determine how to staff
the hotline at minimum cost.
Constraints for Employee Scheduling
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 4/35
Decision Variables
xt =# of full-time employees that begin the day at the
start of intervalt and work for 8 hours
yt = # of part-time employees that are assigned intervalt
min 121.6(x1 +• • • +x6) +51.8(y1 +• • • +y6)
s.t. 5
6 y1
≥ 1556 y2 ≥ 1056 y3 ≥ 4056 y4 ≥ 70
56 y5 ≥ 4056 y6 ≥ 35
(8× 15.20) (4× 12.95)
All shifts must
be covered
PT employee is 5/6 FT employee
x1 + x
6+
x1 + x2 +
x2 + x3 +
x3 + x4 +
x4 + x5 +
x5 + x6 +
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 5/35
x1 +x6 ≥ 23
≥ 23
...
≥ 23
xt≥ 0, yt≥ 0 t =1,2,…,6
At least 2/3
workers must
be full time
More constraints:
Noe!ativity
(x6 +x1 +y1)
x1 +x2 (x1 +x2 +y2)
(x5 +x6 +y6)x5 +x6
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 6/35
• An agricultural mill produces a different feed for cattle,
sheep, and chickens by mixing the following rawingredients: corn, limestone, soybeans, and fish meal.
•These ingredients contain the following nutrients: vitamins, protein, calcium, and crude fat in the following
quantities:
Ingredient, i Vitamins Protein Calcium Crude Fat
Corn 8 10 6 8Limestone 6 5 10 6Soybeans 10 12 6 6Fish Meal 4 18 6 9
"et aik # $uatity of utriet k per k! of i!rediet i
Nutrient, k
Feed Mix Problem
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 7/35
• The mill has (firm) contracts for the following demands.
Demand (kg) Cattle Sheep Chicken10,000 6,000 8,000
• There are limited availabilities of the raw ingredients.
Supply (kg)Corn Limestone Soybeans Fish Meal
6,000 10,000 4,000 5,000
• The different feeds have “quality” bounds per kilogram.
Vitamins Protein Calcium Crude fat
min max min max min max min maxCattle 6 -- 6 -- 7 -- 4 8Sheep 6 -- 6 -- 6 -- 4 8Chicken 4 6 6 -- 6 -- 4 8
si
d j
The above values represent bounds: l jk
andu jk
Constraints
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 8/35
•Cost per kg of the raw ingredients is as follows:
Corn Limestone Soybeans Fish meal
cost/kg,ci 20¢ 12¢ 24¢ 12¢
Formulate problem as a linear program whose solution yields desired feed production levels at minimum cost.
Indices/sets
i∈ I ingredients { corn, limestone, soybeans, fish meal } j∈ J products { cattle, sheep, chicken feeds }k∈ K nutrients { vitamins, protein, calcium, crude fat }
Costs and Notation
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 9/35
Data
d j demand for product j (kg)si supply of ingredienti (kg)l jk lower bound on number of nutrients of typek
per kg of product jupper bound on number of nutrients of typek
per kg of product jcost per kg of ingredientiaik number of nutrientsk per kg of ingredienti
Decision Variables
xij amount (kg) of ingredienti used in producingproduct j
u jk
ci
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 10/35
min ∑ ∑ cixij
s.t. ∑
∑
xij≥ 0
xij=d j
xij ≤si
∀ j∈ J
i∈ I j∈ J
i∈ I
∀ i∈ I j∈ J
∑ aikxij ≤u jkd ji∈ I
∀ j∈ J, k∈K
∑ aikxij≥l jkd ji∈ I
∀ j∈ J, k∈K
∀ i∈ I, j∈ J
LP Formulation of Feed Mix Problem
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 11/35
Raw Materials Qualities Blendedcommodities
corn, limestone,soybeans, fish meal
protein, vitamins,calcium, crude fat
feed
butane, catalyticreformate,
heavy naphtha
octane, volatility, vapor pressure
gasoline
pig iron,ferro-silicon,carbide, various
alloys
carbon,manganese,chrome content
metals
≥ 2 raw ingredients ≥ 1 quality ≥ 1 commodity
Generalization of feed Mix Problem GivesBlending Problems
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 12/35
•Three special orders for rolls of paper have been placedat a paper mill. The orders are to be cut from standardrolls of 10′ and 20′ widths.
Order Width Length
1 5′ 10,000′2 7′ 30,000′3 9′ 20,000′
• Assumption: Lengthwise strips can be taped together
•Goal: Throw away as little as possible
Trim-Loss or Cutting Stock problem
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 13/35
Problem: What is trim-loss?
Decision variables:x j = length of roll cut using
pattern, j = 1, 2, … ?
% ′
&' ′
()
5)5′
2' ′
5''')
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 14/35
10′ roll 20′ roll
x1
5′ 2 0 0 4 2 2 1 0 07′ 0 1 0 0 1 0 2 1 09′ 0 0 1 0 0 1 0 1 2
Trim loss 0 3 1 0 3 1 1 4 2
x2 x3 x4 x5 x6 x7 x8 x9
min z = 10(x1+x2+x3) + 20(x4+x5+x6+x7+x8+x9)
s.t. 2x1 + 4x4 + 2x5 + 2x6 +x7 ≥ 10,000
x2 +x5 + 2x7 +x8 ≥ 30,000
x3 + x6 +x8 + 2x9 ≥ 20,000
x j≥ '* j # &* 2*+*(
Patterns Possible
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 15/35
Minimize Trim Loss + Overproduction
min z = 3x2 + x3 + 3x5 +x6 +x7+ 4x8
+ 5y1+ 7y2+ 9y3
s.t. 2x1 + 4x4 + 2x5 + 2x6 +x7 –y1 = 10,000
x2 + x5 + 2x7 +x8 –y2 = 30,000
x3 + x6 + x8 + 2x9 – y3 = 20,000
x j≥ '* j = 1,…,9;yi ≥ 0,i = 1, 2, 3
where yi is overproductio of width i
+ 2x9
Alternative Formulation
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 16/35
Minimizing Piecewise LinearConvex Functions
•Definition of convexity
•Examples of objective functions
1. f(x) = maxk=1,…, p(ckx +dk)
2. f(x) =Σ j=1,nc j|x j|,c j> 0 for all j
3. f(x) = separable, piecewise linear, convex
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 17/35
Definition of a Convex/Concave Function
•A function f :ℜn → ℜ is calledconvex if foreveryx andy ∈ ℜn, and everyλ ∈[0,1], wehave
f(λ x + (1 –λ )y) ≤λ f(x) + (1 –λ ) f(y)
•A function f :ℜn → ℜ is calledconcave if foreveryx andy ∈ ℜn, and everyλ ∈[0,1], wehave
f(λ x + (1 –λ )y) ≥λ f(x) + (1 –λ ) f(y)
•If f(x) is convex, then – f(x) is concave
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 18/35
Minimizing the Maximum of Several Affine Functions
Problem:min maxk=1,…, p(ckx +dk)s.t. Ax ≥b
Transformed problem:minz
s.t.z ≥ckx +dk,k = 1,…, p
Ax ≥b
x
f(x) = max
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 19/35
Problems Involving Absolute Values: Minimizing theL1-Norm
Problem: minΣ j=1,nc j|x j|,c j> 0 for all j
s.t. Ax ≥b
Transformation 1:
minΣ j=1,nc jz j
s.t. Ax ≥b
z j ≥ x j, j = 1,…,n
z j ≥ –x j, j = 1,…,n
Transformation 2:
minΣ j=1,nc j(x j+ +x j
-)
s.t. Ax + – Ax - ≥b
x + ≥ 0,x - ≥ 0
wherex j =x j+ – x j- for all j
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 20/35
Data Fitting Example
• Problem: We are given p data points of the form(ak,bk),k = 1,…, p, whereak ∈ ℜn andbk ∈ ℜ,and wish to build a model that predicts the valueof the variableb from knowledge of the vectora.
• Assume a linear model:b =ax +x0, where (x,x0) isa parameter vector to be determined.
• Error: Given a particular values of (x,x0), theresidual (predictive error) at thek th data point is
defined by |akx + x0 –bk|.
• Objective: Find values of (x,x0) that best explainthe available data; i.e., minimize the error.
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 21/35
Data Fitting Example (cont’d)
• Model 1: Minimize thelargest residual
min maxk |akx + x0 –bk| Transformed model 1:
minz
s.t.z ≥akx + x0 –bk ,k = 1,…, p
z ≥ – akx – x0+ bk,k = 1,…, p
• Model 2: Minimize thesum of residuals
minΣk=1, p |akx + x0 –bk|
Transformed model 2:
min Σk=1, p zk
s.t.zk≥akx + x0 –bk ,k = 1,…, p
zk ≥ –ak
x
– x0+ bk ,k = 1,…, p
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 22/35
Data (a,b) = { (1,2) , (3,4) , (4,7) }
We want to “fit” a linear functionb =ax +x0 to these data
points; i.e., we have to choose optimal values forx andx0.
%6
5,32
&
& 2 3 , 5
b
a
•
•
•
Constrained Regression
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 23/35
Objective: Find parametersx andx0 that minimize the
maximum absolute deviation between the dataak and the
fitted linebk =akx +x0.
bk and
bk
In addition, we’re going to impose a priori knowledge that the
slope of the line must be positive. (We don’t know about theintercept.)
Decision variables x = slope of line known to be positivex0 = b-intercept positive or negative
observed
value
Predicted
value
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 24/35
Letz = max { |bk − bk|:k = 1, 2, 3 }
Optimization model:
min z
wherebk =akx +x0
Objective function:
s.t. z ≥ |bk − bk|,k = 1, 2, 3
min max { |bk − bk|:k = 1, 2, 3 }
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 25/35
Note: 2≥|x| iff 2≥ x and 2≥ −x
Thusz≥|bk − bk| is equivalent to
z ≥ akx +x0 − bk and z ≥ − akx –x0 +bk
Convert absolute value terms to linear terms:
Nonlinear constraints:
b1
− b1
= 1x +x0
– 2
b2 − b2 = 3x +x0 – 4
b3− b3 = 4x +x0 – 7
z≥
z≥
z≥
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 26/35
Lettingx0 =x0+ − x0-,x0
+ ≥ 0,x0- ≥ 0, we finally get …
min zs.t. x +x0+− x0
-− z ≤ 2
≤ − 2
≤ 4
≤ − 4
≤ 7
≤ − 7
x,x0+,x0-,z ≥ 0
− x − x0++ x0-− z
3x +x0+− x0-− z
− 3x − x0++ x0-− z
4x +x0+− x0-− z
− 4x − x0++ x0-− z
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 27/35
Separable Piecewise Linear Functions
• Model: min f (x) = f1(x1) + f2(x2) +. . . + f p(x p)
• For eachx j we are givenr break points:
0 <a j1 <a j2 <. . . <a jr < ∞
• Letc jt be the slope in the intervala j,t-1≤ x j ≤ a jt fort =1,…,r+1, wherea j0= 0 anda j,r+1 = ∞
• Lety jt be the portion ofx j lying in thetth interval,t = 1,…,r+1
x ja j1 a j2 a jr
f j(x j)
a j,r-10
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 28/35
Transformation for f j(x j)
•Letx j =y j1 +y j2 +. . . +y j,r+1
•Model:
minc j1y j1 +c j2y j2 +. . .+c j,r+1y j,r+1 + f1(x1) +. . .
s.t.0≤ y j1 ≤ a j1
0≤ y j2 ≤ a j2 – a j1. . .
0≤ y jr ≤ a jr – a j,r-1
0≤ y j,r+1
and for everyt, ify jt > 0, then eachy jk is equal to its
upper bounda jk – a j,k-1, for allk <t.
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 29/35
Austin Municipal Power and Light (AMPL) would like to determine optimaloperating levels for their electric generators and associated distribution patternsthat will satisfy customer demand. Consider the following prototype system
Plants
The two plants (generators) have the following (nonlinear) efficiencies:
Plant 1 [ 0, 6 MW] [ 6MW, 10MW]Unit cost ($/MW) $10 $25
Plant 2 [ 0, 5 MW] [5MW, 11MW]Unit cost ($/MW) $8 $28
For plant 1, e.g., if you generate at a rate of 8MW (per sec), then the cost($) is = ($10/MW)(6MW) + ($25/MW)(2MW) = $110.
2
&
3
2
&
-emad
sectors
-emad re$uiremets
, .
% .
6 .
Energy Generation Problem (with piecewise linear objective)
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 30/35
Formulate an LP that, when solved, will yield optimal power
generation and distribution levels.
Decision Variables
= power generated at plant 1 at operating level 1
″ ″ ″ ″ 1 ″ ″ ″ 2
x21 ″ ″ ″ ″ 2 ″ ″ ″ 1
x22 ″ ″ ″ ″ 2 ″ ″ ″ 2
= power sent from plant1 to demand sector 1
″ ″ ″ ″ 1 ″ ″ ″ 2
″ ″ ″ ″ 1 ″ ″ ″
3″ ″ ″ ″ 2 ″ ″ ″ 1
″ ″ ″ ″ 2 ″ ″ ″ 2
″ ″ ″ ″ 2 ″ ″ ″ 3
Problem Statement and Notation
w11w12
w13w21
w22w23
x11
x12
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 31/35
Formulation
min 10x11+ 25x12 + 8x21 + 28x22
s.t. w11 + w12 + w13w21 + w22 + w23
w11 + w21 = 4w12 + w22 = 7
w13 + w23 = 60≤ x11≤6, 0≤ x12 ≤ 4
0≤ x21≤5, 0≤ x22 ≤ 6
w11,w12,w13,w21,w22,w32 ≥ 0
Note that we ca model the oliear operati! costs as a "P oly because
the efficiecies have the ri!ht kid of structure0 1 particular* the plat is
less efficiet more costly at hi!her operati! levels0 Thus the "P solutio
will automatically select level & first0
= x11+x12= x21+x22
Flow balace
-emad
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 32/35
The above formulation can be generalized for any
number of plants, demand sectors, and generationlevels.
Indices/Setsi∈ I plants
demand sectorsgeneration levels
Data
Cik = unit generation cost ($/MW) for planti at levelk
uik= upper bound (MW) for planti at levelk
d j = demand (MW) in sector j
Decision Variables
xik = power (MW) generated at planti at levelk
wij = power (MW) sent from planti to sector j
j∈ J
k∈ K
General Formulation of PowerDistribution Problem
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 33/35
min ∑ ∑
s.t. ∑ wij= ∑
∑
cikxik
xik
0 ≤ xik
≤uik
∀ i
∈ I,k
∈ K
0 ≤ wij ∀ i∈ I, j∈ J
wij= d j
k∈ K i∈ I
k∈ K j∈ J
∀ i∈ I
∀ j∈ J i∈ I
General Network Formulation
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 34/35
Model Transformations
•Direction of optimization:
Minimize {c1 x1 + c2 x2 + … + cn xn}
⇔ Maximize {–c1 x1 – c2 x2 – … – cn xn}
4 restricted variables
x j = y
1 j – y
2 j where y
1 j ≥ 0, y
2 j≥ 0
4 7ostat term i ob8ective fuctio i!ore
4 No9ero lower bouds o variables
x j > l
j replace with x
j = y
j+ l
j where y
j ≥ 0
4 Nopositive variable
x j ≤ 0 replace with x j = – y j where y j ≥ 0
7/23/2019 03_lp2
http://slidepdf.com/reader/full/03lp2 35/35
What You Should Know About LP Problems
•How to formulate various types ofproblems.
•Difference between continuous andinteger variables.
•How to find solutions.
•How to transform variables andfunctions into the standard form.