-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfacility_location.zpl
More file actions
32 lines (22 loc) · 940 Bytes
/
Copy pathfacility_location.zpl
File metadata and controls
32 lines (22 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ZIMPL format
param graphfile := "man_data/man_laposte.txt";
param distance_graphfile := "man_data/man_laposte_distance.txt";
set V := { read graphfile as "<2n>" comment "p" }; # Crossroads
set P := { read graphfile as "<2n>" comment "v" }; # Possible post offices
set V_CROSS_P := V * P;
param distances[V_CROSS_P] := read distance_graphfile as "<2n,3n> 4n";
var client[V_CROSS_P] binary; # Is the client v going to the post office P ?
var open[P] binary; # Is the post office P built ?
# We want to minimize the total distance
minimize cost: sum <p> in P: 500 * open[p]
+ sum <v,p> in V_CROSS_P: distances[v,p] * client[v, p];
subto assign:
forall <v> in V do
sum <p> in P: client[v, p] == 1;
subto build:
forall <v,p> in V_CROSS_P do
client[v,p] <= open[p];
subto initialize_post_office_1:
open[283492455] == 1;
subto initialize_post_office_2:
open[283494345] == 1;