1 1 © 2003 thomson /south-western slide slides prepared by john s. loucks st. edward’s...
TRANSCRIPT
1 1© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Slides Prepared bySlides Prepared by
JOHN S. LOUCKSJOHN S. LOUCKS
St. Edward’s UniversitySt. Edward’s University
2 2© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Chapter 8Chapter 8Integer Linear ProgrammingInteger Linear Programming
Types of Integer Linear Programming ModelsTypes of Integer Linear Programming Models Graphical and Computer Solutions for an All-Graphical and Computer Solutions for an All-
Integer Linear ProgramInteger Linear Program Applications Involving 0-1 VariablesApplications Involving 0-1 Variables Modeling Flexibility Provided by 0-1 VariablesModeling Flexibility Provided by 0-1 Variables
3 3© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Types of Integer Programming ModelsTypes of Integer Programming Models
An LP in which all the variables are restricted An LP in which all the variables are restricted to be integers is called an to be integers is called an all-integer linear all-integer linear program program (ILP).(ILP).
The LP that results from dropping the integer The LP that results from dropping the integer requirements is called the requirements is called the LP RelaxationLP Relaxation of the of the ILP.ILP.
If only a subset of the variables are restricted If only a subset of the variables are restricted to be integers, the problem is called a to be integers, the problem is called a mixed-mixed-integer linear programinteger linear program (MILP). (MILP).
Binary variables are variables whose values Binary variables are variables whose values are restricted to be 0 or 1. If all variables are are restricted to be 0 or 1. If all variables are restricted to be 0 or 1, the problem is called a restricted to be 0 or 1, the problem is called a 0-1 or binary integer linear program0-1 or binary integer linear program. .
4 4© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
Consider the following all-integer linear Consider the following all-integer linear program:program:
Max 3Max 3xx11 + 2 + 2xx22
s.t. 3s.t. 3xx11 + + xx22 << 9 9
xx11 + 3 + 3xx22 << 7 7
--xx11 + + xx22 << 1 1
xx11, , xx22 >> 0 and integer 0 and integer
5 5© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
LP RelaxationLP Relaxation
Solving the problem as a linear program Solving the problem as a linear program ignoring the integer constraints, the optimal ignoring the integer constraints, the optimal solution to the linear program gives fractional solution to the linear program gives fractional values for both values for both xx11 and and xx22. From the graph on . From the graph on the next slide, we see that the optimal solution the next slide, we see that the optimal solution to the linear program is:to the linear program is:
xx11 = 2.5, = 2.5, xx22 = 1.5, = 1.5, zz = 10.5 = 10.5
6 6© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
LP RelaxationLP Relaxation
LP Optimal (2.5, 1.5)LP Optimal (2.5, 1.5)
Max 3Max 3xx11 + 2 + 2xx22
--xx11 + + xx22 << 1 1
xx22
xx11
33xx11 + + xx22 << 9 9
11
33
22
55
44
1 2 3 4 5 6 71 2 3 4 5 6 7
xx11 + 3 + 3xx22 << 7 7
7 7© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
Rounding UpRounding Up
If we round up the fractional solution (If we round up the fractional solution (xx11 = 2.5, = 2.5, xx22 = 1.5) to the LP relaxation problem, = 1.5) to the LP relaxation problem, we get we get xx11 = 3 and = 3 and xx22 = 2. From the graph on = 2. From the graph on the next slide, we see that this point lies the next slide, we see that this point lies outside the feasible region, making this outside the feasible region, making this solution infeasible.solution infeasible.
8 8© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
Rounded Up SolutionRounded Up Solution
LP Optimal (2.5, 1.5)LP Optimal (2.5, 1.5)
Max 3Max 3xx11 + 2 + 2xx22
--xx11 + + xx22 << 1 1
xx22
xx11
33xx11 + + xx22 << 9 9
11
33
22
55
44
1 2 3 4 5 6 71 2 3 4 5 6 7
ILP Infeasible (3, 2)ILP Infeasible (3, 2)
xx11 + 3 + 3xx22 << 7 7
9 9© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
Rounding DownRounding Down
By rounding the optimal solution down to By rounding the optimal solution down to xx11 = 2, = 2, xx22 = 1, we see that this solution indeed = 1, we see that this solution indeed is an integer solution within the feasible is an integer solution within the feasible region, and substituting in the objective region, and substituting in the objective function, it gives function, it gives zz = 8. = 8.
We have found a feasible all-integer We have found a feasible all-integer solution, but have we found the OPTIMAL all-solution, but have we found the OPTIMAL all-integer solution?integer solution?
------------------------------------------
The answer is NO! The optimal solution The answer is NO! The optimal solution is is xx11 = 3 and = 3 and xx22 = 0 giving = 0 giving zz = 9, as evidenced = 9, as evidenced in the next two slides. in the next two slides.
10 10© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
Complete Enumeration of Feasible ILP SolutionsComplete Enumeration of Feasible ILP Solutions
There are eight feasible integer solutions There are eight feasible integer solutions to this problem:to this problem:
xx11 xx22 zz
1. 0 0 01. 0 0 0 2. 1 0 32. 1 0 3 3. 2 0 63. 2 0 6 4. 3 0 9 optimal 4. 3 0 9 optimal
solutionsolution 5. 0 1 25. 0 1 2 6. 1 1 56. 1 1 5 7. 2 1 87. 2 1 8
8. 1 2 78. 1 2 7
11 11© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
ILP Optimal (3, 0)ILP Optimal (3, 0)
Max 3Max 3xx11 + 2 + 2xx22
--xx11 + + xx22 << 1 1
xx22
xx11
33xx11 + + xx22 << 9 9
11
33
22
55
44
1 2 3 4 5 6 71 2 3 4 5 6 7
xx11 + 3 + 3xx22 << 7 7
12 12© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
Partial Spreadsheet Showing Problem DataPartial Spreadsheet Showing Problem Data
A B C D12 Constraint X1 X2 RHS
3 #1 3 1 9
4 #2 1 3 7
5 #3 -1 1 1
6 Obj.Coefficients 3 2
LHS Coefficients
13 13© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
Partial Spreadsheet Showing FormulasPartial Spreadsheet Showing Formulas
A B C D
8 X1 X2
9
10 =B6*C9+C6*D9
11
12 Constraints LHS RHS
13 #1 =B3*$C$9+C3*$D$9 <= 9
14 #2 =B4*$C$9+C4*$D$9 <= 7
15 #3 =B5*$C$9+C5*$D$9 <= 1
Maximized Objective Function
Optimal Decision Variable Values
14 14© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: All-Integer LPExample: All-Integer LP
Partial Spreadsheet Showing Optimal SolutionPartial Spreadsheet Showing Optimal Solution
A B C D
8 X1 X2
9 3.000 2.9419E-12
10 9.000
11
12 Constraints LHS RHS
13 #1 9 <= 9
14 #2 3 <= 7
15 #3 -3 <= 1
Maximized Objective Function
Optimal Decision Variable Values
15 15© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Special 0-1 ConstraintsSpecial 0-1 Constraints
When When xxii and and xxjj represent binary variables represent binary variables designating whether projects designating whether projects ii and and jj have been have been completed, the following special constraints may be completed, the following special constraints may be formulated:formulated:
•At most At most kk out of out of nn projects will be completed: projects will be completed: xxjj << kk jj
•Project Project jj is is conditionalconditional on project on project ii: :
xxjj - - xxii << 0 0
•Project Project ii is a is a corequisitecorequisite for project for project jj: :
xxjj - - xxii = 0 = 0
•Projects Projects ii and and jj are are mutually exclusivemutually exclusive: :
xxii + + xxjj << 1 1
16 16© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Metropolitan Microwaves, Inc. is planning Metropolitan Microwaves, Inc. is planning to expand its operations into other electronic to expand its operations into other electronic appliances. The company has identified seven appliances. The company has identified seven new product lines it can carry. Relevant new product lines it can carry. Relevant information about each line follows on the next information about each line follows on the next slide. slide.
17 17© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Initial Floor Space Exp. Rate Initial Floor Space Exp. Rate
Product Line Product Line Invest. (Sq.Ft.) of Invest. (Sq.Ft.) of ReturnReturn
1. Black & White TVs1. Black & White TVs $ 6,000 125$ 6,000 125 8.1% 8.1%2. Color TVs 2. Color TVs 12,000 150 12,000 150
9.0 9.0 3. Large Screen TVs 3. Large Screen TVs 20,000 200 20,000 200 11.0 11.0 4. VHS VCRs 4. VHS VCRs 14,000 40 14,000 40 10.2 10.2 5. Beta VCRs 5. Beta VCRs 15,000 40 15,000 40
10.5 10.5 6. Video Games 6. Video Games 2,000 20 2,000 20
14.1 14.1 7. Home Computers 7. Home Computers 32,000 100 32,000 100 13.2 13.2
18 18© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Metropolitan has decided that they should Metropolitan has decided that they should not stock large screen TVs unless they stock not stock large screen TVs unless they stock either B&W or color TVs. Also, they will not stock either B&W or color TVs. Also, they will not stock both types of VCRs, and they will stock video both types of VCRs, and they will stock video games if they stock color TVs. Finally, the games if they stock color TVs. Finally, the company wishes to introduce at least three new company wishes to introduce at least three new product lines. product lines.
If the company has $45,000 to invest and If the company has $45,000 to invest and 420 sq. ft. of floor space available, formulate an 420 sq. ft. of floor space available, formulate an integer linear program for Metropolitan to integer linear program for Metropolitan to maximize its overall expected rate of return.maximize its overall expected rate of return.
19 19© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Define the Decision VariablesDefine the Decision Variables
xxjj = 1 if product line = 1 if product line jj is introduced; is introduced;
= 0 otherwise.= 0 otherwise.
Define the Objective FunctionDefine the Objective Function
Maximize total overall expected return:Maximize total overall expected return:
Max .081(6000)Max .081(6000)xx11 + .09(12000) + .09(12000)xx22 + .11(20000)+ .11(20000)xx33
+ .102(14000)+ .102(14000)xx4 4 + .105(15000)+ .105(15000)xx55 + .141(2000)+ .141(2000)xx66
+ .132(32000)+ .132(32000)xx77
20 20© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Define the ConstraintsDefine the Constraints
1) Money: 1) Money:
66xx11 + 12 + 12xx22 + 20 + 20xx33 + 14 + 14xx44 + 15 + 15xx55 + 2 + 2xx66 + + 3232xx77 << 45 45
2) Space: 2) Space:
125125xx11 +150 +150xx22 +200 +200xx33 +40 +40xx44 +40 +40xx55 +20 +20xx66 +100+100xx77 << 420 420
3) Stock large screen TVs only if stock B&W or 3) Stock large screen TVs only if stock B&W or color:color:
xx11 + + xx22 > > xx33 or or xx11 + + xx22 - - xx33 >> 0 0
21 21© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Define the Constraints (continued)Define the Constraints (continued)
4) Do not stock both types of VCRs: 4) Do not stock both types of VCRs:
xx44 + + xx55 << 1 1
5) Stock video games if they stock color TV's: 5) Stock video games if they stock color TV's:
xx22 - - xx66 >> 0 0
6) At least 3 new lines:6) At least 3 new lines:
xx11 + + xx22 + + xx33 + + xx44 + + xx55 + + xx66 + + xx77 >> 3 3
7) Variables are 0 or 1: 7) Variables are 0 or 1:
xxjj = 0 or 1 for = 0 or 1 for jj = 1, , , 7 = 1, , , 7
22 22© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Partial Spreadsheet Showing Problem DataPartial Spreadsheet Showing Problem Data
A B C D E F G H I
1
2 Constraints X1 X2 X3 X4 X5 X6 X7 RHS
3 #1 6 12 20 14 15 2 32 45
4 #2 125 150 200 40 40 20 100 420
5 #3 1 1 -1 0
6 #4 1 1 1
7 #5 1 -1 0
8 #6 1 1 1 1 1 1 1 3
9 Obj.Func.Coeff. 486 1080 2200 1428 1575 282 4224
LHS Coefficients
23 23© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Partial Spreadsheet Showing Example FormulasPartial Spreadsheet Showing Example Formulas
A B C D E F G H
12 X1 X2 X3 X4 X5 X6 X7
13 Dec.Values 0 0 0 0 0 0 0
14 Maximized Total Expected Return #
15
16 LHS RHS
17 0 <= 45
18 0 <= 420
19 0 >= 0
20 0 <= 1
21 ## >= 0
22 0 >= 3
Video
Lines
VCRs
TVs
Constraints
Money
Space
24 24© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Solver Parameters Dialog BoxSolver Parameters Dialog Box
Solver ParametersSolver Parameters
Set Target Cell:Set Target Cell:
Equal To:Equal To:
By Changing Cells:By Changing Cells:
Reset AllReset All
X?
HelpHelp
CloseClose
SolveSolve
OptionsOptions
MMaxax MiMinn VValue of:alue of:
$B$13:$H$13$B$13:$H$13
Subject to the Constraints:Subject to the Constraints:
DeleteDelete
ChangeChange
GuessGuess
AddAdd$B$13:$H$13 = binary$D$17:$D$18 <= $H$17:$H$18$D$19 >= $H$19$D$20 <= $H$20
$B$13:$H$13 = binary$D$17:$D$18 <= $H$17:$H$18$D$19 >= $H$19$D$20 <= $H$20
25 25© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Metropolitan MicrowavesExample: Metropolitan Microwaves
Solver Options Dialog BoxSolver Options Dialog Box
•Select Select Assume Linear ModelAssume Linear Model
•Select Select Assume Non-negativeAssume Non-negative
•Set Set ToleranceTolerance equal to 0 equal to 0
26 26© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Tom’s TailoringExample: Tom’s Tailoring
Tom's Tailoring has five idle tailors and four Tom's Tailoring has five idle tailors and four custom garments to make. The estimated time (in custom garments to make. The estimated time (in hours) it would take each tailor to make each hours) it would take each tailor to make each garment is shown in the next slide. (An 'X' in the garment is shown in the next slide. (An 'X' in the table indicates an unacceptable tailor-garment table indicates an unacceptable tailor-garment assignment.)assignment.)
TailorTailor
GarmentGarment 11 22 33 44 55
Wedding gown 19 23 20 21 18Wedding gown 19 23 20 21 18 Clown costume 11 14 X 12 10Clown costume 11 14 X 12 10 Admiral's uniform 12 8 11 X 9Admiral's uniform 12 8 11 X 9 Bullfighter's outfit X 20 20 18 21Bullfighter's outfit X 20 20 18 21
27 27© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Tom’s TailoringExample: Tom’s Tailoring
Formulate an integer program for Formulate an integer program for determining the tailor-garment assignments that determining the tailor-garment assignments that minimize the total estimated time spent making minimize the total estimated time spent making the four garments. No tailor is to be assigned the four garments. No tailor is to be assigned more than one garment and each garment is to more than one garment and each garment is to be worked on by only one tailor.be worked on by only one tailor.
----------------------------------------
This problem can be formulated as a 0-1 This problem can be formulated as a 0-1 integer program. The LP solution to this problem integer program. The LP solution to this problem will automatically be integer (0-1).will automatically be integer (0-1).
28 28© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Tom’s TailoringExample: Tom’s Tailoring
Define the decision variablesDefine the decision variables
xxijij = 1 if garment i is assigned to tailor = 1 if garment i is assigned to tailor jj
= 0 otherwise.= 0 otherwise.
Number of decision variables = Number of decision variables =
[(number of garments)(number of tailors)] [(number of garments)(number of tailors)]
- (number of unacceptable assignments) - (number of unacceptable assignments)
= [4(5)] - 3 = 17= [4(5)] - 3 = 17
29 29© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Tom’s TailoringExample: Tom’s Tailoring
Define the objective functionDefine the objective function
Minimize total time spent making garments:Minimize total time spent making garments:
Min 19Min 19xx1111 + 23 + 23xx1212 + 20 + 20xx1313 + 21 + 21xx1414 + 18 + 18xx1515 + + 1111xx2121
+ 14+ 14xx2222 + 12 + 12xx2424 + 10 + 10xx2525 + 12 + 12xx3131 + 8 + 8xx3232 + + 1111xx3333
+ 9x+ 9x3535 + 20 + 20xx4242 + 20 + 20xx4343 + 18 + 18xx4444 + 21 + 21xx4545
30 30© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Tom’s TailoringExample: Tom’s Tailoring
Define the ConstraintsDefine the Constraints
Exactly one tailor per garment:Exactly one tailor per garment:
1) 1) xx1111 + + xx1212 + + xx1313 + + xx1414 + + xx1515 = 1 = 1
2) 2) xx2121 + + xx2222 + + xx2424 + + xx2525 = 1 = 1
3) 3) xx3131 + + xx3232 + + xx3333 + + xx3535 = 1 = 1
4) 4) xx4242 + + xx4343 + + xx4444 + + xx4545 = 1 = 1
31 31© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Tom’s TailoringExample: Tom’s Tailoring
Define the Constraints (continued)Define the Constraints (continued)
No more than one garment per tailor:No more than one garment per tailor:
5) 5) xx1111 + + xx2121 + + xx3131 << 1 1
6) 6) xx1212 + + xx2222 + + xx3232 + + xx4242 << 1 1
7) 7) xx1313 + + xx3333 + + xx4343 << 1 1
8) 8) xx1414 + + xx2424 + + xx4444 << 1 1
9) 9) xx1515 + + xx2525 + + xx3535 + + xx4545 << 1 1
Nonnegativity: Nonnegativity: xxijij >> 0 for 0 for ii = 1, . . ,4 and = 1, . . ,4 and jj = = 1, . . ,5 1, . . ,5