Linear Programming

advertisement
Linear Programming
Topics
• General optimization model
• LP model and assumptions
• Manufacturing example
• Characteristics of solutions
• Sensitivity analysis
• Excel add-ins
Deterministic OR Models
Most of the deterministic OR models can be formulated as
mathematical programs.
"Program" in this context, has to do with a “plan” and not a
computer program.
Mathematical Program
Maximize / Minimize z = f (x1,x2,…,xn)
Subject to
gi(x1,x2,…,xn)
{}


=
xj ≥ 0, j = 1,…,n
bi , i =1,…,m
Model Components
• xj are called decision variables. These are things
that you control
• gi(x1,x2,…,xn)
{}


=
bi are called structural
(or functional or technological) constraints
• xj ≥ 0 are nonnegativity constraints
• f (x1,x2,…,xn) is the objective function
Feasibility and Optimality
( )
x1
• A feasible solution x =
.
.
.
satisfies all the
xn
constraints (both structural and nonnegativity)
• The objective function ranks the feasible solutions;
call them x1, x2, . . . , xk. The optimal solution is the
best among these. For a minimization objective, we
have z* = min{ f (x1), f (x2), . . . , f (xk) }.
Linear Programming
A linear program is a special case of a mathematical
program where f(x) and g1(x) ,…, gm(x) are linear
functions
Linear Program:
Maximize/Minimize z = c1x1 + c2x2 + • • • + cnxn
Subject to ai1x1 + ai2x2 + • • • + ainxn
xj  uj, j = 1,…,n
xj  0, j = 1,…,n
{}


=
bi , i = 1,…,m
LP Model Components
xj  uj are called simple bound constraints
x = decision vector = "activity levels"
aij , cj , bi , uj are all known data
 goal is to find x = (x1,x2,…,xn)T
(the symbol “ T ” means)
Linear Programming Assumptions
(i) proportionality
(ii) additivity
(iii) divisibility
(iv) certainty
linearity
Explanation of LP Assumptions
(i) activity j’s contribution to objective function is cjxj
and usage in constraint i is aijxj
both are proportional to the level of activity j
(volume discounts, set-up charges, and nonlinear
efficiencies are potential sources of violation)
(ii) no “cross terms” such as 12 x1x5 may not
appear in the objective or constraints.
Explanation of LP Assumptions (cont’d)
(iii) Fractional values for decision variables are permitted
(iv) Data elements aij , cj , bi , uj are known with
certainty
• Nonlinear or integer programming models should be
used when some subset of assumptions (i), (ii) and
(iii) are not satisfied.
• Stochastic models should be used when a problem
has significant uncertainties in the data that must be
explicitly taken into account [a relaxation of
assumption (iv)].
Product Structure for
Manufacturing Example
Machines A,B,C,D
Available time:
2400 min/week
Operating expenses:
$6000/week
P
Revenue:
$90/unit
Max sales:
100 units/week
Purchased
part:
$5/unit
Q
Revenue:
$100/unit
Max sales:
40 units/week
D
15 min/unit
D
10 min/unit
R
Revenue:
$70/unit
Max sales:
60 units/week
C
16 min/unit
C
9 min/unit
C
6 min/unit
B
16 min/unit
A
20 min/unit
B
12 min/unit
A
10 min/unit
RM1
$20/unit
RM2
$20/unit
RM3
$20/unit
Component 1
Component 2
Component 3
Data for Manufacturing Example
Machine data
Machine \ Product
A
B
C
D
Total processing time
Unit processing times
(min)
P
Q
20
10
12
28
15
6
10
15
57
59
Availability
(min)
R
10
16
16
0
42
2400
2400
2400
2400
Product data
Revenue per unit
Material cost per unit
Profit per unit
Maximum sales
P
Q
R
$90
$45
$45
100
100
$40
$60
40
$70
$20
$50
60
Data Summary
Selling price/unit
Raw Material cost/unit
Maximum sales
Minutes/unit on A
B
C
D
P
Q
R
90
45
100
20
12
15
10
100
40
40
10
28
6
15
70
20
60
10
16
16
0
Machine Availability: 2400 min/wk
Structural
coefficients
Operating Expenses = $6,000/wk (fixed cost)
Decision Variables
xP = # of units of product P to produce per week
xQ = # of units of product Q to produce per week
xR = # of units of product R to produce per week
LP Formulation
max z = 45 xP + 60 xQ + 50 xR – 6000
s.t. 20 xP + 10 xQ + 10 xR  2400
12 xP + 28 xQ + 16 xR  2400
15 xP + 6 xQ + 16 xR  2400
10 xP + 15 xQ + 0 xR  2400
xP  100, xQ  40, xR  60
Are we done?
xP  0, xQ  0, xR  0
Objective Function
Structural
constraints
demand
nonnegativity
Are the LP assumptions
valid for this problem?
= 81.82, x *Q = 16.36, x *R = 60
Optimal solution x *
P
Discussion of Results for
Manufacturing Example
• Optimal objective value is $7,664 but when we
subtract the weekly operating expenses of
$6,000 we obtain a weekly profit of $1,664.
• Machines A & B are being used at maximum
level and are bottlenecks.
• There is slack production capacity in
Machines C & D.
How would we solve model using
Excel Add-ins ?
Solution to Manufacturing Example
Linear Model
TRUE
FALSE
TRUE
FALSE
FALSE
100
100
0
60
0
Ph. 1 Iter.
Solver: Jensen LP/IP
Name: PQR
4
Total Iter.
Type: Linear
Type: LP1
Comp. Time 00:00
Sens.: Yes
Goal: Max
Change
Status Optimal
Side: No
Objective: 7663.6
Solve Select the Relink Buttons command from the OR_MM menu before clicking a button.
3
2
1
Variables
R
Q
P
Name:
Change Relation
60
81.818 16.364
Values:
0
0
0
Lower Bounds:
60
40
100
Upper Bounds:
Linear Obj. Coef.:
Constraints
Num. Name
MachA
1
MachB
2
MachC
3
MachD
4
Linear Model
Value
2400
2400
2285.5
1063.6
Rel.
<=
<=
<=
<=
Name:
RHS
2400
2400
2400
2400
PQR
45
60
50
Linear Constraint Coefficients
10
10
20
16
28
12
16
6
15
0
15
10
Solver: Jensen LP/IP
Ph. 1 Iter.
8
Characteristics of Solutions to LPs
A Graphical Solution Procedure (LPs with 2 decision variables
can be solved/viewed this way.)
1. Plot each constraint as an equation and then decide which
side of the line is feasible (if it’s an inequality).
2. Find the feasible region.
3. Plot two iso-profit (or iso-cost) lines.
4. Imagine sliding the iso-profit line in the improving direction.
The “last point touched” as the iso-profit line leaves the
feasible region region is optimal.
Two-Dimensional Machine
Scheduling Problem -- let xR = 60
max z = 45 xP + 60 xQ + 3000
s.t.
20
12
15
10
xP
xP
xP
xP
+
+
+
+
10 xQ
28 xQ
6 xQ
15 xQ




1800
1440
2040
2400
xP  100, xQ  40
xP  0, xQ  0
Objective Function
Structural
constraints
demand
nonnegativity
Feasible Region for Manufacturing
Example
P
240
Max Q
200
D
160
120
Max P
80
A
40
0
C
B
0
40
80 120
160
200 240 280 320
360
Q
Iso-Profit Lines and Optimal Solution for
Example
P
Optimal solution = (16.36, 81.82)
120
Max Q
100
80
A
60
40
Z = $4664
20
Z = $3600
B
0
0
10
20
30
40
50
60
Q
Possible Outcomes of an LP
1. Unique Optimal Solution
2. Multiple optimal solutions : Max 3x1 + 3x2
s.t. x1+ x2  1
x1, x2  0
3. Infeasible :
feasible region is empty; e.g., if the
constraints include
x1+ x2  6 and x1+ x2  7
4. Unbounded :
Max 15x1+ 7x2
s.t. x1 + x2  1
x1, x2  0
(no finite optimal
solution)
Note: multiple optimal solutions occur in many practical (real-world) LPs.
Example with Multiple Optimal
Solutions
x2
z1
z2
z3
Maximize z = 3x1 – x2
4
subject to 15x1 – 5x2  30
3
10x1 + 30x2  120
2
1
x1  0, x2  0
0
0
1
2
3
4
x1
Bounded Objective Function with
Unbound Feasible Region
z3
x2
z2
Maximize z = –x1 + x2
z1
4
subject to
3
–x1 + 4x2  10
–3x1 + 2x2  2
2
1
x1  0, x2  0
0
0
1
2
3
4
x1
Inconsistent constraint system
x2
Maximize z = x1 + x2
4
subject to
3
3x1 + x2  6
3x1 + x2  3
2
1
0
0
1
2
3
4
x1  0, x2  0
x1
Constraint system allowing only
nonpositive values for x1 and x2
x1
–4
–3
–2
–1
0
0
–1
–2
–3
–4
x2
Maximize z = x1 + x2
subject to
x1 – 2x2  0
–x1
+x2  1
x1  0, x2  0
Sensitivity Analysis
Shadow Price (dual variable) on Constraint i
Amount object function changes with unit increase
in RHS, all other coefficients held constant
Objective Function Coefficient Ranging
Allowable increase & decrease for which
current optimal solution is valid
RHS Ranging
Allowable increase & decrease for which
shadow prices remain valid
Solution to Manufacturing Example
Linear Model
TRUE
FALSE
TRUE
FALSE
FALSE
100
100
0
60
Name: PQR
Solver: Jensen LP/IP
Ph. 1 Iter.
0
Type: LP1
Type: Linear
Total Iter.
4
Change
Goal: Max
Sens.: Yes
Comp. Time 00:00
Objective: 7663.6
Side: No
Status Optimal
Solve Select the Relink Buttons command from the OR_MM menu before clicking a button.
Variables
1
2
3
Change Relation
Name:
P
Q
R
Values:
81.818 16.364
60
Lower Bounds:
0
0
0
Upper Bounds:
100
40
60
Linear Obj. Coef.:
Constraints
Num. Name
1
MachA
2
MachB
3
MachC
4
MachD
Linear Model
Value
2400
2400
2285.5
1063.6
Rel.
<=
<=
<=
<=
Name:
RHS
2400
2400
2400
2400
PQR
45
60
50
Linear Constraint Coefficients
20
10
10
12
28
16
15
6
16
10
15
0
Solver: Jensen LP/IP
Ph. 1 Iter.
8
Sensitivity Analysis with Add-ins
Microsoft Excel 9.0 Sensitivity Report
Worksheet: [ch02.xls]PQR_S
Report Created: 5/5/2002 8:08:50 PM
Adjustable Cells
Cell
$H$8
$I$8
$J$8
Name
Values: P
Values: Q
Values: R
Final
Reduced
Objective
Allowable
Allowable
Value
Cost
Coefficient
Increase
Decrease
81.81818182
0
45 38.33333333 19.28571429
16.36363636
0
60
23
37.5
60 10.45454545
50
1E+30 10.45454545
Constraints
Cell
$D$15
$D$16
$D$17
$D$18
Name
MachA Value
MachB Value
MachC Value
MachD Value
Final
Shadow
Constraint
Allowable
Allowable
Value
Price
R.H. Side
Increase
Decrease
2400 1.227272727
2400 144.8275862 866.6666667
2400 1.704545455
2400
520
360
2285.454545
0
2400
1E+30 114.5454545
1063.636364
0
2400
1E+30 1336.363636
What You Should Know
About Linear Programming
•
•
•
•
What the components of a problem are.
How to formulate a problem.
What the assumptions are underlying an LP.
How to find a solution to a 2-dimensional
problem graphically.
• Possible solutions.
• How to solve an LP with the Excel add-in.
Download