Delete global var for test, remove append() method for dict and correct Ci construction
This commit is contained in:
parent
4ee070a305
commit
f34c45470c
39
read.py
39
read.py
|
@ -1,34 +1,5 @@
|
||||||
#Read the input file
|
#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):
|
def Read_input_file(file):
|
||||||
f = open(file, 'r')
|
f = open(file, 'r')
|
||||||
|
|
||||||
|
@ -58,9 +29,9 @@ def Read_input_file(file):
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
info = line.split(' ')
|
info = line.split(' ')
|
||||||
productQ = {}
|
productQ = {}
|
||||||
for j in range(0, info.size()):
|
for j in range(0, len(info)):
|
||||||
productQ.append(int(info[j]))
|
productQ[j] = int(info[j])
|
||||||
Wi.append(productsQ)
|
Wi.append(productQ)
|
||||||
|
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
nbC = int(line)
|
nbC = int(line)
|
||||||
|
@ -74,8 +45,10 @@ def Read_input_file(file):
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
info = line.split(' ')
|
info = line.split(' ')
|
||||||
orderQ = {}
|
orderQ = {}
|
||||||
|
for k in range(0, P):
|
||||||
|
orderQ[k] = 0
|
||||||
for j in range(0, nbP):
|
for j in range(0, nbP):
|
||||||
orderQ.append(int(info[j]))
|
orderQ[int(info[j])] += 1
|
||||||
Ci.append(orderQ)
|
Ci.append(orderQ)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Reference in a new issue