Package MAKBPInterpreter.agents
Class Agent
- java.lang.Object
-
- MAKBPInterpreter.agents.Agent
-
public class Agent extends java.lang.Object
Represents an agent evolving into an environment.
-
-
Field Summary
Fields Modifier and Type Field Description protected Action
lastSelectedAction
Last selected action linked to the last seen observation.protected java.lang.String
name
Agent name.protected AgentProgram
program
Program used to select the right associated action to an observation.
-
Constructor Summary
Constructors Constructor Description Agent(java.lang.String name, AgentProgram program)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
Action
getAssociatedAction(KripkeStructure structure, KripkeWorld pointedWorld)
Gets the associated action of a structure and a pointed world.java.lang.String
getName()
Gets the name of the agent.AgentProgram
getProgram()
Gets the program for the agent.int
hashCode()
java.lang.Object
performsAssociatedAction(KripkeStructure structure, KripkeWorld pointedWorld, java.lang.Object... objects)
Performs the selected action corresponding a structure and a pointed world.Formula
reverseEngineering()
Returns the associated formula to the last selected action.Formula
reverseEngineering(Action selectedAction)
Returns the associated formula to the passed action.java.lang.String
toString()
-
-
-
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 nameprogram
- 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 structurepointedWorld
- 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 structurepointedWorld
- world to retrieve knowledgeobjects
- 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 classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.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
-
-