Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction
Development of linear programming was among the
most important scientific advances of mid-20th cent.
Most common type of applications: allocate limited
resources to competing activities in an optimal way.
Very large and wide range of applications from local to
very global ones.
Linear programming uses a mathematical model.
Linear because it requires linear functions.
Programming as synonymous of planning.
31
Introduction
Besides allocate resources to activities, any problem
described by a mathematical model can be solved.
Very efficient solution procedure: simplex method.
This method will be described next as well as the
interior-point algorithm for larger problems.
Besides these algorithms, we will also discuss
sensitivity analysis.
32
Prototype example
Wyndor Glass Co. produces glass products, including
windows and glass doors.
Plant 1 produces aluminum frames, Plant 2 produces
wood frames and Plant 3 produces glass and
assembles.
Two new products:
Glass door with aluminum framing (Plant 1 and 3)
New wood-framed glass window (Plant 2 and 3)
Plant 1
Plant 2
Plant 3
Doors
$3.000
Windows
$5.000
Hours available
per week
4
12
18
34
maximize Z
3 x1 5 x2
subject to
and
x1
2 x2
4
12
3x1 2 x2
18
x1
0,
x2
0.
35
Graphical solution
Trial-and-error: Z = 10, 20, 36
Slope of the line is 3/5: x2
3
x1
5
1
Z
5
Feasible region:
satisfies all
constraints
and
x1
0,
x2
0.
36
Doors
$3.000
Windows
$5.000
Hours
Hours
Hours Used Per Batch Produced Used
Available
Plant 1
1
0
2
<=
4
Plant 2
0
2
12 <=
12
Plant 3
3
2
18 <=
18
Batches Produced
Doors
2
Windows
6
Range Name
Cells
BatchesProduced
C12:D12
HoursAvailable
G7:G9
HoursUsed
E7:E9
HoursUsedPerBatchProduced
C7:D9
ProfitPerBatch
C4:D4
TotalProfit
G12
Total Profit
$36.000
37
Generalizing example
Prototype example
General problem
Resources
3 plants
m resources
Production of products
Activities
2 products
n activities
Level of activity j, xj
Profit Z
39
Standard form
maximize Z
c1 x1 c2 x2
cn x n
subject to
a11 x1 a12 x2
a1n xn
b1
a21 x1 a22 x2
a 2 n xn
b2
am1 x1 am 2 x2
amn xn
bm
, xn
0.
and
x1
0, x2
0,
40
c1 x1 c2 x2
cn xn
ain xn
ain xn
41
Amount of
Resource
available
a11
a12
a1n
b1
a21
a22
a2n
b2
am1
am2
amn
bm
Contribution
to Z per unit
of activity
c1
c2
cn
Activity
42
43
44
45
Examples of solutions
More than one solution
46
47
48
Violations of proportionality
2) Increase of marginal return due to economy of
scale (longer production runs, quantity discounts,
learning-curve effect, etc.)
49
Violations of proportionality
3) Decrease of marginal return due to e.g. marketing
costs: to sell more the advertisement grows
exponentially.
50
51
Conclusions
Linear programming models can be solved using:
Spreadsheet as Excel Solver for relatively simple
problems
Problems with thousands (or even millions!) of decision
variables and/or functional constraints must use
modeling languages such as: CPLEX/MDL or
LINGO/LINDO
Matlab Optimization Toolbox
SIMPLEX METHOD
Simplex method
Algebraic procedure with underlying geometric
concepts.
Definitions:
Constraint boundary: line of boundary of the
constraint.
Corner-point solution
Corner-point feasible solution (CFP solution)
CFP solutions are adjacent if they share n 1 constraint
boundaries.
The line segment between two CFP solutions is an edge.
54
Example revisited
Wyndor Glass Co.
55
Optimality test
Optimality test: consider LP with at least one optimal
solution. If a CFP solution has no adjacent CFP
solutions that are better, it must be an optimal
solution.
Adjacent CFP solutions for each CFP solution of
Wyndor Glass Co. problem:
CFP solution
(0, 0)
(0, 6)
(2, 6)
(4, 3)
(4, 0)
(0,6)
58
Augmented form
3x1 5 x2
maximize Z
3x1 5 x2
subject to
subject to
x1
3x1
and
x1
2 x2 12
2 x2 18
0, x2
0.
(1)
(2)
x1
2 x2
x3
x4
4
12
(3)
3 x1 2 x2
x5
18
and
xj
0, j 1, 2,3, 4,5.
60
Basic definitions
Example problem has 5 variables and 3 non redundant
equations, and 2 (5 3) degrees of freedom.
Two variables have an arbitrary value. Simplex uses
the zero value for these nonbasic variables.
The solution for the other variables (basic variables) is
a basic solution.
Basic solutions have thus a number of properties.
61
Final form
maximize Z
subject to
(0)
3 x1 5 x2
(1)
x1
x3
(2)
2 x2
x4
12
(3)
3x1 2 x2
x5
18
and
xj
0, j 1,
,5.
63
x1
+ x3
(2)
2x2
(3)
3x1 + 2x2
+ x4
Basic
variable
Eq.
= 0
(0)
1 -3 -5 0 0 0
= 4
x3
(1)
0 1 0 1 0 0
= 12
x4
(2)
0 0 2 0 1 0
12
+ x5 = 18
x5
(3)
0 3 2 0 0 1
18
x1 x2 x3 x4 x5
Right
side
64
65
Eq.
Coefficient of:
Right
side
x1
x2
x3
x4
x5
(0)
-3
-5
x3
(1)
x4
(2)
12
x5
(3)
18
66
Iteration
Step 2: Determine leaving basic variable, by applying
minimum ratio test:
Basic
variable
Eq.
Coefficient of:
Right side
x1
x2
x3
x4
x5
(0)
-3
-5
x3
(1)
x4
(2)
12
12/2 = 6
x5
(3)
18
18/2 = 9
Ratio
pivot row
minimum
pivot number
67
Iteration
Step 3: solve for the new BF solution by using
elementary row operations.
Iteration
Basic
variable
Eq.
Coefficient of:
Right
side
x1
x2
x3
x4
x5
(0)
-3
-5
x3
(1)
x4
(2)
12
x5
(3)
18
(0)
-3
2.5
30
x3
(1)
x2
(2)
0.5
x5
(3)
-1
68
Iteration
Basic
variable
Eq.
Coefficient of:
Right
side
x1
x2
x3
x4
x5
(0)
-3
2.5
30
x3
(1)
x2
(2)
0.5
x5
(3)
-1
Ratio
4/1 = 4
6/3 = 2
minimum
69
Basic variable
Eq.
Coefficient of:
Right side
x1
x2
x3
x4
x5
(0)
-3
-5
x3
(1)
x4
(2)
12
x5
(3)
18
(0)
-3
2.5
30
x3
(1)
x2
(2)
0.5
x5
(3)
-1
(0)
1.5
36
x3
(1)
1/3
-1/3
x2
(2)
0.5
x1
(3)
-1/3
1/3
2
70
Minimization
Maximize Z.
71
Postoptimality analysis
Reoptimization: when the problem changes slightly,
new solution is derived from the final simplex tableau.
Shadow price for resource i (denoted yi*) is the
marginal value of i.
i.e. the rate at which Z can be increased by slightly
increasing the amount of this resource bi.
72
Graphical check
Increasing b2 in 1 unit, the new profit is 37.5
73
Shadow prices
Increasing b2 in 1 unit increases the profit in $1500.
Should this be done? Depends on the marginal
profitability of other products using that hour time.
Shadow prices are part of the sensitivity analysis.
Constraint on resource 1 is not binding the optimal
solution. Resources as this are free goods.
Constraints on resources 2 and 3 are binding
constraints. Resources are scarce goods.
74
Sensitivity analysis
Identify sensitive parameters (those that cannot be
changed without changing optimal solution).
Parameters bi can be analyzed using shadow prices.
Parameters ci for Wyndor example (see figure in next
slide).
Parameters aij can also be analyzed graphically.
75
76
Interior-point approach
Discovery made in 1984 by Narendra Karmarkar.
Used in huge linear programming problems, beyond
the scope of the simplex method.
Starts by identifying a feasible trial solution, moving a
better one until it reaches the optimal trial solution.
Trial solutions are interior points.
Interior-point or barrier algorithms (each constraint
boundary is treated as a barrier).
77
Example
The Wyndor Glass Co. example reaches the solution in
15 iterations for changes smaller than 0.0001
78
maximize Z
c1 x1 c2 x2
cn x n
subject to
a11 x1 a12 x2
a1n xn
b1
a21 x1 a22 x2
a 2 n xn
b2
am1 x1 am 2 x2
amn xn
bm
, xn
0.
and
x1
0, x2
0,
79
Augmented form
maximize Z
c1 x1
cn xn cn 1 xn
cn m xn
subject to
a11 x1 a12 x2
a21 x1 a22 x2
am1 x1 am 2 x2
and
xj
0,
a1n xn xn 1 b1
a2 n xn xn 2 b2
amn xn
j 1, 2,
xn
bm
, m.
80
cx
subject to
Ax
c [c1 , c2 ,
b1
x2
b2
xn
, cn ],
x1
,
b and x
bm
, 0
0
0
0
, A
a11
a21
a12
a22
a1n
a2 n
a m1 a m 2
amn
81
xs
xn
1
2
x
xs
and
x
xs
82
xB
B b
and
c Bx B
c BB b
83
Duality theory
Every linear programming problem (primal) has a dual
problem.
Most problem parameters are estimates, others (as
resource amounts) represent managerial decisions.
The choice of parameter values is made based on a
sensitivity analysis.
Interpretation and implementation of sensitivity
analysis are key uses of duality theory.
86
Primal problem
n
maximize Z
cjxj
minimize W
j 1
bi yi
i 1
subject to
subject to
aij x j
bi , for i 1, 2,
,m
j 1
and
aij yi
c j , for j 1, 2,
,n
0 for i 1, 2,
, m.
i 1
xj
0 for j 1, 2,
, n.
and
yi
87
Duality theory
Relations between parameters:
The coefficients of the objective functions of the primal
are the right-hand sides of the functional constraints in
the dual.
The right-hand side of the functional constraints in the
primal are coefficients of the objective functions in the
dual.
The coefficients of a variable in the functional
constraints of the primal are the coefficients in the
functional constraints of the dual.
88
Primal-dual table
Primal problem
Coefficient of:
Right
side
xn
y1
a11
a12
a1n
b1
y2
a21
a22
a2n
b2
ym
an1
an2
amn
bm
Right
side
c1
c2
Dual problem
x2
Coefficients of
objective function
(minimize)
Coefficient of:
x1
cn
Maximize Z
3 5
subject to
1 0
0 2
3 2
and
x1
x2
Dual problem
x1
x2
Minimize Z
y1 y2 y3
subject to
x1
x2
0
0
4
12
18
y1 y2 y3
and
y1 y2 y3
1 0
0 2
3 2
4
12 ,
18
35
0 0 0.
90
x2
y1
y2
12
y3
18
91
Primal-dual relationships
Weak duality property: If x is a feasible solution for
the primal problem and y is a feasible solution for the
dual problem, then
cx yb
Strong duality property: If x* is an optimal solution for
the primal problem and y* is an optimal solution for
the dual problem, then
cx* = y*b
92
Primal-dual relationships
Complementary solutions property: At each iteration,
the simplex method identifies a CFP solution x for the
primal problem and a complementary solution for the
dual problem, where
cx = yb
If x is not optimal for the primal problem, then y is not
feasible for the dual problem.
93
Primal-dual relationships
Complementary optimal solutions property: At the
final iteration, the simplex method identifies an
optimal solution x* for the primal problem and a
complementary optimal solution y* for the dual
problem, where
cx* = y*b
The yi* are the shadow prices for the primal problem.
94
Primal-dual relationships
Symmetry property: For any primal problem and its
dual problem, all relationships between them must be
symmetric because the dual of this dual problem is
this primal problem.
Duality theorem: The following are the only possible
relationships between the primal and dual problems:
95
Primal-dual relationships
1. If one problem has feasible solutions and a bounded
96
Primal-dual relationships
Relationships between complementary basic solutions
Primal basic
solution
Complementary
dual basic
solution
Suboptimal
Superoptimal
Yes
No
Optimal
Optimal
Yes
Yes
Superoptimal
Suboptimal
No
Yes
No
Dual feasible?
97
Primal-dual relationships
98
99
Original variables
Slack variables
Right side
(0)
(1,2,,m)
Revised
(0)
final tableau (1,2,,m)
z* c y*A c
y*
Z* y *b
A* S * A
S*
b* S * b
New initial
tableau
102
103
105