-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtop_level.py
More file actions
74 lines (56 loc) · 2.11 KB
/
Copy pathtop_level.py
File metadata and controls
74 lines (56 loc) · 2.11 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import code
import cmd, sys
import quantum
import qutilities
#my_console = code.InteractiveConsole()
#my_console.interact('Quantum Top Level')
#my_console.raw_input('Command: ')
class CLI(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.prompt = '(QUANTUM) > '
def do_quit(self, arg):
sys.exit(1)
def do_abstract(self, arg):
try:
quantum.cur_exp.hybrid_system = None
print 'Cleared hybrid_system'
except AttributeError:
pass
try:
#print type(arg)
if not arg:
quantum.restart()
else :
quantum.run(arg.split())
except KeyboardInterrupt:
pause = 1
print 'abstraction paused'
def do_graphiz(self,arg):
qutilities.output_graphiz(quantum.cur_exp.hybrid_system)
def do_print(self, arg):
#print quantum.filenames
print quantum.cur_exp.system_def
def do_stats(self, arg):
hs = quantum.hybrid_system
print '*'*40
print 'Abstraction Proof Statistics'
print '*'*40
print 'Total Number of States : {}'.format(len([x for x in hs.itervalues()
if x.is_feasible and x.feasability_checked and x.next_states]))
print 'Total Number of Proved Transition Problems : {}'.format(quantum.cur_exp.trans_proved)
print 'Total Number of Unproved Transition Problems : {}'.format(quantum.cur_exp.trans_unproved)
print 'Total Number of Proved Infeasible Problems : {}'.format(quantum.cur_exp.infeas_proved)
print 'Total Number of Unproved Infeasible Problems : {}'.format(quantum.cur_exp.infeas_unproved)
def do_run(self, arg):
try:
while True:
print 'hello world'
except KeyboardInterrupt:
print 'done'
# shortcuts
do_q = do_quit
do_g = do_graphiz
if __name__ == '__main__':
cli = CLI()
cli.cmdloop('Quantum V0.1')