All indices start at 0 -_-
This commit is contained in:
parent
e71771d48d
commit
8a19a859d8
6
main.py
6
main.py
|
@ -140,7 +140,7 @@ def load(d, w, p, q):
|
||||||
assert(weight(d) <= M)
|
assert(weight(d) <= M)
|
||||||
assert(Dd[d] <= T)
|
assert(Dd[d] <= T)
|
||||||
print("Drone", d, "loads", q, "of", p, "from warehouse", w, "→", Dd[d])
|
print("Drone", d, "loads", q, "of", p, "from warehouse", w, "→", Dd[d])
|
||||||
Out.append(str(d) + ' L ' + str(w+1) + ' ' + str(p+1) + ' ' + str(q))
|
Out.append(str(d) + ' L ' + str(w) + ' ' + str(p+1) + ' ' + str(q))
|
||||||
|
|
||||||
def unload(d, w, p, q):
|
def unload(d, w, p, q):
|
||||||
# drone number, warehouse, product, qt
|
# drone number, warehouse, product, qt
|
||||||
|
@ -151,7 +151,7 @@ def unload(d, w, p, q):
|
||||||
Di[d][p] += -q
|
Di[d][p] += -q
|
||||||
assert(Dd[d] <= T)
|
assert(Dd[d] <= T)
|
||||||
print("Drone", d, "unloads", q, "of", p, "from warehouse", w, "→", Dd[d])
|
print("Drone", d, "unloads", q, "of", p, "from warehouse", w, "→", Dd[d])
|
||||||
Out.append(str(d) + ' U ' + str(w+1) + ' ' + str(p+1) + ' ' + str(q))
|
Out.append(str(d) + ' U ' + str(w) + ' ' + str(p) + ' ' + str(q))
|
||||||
|
|
||||||
def deliver(d, c, p, q):
|
def deliver(d, c, p, q):
|
||||||
# drone number, customer, product, qt
|
# drone number, customer, product, qt
|
||||||
|
@ -163,7 +163,7 @@ def deliver(d, c, p, q):
|
||||||
Dd[d] += 1
|
Dd[d] += 1
|
||||||
assert(Dd[d] <= T)
|
assert(Dd[d] <= T)
|
||||||
print("Drone", d, "delivers", q, "of", p, "to client", w, "→", Dd[d])
|
print("Drone", d, "delivers", q, "of", p, "to client", w, "→", Dd[d])
|
||||||
Out.append(str(d) + ' D ' + str(c+1) + ' ' + str(p+1) + ' ' + str(q))
|
Out.append(str(d) + ' D ' + str(c) + ' ' + str(p) + ' ' + str(q))
|
||||||
|
|
||||||
def wait(d, w=1):
|
def wait(d, w=1):
|
||||||
assert(d in Da)
|
assert(d in Da)
|
||||||
|
|
Reference in a new issue