Linear Programming

advertisement
Linear Programming
Operations Management
Dr. Ron Lembke
Motivating Example

Suppose you are an entrepreneur making
plans to make a killing over the summer by
traveling across the country selling
products you design and manufacture
yourself. To be more straightforward, you
plan to follow the Dead all summer, selling
t-shirts.
Example




You are really good with tie-dye, so you earn a
profit of $25 for each t-shirt.
The sweatshirt screen-printed sweatshirt makes
a profit of $20.
You have 4 days before you leave, and you want
to figure out how many of each to make before
you head out for the summer.
You plan to work 14 hours a day on this. It takes
you 30 minutes per tie dye, and 15 minutes to
make a sweatshirt.
Example
You have a limited amount of space in the
van. Being an engineer at heart, you
figure:
 If
you cram everything in the van, you have 40
cubit feet of space in the van.
 A tightly packed t-shirt takes 0.2 ft3
 A tightly packed sweatshirt takes 0.5 ft3.
How many of each should you make?
Summary
Van:
Tshirt:
Sshirt:
40.0 ft3
0.2 ft3
0.5 ft3
14
4
30
15
hrs / day
days
min / tshirt
min / Sshirt
How many should we make of each?
Linear Programming
What we have just done is called “Linear
Programming.”
 Has nothing to do with computer
programming
 Invented in WWII to optimize military
“programs.”
 “Linear” because no x3, cosines, x*y, etc.

Standard Form

Linear programs are written the following way:
Max 3x + 4y
s.t.
x + y <= 10
x + 2y <= 12
x
>= 0
y >= 0
Standard Form

Linear programs are written the following way:
Objective Coefficients
Objective
Function
Constraints
Non-negativity
Constraints
Max 3x + 4y
s.t.
x + y <= 10
x + 2y <= 12
x
>= 0
y >= 0
LHS (left hand side)
RHS (right hand side)
inequalities
Example 2
- 4 hrs electronics work

- 2 hrs assembly time
 DVD
- 3 hrs assembly time

- 1 hrs assembly time
 Hours available: 240 (elect) 100 (assy)
 Profit / unit: mp3 $7, DVD $5
X1 = number of mp3 players to make
X2 = number of DVD players to make

mp3
Standard Form
Max 7x1 + 5x2
s.t. 4x1 + 3x2
2x1 + 1x2
x1
x2
<=
<=
>=
>=
240
100
0
0
electronics
assembly
Graphical Solution
100
80
X2 60
mp3
40
20
0
0
20
40
X1 DVD players
60
80
Graphical Solution
X1 = 0, X2 = 80
100
80
X2 60
mp3
40
X1 = 60, X2 = 0
20
0
0
20
40
X1 DVD players
60
80
Graphical Solution
X1 = 0, X2 = 100
100
80
X2 60
mp3
40
X1 = 50, X2 = 0
20
0
0
20
40
X1 DVD players
60
80
Graphical Solution
100
80
Feasible Region – Satisfies all constraints
X2 60
mp3
40
20
0
0
20
40
X1 DVD players
60
80
Isoprofit Lnes
100
80
X2 60
Isoprofit Line:
mp3
$7X1 + $5X2 = $210
(0, 42) 40
20
0
0
20
40
(30,0)
X1 DVD players
60
80
Isoprofit Lines
100
80
X2 60
$280
mp3
40
$210
20
0
0
20
40
X1 DVD players
60
80
Isoprofit Lines
100
80
$350
X2 60
$280
mp3
40
$210
20
0
0
20
40
X1 DVD players
60
80
Isoprofit Lines
100
(0, 82)
80
$7X1 + $5X2 = $410
X2 60
mp3
40
20
(58.6, 0)
0
0
20
40
X1 DVD players
60
80
Mathematical Solution
Obviously, graphical solution is slow
 We can prove that an optimal solution
always exists at the intersection of
constraints.
 Why not just go directly to the places
where the constraints intersect?

Constraint Intersections
100
X1 = 0 and 4X1 + 3X2 <= 240
So X2 = 80
(0, 80) 80
X2 60
mp3
40
4X1 + 3X2 <= 240
20
0
(0, 0)
0
20
40
X1 DVD players
60
80
Constraint Intersections
100
(0, 80) 80
X2 60
mp3
X2 = 0 and 2X1 + 1X2 <= 100
So X1 = 50
40
20
0
(0, 0)
0
20
40
(50, 0) 60
X1 DVD players
80
Constraint Intersections
4X1+ 3X2 <= 240
2X1 + 1X2 <= 100 – multiply by -2
100
4X1+ 3X2 <= 240
-4X1 -2X2 <= -200 add rows together
(0, 80) 80
0X1+ 1X2 <= 40 X2 = 40 substitute into #2
X2 60
2X1+ 40 <= 100 So X1 = 30
mp3
40
20
0
(0, 0)
0
20
40
(50, 0) 60
X1 DVD players
80
Constraint Intersections
100
Find profits of each point.
(0, 80) 80
$400
X2 60
mp3
(30,40)
$410
40
20
(50, 0)
$350
0
(0, 0)
$0
0
20
40
X1 DVD players
60
80
Do we have to do this?
Obviously, this is not much fun: slow and
tedious
 Yes, you have to know how to do this to
solve a two-variable problem.
 We won’t solve every problem this way.

Constraint Intersections
Start at (0,0), or some other easy feasible point.
1. Find a profitable direction to go along an edge
2. Go until you hit a corner, find profits of point.
3. If new is better, repeat, otherwise, stop.
100
Good news:
Excel can do
this for us.
80
60
mp3
X2 40
20
0
0
20
40
60
X1 DVD players
80
Formulating in Excel
1.
2.
3.
4.
Write the LP out on paper, with all
constraints and the objective function.
Decide on cells to represent variables.
Enter coefficients of each variable in
each constraint in a block of cells.
Compute amount of each constraint
being used by current solution.
Current solution
Amount of each
constraint used
by current solution
Formulating in Excel
5. Place inequalities in sheet, so you
remember <=, >=
6. Enter amount of each constraint
7. Enter objective coefficients
8. Calculate value of objective function
9. Make sure you have plenty of labels.
10. Widen columns for readability.
Objective
Function
value of current
solution
RHS of constraints,
Inequality signs.
Solving in Excel
All we have so far is a big ‘what if” tool. We
need to tell the LP Solver that this is an
LP that it can solve.
 Choose ‘Solver’ from ‘Tools’ menu
Solving in Excel
1.
2.
3.
Choose ‘Solver’ from ‘Tools’ menu
Tell Solver what is the objective function,
and which are variables.
Tell Solver to minimize or maximize
Solving in Excel
1.
2.
3.
4.
Choose ‘Solver’ from ‘Tools’ menu
Tell Solver what is the objective function, and
which are variables.
Tell Solver to minimize or maximize
Add constraints:


5.
Click ‘Add’, enter LHS, RHS, choose inequality
Click ‘Add’ if you need to do more, or click ‘Ok’ if
this is the last one.
Add rest of constraints
Add Constraint Dialog Box
Constraints Added
Assuming Linear
6.
You have to tell Solver that the model is
Linear. Click ‘options,’ and make sure
the ‘Assume Linear Model’ box is
checked.
Assume Linear
Assuming Linear
6.
7.
You have to tell Solver that the model is
Linear. Click ‘options,’ and make sure the
‘Assume Linear Model’ box is checked.
On this box, checking “assume non-negative”
means you don’t need to actually add the nonnegativity constraints manually.
Solve the LP: Click ‘Solve.’ Look at Results.
Solution is Found
When a solution has been found, this box comes up.
You can choose between keeping the solution and going
back to your original solution.
Highlight the reports that you want to look at.
Solution
After clicking on the reports you want
generated, they will be generated on new
worksheets.
 You will return to the workbook page you
were at when you called up Solver.
 It will show the optimal solution that was
found.

Optimal Solution
Answer Report
Gives optimal and initial values of
objective function
 Gives optimal and initial values of
variables
 Tells amount of ‘slack’ between LHS and
RHS of each constraint, tells whether
constraint is binding.

Answer Report
Microsoft Excel 11.0 Answer Report
Worksheet: [lp_sony.xls]Sheet1
Report Created: 1/14/2004 3:30:08 PM
Target Cell (Max)
Cell
Name
$E$2 Objective Actual
Original Value
12
Final Value
410
Adjustable Cells
Cell
Name
$C$4 Variables DVD
$D$4 Variables mp3
Original Value
1
1
Final Value
30
40
Constraints
Cell
Name
$E$6 Electronics Actual
$E$7 Assembly Actual
$E$8 DVD Non-Neg Actual
Cell Value
Formula
240 $E$6<=$G$6
100 $E$7<=$G$7
30 $E$8>=$G$8
Status
Binding
Binding
Not Binding
Slack
0
0
30
Sensitivity Report
Variables:
 Final value of each variable
 Reduced cost: how much objective
changes if current solution is changed
 Objective coefficient (from problem)
Sensitivity Report
Variables:
 Allowable increase:
How much the objective coefficient can go up
before the optimal solution changes.

Allowable decrease
How much the objective coefficient can go
down before optimal solution changes.

Up to 24.667, Down to 23.333
Sensitivity Report
Constraints
 Final Value (LHS)
 Shadow price: how much objective would
change if RHS increased by 1.0
 Allowable increase, decrease: how wide a
range of values of RHS shadow price is
good for.
Sensitivity Report
Microsoft Excel 11.0 Sensitivity Report
Worksheet: [lp_sony.xls]Sheet1
Report Created: 1/14/2004 3:30:08 PM
Adjustable Cells
Cell
Name
$C$4 Variables DVD
$D$4 Variables mp3
Final
Reduced
Value
Cost
30
0
40
0
Objective
Coefficient
7
5
Allowable
Increase
3
0.25
Final
Value
240
100
Constraint
R.H. Side
240
100
Allowable
Increase
60
20
Constraints
Cell
Name
$E$6 Electronics Actual
$E$7 Assembly Actual
Shadow
Price
1.5
0.5
Limits Report
Tells ranges of values over which the
maximum and minimum objective values
can be found.
 Rarely useful

Limits Report
Microsoft Excel 11.0 Limits Report
Worksheet: [lp_sony.xls]Limits Report 2
Report Created: 1/14/2004 3:30:08 PM
Target
Cell
Name
$E$2 Objective Actual
Adjustable
Cell
Name
$C$4 Variables DVD
$D$4 Variables mp3
Value
410
Value
30
40
Lower
Target
Limit
Result
2.377E-12
200
2.017E-11
210
Upper Target
Limit
Result
30
410
40.00 410.000
Download