-
Notifications
You must be signed in to change notification settings - Fork 2
/
hexiom_config.py
31 lines (25 loc) · 980 Bytes
/
hexiom_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
LEVEL_INPUT_FILENAME_PATTERN = (lambda n: 'levels/level%02d.txt' % n )
SAT_INPUT_FILENAME_PATTERN = (lambda n: 'sat_in/level%02d.cnf' % n )
SAT_OUTPUT_FILENAME_PATTERN = (lambda n: 'sat_out/level%02d.txt' % n )
NAMED_CNF_INPUT_FILE = 'scratch/formula.txt'
NAMED_CNF_RESULT_FILE = 'scratch/result.txt'
import subprocess
def in_file_out_file(exe_name):
''' Run a minisat style solver'''
def solve(infilename, outfilename):
return subprocess.call(
[exe_name, infilename, outfilename]
)
return solve
def in_file_out_pipe(exe_name):
''' Run a precosat style solver'''
def solve(infilename, outfilename):
with open(outfilename, 'w') as fil:
return subprocess.call(
[exe_name, infilename],
stdout=fil
)
return solve
#SAT_SOLVE = in_file_out_pipe('./lingeling')
#SAT_SOLVE = in_file_out_file('./cryptominisat')
SAT_SOLVE = in_file_out_file('./glucose_static')