process synchronization (commented out for now)
This commit is contained in:
parent
53350b5bff
commit
1b80cf69ee
2 changed files with 22 additions and 1 deletions
|
@ -74,12 +74,14 @@ def main():
|
|||
|
||||
stuff1 = list()
|
||||
|
||||
for order in itertools.product([0,1,2,3], repeat=8):
|
||||
#for order in itertools.product([True, False], repeat=10):
|
||||
#for order in [[True]*12,]:
|
||||
for order in itertools.product([0,1,2,3], repeat=8):
|
||||
rests = list()
|
||||
layers = list()
|
||||
|
||||
it = get_layers(bins, pallet, get_bit(order[0], 0), get_bit(order[0], 1))
|
||||
#it = get_layers(bins, pallet, order[0], False)
|
||||
layer, rest = it.next()
|
||||
if layer:
|
||||
layers.append(layer)
|
||||
|
@ -90,6 +92,7 @@ def main():
|
|||
for rot_article in order[1:]:
|
||||
try:
|
||||
layer, rest = it.send((get_bit(rot_article,0), get_bit(rot_article,1)))
|
||||
#layer, rest = it.send((rot_article, False))
|
||||
if layer:
|
||||
layers.append(layer)
|
||||
if rest:
|
||||
|
|
|
@ -10,6 +10,7 @@ from binascii import a2b_base64
|
|||
import tempfile
|
||||
import os
|
||||
import zlib
|
||||
import fcntl
|
||||
|
||||
def evaluate_layers_rests(layers, rests, scores, pallet):
|
||||
rest_layers = list()
|
||||
|
@ -66,6 +67,23 @@ def evaluate_layers_rests(layers, rests, scores, pallet):
|
|||
os.remove(tmp)
|
||||
scores.append(score)
|
||||
|
||||
"""
|
||||
lock = open("score_max.lock", "w")
|
||||
fcntl.lockf(lock, fcntl.LOCK_EX)
|
||||
score_max_f = open("score_max", "w+")
|
||||
score_max = score_max_f.read()
|
||||
if not score_max:
|
||||
score_max = 0.0
|
||||
if score > score_max:
|
||||
shutil.move(tmp, sys.argv[2])
|
||||
score_max_f.write(str(score))
|
||||
else:
|
||||
os.remove(tmp)
|
||||
score_max_f.close()
|
||||
lock.close()
|
||||
scores.append(score)
|
||||
"""
|
||||
|
||||
def main():
|
||||
scores = list()
|
||||
for arg in sys.argv[3:]:
|
||||
|
|
Loading…
Reference in a new issue