Commit a4f61528 authored by Kento HASEGAWA's avatar Kento HASEGAWA

Fix a bug on stopping the solver

parent 4f553185
......@@ -48,28 +48,30 @@ def solve(params):
if not stop_flag:
solver.print_cnf(nodes, cnfs, filename=cnf_filepath)
solution_filepath = f'{basedir}/a.txt'
cmds = f'minisat {cnf_filepath} {solution_filepath}'.split()
proc = subprocess.Popen(
cmds,
# stderr=subprocess.PIPE,
# stdout=subprocess.PIPE
)
try:
# outs, errs = proc.communicate()
proc.communicate()
status = 'done'
except Exception as ex:
status = 'failed'
finally:
returncode = proc.returncode
# outs = outs.decode()
# errs = errs.decode()
# print(outs)
# print(errs)
returncode = 0
if not stop_flag:
solution_filepath = f'{basedir}/a.txt'
cmds = f'minisat {cnf_filepath} {solution_filepath}'.split()
proc = subprocess.Popen(
cmds,
# stderr=subprocess.PIPE,
# stdout=subprocess.PIPE
)
try:
# outs, errs = proc.communicate()
proc.communicate()
status = 'done'
except Exception as ex:
status = 'failed'
finally:
returncode = proc.returncode
# outs = outs.decode()
# errs = errs.decode()
# print(outs)
# print(errs)
solution = ''
if returncode == 10: # 10 when SAT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment