<jupyter_start><jupyter_text>Interference<jupyter_code>print(a1.preconditions)
print(a1.effects)
a1
print(a2.preconditions)
print(a2.effects)
a2<jupyter_output>{~Have(Cake)}
{Have(Cake)}<jupyter_text>a1 y a2 no interfieren, pero a2 interfiere consigo misma.<jupyter_code>def _interference(self, actionA, actionB):
        """ Return True if the effects of either action negate the preconditions of the other 
        
        See Also
        --------
        layers.ActionNode
        """
        inconsistent = False
        for p1, e2 in product(actionA.preconditions, actionB.effects):
            inconsistent = p1.__eq__(e2.__invert__())
            if inconsistent:
                return True
        for e1, p2 in product(actionA.effects, actionB.preconditions):
            inconsistent = e1.__eq__(p2.__invert__())
            if inconsistent:
                return True
        return inconsistent
_interference(None, a1,a2)
_interference(None, a2, a2)<jupyter_output><empty_output><jupyter_text>Competing needs I won't simulate this because it would require to build a 2-layers graph and I think I can solve this function without so much work. If the first approach doesn't work I may do the simulation.<jupyter_code>def _competing_needs(self, actionA, actionB):
        """ Return True if any preconditions of the two actions are pairwise 
        mutex in the parent layer
        
        See Also
        --------
        layers.ActionNode
        layers.BaseLayer.parent_layer
        """
        return self.parent_layer.is_mutex(actionA, actionB)<jupyter_output><empty_output><jupyter_text>The complete class<jupyter_code>class ActionLayer(BaseActionLayer):

    def _inconsistent_effects(self, actionA, actionB):
        """ Return True if an effect of one action negates an effect of the other

        See Also
        --------
        layers.ActionNode
        """
        inconsistent = False
        for e1, e2 in product(actionA.effects, actionB.effects):
            inconsistent = e1.__eq__(e2.__invert__())
            if inconsistent:
                break
        return inconsistent


    def _interference(self, actionA, actionB):
        """ Return True if the effects of either action negate the preconditions of the other 
        
        See Also
        --------
        layers.ActionNode
        """
        inconsistent = False
        for p1, e2 in product(actionA.preconditions, actionB.effects):
            inconsistent = p1.__eq__(e2.__invert__())
            if inconsistent:
                return True
        for e1, p2 in product(actionA.effects, actionB.preconditions):
            inconsistent = e1.__eq__(p2.__invert__())
            if inconsistent:
                return True
        return inconsistent

    def _competing_needs(self, actionA, actionB):
        """ Return True if any preconditions of the two actions are pairwise mutex in the parent layer
        
        See Also
        --------
        layers.ActionNode
        layers.BaseLayer.parent_layer
        """
        return self.parent_layer.is_mutex(actionA, actionB)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08416, 'fraction_numerical': 0.01088, 'mean_word_length': 2.3433155080213903, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '303975', 'license': 'MIT', 'n_tokens_mistral': 899, 'n_tokens_neox': 854, 'n_words': 247, 'path': 'Projects/2_Classical Planning/scratchpad/n01_action_layer.ipynb', 'repo_name': 'mtasende/artificial-intelligence', 'size': '3125'}