本文整理汇总了Python中tools.mas.glob.load_from_file函数的典型用法代码示例。如果您正苦于以下问题:Python load_from_file函数的具体用法?Python load_from_file怎么用?Python load_from_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_from_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reachable_states_for_simple_model
def test_reachable_states_for_simple_model(self):
glob.load_from_file("tests/tools/ctlk/agents.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
true = eval_simple_expression(fsm, "TRUE")
self.assertEqual(fsm.reachable_states, true)
示例2: test_constraints_post
def test_constraints_post(self):
glob.load_from_file("tests/tools/ctlk/constraints.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
false = eval_simple_expression(fsm, "FALSE")
false = eval_simple_expression(fsm, "TRUE")
p = eval_simple_expression(fsm, "p")
q = eval_simple_expression(fsm, "q")
a = eval_simple_expression(fsm, "a")
self.assertEqual(1, fsm.count_states(fsm.init))
self.assertEqual(2, fsm.count_states(fsm.post(fsm.init)))
self.assertEqual(1, fsm.count_states(p & q))
self.assertEqual(1, fsm.count_states(p & ~q))
self.assertEqual(1, fsm.count_states(~p & q))
self.assertEqual(1, fsm.count_states(~p & ~q))
self.assertEqual(2, fsm.count_states(fsm.post(p & q)))
self.assertEqual(1, fsm.count_states(fsm.post(p & ~q)))
self.assertEqual(1, fsm.count_states(fsm.post(~p & q)))
self.assertEqual(1, fsm.count_states(fsm.post(p & q, a)))
self.assertEqual(0, fsm.count_states(fsm.post(p & ~q, ~a)))
self.assertEqual(0, fsm.count_states(fsm.post(~p & q, a)))
self.assertEqual(1, fsm.count_states(fsm.post(~p & q, ~a)))
示例3: test_dining_crypto
def test_dining_crypto(self):
glob.load_from_file("tests/tools/ctlk/dining-crypto.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
agents = fsm._epistemic.keys()
self.assertSetEqual(set(agents), {"c1", "c2", "c3"})
示例4: test_cardgame_with_agents
def test_cardgame_with_agents(self):
glob.load_from_file("tests/tools/mas/cardgame.smv")
agents = (Agent("player", {"step", "pcard", "ddcard"},
{"player.action"}),
Agent("dealer", {"step", "pcard", "dcard"},
{"dealer.action"}))
fsm = glob.mas(agents=agents)
self.assertIsNotNone(fsm)
return fsm
示例5: test_simple_pre
def test_simple_pre(self):
glob.load_from_file("tests/tools/ctlk/agents.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
lt = eval_simple_expression(fsm, "at.local")
lf = eval_simple_expression(fsm, "af.local")
g = eval_simple_expression(fsm, "global")
true = eval_simple_expression(fsm, "TRUE")
false = eval_simple_expression(fsm, "FALSE")
self.assertEqual(fsm.pre(lt & ~lf & ~g),
(lt & lf & ~g) | (~lt & ~lf & g))
self.assertEqual(fsm.pre(g), true)
self.assertEqual(fsm.pre(lf), lf.iff(g))
示例6: test_d_distributedmodel
def test_d_distributedmodel(self):
glob.load_from_file("tests/tools/ctlk/distributed_knowledge.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
l1 = eval_simple_expression(fsm, "a1.local")
l2 = eval_simple_expression(fsm, "a2.local")
l3 = eval_simple_expression(fsm, "a3.local")
true = eval_simple_expression(fsm, "TRUE")
false = eval_simple_expression(fsm, "FALSE")
specs = parseCTLK("'a1.local' -> D<'a1','a2'> 'a1.local'")
self.assertEqual(len(specs), 1)
spec = specs[0]
a1da1 = evalCTLK(fsm, spec)
self.assertEqual(true, a1da1)
示例7: test_next_state_without_inputs
def test_next_state_without_inputs(self):
glob.load_from_file("tests/pynusmv/models/modules.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
c2p = eval_simple_expression(fsm, "top")
(inputs, state) = choose_next_state(fsm, fsm.pick_one_state(fsm.init))
print()
if state is None:
print("No chosen state.")
else:
if inputs is not None:
values = inputs.get_str_values()
for var in values:
print(var, "=", values[var])
print("-" * 40)
values = state.get_str_values()
for var in values:
print(var, "=", values[var])
示例8: do_model
def do_model(self, arg):
if "model" not in self.argparsers:
self.parse_model()
# Handle arguments parsing errors
try:
args = self.argparsers["model"].parse_args(self._split_escaped(arg))
except ArgumentParsingError as err:
print(err, end="")
return False
# Error if
# showing path or content when nothing is read
# reading a file when one is already read
if (args.content or args.path is None) and self.model is None:
print("No read model.")
return False
if args.path is not None and self.model is not None:
print("model: error: a model is already read from", self.model.path)
return False
if args.path is None:
print("read model:", self.model.path)
if args.content:
print(self.model.content)
if args.path is not None:
try:
f = open(args.path, 'r')
content = f.read()
f.close()
glob.load_from_file(args.path)
self.fsm = glob.mas()
self.model = Model(args.path, content)
except PyNuSMVError as err:
print("model: error:", err)
except IOError as err:
print("model: error:", err)
示例9: model
def model(self):
glob.load_from_file("tests/tools/ctlk/dining-crypto.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
return fsm
示例10: simplemodel
def simplemodel(self):
glob.load_from_file("tests/tools/ctlk/agents.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
return fsm
示例11: transmission_fair
def transmission_fair(self):
glob.load_from_file("tests/tools/atlkFO/models/transmission-fair.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
return fsm
示例12: cardgame_fair
def cardgame_fair(self):
glob.load_from_file("tests/tools/atlkFO/models/cardgame-fair.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
return fsm
示例13: little
def little(self):
glob.load_from_file("tests/tools/atlkPO/models/little.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
return fsm
示例14: transmission_with_knowledge
def transmission_with_knowledge(self):
glob.load_from_file(
"tests/tools/atlkPO/models/transmission-knowledge.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
return fsm
示例15: tictactoe
def tictactoe(self):
glob.load_from_file("tests/tools/atl/models/tictactoe.smv")
fsm = glob.mas()
self.assertIsNotNone(fsm)
return fsm