Class CommonKnowledge

  • All Implemented Interfaces:
    Formula

    public class CommonKnowledge
    extends java.lang.Object
    implements Formula
    Represents a set of agents knowing a common formula. This knowledge corresponding of EK^depth(EK^(depth-1) (... (EK(phi)))).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Set<Agent> agents
      Agent set where each agent knows the associated formula.
      protected Formula innerFormula
      Common formula knows by all the agents.
    • Constructor Summary

      Constructors 
      Constructor Description
      CommonKnowledge​(Formula formula, java.util.Set<Agent> agents)
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(Formula otherFormula)
      Returns true if this formula contains the specified formula.
      boolean equals​(java.lang.Object other)
      Verifies if the current object formula and other formula are the same.
      boolean evaluate​(LogicAssignment assignment)
      Evaluates the everybody knowledge of formula in all accessible worlds by all agents of the group agents.
      java.util.Set<Agent> getAgents()
      Gets the agent set where each agent knows the associated formula.
      Formula getInnerFormula()
      Gets the inner formula object.
      Formula getNegation()
      Returns the negation of the current formula.
      int hashCode()  
      Formula simplify()
      Simplifies the logic formula.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • agents

        protected java.util.Set<Agent> agents
        Agent set where each agent knows the associated formula.
      • innerFormula

        protected Formula innerFormula
        Common formula knows by all the agents.
    • Constructor Detail

      • CommonKnowledge

        public CommonKnowledge​(Formula formula,
                               java.util.Set<Agent> agents)
        Default constructor.
        Parameters:
        formula - knowledge
        agents - set of agents where each of this knows the formula
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object other)
        Description copied from interface: Formula
        Verifies if the current object formula and other formula are the same.
        Specified by:
        equals in interface Formula
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - other formula to test the equality
        Returns:
        result of the equality test
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • simplify

        public Formula simplify()
        Description copied from interface: Formula
        Simplifies the logic formula.
        Specified by:
        simplify in interface Formula
        Returns:
        simplified formula
      • getNegation

        public Formula getNegation()
        Description copied from interface: Formula
        Returns the negation of the current formula.
        Specified by:
        getNegation in interface Formula
        Returns:
        negation of formula
      • contains

        public boolean contains​(Formula otherFormula)
        Description copied from interface: Formula
        Returns true if this formula contains the specified formula.
        Specified by:
        contains in interface Formula
        Parameters:
        otherFormula - other formula whose presence in this formula is to be tested
        Returns:
        true if this formula contains the specified formula
      • getInnerFormula

        public Formula getInnerFormula()
        Gets the inner formula object.
        Returns:
        inner formula object
        See Also:
        innerFormula
      • getAgents

        public java.util.Set<Agent> getAgents()
        Gets the agent set where each agent knows the associated formula.
        Returns:
        agent set
      • evaluate

        public boolean evaluate​(LogicAssignment assignment)
                         throws java.lang.Exception
        Evaluates the everybody knowledge of formula in all accessible worlds by all agents of the group agents. An adapted Breadth-first search where at each world, an evaluation of EK was realized. This algorithm represents the infinite depth in theory but limited by the number of edges and vertices of the Kripke structure.
        Specified by:
        evaluate in interface Formula
        Parameters:
        assignment - state to evaluate
        Returns:
        result of the evaluation
        Throws:
        java.lang.Exception - throws when the formula not supported this operation or expected object not given