-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsolver.py
42 lines (31 loc) · 1016 Bytes
/
solver.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
32
33
34
35
36
37
38
39
from SAT import SAT
import argparse
import sys
if __name__ == "__main__":
# option whether to log while solving the
# problem
to_log = sys.argv[1]
if to_log == "False":
to_log = False
elif to_log == "True":
to_log = True
else:
raise ValueError("The first argument should be either True or False.")
# Decision Heuristic to be used
decider_to_use = sys.argv[2]
# Restart Heuristic to be used
# None if no restart strategy to be used
restarter_to_use = sys.argv[3]
# File name of the file containing
# the input problem
input_file_name = sys.argv[4]
if restarter_to_use == "None":
# If no restart strategy is to be used
sat = SAT(to_log,decider_to_use)
sat.solve(input_file_name)
sat.stats.print_stats()
else:
# If a restart strategy is specified
sat = SAT(to_log,decider_to_use,restarter_to_use)
sat.solve(input_file_name)
sat.stats.print_stats()