Last change
on this file since 16147 was
14895,
checked in by jkarder, 8 years ago
|
#2205: worked on optimization networks
- added lrp networks (4, 5)
- fixed lrp evaluation
- updated flp models
- updated to cplex 12.7
|
File size:
1.3 KB
|
Line | |
---|
1 | //Capacitated Facility Location Problem:
|
---|
2 |
|
---|
3 | int I = ...;
|
---|
4 | int J = ...;
|
---|
5 | float f[0..(I-1)] = ...; //Kosten Depot i
|
---|
6 | float s[0..(I-1)] = ...; //KAP Depot i
|
---|
7 | float d[0..(J-1)] = ...; //Bedarf Kunde j
|
---|
8 | float c[0..(I-1)][0..(J-1)] = ...; //Wegkosten von i nach j
|
---|
9 |
|
---|
10 | range RI = 0..(I-1);
|
---|
11 | range RJ = 0..(J-1);
|
---|
12 |
|
---|
13 | dvar float+ x[0..(I-1)][0..(J-1)]; //Transportmenge
|
---|
14 | dvar boolean y[0..(I-1)]; //Eröffnung Depot i
|
---|
15 | dvar boolean z[0..(I-1)][0..(J-1)]; //Depot i beliefert Kunde j
|
---|
16 |
|
---|
17 | execute
|
---|
18 | {
|
---|
19 | cplex.threads=1;
|
---|
20 | }
|
---|
21 |
|
---|
22 | minimize
|
---|
23 | ( sum ( i in 0..(I-1), j in 0..(J-1) ) ( c[i][j] * x[i][j] ) + sum ( i in 0..(I-1) ) ( f[i] * y[i] ) );
|
---|
24 |
|
---|
25 |
|
---|
26 | subject to
|
---|
27 | {
|
---|
28 | //Für jedes Depot gilt: Ausliefermenge x kann maximal so groß sein wie Depot-KAP y
|
---|
29 | forall ( i in 0..(I-1) )
|
---|
30 | sum ( j in 0..(J-1) ) ( x[i][j] ) <= s[i] * y[i];
|
---|
31 |
|
---|
32 | //Die Ausliefermenge x kann maximal so groß sein wie der Bedarf des Kunden und es kann nur ausgeliefert werden, wenn das Depot eröffnet wird
|
---|
33 | forall ( i in 0..(I-1), j in 0..(J-1) )
|
---|
34 | ( x[i][j] ) == ( d[j] * z[i][j] );
|
---|
35 |
|
---|
36 | //Jeder Kunde muss insgesamt genau den Bedarf d geliefert bekommen:
|
---|
37 | forall ( j in 0..(J-1) )
|
---|
38 | sum ( i in 0..(I-1) ) ( x[i][j] ) == d[j];
|
---|
39 |
|
---|
40 | forall ( j in 0..(J-1) )
|
---|
41 | sum ( i in 0..(I-1) ) ( z[i][j] ) == 1;
|
---|
42 |
|
---|
43 | forall ( i in 0..(I-1) )
|
---|
44 | sum ( j in 0..(J-1) ) z[i][j] <= J * y[i];
|
---|
45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.