Lecture 17 Chapter 11 Discrete Optimization

advertisement
Lecture 17 Chapter 11
Discrete Optimization
11.9 Page 567 Set Covering Constraints
Example - locating fire houses - every
district must be covered by at least 1 fire
house
j  S xj > 1
11.10 Page 567 Set Packing Constraints
Example - locating radio stations with a
given frequency in an area
j  S xj < 1
11.11 Page 568 Set Partitioning Constraints
1
Example - redistricting models - each area
must belong to exactly 1 political district
j  S xj = 1
Crew Scheduling For American Airlines Page 572
nn
2
# AA Crew Scheduling Page 572
var x01 binary; var x02 binary;
var x03 binary; var x04 binary;
var x05 binary; var x06 binary;
var x07 binary; var x08 binary;
var x09 binary; var x10 binary;
var x11 binary; var x12 binary;
var x13 binary; var x14 binary;
var x15 binary;
subject to F101:
x01+x02+x03+x04
= 1;
subject to F109:
x06+x07+x08+x09+x10+x13+x15 = 1;
subject to F203:
x01+x02+x05+x06
= 1;
subject to F204:
x03+x04+x07+x08+x11+x12
= 1;
3
subject to F211:
x12+x13+x14+x15
subject to F212:
x09+x10
subject to F305:
x03+x07+x09+x11
subject to F308:
x01+x04+x08+x10+x13
subject to F310:
x05+x12+x14
subject to F402:
x11+x12
subject to F406:
x01+x05+x13+x14
subject to F407:
x02+x03+x06+x07+x09+x15
= 1;
= 1;
= 1;
= 1;
= 1;
= 1;
= 1;
= 1;
minimize PayAndCredit:
2900*x01+2700*x02+2600*x03
4
+3000*x04
+2600*x05+3150*x06+2550*x07
++2500*x08
+2600*x09+2050*x10+2400*x11
+3600*x12
+2550*x13+2650*x14+2350*x15;
option solver cplex;
solve;
display
x01,x02,x03,x04,x05,x06,x07,x08,x09
,x10,x11,x12,x13,x14,x15;
sw: ampl
ampl: model AA.txt;
CPLEX 7.1.0: optimal integer solution;
objective 9100
0 MIP simplex iterations
0 branch-and-bound nodes
5
x01 = 1
x02 = 0
x03 = 0
x04 = 0
x05 = 0
x06 = 0
x07 = 0
x08 = 0
x09 = 1
x10 = 0
x11 = 0
x12 = 1
x13 = 0
x14 = 0
x15 = 0
ampl:
6
The Traveling Salesman Problem
Visit each city exactly once and return to
the home city.
Example
3
2
1
6
8
5
7
4
7
Possible Solution
3
2
1
6
8
5
7
4
# TSP Example
set I := {1,2,3,4,5,6,7,8};
param x {I};
param y {I};
let x[1] := 1; let x[2] := 1; let x[3] := 1;
let x[4] := 2; let x[5] := 3; let x[6] := 3;
let x[7] := 4; let x[8] := 4;
let y[1] := 1; let y[2] := 2; let y[3] := 5;
let y[4] := 2; let y[5] := 1; let y[6] := 3;
let y[7] := 1; let y[8] := 3;
8
option display_round 2;
display x, y;
param dist {I,I};
for {i in I}
for {j in I}
let dist[i,j] :=
sqrt((x[i]-x[j])^2 + (y[i]-y[j])^2);
display dist;
var z {I,I} binary;
#see 11.16 on P 586
subject to Const {i in I}:
sum {j in I:j<i} z[j,i]
+ sum {j in I:j>i} z[i,j] = 2;
9
minimize distance:
sum{i in I, j in I:j>i} dist[i,j]*z[i,j];
option solver cplex;
solve;
display z;
sw: ampl
ampl: model TSP.txt;
: x
y
:=
1 1.00 1.00
2 1.00 2.00
3 1.00 5.00
10
4
5
6
7
8
;
2.00
3.00
3.00
4.00
4.00
2.00
1.00
3.00
1.00
3.00
dist [*,*]
: 1
2
3
4
5
1 0.00 1.00 4.00 1.41
2 1.00 0.00 3.00 1.00
3 4.00 3.00 0.00 3.16
4 1.41 1.00 3.16 0.00
5 2.00 2.24 4.47 1.41
6 2.83 2.24 2.83 1.41
7 3.00 3.16 5.00 2.24
8 3.61 3.16 3.61 2.24
;
6
7
8
:=
2.00 2.83 3.00 3.61
2.24 2.24 3.16 3.16
4.47 2.83 5.00 3.61
1.41 1.41 2.24 2.24
0.00 2.00 1.00 2.24
2.00 0.00 2.24 1.00
1.00 2.24 0.00 2.00
2.24 1.00 2.00 0.00
11
CPLEX 7.1.0: optimal integer solution;
objective 13.65685425
10 MIP simplex iterations
0 branch-and-bound nodes
z [*,*]
: 1
2
3
1 0.00 1.00
2 0.00 0.00
3 0.00 0.00
4 0.00 0.00
5 0.00 0.00
6 0.00 0.00
7 0.00 0.00
8 0.00 0.00
;
4
0.00
1.00
0.00
0.00
0.00
0.00
0.00
0.00
5
1.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
6
7
8
:=
0.00 0.00 0.00
0.00 0.00 0.00
0.00 1.00 0.00
1.00 0.00 0.00
0.00 0.00 1.00
0.00 0.00 0.00
0.00 0.00 0.00
0.00 0.00 0.00
0.00
0.00
0.00
0.00
0.00
1.00
1.00
0.00
12
Solution
3
2
6
8
5
7
4
1
3
2
1
6
8
5
7
4
We were
lucky - No
Subtours
You may end up
with subtours then you need to
add const to
remove this
subtour
13
Basic Facility Location Model - See Page 596
Plants
1
Customers
1
2
2
3
4
3
5
6
4
7
i = 1,..,4
j = 1,..,7
dj = demand at customer j
fj = fixed cost for opening plant i
cij = cost for producing a unit at plant i and
delivering it to customer j
ui = capacity of plant i
14
Decision Variables:
yi = 1 if plant i is opened; and = 0
otherwise
xij = the fraction of demand at j satisfied
by plant i
The Model:
minimize i,j cij dj xij + i fiyi
subject to
i xij = 1; all j
j djxij < uiyi; all i
xij > 0
yi binary
15
What are some of the assumptions made
about this model?
1. There are no capacities on the flows.
2. There is a single commodity that is
being produced.
3. Plant capacities are fixed.
4. Customer demands are fixed
5. Backorders are not permitted.
If a plant already exists, then what is the
fixed cost for that plant?
Consider the problem that I worked on in
graduate School
Open 3 Food Distribution Centers
16
Assign Clients to the nearest Surplus Food
Distribution Center
2
1
3
5
6
8
7
11
4
10
9
12
13
Census Tracks
Solution: 13 things taken 3 at a time
13
3 = 13!/(3!)(10!) = (13)(12)(11)/(3)(2) = 286
There are only 286 possibilities!!!!!!!!!!!!!!!!!!!!
17
List Them:
1,2,3
1,2,4
1,3,4
1,3,5
.
.
.
1,2,5
1,3,6
1,2,6
1,3,7
…
…
1,2,13
1,3,13
11,12,13
The Solution With 5,9,12
18
Total Distance Times Number Of Clients
Was the Objective Function
Consider the integer program with 100
variables ( all binary) and only one
constraint - the knapsack problem
min j = 1..100 cj xj
s.t.
 j= 1…100 aj xj < b
(one constraint)
xj binary, all j
If we want to use complete enumeration,
then how many possibilities do we have to
consider?
We have 100 variables each of which can
be either 0 or 1.
19
2100 = [210]10  [103]10 = 1030
Suppose our computer can check 1 billion
possibilities per second!
1 billion = 1,000,000,000 = 109
1030 = [109][1021] yields 1021 seconds
1021
_____________________________
(60 sec/min)(60min/hr)(24hr/day)(365days/yr)(100yrs/century)
= 3 X 1011 centuries
20
12.4 PR is a constraint relaxation of P if
the feasible region of P is a subset of the
feasible region of PR and the objective
functions are the same.
PR
PR
P
P are the green dots only
21
12.6 Page 633 LP Relaxations
Binary IP
min cx
st
Ax = b
xj binary
LP Relaxation
min cx
st
Ax = b
0 < xj < 1
22
IP
min
st
cx
Ax = b
0<x<u
xj integer
LP Relaxation
min cx
st
Ax = b
0<x<u
23
Download