Scores added

That'll be enough for tonight.

Note that we got 213338 with the following runs
1: 8T/10
2: 8T/10
3: T/2

And we would have been 311 instead of 662 with
very few modifications
This commit is contained in:
Geoffrey Frogeye 2016-02-11 23:35:05 +01:00
parent d30396c471
commit 01a7f8405d
2 changed files with 11 additions and 3 deletions

View file

@ -1,7 +1,7 @@
all: 1o 2o 3o ../submission.zip all: 1o 2o 3o ../submission.zip
../submission.zip: ../submission.zip: 1o 2o 3o
zip $@ .git *.py -r zip $@ .git *o *.py -r
1o: 1 1o: 1
python main.py $< python main.py $<

10
main.py
View file

@ -18,6 +18,7 @@ W = 0 # Nb warehouses
C = 0 # Nb customers C = 0 # Nb customers
t = 0 # Turn t = 0 # Turn
s = 0 # Score
Dp = [] # Positions of drones Dp = [] # Positions of drones
# (x, y) # (x, y)
@ -171,6 +172,11 @@ def deliver(d, c, p, q):
assert(Dd[d] <= T) assert(Dd[d] <= T)
print("Drone", d, "delivers", q, "of", p, "to client", c, "", Dd[d]) print("Drone", d, "delivers", q, "of", p, "to client", c, "", Dd[d])
Out.append(str(d) + ' D ' + str(c) + ' ' + str(p) + ' ' + str(q)) Out.append(str(d) + ' D ' + str(c) + ' ' + str(p) + ' ' + str(q))
# Score
if Ci[c][p] == 0:
global s
s += math.ceil((T-t)/T*100)
def wait(d, w=1): def wait(d, w=1):
global Dd, Da global Dd, Da
@ -230,7 +236,7 @@ for c in range(C):
N.append((c, p)) N.append((c, p))
try: try:
while t < T: while t < T-100:
for d in [d for d in range(D) if Da[d]]: for d in [d for d in range(D) if Da[d]]:
for tk in Dt[d]: for tk in Dt[d]:
c, p = tk c, p = tk
@ -276,3 +282,5 @@ def WarehouseHasItems(w, items):
if Wi[w][items[i][0]] < items[i][1]: if Wi[w][items[i][0]] < items[i][1]:
return False return False
return True return True
sys.stdout.write(str(s)+'\n')