Beispiel #1
0
 def check_cex(self, fsm, explanation, agents, phi):
     """Check that the explanation is correct."""
     # Get the cubes
     gamma_cube = fsm.inputs_cube_for_agents(agents)
     ngamma_cube = fsm.bddEnc.inputsCube - gamma_cube
     
     # The first state satisfies the spec
     self.assertTrue(explanation.state <= cex(fsm, agents, phi))
     acts = BDD.false(fsm.bddEnc.DDmanager)
     states = BDD.false(fsm.bddEnc.DDmanager)
     for (act, succ) in explanation.successors:
         ag_action = act.forsome(ngamma_cube)
         # The successor satisfies phi
         self.assertTrue(succ.state <= phi)
         # The action is effectively possible
         self.assertTrue(act <= fsm.get_inputs_between_states(
                                              explanation.state, succ.state))
         # Accumulate states and actions
         acts = acts | act
         states = states | succ.state
     
     # The reached states are effectively the reachable states
     # through the action
     self.assertTrue(states <= fsm.post(explanation.state, ag_action))
     self.assertTrue(states >= fsm.post(explanation.state, ag_action)
                                                     & fsm.bddEnc.statesMask)
                                                     
     # The actions are effectively all the possible actions completing ag_act
     self.assertTrue(acts <= ag_action)
     self.assertTrue(acts >= ag_action & 
                   fsm.get_inputs_between_states(explanation.state, states) &
                   fsm.bddEnc.inputsMask)
Beispiel #2
0
    def check_cex(self, fsm, explanation, agents, phi):
        """Check that the explanation is correct."""
        # Get the cubes
        gamma_cube = fsm.inputs_cube_for_agents(agents)
        ngamma_cube = fsm.bddEnc.inputsCube - gamma_cube

        # The first state satisfies the spec
        self.assertTrue(explanation.state <= cex(fsm, agents, phi))
        acts = BDD.false(fsm.bddEnc.DDmanager)
        states = BDD.false(fsm.bddEnc.DDmanager)
        for (act, succ) in explanation.successors:
            ag_action = act.forsome(ngamma_cube)
            # The successor satisfies phi
            self.assertTrue(succ.state <= phi)
            # The action is effectively possible
            self.assertTrue(act <= fsm.get_inputs_between_states(
                explanation.state, succ.state))
            # Accumulate states and actions
            acts = acts | act
            states = states | succ.state

        # The reached states are effectively the reachable states
        # through the action
        self.assertTrue(states <= fsm.post(explanation.state, ag_action))
        self.assertTrue(states >= fsm.post(explanation.state, ag_action)
                        & fsm.bddEnc.statesMask)

        # The actions are effectively all the possible actions completing ag_act
        self.assertTrue(acts <= ag_action)
        self.assertTrue(
            acts >= ag_action
            & fsm.get_inputs_between_states(explanation.state, states)
            & fsm.bddEnc.inputsMask)
Beispiel #3
0
 def check_cax(self, fsm, explanation, agents, phi):
     """Check that the explanation is correct."""
     # Get the cubes
     gamma_cube = fsm.inputs_cube_for_agents(agents)
     ngamma_cube = fsm.bddEnc.inputsCube - gamma_cube
     
     # The first state satisfies the spec
     self.assertTrue(explanation.state <= ~cex(fsm, agents, ~phi))
     acts = BDD.false(fsm.bddEnc.DDmanager)
     states = BDD.false(fsm.bddEnc.DDmanager)
     for (act, succ) in explanation.successors:
         # The successor satisfies phi
         self.assertTrue(succ.state <= phi)
         # The action is effectively possible
         self.assertTrue(act <= fsm.get_inputs_between_states(
                                              explanation.state, succ.state))
         # Accumulate states and actions
         acts = acts | act
         states = states | succ.state
     
     # The actions are effectively all the possible ones
     self.assertEqual((fsm.protocol(agents) &
                       explanation.state).forsome(fsm.bddEnc.statesCube).
                       forsome(ngamma_cube) &
                      fsm.bddEnc.statesMask,
                      acts.forsome(ngamma_cube) & fsm.bddEnc.statesMask)
Beispiel #4
0
    def check_cax(self, fsm, explanation, agents, phi):
        """Check that the explanation is correct."""
        # Get the cubes
        gamma_cube = fsm.inputs_cube_for_agents(agents)
        ngamma_cube = fsm.bddEnc.inputsCube - gamma_cube

        # The first state satisfies the spec
        self.assertTrue(explanation.state <= ~cex(fsm, agents, ~phi))
        acts = BDD.false(fsm.bddEnc.DDmanager)
        states = BDD.false(fsm.bddEnc.DDmanager)
        for (act, succ) in explanation.successors:
            # The successor satisfies phi
            self.assertTrue(succ.state <= phi)
            # The action is effectively possible
            self.assertTrue(act <= fsm.get_inputs_between_states(
                explanation.state, succ.state))
            # Accumulate states and actions
            acts = acts | act
            states = states | succ.state

        # The actions are effectively all the possible ones
        self.assertEqual((fsm.protocol(agents) & explanation.state).forsome(
            fsm.bddEnc.statesCube).forsome(ngamma_cube)
                         & fsm.bddEnc.statesMask,
                         acts.forsome(ngamma_cube) & fsm.bddEnc.statesMask)