Add write of drone command to out.
This commit is contained in:
parent
c56e442d29
commit
e71771d48d
3
main.py
3
main.py
|
@ -140,6 +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))
|
||||||
|
|
||||||
def unload(d, w, p, q):
|
def unload(d, w, p, q):
|
||||||
# drone number, warehouse, product, qt
|
# drone number, warehouse, product, qt
|
||||||
|
@ -150,6 +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))
|
||||||
|
|
||||||
def deliver(d, c, p, q):
|
def deliver(d, c, p, q):
|
||||||
# drone number, customer, product, qt
|
# drone number, customer, product, qt
|
||||||
|
@ -161,6 +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))
|
||||||
|
|
||||||
def wait(d, w=1):
|
def wait(d, w=1):
|
||||||
assert(d in Da)
|
assert(d in Da)
|
||||||
|
|
Reference in a new issue