2016-02-11 19:24:11 +01:00
|
|
|
#Read the input file
|
|
|
|
|
2016-02-11 19:55:30 +01:00
|
|
|
X = 0 # Nb rows
|
|
|
|
Y = 0 # Nb columns
|
|
|
|
D = 0 # Nb drones
|
|
|
|
T = 0 # Deadline
|
|
|
|
M = 0 # Maximum load
|
|
|
|
P = 0 # Nb products
|
|
|
|
W = 0 # Nb warehouses
|
|
|
|
C = 0 # Nb customers
|
|
|
|
|
|
|
|
Dp = []; # Positions of drones
|
|
|
|
# (x, y)
|
|
|
|
Di = []; # Items of drones
|
|
|
|
# {product number: qt}
|
|
|
|
Dd = []; # Turn avaibility of drone
|
|
|
|
# int
|
|
|
|
|
|
|
|
Pw = []; # Weight of products
|
|
|
|
# int
|
|
|
|
|
|
|
|
Wp = []; # Positions of warehouses
|
|
|
|
# (x, y)
|
|
|
|
Wi = []; # Items of warehouses
|
|
|
|
# {product number: qt}
|
|
|
|
|
|
|
|
Cp = []; # Positions of customers
|
|
|
|
# (x, y)
|
|
|
|
Ci = []; # Needs of customers
|
|
|
|
# {product number: qt}
|
|
|
|
|
2016-02-11 19:24:11 +01:00
|
|
|
def Read_input_file(file):
|
|
|
|
f = open(file, 'r')
|
|
|
|
|
2016-02-11 19:50:19 +01:00
|
|
|
line = f.readline()
|
2016-02-11 19:24:11 +01:00
|
|
|
info = line.split(' ')
|
|
|
|
|
|
|
|
GRILLE = (int(info[0]), int(info[1]))
|
|
|
|
D = int(info[2])
|
|
|
|
T = int(info[3])
|
|
|
|
M = int(info[4])
|
|
|
|
|
2016-02-11 19:50:19 +01:00
|
|
|
line = f.readline()
|
2016-02-11 19:24:11 +01:00
|
|
|
P = int(line)
|
|
|
|
|
2016-02-11 19:50:19 +01:00
|
|
|
line = f.readline()
|
2016-02-11 19:24:11 +01:00
|
|
|
info = line.split(' ')
|
2016-02-11 19:50:19 +01:00
|
|
|
for i in range(0, P):
|
2016-02-11 19:55:30 +01:00
|
|
|
Pw.append(int(info[i]))
|
2016-02-11 19:24:11 +01:00
|
|
|
|
2016-02-11 19:50:19 +01:00
|
|
|
line = f.readline()
|
2016-02-11 19:24:11 +01:00
|
|
|
W = int(line)
|
|
|
|
|
2016-02-11 19:50:19 +01:00
|
|
|
for i in range(0, W):
|
|
|
|
line = f.readline()
|
2016-02-11 19:24:11 +01:00
|
|
|
info = line.split(' ')
|
2016-02-11 19:55:30 +01:00
|
|
|
Wp.append((int(info[0]), int(info[1])))
|
2016-02-11 19:50:19 +01:00
|
|
|
line = f.readline()
|
2016-02-11 19:24:11 +01:00
|
|
|
info = line.split(' ')
|
2016-02-11 19:36:20 +01:00
|
|
|
productQ = {}
|
2016-02-11 19:55:30 +01:00
|
|
|
for j in range(0, info.size()):
|
|
|
|
productQ.append(int(info[j]))
|
|
|
|
Wi.append(productsQ)
|
2016-02-11 19:36:20 +01:00
|
|
|
|
2016-02-11 19:50:19 +01:00
|
|
|
line = f.readline()
|
2016-02-11 19:36:20 +01:00
|
|
|
nbC = int(line)
|
|
|
|
|
2016-02-11 19:50:19 +01:00
|
|
|
for i in range(0, nbC):
|
|
|
|
line = f.readline()
|
2016-02-11 19:36:20 +01:00
|
|
|
info = line.split(' ')
|
2016-02-11 19:55:30 +01:00
|
|
|
Cp.append((int(info[0]), int(info[1])))
|
2016-02-11 19:50:19 +01:00
|
|
|
line = f.readline()
|
2016-02-11 19:36:20 +01:00
|
|
|
nbP = int(line)
|
2016-02-11 19:50:19 +01:00
|
|
|
line = f.readline()
|
2016-02-11 19:36:20 +01:00
|
|
|
info = line.split(' ')
|
|
|
|
orderQ = {}
|
2016-02-11 19:50:19 +01:00
|
|
|
for j in range(0, nbP):
|
2016-02-11 19:55:30 +01:00
|
|
|
orderQ.append(int(info[j]))
|
|
|
|
Ci.append(orderQ)
|
2016-02-11 19:24:11 +01:00
|
|
|
|
2016-02-11 19:50:19 +01:00
|
|
|
return
|