Professional Documents
Culture Documents
- An objective function.
- A set of decision variables.
- A set of constraints.
Brewery Problem
Small brewery produces ale and beer.
• Production limited by scarce resources: corn, hops, barley malt.
• Recipes for ale and beer require different proportions of resources.
Mathematical Model:
max 13 A 23B
s. t. 5 A 15B 480
4 A 4B 160
35 A 20B 1190
A , B 0
Brewery Problem: Graphical Method
Hops Malt
4A + 4B 160 35A + 20B 1190
(0, 32)
(12, 28)
Feasible (26, 14) Corn
Region 5A + 15B 480
Beer
(0, 32)
(12, 28)
13A + 23B = 1600
(26, 14)
(0, 32)
(12, 28)
(26, 14)
Beer
Subject to:
a11 x1 a12 x2 ... a1n xn b1
a21 x1 a22 x2 ... a2 n xn b2
Constraint
. . Set
. .
am1 x1 am 2 x2 ... amn xn bm
Non-negative x1 0, x2 0,..., xn 0
Right-hand side Non-negative
Constants b1 0, b2 0,..., bm 0 Variables
Constraint
LP standard form: matrix description
Maximize: Z cx
Subject to: Ax b
x0 where,
b0 c [c1 c2 . . . cn ]
x1 + 3x2 + 5x3 ≥ 10
Introduce a surplus variable x5:
x1 + 3x2 + 5x3 - x5 = 10
(x5 ≥ 0)
Non-standard to standard Form: an
example
The answer
Graphical solution
Graphical solution
Graphical solution
Graphical solution
Graphical solution
Graphical solution
B
The optimal solution
is at B, which is the
solution of C
Feasible
region
x1=2, x2=6,
Z=36000.
Graphical solution
Feasible solution – A solution
for which all constraints are
satisfied (point 1)
Infeasible solution – A solution
Point 3 for which at least one constraint
is violated (point 2)
Point 2 Feasible region – The collection
of all feasible solutions (blue
Point 1 region)
Optimal solution – A feasible
solution that has the most
favorable value of the objective
function (point 3)
Graphical solution discussion
Feasible C
region
Graphical solution discussion
2. Feasible region
Feasible region is
unbounded, x2 could
increase indefinitely.
->no optimal solution and
Z is unbounded.
Feasible
region
Simplex algorithm
Step 1 Convert the LP to standard form
Step 2 Obtain a bfs from the standard form
Step 3 Determine whether the current bfs is optimal
Step 4 If the current bfs is not optimal, determine which
nonbasic variable should become a basic variable and
which basic variable should become a nonbasic variable, to
find a bfs with a better objective function value.
Step 5 Find a new bfs with a better objective function
value. Go back to Step 3.
Summary
The simplex algorithm starts at some vertex of the
feasible region and performs a sequence of iterations.
In each iteration, it moves along an edge of the feasible
region from a current vertex to a neighboring vertex
whose objective value is improved. The simplex
algorithm terminates when it reaches a local maximum,
which is a vertex from which all neighboring vertices
have a smaller objective value.
Other algorithms for LP
The simplex algorithm often solves general
linear programs quickly in practice. With
some carefully contrived inputs, the simplex
algorithm can require exponential time.
The first polynomial-time algorithm for linear
programming was the ellipsoid algorithm,
which runs slowly in practice.
A second class of polynomial-time algorithms
are known as interior-point methods.
Example
To explain the steps of the algorithm we consider the following LP
maximize z 3x1 5 x2
s.t. x1 8
2 x2 12
3x1 4 x2 36
x1 , x2 0
x3 = 8 - x1
x4 = 12 - 2 x2
x5 = 36 - 3x1 - 4x2
Choose Entering Variable
Next we choose the entering variable x2 by
looking at the objective function
z = 3x1 + 5x2 largest coefficient, choose x
2
maximize z 3x1 5 x2
s.t. x1 x3 8
2 x2 x4 12
3 x1 4 x2 x5 36
x1 , x2 , x3 , x4 , x5 0
Optimal solution
X (4,6,4,0,0)
* T
z 42
*
Applications of LP
Many problems can be formulated as maximizing or
minimizing an objective, given limited resources and
competing constraints.
build roads -2 5 3
gun control 8 2 -5
farm subsidies 0 0 10
gasoline tax 10 0 -2
minimize x1+x2+x3+x4
subject to
-2x1+8x2+0x3+10x4≥50
5x1+2x2+0x3+0x4≥100
3x1-5x2+10x3-2x4≥25
x1, x2, x3, x4≥0
Personnel Scheduling
UNION AIRWAYS needs to hire additional customer
service agents.
Each agent works an 8-hour shift 5 days per week, and the
authorized shifts are
Shift 1: 6:00 A.M. to 2:00 P.M.
Shift 2: 8:00 A.M. to 4:00 P.M.
Shift 3: Noon to 8:00 P.M.
Shift 4: 4:00 P.M. to midnight
Shift 5: 10:00 P.M. to 6:00 A.M.
The minimum number of agents that need to be on duty at
different times of the day are shown in the table.
For each shift, the daily compensation (including benefits)
for each agent is shown in the bottom row.
Goal: how many agents should be assigned to the
respective shifts each day to minimize the total personnel cost .
Analysis
x1 x2 x3 x4 x5
Material cutting
We have a batch of steel pipes with length 8
meters, and require 100 pieces with length
2.5 meters and 200 pieces with length 1.3
meters cut from the batch. What is the
minimum number of steel pipes that must be
cut?
Ⅰ Ⅱ Ⅲ Ⅳ
2.5m 3 2 1 0
1.3m 0 2 4 6
Remnants 0.5 0.4 0.3 0.2
The quantities of raw materials required for patterns Ⅰ, Ⅱ,
Ⅲ, and Ⅳ are set as xj (j = 1, 2, 3, 4), respectively. The LP
model can be built as the following:
min Z x1 x2 x3 x4
3x1 2 x2 x3 100
2 x2 4 x3 6 x4 200
x 0 ( j 1, 2, 3,4)
j
Material cutting in 2-dimension:
An interesting problem
LP model?
Reformulate the problem as a LP:
max
s.t. t2 t1 0
t3 t 2 0
tn tn 1 0
a j t j bj j 1, 2,, n
0-1 Integer Linear Programming
2x3-x1-x2 ≤ 0
x4-x7 ≤ 0
2x5-x1-x2 ≤ 0
x6-x7 ≤ 0
x8-x7 ≤ 0
2x9-x1-x2 ≤ 0
Allocating TV spots
A corporation is developing its marketing plans for next year’s new products. For three
of these products, it is considering purchasing a total of five TV spots for commercials
on national television networks. The problem we will focus on is how to allocate the
five spots to these three products, with a maximum of three spots (and a minimum of
zero) for each product.
The following table shows the estimated impact of allocating zero, one, two, or three
spots to each product. This impact is measured in terms of the profit from the additional
sales that would result from the spots, considering also the cost of producing the
commercial and purchasing the spots. The objective is to allocate five spots to the
products so as to maximize the total profit.
Profit
Number of TV
Product
spots
1 2 3
0 0 0 0
1 1 0 -1
2 3 2 2
3 3 3 4
Solution
This small problem can be solved by inspection. However, we will show an
ILP formulation. Such a formulation would become necessary if this small
problem needed to be incorporated into a large IP model involving the
allocation of resources to marketing activities for all the corporation’s new
products.
A natural formulation would be to let x1,x2,x3 be the number of TV spots
allocated to the respective products. The contribution of each xj to the
objective function then would be given by the corresponding column in the
table. However, each of these columns violates proportionality. Therefore,
we cannot write a linear objective function in terms of these integer decision
variables.
Now see what happens when we introduce an auxiliary binary variable yij
for each positive integer value of xi=j (i=1,2,3 ; j=0,1,2,3), where yij has the
following interpretation
1, if xi j
yij
0, otherwise
Covering All Flights
An airline needs to assign its crews to cover all its upcoming flights.
We will focus on the problem of assigning three crews based in San
Francisco (SF) to the flights listed in the first column of the next table.
The other 12 column shows the 12 feasible sequences of flights for a
crew. Exactly three of the sequences need to be chosen in such a way
that every flight is covered. (It is permissible to have more than one
crew on a flight, where the extra crews would fly as passengers, but
union contracts require that the extra crews still be paid for their time
as if they were working). The cost of assigning a crew to a particular
sequence of flights is given (in thousands of dollars) in the bottom row
of the table. The objective is to minimize the total cost of the three
crew assignments that cover all the flights.
Feasible Sequence of Flights
Flight 1 2 3 4 5 6 7 8 9 10 11 12
San F. to Los A. 1 1 1 1
San F. to Denver 1 1 1 1
San F. to Seattle 1 1 1 1
Los A. to Chicago 2 2 3 2 3
Los A to San F. 2 3 5 5
Chicago to Denver 3 3 4
Chicago to Seattle 3 3 3 3 4
Denver to San F. 2 4 4 5
Denver to Chicago 2 2 2
Seattle to San F. 2 4 4 5
Seattle to Los A. 2 2 4 4 2
Cost, $1,000 2 3 4 6 7 5 7 8 9 9 8 9
Formulation with binary variables: with 12 feasible sequences of flights, we have 12
yes-or-no decisions:
1, if sequence j is assigned to a crew,
xj
0, otheriwse
MinZ 2 x1 3 x2 4 x3 6 x4 7 x5 5 x6
7 x7 8 x8 9 x9 9 x10 8 x11 9 x12
x1 x4 x7 x10 1
x2 x5 x8 x11 1
x3 x6 x9 x12 1
x x x x
12 1
4 7 9
x1 x6 x10 x11 1
x4 x5 x9 1
x7 x8 x10 x11 x12 1
x x x x 1
2 4 5 9
x5 x8 x11 1
x3 x7 x8 x12 1
x6 x9 x10 x11 x12 1
12
xj 3
j 1
x j is binary , for j 1,2...,12.
Duality theory
One of the most important discoveries in the early development
of linear programming was the concept of duality. This discovery
revealed that every linear programming problem has associated with
it another linear programming problem called the dual. The
relationships between the dual problem and the original problem
prove to be extremely useful in a variety of ways.
Example
There is a company which produced two products A and B, and
information is in the following table.
A B Available materials
Material 1 2 3 24
Material 1 3 2 26
profit($/each) 4 3
How does the company arrange its productions to make the total profit
maximum?
max Z 4 x1 3 x 2
2 x1 3 x 2 24 ( material 1)
s.t .3 x1 2 x 2 26 ( material 2)
x1 , x 2 0
Now, from the other way, if the company would not want to arrange the
production, and would rather sell its materials to get revenue then how to
determine the sale price of materials.
A B Available materials
Material 1 2 3 24
Material 2 3 2 26
profit($/each) 4 3
min W 24 y 26 y
1 2
2 y 3 y 4 ( product A)
1 2
s .t . 3 y 2 y 3 ( product B )
1 2
y , y 0
1 2
max Z 4 x1 3 x 2 min W 24 y 26 y
1 2
2 x1 3 x 2 24 ( material 1) 2 y 3 y 4 ( product A)
1 2
s.t .3 x1 2 x 2 26 ( material 2)
s .t . 3 y 2 y 3 ( product B )
x1 , x 2 0
1 2
y , y 0
1 2
Standard form
Given the standard form for the primal problem at
the left, its dual problem has the form shown to the
right.
ij j m
a ij y i c j
i
s.t. j 1
x j 0 s .t . i 1
y 0
i
Key observations
1. The primal problem in maximization form, the dual problem is in
minimization.
2.The coefficients in the objective function of the primal problem
are the right-hand sides of the functional constraints in the dual
problem.
3. The right-hand sides of the functional constrains in the primal
problem are the coefficients in the objective function of the dual
problem.
4.The coefficients of a variable in the functional constraints of the
primal problem are the coefficients in a functional constraint of the
dual problem.
The primal-dual table for linear programming also helps to highlight
the correspondence between the two problems in standard form.
primal problem
x1 x2 xn
y1 a11 a12 a1n b1
Dual
y2 a21 a22 a2 n b2
problem
yn am1 am 2 amn bm
c1 c2 cn
Relationship between the primal and the Dual
in general form
Primal Problem Dual Problem
(or Dual Problem) (or Primal Problem)
Maximize Minimize
Constraint i Variable y i
< form yi > 0
= form y i unconstrained
> form yi < 0
Variable x j Constraint j
xj > 0 > form
x j unconstrained = form
xj < 0 < form
Example
Primal Dual
min z 2 x1 3 x2 5 x3 x4 max w 5 y1 4 y2 6 y3
s.t. x1 x2 3 x3 x4 5 s.t. y1 2 y2 2
2 x1 2 x3 x4 4 y1 y3 3
x2 x3 x4 6 3 y1 2 y2 y3 5
x1 0, x2 0, x3 0 y1 y2 y3 1
y1 0, y2 0, y3 free
Primal and dual in compact (matrix)
form
P:max Z CX D:min W Y T b
AX b A T Y CT
X0 Y0
Primal Dual
Problem Problem
Primal and Dual Relationships
a. Symmetry Property:
– Dual’s dual=primal problem
d. Duality theorem
– If one problem has feasible solutions and bounded
objective functions, then so does the other
problem. So both weak and strong duality
properties are applicable
– If one problem has feasible solutions and unbounded
objective functions, the other problem has no
feasible solutions.
– If one problem has no feasible solution, then the other
problem either has no feasible solution, or an
unbounded objective function.
Economic Interpretation
P:max Z CX D:min W Y T b
AX b A T Y CT
X0 Y0
n m
z*
z c j x j bi yi , yi * (i 1,2m)
j 1 i 1 bi
Shadow Price
The shadow price is a kind of marginal price, which is the
change of the optimal value of the objective function
caused by a unit change of the resource.
The shadow price is the valuation of unit resource under
the conditions of optimal utilization of the resources, and
such a valuation is not the actual market price of the
resource.
If a certain resource is not completely consumed in
production, the shadow price of the resource is 0; if the
shadow price of the resource is not 0, it indicates that the
resource is completely consumed in production.
Sensitivity Analysis
A furniture factory manufactures 4 types of small furniture.
Because they have different sizes, shapes, and styles, the main
raw materials (timber and glass) and production time for them
are different. The available timber, glass, and labor hours, and
the unit profit and maximum demand of each type in a day are
showed below.
Maximum
Furniture Timber Glass Profit per
Labor-hours demand
type (units) (units) piece (yuan)
(pieces)
1 2 4 6 60 100
2 1 2 2 20 200
3 3 1 1 40 50
4 2 2 2 30 100
Available
400 hours 600 units 1000 units
Amount
Questions
1. How to arrange the daily production of these four types of
furniture to maximize the daily profit?
3. If the available labor time reduces to 398 hours, how will the
optimal daily profit change?
5. If the unit profit of the first type furniture fell from 60 yuan to
55 yuan, then, how will the optimal production planning and
daily profit change?
Modeling and Analysis
Max Z 60 x1 20 x2 40 x3 30 x4
4 x1 2 x2 x3 2 x4 600
6 x 2 x x 2 x 1000
1 2 3 4
2 x1 1x2 3 x3 2 x4 400
x1 100
s.t.
x2 200
x3 50
x4 100
x , x , x , x 0
1 2 3 4
Conclusions on duality
x1 4 x2 6 x3 5
2 4
x1 , x2 , x3 0