当前位置: 首页>>代码示例>>Python>>正文


Python BDD.true方法代码示例

本文整理汇总了Python中pynusmv.dd.BDD.true方法的典型用法代码示例。如果您正苦于以下问题:Python BDD.true方法的具体用法?Python BDD.true怎么用?Python BDD.true使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pynusmv.dd.BDD的用法示例。


在下文中一共展示了BDD.true方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: caw

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
def caw(fsm, agents, phi, psi):
    """
    Return the set of states of fsm satisfying [agents][phi W psi].
    
    fsm -- a MAS representing the system
    agents -- a list of agents names
    phi -- a BDD representing the set of states of fsm satisfying phi
    psi -- a BDD representing the set of states of fsm satisfying psi
    """
    if len(fsm.fairness_constraints) == 0:
        return fp(lambda Z: psi | (phi & fsm.pre_nstrat(Z, agents)), BDD.true(fsm.bddEnc.DDmanager))
    else:

        def inner(Z):
            res = phi
            for f in fsm.fairness_constraints:
                res = res & fsm.pre_nstrat(
                    fp(
                        lambda Y: (psi & fair_gamma_states(fsm, agents)) | (Z & f) | (phi & fsm.pre_nstrat(Y, agents)),
                        BDD.false(fsm.bddEnc.DDmanager),
                    ),
                    agents,
                )
            return (psi & fair_gamma_states(fsm, agents)) | res

        return fp(inner, BDD.true(fsm.bddEnc.DDmanager))
开发者ID:sbusard,项目名称:pynusmv,代码行数:28,代码来源:eval.py

示例2: eg

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
def eg(fsm, phi):
    """
    Return the set of states of fsm satisfying EG phi.
    
    fsm -- a MAS representing the system
    phi -- a BDD representing the set of states of fsm satisfying phi
    """
    # def inner(Z):
    #    res = Z
    #    for f in fsm.fairness_constraints:
    #        res = res & fp(lambda Y : (Z & f) | (phi & fsm.weak_pre(Y)),
    #                             BDD.false(fsm.bddEnc.DDmanager))
    #    return phi & fsm.weak_pre(res)
    #
    # r = fp(inner, BDD.true(fsm.bddEnc.DDmanager))
    # return r.forsome(fsm.bddEnc.inputsCube)

    phi = phi.forsome(fsm.bddEnc.inputsCube) & fsm.bddEnc.statesMask

    if len(fsm.fairness_constraints) == 0:
        return fp(lambda Z: phi & fsm.pre(Z), BDD.true(fsm.bddEnc.DDmanager)).forsome(fsm.bddEnc.inputsCube)
    else:

        def inner(Z):
            res = phi
            for f in fsm.fairness_constraints:
                res = res & fsm.pre(fp(lambda Y: (Z & f) | (phi & fsm.pre(Y)), BDD.false(fsm.bddEnc.DDmanager)))
            return res

        return fp(inner, BDD.true(fsm.bddEnc.DDmanager)).forsome(fsm.bddEnc.inputsCube)
开发者ID:sbusard,项目名称:pynusmv,代码行数:32,代码来源:eval.py

示例3: pre

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
 def pre(self, states, inputs=None, subsystem=None):
     """
     Return the pre image of states, through inputs (if any) and in
     subsystem (if any).
     """
     
     if inputs is None:
         inputs = BDD.true(self.bddEnc.DDmanager)
     
     if subsystem is None:
         subsystem = BDD.true(self.bddEnc.DDmanager)
     
     return ((self.weak_pre(states & inputs) &
              subsystem).forsome(self.bddEnc.inputsCube) &
              self.bddEnc.statesMask)
开发者ID:xgillard,项目名称:pynusmv,代码行数:17,代码来源:mas.py

示例4: post

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
 def post(self, states, inputs=None, subsystem=None):
     """
     Return the post image of states, through inputs (if any) and in
     subsystem (if any).
     """
     
     if inputs is None:
         inputs = BDD.true(self.bddEnc.DDmanager)
     
     if subsystem is None:
         subsystem = BDD.true(self.bddEnc.DDmanager)
     
     states = states & subsystem
     
     return super(MAS, self).post(states, inputs)
开发者ID:xgillard,项目名称:pynusmv,代码行数:17,代码来源:mas.py

示例5: test_size

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
 def test_size(self):
     (fsm, enc, manager) = self.init_model()
     true = BDD.true(manager)
     false = BDD.false(manager)
     init = fsm.init
     noadmin = eval_simple_expression(fsm, "admin = none")
     alice = eval_simple_expression(fsm, "admin = alice")
     processing = eval_simple_expression(fsm, "state = processing")
     
     self.assertEqual(BDD.true().size, 1)
     self.assertEqual(BDD.false().size, 1)
     self.assertEqual(fsm.pick_one_state(BDD.true()).size,
                      len(fsm.bddEnc.get_variables_ordering("bits")) + 1)
     self.assertEqual(init.size, 5)
     self.assertEqual(processing.size, 3)
     
开发者ID:ancailliau,项目名称:pynusmv,代码行数:17,代码来源:testBDD.py

示例6: check_free_choice

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
 def check_free_choice(self):
     """
     Check whether this MAS satisfies the free-choice property, that is,
     in every state, the choices of actions for each agent is not
     constrained by the choices of other agents.
     
     Return the set of moves that are not present in the MAS and should,
     or that are present but should not.
     """
     
     if len(self.agents) <= 0:
         return BDD.false(self.bddEnc.DDmanager)
     
     true = BDD.true(self.bddEnc.DDmanager)
     protocols = {agent: self.protocol({agent}) for agent in self.agents}
     enabled = (self.weak_pre(self.reachable_states) &
                self.reachable_states & self.bddEnc.statesInputsMask)
     
     for s in self.pick_all_states(self.reachable_states):
         product = self.bddEnc.statesInputsMask
         for agent in self.agents:
             product &= protocols[agent] & s
         if (enabled & s) != product:
             return product.xor(enabled & s)
     return BDD.false(self.bddEnc.DDmanager)
开发者ID:xgillard,项目名称:pynusmv,代码行数:27,代码来源:mas.py

示例7: fair_states

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
def fair_states(fsm):
    """
    Return the set of fair states of the model.
    
    fsm - the model
    """
    return eg(fsm, BDD.true(fsm.bddEnc.DDmanager))
开发者ID:sbusard,项目名称:pynusmv,代码行数:9,代码来源:eval.py

示例8: nfair_gamma_si

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
def nfair_gamma_si(fsm, agents, strat=None):
    """
    Return the set of state/inputs pairs of strat
    in which agents can avoid a fair path in strat.
    If strat is None, it is considered true.
    
    fsm -- the model
    agents -- a list of agents names
    strat -- a BDD representing allowed state/inputs pairs, or None
    
    """
    if not strat:
        strat = BDD.true(fsm.bddEnc.DDmanager)
    
    if len(fsm.fairness_constraints) == 0:
        return BDD.false(fsm.bddEnc.DDmanager)
    else:
        def inner(Z):
            res = BDD.false(fsm.bddEnc.DDmanager)
            for f in fsm.fairness_constraints:
                nf = ~f & fsm.bddEnc.statesMask & strat
                res = res | fsm.pre_strat_si(fp(lambda Y :
                                                 (Z | nf) &
                                                 fsm.pre_strat_si(Y, agents,
                                                                  strat),
                                             BDD.true(fsm.bddEnc.DDmanager)),
                                             agents, strat)
            return res
        return fp(inner, BDD.false(fsm.bddEnc.DDmanager))
开发者ID:xgillard,项目名称:pynusmv,代码行数:31,代码来源:evalMem.py

示例9: eg

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
def eg(fsm, phi):
    res = BDD.true(fsm.bddEnc.DDmanager)
    old = BDD.false(fsm.bddEnc.DDmanager)
    while res != old:
        old = res
        new = ex(fsm, res)
        res = res & new & phi & fsm.reachable_states
    return res
开发者ID:ancailliau,项目名称:pynusmv,代码行数:10,代码来源:eval.py

示例10: test_nfair_gamma_si

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
    def test_nfair_gamma_si(self):
        fsm = self.cardgame_post_fair()

        s0 = eval_simple_expression(fsm, "step = 0")
        s1 = eval_simple_expression(fsm, "step = 1")
        s2 = eval_simple_expression(fsm, "step = 2")

        pa = eval_simple_expression(fsm, "pcard = Ac")
        pk = eval_simple_expression(fsm, "pcard = K")
        pq = eval_simple_expression(fsm, "pcard = Q")

        da = eval_simple_expression(fsm, "dcard = Ac")
        dk = eval_simple_expression(fsm, "dcard = K")
        dq = eval_simple_expression(fsm, "dcard = Q")

        dda = eval_simple_expression(fsm, "ddcard = Ac")
        ddk = eval_simple_expression(fsm, "ddcard = K")
        ddq = eval_simple_expression(fsm, "ddcard = Q")

        pan = eval_simple_expression(fsm, "player.action = none")
        pak = eval_simple_expression(fsm, "player.action = keep")
        pas = eval_simple_expression(fsm, "player.action = swap")

        dan = eval_simple_expression(fsm, "dealer.action = none")

        win = eval_simple_expression(fsm, "win")
        lose = eval_simple_expression(fsm, "lose")

        true = eval_simple_expression(fsm, "TRUE")
        false = eval_simple_expression(fsm, "FALSE")

        agents = {"dealer"}
        strats = split(fsm, fsm.protocol(agents), agents)
        strat = strats.pop()
        nf = ~fsm.fairness_constraints[0] & fsm.bddEnc.statesInputsMask

        self.assertEqual(
            nf & fsm.pre_strat_si(BDD.true(fsm.bddEnc.DDmanager), agents, strat),
            nf & fsm.pre_strat_si(BDD.true(fsm.bddEnc.DDmanager), agents, strat) & fsm.bddEnc.statesInputsMask,
        )

        nfp = nfair_gamma_si(fsm, {"player"})
        nfd = nfair_gamma_si(fsm, {"dealer"})

        self.assertTrue(nfp.is_false())
        self.assertTrue(fsm.protocol({"dealer"}) <= nfd)
开发者ID:sbusard,项目名称:pynusmv,代码行数:48,代码来源:testEval.py

示例11: inner

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
 def inner(Z):
     res = BDD.false(fsm.bddEnc.DDmanager)
     for f in fsm.fairness_constraints:
         nf = ~f  # & fsm.bddEnc.statesMask
         res = res | fsm.pre_strat(
             fp(lambda Y: (Z | nf) & fsm.pre_strat(Y, agents), BDD.true(fsm.bddEnc.DDmanager)), agents
         )
     return res
开发者ID:sbusard,项目名称:pynusmv,代码行数:10,代码来源:eval.py

示例12: fair_gamma_states

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
def fair_gamma_states(fsm, agents):
    """
    Return the set of states in which agents cannot avoid a fair path.
    
    fsm -- the model
    agents -- a list of agents names
    """
    return cag(fsm, agents, BDD.true(fsm.bddEnc.DDmanager))
开发者ID:sbusard,项目名称:pynusmv,代码行数:10,代码来源:eval.py

示例13: explain_fair

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
def explain_fair(fsm, state):
    """
    Explain why state of fsm is a fair state.
    
    fsm -- the fsm;
    state -- a fair state of fsm.
    """
    return explain_eg(fsm, state, BDD.true(fsm.bddEnc.DDmanager))
开发者ID:ancailliau,项目名称:pynusmv,代码行数:10,代码来源:explain.py

示例14: test_init

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
 def test_init(self):
     fsm = self.init_model()
     manager = fsm.bddEnc.DDmanager
     init = fsm.init
     
     initState = fsm.pick_one_state(init)
     
     self.assertTrue(BDD.false(manager) <= init <= BDD.true(manager))
     self.assertTrue(BDD.false(manager) < initState <= init)
开发者ID:ancailliau,项目名称:pynusmv,代码行数:11,代码来源:testExplain.py

示例15: ceg

# 需要导入模块: from pynusmv.dd import BDD [as 别名]
# 或者: from pynusmv.dd.BDD import true [as 别名]
def ceg(fsm, agents, phi):
    """
    Return the set of states of fsm satisfying <agents> G phi.
    
    fsm -- a MAS representing the system
    agents -- a list of agents names
    phi -- a BDD representing the set of states of fsm satisfying phi
    """
    return fp(lambda Z: phi & fsm.pre_strat(Z, agents), BDD.true(fsm.bddEnc.DDmanager))
开发者ID:sbusard,项目名称:pynusmv,代码行数:11,代码来源:eval.py


注:本文中的pynusmv.dd.BDD.true方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。