-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
43 lines (40 loc) · 1.65 KB
/
run.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
40
41
42
43
import argparse
import os
from datetime import datetime
from multiprocessing import Process
import sys
sys.path.append("..")
import model_encoder
import pdr
import time
def run_with_limited_time(func, time):
p = Process(target=func)
p.start()
p.join(time)
if p.is_alive():
p.terminate()
return False
return True
if __name__ == '__main__':
#sys.stdout = open('file', 'w') #open this when we need the log
help_info = "Usage: python main.py <file-name>.aag"
parser = argparse.ArgumentParser(description="Run tests examples on the PDR algorithm")
parser.add_argument('fileName', type=str, help='The name of the test to run', default=None, nargs='?')
# parser.add_argument('-m', type=int, help='the time limitation of one test to run', default=3600)
# parser.add_argument('-c', help='switch to counting time', action='store_true')
#args = parser.parse_args(['/data/guangyuh/coding_env/pyPDR/dataset/hwmcc07_tip_aag/nusmv.syncarb5^2.B.aag']) #When you need to run single file, setup this
#args = parser.parse_args(['/data/guangyuh/coding_env/pyPDR/dataset/hwmcc07_tip_aag/ken.flash^12.C.aag'])
args = parser.parse_args()
if args.fileName is not None:
file = args.fileName
start_time = time.time()
m = model_encoder.Model()
end_time = time.time()
parsing_time = end_time - start_time
#print("============= Running test ===========")
solver = pdr.PDR(*m.parse(file))
startTime = datetime.now()
solver.run()
endTime = datetime.now()
# if args.c:
# print("TIME CONSUMING: " + str((endTime - startTime).seconds) + "seconds")