Upload
clara-murphy
View
223
Download
0
Embed Size (px)
DESCRIPTION
3 Ardavan Asef-Vaziri June-2013Integer Programming Now suppose we have an easy problem with n variables. Therefore, the solution time is proportional to n 2. We have solved this problem in 1 hour using a computer with 5 GHz CPU. Suppose we have a new computer with its processing capabilities times of a 5 GHz computer, and we have one century time. What is the size of the largest problem that we can solve with this revolutionary computer in one century (100 years and about hours per year). 1 n21 n2 (10000) (100)(10000)(n+x) 2 Computational Complexity
Citation preview
Integer Programming
2Ardavan Asef-Vaziri June-2013Integer Programming
Computationally speaking, we can partition problems into two categories. Easy Problems and Hard Problems
We can say that easy problem ( or in some languages polynomial problems) are those problems with their solution time proportional to nk. Where n is the number of variables in the problem, and k is a constant, say 2, 3, 4 … Let’s assume that k = 2.
Therefore, easy problems are those problems with their solution time proportional to n2. Where n is the number of variables in the problem.
Difficult problems are those problems with their solution time proportional to kn, or in our case 2n.
Computational Complexity
3Ardavan Asef-Vaziri June-2013Integer Programming
Now suppose we have an easy problem with n variables. Therefore, the solution time is proportional to n2 . We have solved this problem in 1 hour using a computer with 5 GHz CPU.
Suppose we have a new computer with its processing capabilities 10000 times of a 5 GHz computer, and we have one century time. What is the size of the largest problem that we can solve with this revolutionary computer in one century (100 years and about 10000 hours per year).
1 n2
(10000) (100)(10000) (n+x)2
Computational Complexity
4Ardavan Asef-Vaziri June-2013Integer Programming
1 n2
(10)10 (n+x)2
1 (n+x)2 = (10)10 n2
(n+x)2 / n2 = (10)10
(n+x / n ) 2 = (10)10
n+x / n = (10)5 = 100000
n+x = 100,000nThe number of variables in the new problem is 100,000 times greater that the number of variables in the old problem.
Computational Complexity
5Ardavan Asef-Vaziri June-2013Integer Programming
Now supposed we have a hard problem with n variables. Therefore, the solution time is proportional to 2n . We have solved this problem in one hour using a computer with 900 MHz CPU.
Suppose we have a new computer with 900,000 MHz CPU, and we have one century time. What is the size of the largest problem that we can solve in one century using a 900, 000 MHz CPU.
1 2n
(10)10 2(n+x)
Computational Complexity
6Ardavan Asef-Vaziri June-2013Integer Programming
1 2n
(10)10 2(n+x)
(1) 2(n+x) = (10)102n
2(n+x) / 2n = (10)10
2x = (10)10
log 2x = log (10)10
x log 2 = 10 log (10)x ( .301) = 10(1)x = 33The number of variables in the new problem is 33 variables greater that the number of variables in the old problem.
Computational Complexity
7Ardavan Asef-Vaziri June-2013Integer Programming
1,02,1
021
2
011
1
XX
Otherwiseselectedisprojectif
X
Otherwiseselectedisprojectif
X
Working with Binary Variables
8Ardavan Asef-Vaziri June-2013Integer Programming
1- Exactly one of the two projects is selectedX1+X2 =1 2- At least one of the two projects is selectedX1+X2 ≥1 3-At most one of the two projects is selectedX1+X2 ≤1 4- None of the projects should be selectedX1+X2 =05- Both projects must be selectedX1+X2 =26- none, or one or both of projects are selected7- If project 1 is selected then project 2 must be selectedX2 ≥ X18- If project 1 is selected then project 2 could not be selectedX1+X2 ≤1 !!!
Binary Variables
9Ardavan Asef-Vaziri June-2013Integer Programming
1,05,4,3,2,10
515
041
4
031
3
021
2
011
1
XXXXXOtherwise
selectedisprojectifX
Otherwiseselectedisprojectif
X
Otherwiseselectedisprojectif
X
Otherwiseselectedisprojectif
X
Otherwiseselectedisprojectif
X
More Practice
10Ardavan Asef-Vaziri June-2013Integer Programming
Either project 1&2 or projects 3&4&5 are selectedX1=X2X3=X4=X5X1+X3=1Suppose Y1 is our production of product 1 .
Due to technical considerations, we want one of the following two constraints to be satisfied.
If the other one is also satisfied it does not create any problem.
If the other one is violated it does not create any problem.
More Practice
11Ardavan Asef-Vaziri June-2013Integer Programming
We can produce 3 products but due to managerial difficulties, we want to produce only two of them.We can produce these products either in plant 1 or plant 2 but not in both. In other words, we should also decide whether we produce them in plant one or plant two.Other information are given below
Required hrs Available hrsProduct 1 Product 2 Product 3
Plant 1 3 4 2 30Plant 2 4 6 2 40
Unit profit 5 7 3Sales potential 7 5 9
One constraint out of two
Xij volume of production of product i in plant j, i=1,2,3, j=1,2..Yi is 1 if plant I produces and 0 otherwise.Tij w volume of production of product i, i=1,2,3.
12Ardavan Asef-Vaziri June-2013Integer Programming
Required hrs Available hrsProduct 1 Product 2 Product 3
Plant 1 3 4 2 30Plant 2 4 6 2 40
Unit profit 5 7 3Sales potential 7 5 9
One constraint out of two
X1+X2+X3 ≤ 2Y1+Y2 ≤ 1
Yi Plant i produces, i=1,2
13Ardavan Asef-Vaziri June-2013Integer Programming
Consider a linear program with the following set of constraints:
12x1 + 24x2 + 18x3 ≤ 2400
15x1 + 32x2 + 12x3 ≤ 1800
20x1 + 15x2 + 20x3 ≤ 2000
18x1 + 21x2 + 15x3 ≥ 1600
Suppose that meeting 3 out of 4 of these constraints is “good enough”.
Meeting a Subset of Constraints
14Ardavan Asef-Vaziri June-2013Integer Programming
We want two of the following 4 constraints to be satisfied.The other 2 are free, they may be automatically satisfied, but if they are not satisfied there is no problem
y1 + y2 100y1 +2 y3 160y2 + y3 50y1 + y2 + y3 170
In general we want to satisfy k constraints out of n constraints
Still Fun
15Ardavan Asef-Vaziri June-2013Integer Programming
A Constraint With k Possible Values
y1 + y2 = 10 or 20 or 100
Mastering Formulation of Binary Variables
16Ardavan Asef-Vaziri June-2013Integer Programming
We have 5 demand centers, referred to as 1, 2, 3, 4,5.We plan to open one or more Distribution Centers (DC) to serve these markets. There are 5 candidate locations for these DCs, referred to as A, B, C, D, and E. Annual cost of meeting all demand of each market from a DC located in each candidate location is given below
DC1 DC2 DC3 DC4 DC5Market 1 1 5 18 13 17Market 2 15 2 26 14 14Market 3 28 18 7 8 8Market 4 100 120 8 8 9Market 5 30 20 20 30 40
Each DC can satisfy the demand of one, two, three, four, or five market
A Location Allocation Problem
17Ardavan Asef-Vaziri June-2013Integer Programming
Depreciated initial investment and operating cost of a DC in location A, B, C, D, and E is 199, 177, 96, 148, 111.
The objective function is to minimize total cost (Investment &Operating and Distribution) of the system.
Suppose we want to open only one DC. Where is the optimal location.Suppose we don't impose any constraint on the number of DCs. What is the optimal number of DCs.
A Location Allocation Problem
18Ardavan Asef-Vaziri June-2013Integer Programming
Mercer Development is considering the potential of four different development projects. Each project would be completed in at most three years. The required cash outflow for each project is given in the table below, along with the net present value of each project to Mercer, and the cash that is available (from previous projects) each year.
Cash Outflo w Required ($mil lio n) CashAvailable
Project 1 Project 2 Project 3 Project 4 ($mi llio n)Year 1 10 8 6 12 30Year 2 8 5 4 0 15Year 3 8 0 6 0 12NPV 35 18 24 16
Example #1 (Capital Budgeting)
19Ardavan Asef-Vaziri June-2013Integer Programming
Maximum Flow Problem : D.V. and OF
5
122
24
1 43
2
5
3
jnodetoinodeFromFlowMaterial:t ij
origintheofoutgoingflowtotalimizemaxtoisobjectiveThe
1312 ttZMax
20Ardavan Asef-Vaziri June-2013Integer Programming
Maximum Flow Problem : Arc Capacity Constraints
5
122
24
1 43
2
5
3arcsallFor
ijij Tt
2t 23
2t5t3t1t2t4t
45
34
25
24
13
12
21Ardavan Asef-Vaziri June-2013Integer Programming
Maximum Flow Problem : Flow Balance Constraint
5
122
24
1 43
2
5
3nodesallFor
453424 ttt
flowoutgoingTotaltoequalisflowgminincoTotal
tij = tji i N \ O and D
4nodeFor
25242312 tttt
342313 ttt 3nodeFor
2nodeFor
22Ardavan Asef-Vaziri June-2013Integer Programming
Maximum Flow Problem : Flow Balance Constraint
5
122
24
1 43
2
5
3
453424 ttt
25242312 tttt
342313 ttt
2t5t3t1t2t2t4t
45
34
25
24
23
13
12
1312 ttZMax
2
122
23
1 43
2
5
3
1
121
24
1 43
2
5
3
2
121
14
1 43
2
5
3
23Ardavan Asef-Vaziri June-2013Integer Programming
Maximum Flow Problem with Restricted Number of Arcs
xij : The decision variable for the directed arc from node i to nod j.
xij = 1 if arc ij is on the flow path
xij = 0 if arc ij is not on the flow path
xij 4
24Ardavan Asef-Vaziri June-2013Integer Programming
Maximum Flow Problem with Restricted Number of Arcs
453424 ttt
25242312 tttt
342313 ttt
2t5t3t1t2t2t4t
45
34
25
24
23
13
12
1312 ttZMax
4xxxxxxx 45342524231312
5
122
24
1 43
2
5
3
1
121
24
1 43
2
5
3
25Ardavan Asef-Vaziri June-2013Integer Programming
Divisibility 1.5, 500.3, 111.11
Certainty cj, aij, bi
Linearity No x1 x2, x1
2, 1/x1, sqrt (x1)
aijxj
aijxj + aikxk
Nonnegativity
The relationship between flow and arc variables
2tx 2323
t23 could be greater than 0 while x23 is 0,
26Ardavan Asef-Vaziri June-2013Integer Programming
Relationship between Flow and Arcs
5
112
24
1 43
2
5
3
453424 ttt
25242312 tttt
342313 ttt
4545
3434
2525
2424
2323
1313
1212
x2tx5tx3tx1tx2tx2tx4t
1312 ttZMax
4xxxxxxx 45342524231312
5
122
24
1 43
2
5
3
27Ardavan Asef-Vaziri June-2013Integer Programming
On a Path
453424 xxx
25242312 xxxx
342313 xxx
5
122
24
1 43
2
5
3
5
122
24
1 43
2
5
3
5
122
24
1 43
2
5
3
5
122
24
1 43
2
5
3
28Ardavan Asef-Vaziri June-2013Integer Programming
Maximum Flow on a Path
453424 ttt
25242312 tttt
342313 ttt
1312 ttZMax
5
122
24
1 43
2
5
3
453424 xxx
25242312 xxxx
342313 xxx
4545
3434
2525
2424
2323
1313
1212
x2tx5tx3tx1tx2tx2tx4t
29Ardavan Asef-Vaziri June-2013Integer Programming
The Shortest Route ProblemThe shortest route between two points
l ij : The length of the directed arc ij. l ij is a parameter, not a decision variable. It could be the length in term of distance or in terms of time or cost ( the same as c ij ) For those nodes which we are sure that we go from i to j we only have one directed arc from i to j.
For those node which we are not sure that we go from i to j or from j to i, we have two directed arcs, one from i to j, the other from j to i. We may have symmetric or asymmetric network.
In a symmetric network lij = lji ij In a asymmetric network this condition does not hold
30Ardavan Asef-Vaziri June-2013Integer Programming
Example
6
3
4
2
5
7
2
6
5
6
4
8
7
2
2
12
2
2
31Ardavan Asef-Vaziri June-2013Integer Programming
Decision Variables and Formulationxij : The decision variable for the directed arc from node i to nod j.
xij = 1 if arc ij is on the shortest route
xij = 0 if arc ij is not on the shortest route
xij - xji = 0 i N \ O and D
xoj =1
xiD = 1
Min Z = lij xij 6
3
4
2
5
7
2
6
5
6
4
8
7
2
2
12
2
2
32Ardavan Asef-Vaziri June-2013Integer Programming
Example
6
3
4
2
5
7
2
6
5
6
4
8
7
2
2
12
2
2
+ x13 + x14+ x12= 1- x57 - x67 = -1+ x34 + x35 - x43 - x13 = 0+ x42 + x43 + x45 + x46 - x14 - x24 - x34 = 0
….…..
Min Z = + 5x12 + 4x13 + 3x14 + 2x24 + 6x26 + 2x34 + 3x35
+ 2x43 + 2x42 + 5x45 + 4x46 + 3x56 + 2x57 + 3x65 + 2x67
33Ardavan Asef-Vaziri June-2013Integer Programming
The ShR Problem : Binary Decision Variables
8
3
4
5
7
10
4
3
5
6
4
5
3
2
2
1
2
6
9
11
6
2
4
34
6
6
OD
2
3
6
53
2
3
2
2
1 43
2
Find the shortest route of these two networks.
But for red bi-directional edges you are not allowed to define two decision variables.
Only one.
Solve the small problem.
Only using 5 variables
34Ardavan Asef-Vaziri June-2013Integer Programming
Do not worry about the length of the arcs, we do not need to write the objective functions.
Note that we do not know whether we may go from node 2 to 3 or from 3 to 2.
Now we want to formulate this problem as a shortest route.
The ShR Problem : Binary Decision Variables
143
2
35Ardavan Asef-Vaziri June-2013Integer Programming
To formulate the problem as a shortest route, you probably want to define a pair of decision variables for arcs 2-3 and 3-2, and then for example write the constraint on node 2 as followsX23+X24 = X12 + X32
But you are not allowed to define two variables for 2-3 and 3-2. You should formulated the problem only using the following variables
X23 is a binary variable corresponding to the NON-DIRECTED edge between nodes 2 and 3.
It is equal to 1 if arc 2-3 or 3-2 is on the shortest route and it is 0 otherwise.
The ShR Problem : Binary Decision Variables
36Ardavan Asef-Vaziri June-2013Integer Programming
As usual we can have the following variables
X12 X13 X24 X34
each corresponding to a directed arc
The solution of (X12 = 1 , X23 = 1, X34 = 1 all other variables are 0) means that the shortest route is 1-2-3-4.
The solution of (X13 = 1 , X32 = 1, X24 = 1 all other variables are 0) ) means that the shortest route is 1-3-2-4.
The solution of (X13 = 1 , X34= 1 all other variables are 0) ) means that the shortest route is 1-3-4.
The ShR Problem : Smaller Number of Binary Variables
37Ardavan Asef-Vaziri June-2013Integer Programming
Now you should formulate the shortest route problem using defining only one variable for each edge.
Your formulation should be general, not only for this example.
How many variables do you need to formulate this problem?
The ShR Problem : Smaller Number of Binary Variables
38Ardavan Asef-Vaziri June-2013Integer Programming
How Many Binary Variables for this ShR problem
8
3
4
5
7
10
4
3
5
6
4
5
3
2
2
1
2
6
9
11
6
2
4
34
6
6
OD
2
3
6
53
2
3
2
2
39Ardavan Asef-Vaziri June-2013Integer Programming
When are “non-integer” solutions okay?· Solution is naturally divisible
· Solution represents a rate
· Solution only for planning purposes
When is rounding okay?
Integer Programming
40Ardavan Asef-Vaziri June-2013Integer Programming
1 2 3 4 5
1
2
3
4
5
x1
x2· Rounded solution may not be feasible
· Rounded solution may not be close to optimal
· There can be many rounded solutions
Example: Consider a problem with 30 variables that are non-integer in the LP solution. How many possible rounded solutions are there?
The Challenge of Rounding
41Ardavan Asef-Vaziri June-2013Integer Programming
1 2 3 4 5
1
2
3
4
5
x1
x2
1 2 3 4 5
1
2
3
4
5
x1
x2
How Integer Programs are solved
42Ardavan Asef-Vaziri June-2013Integer Programming
56789
1011
GTotal
=SUMPRODUCT(C4:F4,C6:F6)
Total Outflow=SUMPRODUCT(C4:F4,C9:F9)=SUMPRODUCT(C4:F4,C10:F10)=SUMPRODUCT(C4:F4,C11:F11)
1234567891011
A B C D E F G H IMercer Development Capital Budgeting
Project 1 Project 2 Project 3 Project 4Undertake? 1 1 0 1
TotalNPV ($million) 35 18 24 16 69
Total Outflow AvailableYear 1 10 8 6 12 30 <= 30Year 2 8 5 4 0 13 <= 15Year 3 8 0 6 0 8 <= 12
Cash Outflow Required ($million)
Spreadsheet Solution to Example #1
43Ardavan Asef-Vaziri June-2013Integer Programming
Suppose the Washington State legislature is trying to decide on locations at which to base search-and-rescue teams. The teams are expensive, and hence they would like as few as possible. However, since response time is critical, they would like every county to either have a team located in that county, or in an adjacent county. Where should the teams be located?
1
2
3
4
76
9
10
11
12
8
5
13
14
15
1617
18
1920
21 22
2325
24
26 27 28
29 30
31 32
33
3435
36
37
Counties 1. Clallum 2. Jefferson 3. Grays Harbor 4. Pacific 5. Wahkiakum 6. Kitsap 7. Mason 8. Thurston 9. Whatcom10. Skagit11. Snohomish12. King13. Pierce14. Lewis15. Cowlitz16. Clark17. Skamania18. Okanogan19. Chelan
20. Douglas21. Kittitas22. Grant23. Yakima24. Klickitat25. Benton26. Ferry27. Stevens28. Pend Oreille29. Lincoln30. Spokane31. Adams32. Whitman33. Franklin34. Walla Walla35. Columbia36. Garfield37. Asotin
Example #2 (Set Covering Problem)
44Ardavan Asef-Vaziri June-2013Integer Programming
1
2
3
4
76
9
10
11
12
8
5
13
14
15
1617
18
1920
2122
2325
24
26 27 28
29 30
31 3 2
33
3435
3 6
37
Counties 1. Clallum 2. Jefferson 3. Grays Harbor 4. Pacific 5. Wahkiakum 6. Kitsap 7. Mason 8. Thurston 9. Whatcom10. Skagit11. Snohomish12. King13. Pierce14. Lewis15. Cowlitz16. Clark17. Skamania18. Okanogan19. Chelan
20. Douglas21. Kittitas22. Grant23. Yakima24. Klickitat25. Benton26. Ferry27. Stevens28. Pend Oreille29. Lincoln30. Spokane31. Adams32. Whitman33. Franklin34. Walla Walla35. Columbia36. Garfield37. Asotin
Spreadsheet Solution to Example #2
45Ardavan Asef-Vaziri June-2013Integer Programming
123456789101112131415161718192021222324
A B C D E F G H I J K L M NSearch & Rescue Location
# Teams # TeamsCounty Team? Nearby County Team? Nearby
1 Clallam 0 1 >= 1 19 Chelan 0 2 >= 12 Jefferson 1 1 >= 1 20 Douglas 0 1 >= 13 Grays Harbor 0 2 >= 1 21 Kittitas 1 1 >= 14 Pacific 0 1 >= 1 22 Grant 0 1 >= 15 Wahkiakum 0 1 >= 1 23 Yakima 0 3 >= 16 Kitsap 0 1 >= 1 24 Klickitat 0 1 >= 17 Mason 0 1 >= 1 25 Benton 0 1 >= 18 Thurston 0 1 >= 1 26 Ferry 0 1 >= 19 Whatcom 0 1 >= 1 27 Stevens 1 1 >= 110 Skagit 1 1 >= 1 28 Pend Oreille 0 1 >= 111 Snohomish 0 1 >= 1 29 Lincoln 0 1 >= 112 King 0 1 >= 1 30 Spokane 0 1 >= 113 Pierce 0 2 >= 1 31 Adams 0 1 >= 114 Lewis 1 2 >= 1 32 Whitman 0 2 >= 115 Cowlitz 0 2 >= 1 33 Franklin 1 1 >= 116 Clark 0 1 >= 1 34 Walla Walla 0 1 >= 117 Skamania 1 2 >= 1 35 Columbia 0 1 >= 118 Okanogan 0 1 >= 1 36 Garfield 1 1 >= 1
37 Asotin 0 1 >= 1Total Teams: 8
Spreadsheet Solution to Example #2
46Ardavan Asef-Vaziri June-2013Integer Programming
3456789
10111213141516171819202122
E# TeamsNearby
=D5+D6=D5+D6+D7+D8+D10+D11=D6+D7+D8+D11+D12+D18=D7+D8+D9+D18=D8+D9+D18+D19=D6+D10+D11+D15+D16+D17=D6+D7+D10+D11+D12+D17=D7+D11+D12+D17+D18=D13+D14+D22=D13+D14+D15+D22+K5=D14+D15+D16+K5=D10+D15+D16+D17+K5+K7=D10+D11+D12+D16+D17+D18+K7+K8=D7+D8+D9+D12+D17+D18+D19+D21+K9=D9+D18+D19+D20+D21=D19+D20+D21=D18+D19+D20+D21+K9+K10=D13+D14+D22+K5+K6+K12+K15
3456789
1011121314151617181920212223
L# TeamsNearby
=D14+D15+D16+D22+K5+K6+K7=D22+K5+K6+K7+K8=D16+D17+K5+K6+K7+K8+K9=K6+K7+K8+K9+K11+K15+K16+K17=D17+D18+D21+K7+K8+K9+K10+K11=D21+K9+K10+K11=K8+K9+K10+K11+K19+K20=D22+K12+K13+K15=K12+K13+K14+K15+K16=K13+K14+K16=D22+K8+K12+K13+K15+K16+K17+K18=K13+K14+K15+K18=K8+K15+K17+K18+K19=K15+K16+K17+K18+K19+K21+K22+K23=K8+K11+K17+K18+K19+K20=K11+K19+K20+K21=K18+K20+K21+K22=K18+K21+K22+K23=K18+K22+K23
24C D
Total Teams: =SUM(D5:D22,K5:K23)
Spreadsheet Solution to Example #2 (Formulas)