Class MAKBPInterpreter


  • public class MAKBPInterpreter
    extends java.lang.Object
    Represents a Multi-Agent Knowledge-Based Program interpreter. We can pass a default structure, collections of agents and objects, and an association of permissions to initialize this. We can iterate through the publicAnnoucement method to run the deduction system. We can check if all agents know that are all in the real world.
    • Constructor Detail

      • MAKBPInterpreter

        public MAKBPInterpreter​(java.util.Set<Agent> agents,
                                KripkeStructure structure,
                                java.util.Map<Agent,​java.util.Set<Agent>> permissions,
                                java.util.Map<Action,​java.util.List<java.lang.Object>> objects)
        Constructor.
        Parameters:
        agents - set of agents
        structure - default structure to copy for each agents
        permissions - agent programs knowledge for each agent
        objects - lists of objects to pass for action execution
    • Method Detail

      • publicAnnouncement

        public void publicAnnouncement​(java.util.List<Agent> agents,
                                       java.util.List<Formula> formulas)
                                throws java.lang.Exception
        Announcement of associated formulas to agents. Specification to announce formulas to agents in one method.
        Parameters:
        agents - list of agents who received announcement
        formulas - list of formula to announce
        Throws:
        java.lang.Exception - thrown when the list sizes are not equals or by the Kripke structure in case of error
      • publicAnnouncement

        public void publicAnnouncement​(java.util.Map<Agent,​Formula> formulas)
                                throws java.lang.Exception
        Announcement of associated formulas to agents. Specification to announce formula to agent via a map.
        Parameters:
        formulas - map of formula to announce to a related agent
        Throws:
        java.lang.Exception - thrown when the list sizes are not equals or by the Kripke structure in case of error
      • publicAnnouncement

        public void publicAnnouncement​(java.util.Collection<Agent> agents,
                                       Formula formula)
                                throws java.lang.Exception
        Announcement of a formula to a collection of agents. Specification to announce one formula to multiple agents.
        Parameters:
        agents - collection of agents who received announcement
        formula - formula to announce
        Throws:
        java.lang.Exception - thrown by the Kripke structure in case of error
      • publicAnnouncement

        public void publicAnnouncement​(Agent agent,
                                       Formula formula)
                                throws java.lang.Exception
        Announcement of a formula to an agent.
        Parameters:
        agent - agent who received announcement
        formula - formula to announce
        Throws:
        java.lang.Exception - thrown by the Kripke structure in case of error
      • getAssociatedAction

        public java.util.Map<Agent,​Action> getAssociatedAction​(java.util.Collection<Agent> agents,
                                                                     KripkeWorld pointedWorld)
                                                              throws java.lang.Exception
        Gets the associated action for each agent of the agents argument by retrieving its associated Kripke structure and the pointedWorld.
        Parameters:
        agents - collection of agents to get actions
        pointedWorld - pointed world in the Kripke structure to retrieve actions
        Returns:
        map of agents and actions
        Throws:
        java.lang.Exception - throws when the formula not supported evaluate operation or expected object not given
      • executeAction

        public java.util.Map<Agent,​java.lang.Object> executeAction​(java.util.Map<Agent,​Action> actions)
                                                                  throws java.lang.Exception
        Executes retrieving actions.
        Parameters:
        actions - actions to execute
        Returns:
        returned objects of the actions executions
        Throws:
        java.lang.Exception - thrown when an actions no longer exists in objects attribute or when an action received illegal arguments, objects cannot be processed, etc
      • reverseEngineering

        public java.util.Map<Agent,​Formula> reverseEngineering​(java.util.Map<Agent,​Action> actions)
        Gets modal logic formulas for each retrieved action.
        Parameters:
        actions - retrieved actions
        Returns:
        modal logic formulas
      • reasoning

        public Formula reasoning​(Agent agent,
                                 java.util.Map<Agent,​Formula> observations)
        Returns a formula in function of observations and agents programs knowledge for an agent.
        Parameters:
        agent - reasoning agent
        observations - observations
        Returns:
        deducted formula
        See Also:
        reasoning(Agent, Map, Map)
      • reasoning

        public Formula reasoning​(Agent agent,
                                 java.util.Map<Agent,​Formula> observations,
                                 java.util.Map<Agent,​java.util.Set<Agent>> permissions)
        Returns a formula in function of observations and observations knowledge for agents via permissions.
        Parameters:
        agent - reasoning agent
        observations - observations
        permissions - map to know if an agent can see another agent
        Returns:
        deducted formula
      • reasoning

        public java.util.Map<Agent,​Formula> reasoning​(java.util.Collection<Agent> agents,
                                                            java.util.Map<Agent,​Formula> observations)
        Returns a map of agents and formulas in function of observations and agents programs knowledge for agents.
        Parameters:
        agents - reasoning agents
        observations - observations
        Returns:
        deducted formulas
        See Also:
        reasoning(Collection, Map, Map)
      • reasoning

        public java.util.Map<Agent,​Formula> reasoning​(java.util.Collection<Agent> agents,
                                                            java.util.Map<Agent,​Formula> observations,
                                                            java.util.Map<Agent,​java.util.Set<Agent>> permissions)
        Returns a map of agents and formulas in function of observations and observations knowledge for agents via permissions.
        Parameters:
        agents - reasoning agents
        observations - observations
        Returns:
        deducted formulas
      • getPermissions

        public java.util.Map<Agent,​java.util.Set<Agent>> getPermissions()
        Gets the permissions.
        Returns:
        permissions object
      • getObjects

        public java.util.Map<Action,​java.util.List<java.lang.Object>> getObjects()
        Gets the objects associated to actions.
        Returns:
        objects map
      • getStructures

        public java.util.Map<Agent,​KripkeStructure> getStructures()
        Gets the Kripke structures of the agents.
        Returns:
        structures map