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): ...@@ -48,28 +48,30 @@ def solve(params):
if not stop_flag: if not stop_flag:
solver.print_cnf(nodes, cnfs, filename=cnf_filepath) solver.print_cnf(nodes, cnfs, filename=cnf_filepath)
solution_filepath = f'{basedir}/a.txt' returncode = 0
if not stop_flag:
cmds = f'minisat {cnf_filepath} {solution_filepath}'.split() solution_filepath = f'{basedir}/a.txt'
proc = subprocess.Popen( cmds = f'minisat {cnf_filepath} {solution_filepath}'.split()
cmds,
# stderr=subprocess.PIPE, proc = subprocess.Popen(
# stdout=subprocess.PIPE cmds,
) # stderr=subprocess.PIPE,
# stdout=subprocess.PIPE
try: )
# outs, errs = proc.communicate()
proc.communicate() try:
status = 'done' # outs, errs = proc.communicate()
except Exception as ex: proc.communicate()
status = 'failed' status = 'done'
finally: except Exception as ex:
returncode = proc.returncode status = 'failed'
# outs = outs.decode() finally:
# errs = errs.decode() returncode = proc.returncode
# print(outs) # outs = outs.decode()
# print(errs) # errs = errs.decode()
# print(outs)
# print(errs)
solution = '' solution = ''
if returncode == 10: # 10 when SAT 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