Delete global var for test, remove append() method for dict and correct Ci construction

This commit is contained in:
JLo'w 2016-02-11 20:09:19 +01:00
parent 4ee070a305
commit f34c45470c

39
read.py
View file

@ -1,34 +1,5 @@
#Read the input file
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}
def Read_input_file(file):
f = open(file, 'r')
@ -58,9 +29,9 @@ def Read_input_file(file):
line = f.readline()
info = line.split(' ')
productQ = {}
for j in range(0, info.size()):
productQ.append(int(info[j]))
Wi.append(productsQ)
for j in range(0, len(info)):
productQ[j] = int(info[j])
Wi.append(productQ)
line = f.readline()
nbC = int(line)
@ -74,8 +45,10 @@ def Read_input_file(file):
line = f.readline()
info = line.split(' ')
orderQ = {}
for k in range(0, P):
orderQ[k] = 0
for j in range(0, nbP):
orderQ.append(int(info[j]))
orderQ[int(info[j])] += 1
Ci.append(orderQ)
return