-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimporter.py
More file actions
27 lines (22 loc) · 802 Bytes
/
Copy pathimporter.py
File metadata and controls
27 lines (22 loc) · 802 Bytes
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
import argparse
from checker import check_sat
def main():
parser = argparse.ArgumentParser(
prog = "importer",
description="imports a WDIMACS file and returns the number of clauses in the file satisfied by the assignment ",
)
parser.add_argument('-wdimacs','--wdimacs',type=str,required=True)
parser.add_argument('-assignment','--assignment',type=str,required=True)
args = parser.parse_args()
file = args.wdimacs
assignment = args.assignment
with open(file,'r') as f:
lines = [line.rstrip("\n") for line in f]
sat=0
for line in lines:
if line[0]=='c' or line[0]=='p':
continue
sat+=check_sat(line,assignment)
print(sat)
if __name__=='__main__':
main()