Package MAKBPInterpreter.agents
Class KripkeStructure
- java.lang.Object
-
- MAKBPInterpreter.agents.KripkeStructure
-
public class KripkeStructure extends java.lang.ObjectRepresents a system of reasoning for modal logic.
-
-
Constructor Summary
Constructors Constructor Description KripkeStructure(java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> graph, java.util.Collection<Agent> agents)Default constructor.KripkeStructure(java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> graph, java.util.Collection<Agent> agents, boolean reflexiveArcsIncluded, boolean symetricArcsIncluded)Constructor.KripkeStructure(KripkeStructure structure)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>>addReflexiveArcs(java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> graph, java.util.Collection<Agent> agents)Adds reflexive arcs into thegraphobject.java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>>addSymetricArcs(java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> graph, java.util.Collection<Agent> agents)Adds symetric arcs into thegraphobject.booleanequals(java.lang.Object other)java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>>getGraph()Gets the graph used by the structure.java.util.Collection<KripkeWorld>getWorlds()Gets the collection of remaining worlds in the structure.java.util.Set<KripkeWorld>getWorldsFromOtherWorldAndAgent(KripkeWorld world, Agent agent)Gets the worlds linked to a world via an agent.inthashCode()protected java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>>initializeGraph(java.util.Collection<KripkeWorld> worlds, java.util.Collection<Agent> agents)Initializes an empty graph with all worlds and agents as keys.voidpublicAnnouncement(Formula formula)Called when a public announcement is formulated.java.lang.StringtoString()
-
-
-
Constructor Detail
-
KripkeStructure
public KripkeStructure(java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> graph, java.util.Collection<Agent> agents, boolean reflexiveArcsIncluded, boolean symetricArcsIncluded)
Constructor.- Parameters:
graph- graph to assigned to the structureagents- list of agents to assigned to the structurereflexiveArcsIncluded- iffalse, we call theaddReflexiveArcs(Map, Collection)mathodsymetricArcsIncluded- iffalse, we call theaddSymetricArcs(Map, Collection)method
-
KripkeStructure
public KripkeStructure(java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> graph, java.util.Collection<Agent> agents)
Default constructor.- Parameters:
graph- graph to assigned to the structureagents- list of agents to assigned to the structure
-
KripkeStructure
public KripkeStructure(KripkeStructure structure)
Copy constructor.- Parameters:
structure- structure to copy
-
-
Method Detail
-
initializeGraph
protected java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> initializeGraph(java.util.Collection<KripkeWorld> worlds, java.util.Collection<Agent> agents)
Initializes an empty graph with all worlds and agents as keys.- Parameters:
worlds- all worlds of the structureagents- all agents in the structure- Returns:
- an initialized graph
-
addReflexiveArcs
public java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> addReflexiveArcs(java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> graph, java.util.Collection<Agent> agents)
Adds reflexive arcs into thegraphobject. A copy is realized so thegraphobject is not modified.- Parameters:
graph- current graph knowledgeagents- collection of agents- Returns:
- the modified copy of
graph
-
addSymetricArcs
public java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> addSymetricArcs(java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> graph, java.util.Collection<Agent> agents)
Adds symetric arcs into thegraphobject. A copy is realized so thegraphobject is not modified.- Parameters:
graph- current graph knowledgeagents- collection of agents- Returns:
- the modified copy of
graph
-
publicAnnouncement
public void publicAnnouncement(Formula formula) throws java.lang.Exception
Called when a public announcement is formulated.- Parameters:
formula- formula to announce- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getWorldsFromOtherWorldAndAgent
public java.util.Set<KripkeWorld> getWorldsFromOtherWorldAndAgent(KripkeWorld world, Agent agent)
Gets the worlds linked to a world via an agent. Can be used to determine if an agent knows his state (only one world in the set which is theworldpassed) if theworldpassed is the real one.- Parameters:
world- world to testagent- agent to test- Returns:
- a set of worlds
-
getGraph
public java.util.Map<KripkeWorld,java.util.Map<Agent,java.util.Set<KripkeWorld>>> getGraph()
Gets the graph used by the structure.- Returns:
- reasoning graph
-
getWorlds
public java.util.Collection<KripkeWorld> getWorlds()
Gets the collection of remaining worlds in the structure.- Returns:
- collection of Kripke worlds
-
-