示例#1
0
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))
示例#2
0
def ceu(fsm, agents, phi, psi, strat=None):
    """
    Return the set of states of strat satisfying <agents>[phi U psi]
    under full observability in strat.
    If strat is None, strat is considered true.
    
    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
    strat -- a BDD representing allowed state/inputs pairs, or None
    
    """
    
    if len(fsm.fairness_constraints) == 0:
        return fp(lambda Z : psi | (phi & fsm.pre_strat(Z, agents, strat)),
                  BDD.false(fsm.bddEnc.DDmanager))
    else:
        nfair = nfair_gamma(fsm, agents, strat)
        def inner(Z):
            res = psi
            for f in fsm.fairness_constraints:
                nf = ~f
                res = res | fsm.pre_strat(fp(lambda Y :
                                             (phi | psi | nfair) &
                                             (Z | nf) &
                                             (psi |
                                              fsm.pre_strat(Y, agents, strat)),
                                             BDD.true(fsm.bddEnc.DDmanager)),
                                              agents, strat)
            return (psi | phi | nfair) & res
        return fp(inner, BDD.false(fsm.bddEnc.DDmanager))
示例#3
0
文件: eval.py 项目: sbusard/pynusmv
def ceu(fsm, agents, phi, psi):
    """
    Return the set of states of fsm satisfying <agents>[phi U 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
    """
    # phi = phi & fsm.bddEnc.statesInputsMask
    # psi = psi & fsm.bddEnc.statesInputsMask

    if len(fsm.fairness_constraints) == 0:
        return fp(lambda Z: psi | (phi & fsm.pre_strat(Z, agents)), BDD.false(fsm.bddEnc.DDmanager))
    else:
        nfair = nfair_gamma_states(fsm, agents)

        def inner(Z):
            res = psi
            for f in fsm.fairness_constraints:
                nf = ~f  # & fsm.bddEnc.statesMask
                res = res | fsm.pre_strat(
                    fp(
                        lambda Y: (phi | psi | nfair) & (Z | nf) & (psi | fsm.pre_strat(Y, agents)),
                        BDD.true(fsm.bddEnc.DDmanager),
                    ),
                    agents,
                )
            return (psi | phi | nfair) & res

        return fp(inner, BDD.false(fsm.bddEnc.DDmanager))
示例#4
0
def ceu(fsm, agents, phi, psi):
    """
    Return the set of states of fsm satisfying <agents>[phi U 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
    """
    #phi = phi & fsm.bddEnc.statesInputsMask
    #psi = psi & fsm.bddEnc.statesInputsMask
    
    if len(fsm.fairness_constraints) == 0:
        return fp(lambda Z : psi | (phi & fsm.pre_strat(Z, agents)),
                  BDD.false(fsm.bddEnc.DDmanager))
    else:
        nfair = nfair_gamma_states(fsm, agents)
        def inner(Z):
            res = psi
            for f in fsm.fairness_constraints:
                nf = ~f #& fsm.bddEnc.statesMask
                res = res | fsm.pre_strat(fp(lambda Y :
                                             (phi | psi | nfair) &
                                              (Z | nf) &
                                              (psi | fsm.pre_strat(Y, agents)),
                                              BDD.true(fsm.bddEnc.DDmanager)),
                                              agents)
            return (psi | phi | nfair) & res
        return fp(inner, BDD.false(fsm.bddEnc.DDmanager))
示例#5
0
文件: eval.py 项目: sbusard/pynusmv
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))
示例#6
0
文件: eval.py 项目: sbusard/pynusmv
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)
示例#7
0
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))
示例#8
0
 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
示例#9
0
文件: eval.py 项目: sbusard/pynusmv
def nfair_gamma_states(fsm, agents):
    """
    Return the set of states in which agents cann avoid fair paths.
    
    fsm -- the model
    agents -- a list of agents names
    """
    # NFair_Gamma = not([Gamma] G True) = <Gamma> F False
    agents = frozenset(agents)
    if agents not in __nfair_gamma_states:
        if len(fsm.fairness_constraints) == 0:
            __nfair_gamma_states[agents] = 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
                    res = res | fsm.pre_strat(
                        fp(lambda Y: (Z | nf) & fsm.pre_strat(Y, agents), BDD.true(fsm.bddEnc.DDmanager)), agents
                    )
                return res

            __nfair_gamma_states[agents] = fp(inner, BDD.false(fsm.bddEnc.DDmanager))
    return __nfair_gamma_states[agents]
示例#10
0
文件: eval.py 项目: sbusard/pynusmv
 def inner(Z):
     res = phi
     for f in fsm.fairness_constraints:
         res = res & fsm.pre_nstrat(
             fp(lambda Y: (Z & f) | (phi & fsm.pre_nstrat(Y, agents)), BDD.false(fsm.bddEnc.DDmanager)), agents
         )
     return res
示例#11
0
def nfair_gamma_states(fsm, agents):
    """
    Return the set of states in which agents cann avoid fair paths.
    
    fsm -- the model
    agents -- a list of agents names
    """
    # NFair_Gamma = not([Gamma] G True) = <Gamma> F False
    agents = frozenset(agents)
    if agents not in __nfair_gamma_states:
        if len(fsm.fairness_constraints) == 0:
            __nfair_gamma_states[agents] = 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
                    res = res | fsm.pre_strat(fp(lambda Y :
                                                 (Z | nf) &
                                                 fsm.pre_strat(Y, agents),
                                                BDD.true(fsm.bddEnc.DDmanager)),
                                              agents)
                return res
            __nfair_gamma_states[agents] = fp(inner, 
                                              BDD.false(fsm.bddEnc.DDmanager))
    return __nfair_gamma_states[agents]
示例#12
0
def cew_si(fsm, agents, phi, psi, strat=None):
    """
    Return the set of state/inputs pairs of strat satisfying <agents>[phi W psi]
    under full observability in strat.
    If strat is None, strat is considered true.
    
    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
    strat -- a BDD representing allowed state/inputs pairs, or None
    
    """
    if not strat:
        strat = BDD.true(fsm.bddEnc.DDmanager)

    phi = phi & fsm.bddEnc.statesInputsMask & strat
    psi = psi & fsm.bddEnc.statesInputsMask & strat

    nfair = nfair_gamma_si(fsm, agents, strat)

    return fp(
        lambda Y:
        (psi | phi | nfair) & (psi | fsm.pre_strat_si(Y, agents, strat)),
        BDD.true(fsm.bddEnc.DDmanager))
示例#13
0
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))
示例#14
0
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))
示例#15
0
文件: eval.py 项目: sbusard/pynusmv
 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
示例#16
0
文件: eval.py 项目: ankur8931/sdn-nrl
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
    """
    return fp(lambda Z: (phi & fsm.pre(Z)), BDD.true(fsm.bddEnc.DDmanager))
示例#17
0
 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
示例#18
0
文件: eval.py 项目: sbusard/pynusmv
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))
示例#19
0
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
    """
    return fp(lambda Z: (phi & fsm.pre(Z)),
               BDD.true(fsm.bddEnc.DDmanager))
示例#20
0
文件: eval.py 项目: ankur8931/sdn-nrl
def eu(fsm, phi, psi):
    """
    Return the set of states of fsm satisfying E[ phi U psi ].
    
    fsm -- a MAS representing the system
    phi -- a BDD representing the set of states of fsm satisfying phi
    psi -- a BDD representing the set of states of fsm satisfying psi
    """
    return fp(lambda Z: (psi | (phi & fsm.pre(Z))),
              BDD.false(fsm.bddEnc.DDmanager))
示例#21
0
def eu(fsm, phi, psi):
    """
    Return the set of states of fsm satisfying E[ phi U psi ].
    
    fsm -- a MAS representing the system
    phi -- a BDD representing the set of states of fsm satisfying phi
    psi -- a BDD representing the set of states of fsm satisfying psi
    """
    return fp(lambda Z: (psi | (phi & fsm.pre(Z))),
               BDD.false(fsm.bddEnc.DDmanager))
示例#22
0
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))
示例#23
0
文件: eval.py 项目: sbusard/pynusmv
def ceu(fsm, agents, phi, psi):
    """
    Return the set of states of fsm satisfying <agents>[phi U 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
    """
    return fp(lambda Y: psi | (phi & fsm.pre_strat(Y, agents)), BDD.false(fsm.bddEnc.DDmanager))
示例#24
0
 def inner(Z):
     res = psi
     for f in fsm.fairness_constraints:
         nf = ~f & fsm.bddEnc.statesMask & strat
         res = res | fsm.pre_strat_si(
             fp(
                 lambda Y: (phi | psi | nfair) & (Z | nf) &
                 (psi | fsm.pre_strat_si(Y, agents, strat)),
                 BDD.true(fsm.bddEnc.DDmanager)), agents, strat)
     return (psi | phi | nfair) & res
示例#25
0
 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
示例#26
0
文件: eval.py 项目: sbusard/pynusmv
 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
示例#27
0
def ceu(fsm, agents, phi, psi):
    """
    Return the set of states of fsm satisfying <agents>[phi U 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
    """
    return fp(lambda Y: psi | (phi & fsm.pre_strat(Y, agents)),
              BDD.false(fsm.bddEnc.DDmanager))
示例#28
0
文件: eval.py 项目: sbusard/pynusmv
def cag(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
    """
    if len(fsm.fairness_constraints) == 0:
        return fp(lambda Z: 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: (Z & f) | (phi & fsm.pre_nstrat(Y, agents)), BDD.false(fsm.bddEnc.DDmanager)), agents
                )
            return res

        return fp(inner, BDD.true(fsm.bddEnc.DDmanager))
示例#29
0
 def inner(Z):
     res = psi
     for f in fsm.fairness_constraints:
         nf = ~f
         res = res | fsm.pre_strat(fp(lambda Y :
                                      (phi | psi | nfair) &
                                      (Z | nf) &
                                      (psi |
                                       fsm.pre_strat(Y, agents, strat)),
                                      BDD.true(fsm.bddEnc.DDmanager)),
                                       agents, strat)
     return (psi | phi | nfair) & res
示例#30
0
文件: eval.py 项目: sbusard/pynusmv
def nc(fsm, group, phi):
    """
    Return the set of states of fsm satisfying nC<group> phi
    
    fsm -- a MAS representing the system
    group -- a non-empty list of (str) names of agents of fsm
    phi -- a BDD representing the set of states of fsm satisfying phi
    """
    # nC<g> p = mu Z. p | nE<g> Z
    # return fp(lambda Z: (phi | ne(fsm, group, Z)),
    #          BDD.false(fsm.bddEnc.DDmanager))
    # nC<g> p = mu Z. nE<g> (p | Z)
    return fp(lambda Z: ne(fsm, group, (Z | phi)), BDD.false(fsm.bddEnc.DDmanager))
示例#31
0
文件: eval.py 项目: sbusard/pynusmv
def cau(fsm, agents, phi, psi):
    """
    Return the set of states of fsm satisfying [agents][phi U 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
    """
    return fp(
        lambda Y: (psi & fair_gamma_states(fsm, agents)) | (phi & fsm.pre_nstrat(Y, agents)),
        BDD.false(fsm.bddEnc.DDmanager),
    )
示例#32
0
def nc(fsm, group, phi):
    """
    Return the set of states of fsm satisfying nC<group> phi
    
    fsm -- a MAS representing the system
    group -- a non-empty list of (str) names of agents of fsm
    phi -- a BDD representing the set of states of fsm satisfying phi
    """
    # nC<g> p = mu Z. p | nE<g> Z
    #return fp(lambda Z: (phi | ne(fsm, group, Z)),
    #          BDD.false(fsm.bddEnc.DDmanager))
    # nC<g> p = mu Z. nE<g> (p | Z)
    return fp(lambda Z: ne(fsm, group, (Z | phi)),
              BDD.false(fsm.bddEnc.DDmanager))
示例#33
0
def eu(fsm, phi, psi):
    """
    Return the set of states of fsm satisfying E[ phi U psi ].
    
    fsm -- a MAS representing the system
    phi -- a BDD representing the set of states of fsm satisfying phi
    psi -- a BDD representing the set of states of fsm satisfying psi
    """
    
    phi = phi.forsome(fsm.bddEnc.inputsCube) & fsm.bddEnc.statesMask
    psi = psi.forsome(fsm.bddEnc.inputsCube) & fsm.bddEnc.statesMask
    return fp(lambda X : (psi & fair_states(fsm) & fsm.reachable_states) |
                               (phi & ex(fsm, X)),
                    BDD.false(fsm.bddEnc.DDmanager))
示例#34
0
文件: eval.py 项目: sbusard/pynusmv
def eu(fsm, phi, psi):
    """
    Return the set of states of fsm satisfying E[ phi U psi ].
    
    fsm -- a MAS representing the system
    phi -- a BDD representing the set of states of fsm satisfying phi
    psi -- a BDD representing the set of states of fsm satisfying psi
    """

    phi = phi.forsome(fsm.bddEnc.inputsCube) & fsm.bddEnc.statesMask
    psi = psi.forsome(fsm.bddEnc.inputsCube) & fsm.bddEnc.statesMask
    return fp(
        lambda X: (psi & fair_states(fsm) & fsm.reachable_states) | (phi & ex(fsm, X)), BDD.false(fsm.bddEnc.DDmanager)
    )
示例#35
0
文件: eval.py 项目: sbusard/pynusmv
def cew(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
    """
    # phi = phi & fsm.bddEnc.statesInputsMask
    # psi = psi & fsm.bddEnc.statesInputsMask

    nfair = nfair_gamma_states(fsm, agents)

    return fp(lambda Y: (psi | phi | nfair) & (psi | fsm.pre_strat(Y, agents)), BDD.true(fsm.bddEnc.DDmanager))
示例#36
0
 def test_tictactoe_cau(self):
     fsm = self.tictactoe()
     
     spec = parseATL("['circlep']['TRUE' U  ('winner != circle' & 'run = stop')]")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.left)
     psi = evalATL(fsm, spec.right)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     
     self.assertEqual(sat, fp(lambda Y : psi | (phi & fsm.pre_nstrat(Y, agents)), BDD.false(fsm.bddEnc.DDmanager)))
     
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_cau(fsm, first, agents, phi, psi)
     self.check_ceu(fsm, explanation, agents, phi, psi)
 def test_tictactoe_cau(self):
     fsm = self.tictactoe()
     
     spec = parseATL("['circlep']['TRUE' U  ('winner != circle' & 'run = stop')]")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.left)
     psi = evalATL(fsm, spec.right)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     
     self.assertEqual(sat, fp(lambda Y : psi | (phi & fsm.pre_nstrat(Y, agents)), BDD.false(fsm.bddEnc.DDmanager)))
     
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_cau(fsm, first, agents, phi, psi)
     self.check_ceu(fsm, explanation, agents, phi, psi)
示例#38
0
def ceg(fsm, agents, phi, strat=None):
    """
    Return the set of states of strat satisfying <agents> G phi
    under full observability in strat.
    If strat is None, strat is considered true.
    
    fsm -- a MAS representing the system
    agents -- a list of agents names
    phi -- a BDD representing the set of states of fsm satisfying phi
    strat -- a BDD representing allowed state/inputs pairs, or None
    
    """    
    nfair = nfair_gamma(fsm, agents, strat)
    
    return fp(lambda Y : (phi | nfair) & fsm.pre_strat(Y, agents, strat),
              BDD.true(fsm.bddEnc.DDmanager))
示例#39
0
def cew(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
    """
    #phi = phi & fsm.bddEnc.statesInputsMask
    #psi = psi & fsm.bddEnc.statesInputsMask
    
    nfair = nfair_gamma_states(fsm, agents)
    
    return fp(lambda Y : (psi | phi | nfair) &
                         (psi | fsm.pre_strat(Y, agents)),
              BDD.true(fsm.bddEnc.DDmanager))
示例#40
0
def cew_si(fsm, agents, phi, psi, strat=None):
    """
    Return the set of state/inputs pairs of strat satisfying <agents>[phi W psi]
    under full observability in strat.
    If strat is None, strat is considered true.
    
    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
    strat -- a BDD representing allowed state/inputs pairs, or None
    
    """
    if not strat:
        strat = BDD.true(fsm.bddEnc.DDmanager)
    
    phi = phi & fsm.bddEnc.statesInputsMask & strat
    psi = psi & fsm.bddEnc.statesInputsMask & strat
    
    nfair = nfair_gamma_si(fsm, agents, strat)
    
    return fp(lambda Y : (psi | phi | nfair) &
                         (psi | fsm.pre_strat_si(Y, agents, strat)),
              BDD.true(fsm.bddEnc.DDmanager))