Class Agent


  • public class Agent
    extends java.lang.Object
    Represents an agent evolving into an environment.
    • Field Detail

      • name

        protected java.lang.String name
        Agent name.
      • program

        protected AgentProgram program
        Program used to select the right associated action to an observation. If a null formula is provided, the agent deduce that is the else case.
      • lastSelectedAction

        protected Action lastSelectedAction
        Last selected action linked to the last seen observation.
    • Constructor Detail

      • Agent

        public Agent​(java.lang.String name,
                     AgentProgram program)
        Constructor.
        Parameters:
        name - agent name
        program - used to select the right associated action to an observation
    • Method Detail

      • getAssociatedAction

        public Action getAssociatedAction​(KripkeStructure structure,
                                          KripkeWorld pointedWorld)
                                   throws java.lang.Exception
        Gets the associated action of a structure and a pointed world.
        Parameters:
        structure - Kripke structure
        pointedWorld - world to retrieve knowledge
        Returns:
        associated action or null if no matched conditions and else is not present
        Throws:
        java.lang.Exception - throws when the formula not supported evaluate operation or expected object not given
      • reverseEngineering

        public Formula reverseEngineering​(Action selectedAction)
        Returns the associated formula to the passed action.
        Parameters:
        selectedAction - the selected action to get the right initial formula of the observation
        Returns:
        associated formula or null object if no match
      • performsAssociatedAction

        public java.lang.Object performsAssociatedAction​(KripkeStructure structure,
                                                         KripkeWorld pointedWorld,
                                                         java.lang.Object... objects)
                                                  throws java.lang.Exception
        Performs the selected action corresponding a structure and a pointed world.
        Parameters:
        structure - Kripke structure
        pointedWorld - world to retrieve knowledge
        objects - any number or type of object arguments to pass to action performer
        Returns:
        action return
        Throws:
        java.lang.Exception - throws when receive illegal arguments, objects cannot be processed, etc or when the formula not supported this operation or expected object not given
        See Also:
        getAssociatedAction(KripkeStructure, KripkeWorld), Action.performs(Object...)
      • reverseEngineering

        public Formula reverseEngineering()
        Returns the associated formula to the last selected action. Can be used in any case.
        Returns:
        associated formula or null object if no match
        See Also:
        lastSelectedAction, reverseEngineering(Action)
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

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

        public java.lang.String getName()
        Gets the name of the agent.
        Returns:
        agent name
      • getProgram

        public AgentProgram getProgram()
        Gets the program for the agent.
        Returns:
        agent program