Package MAKBPInterpreter.agents
Class KripkeStructure
- java.lang.Object
-
- MAKBPInterpreter.agents.KripkeStructure
-
public class KripkeStructure extends java.lang.Object
Represents 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 thegraph
object.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 thegraph
object.boolean
equals(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.int
hashCode()
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.void
publicAnnouncement(Formula formula)
Called when a public announcement is formulated.java.lang.String
toString()
-
-
-
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 thegraph
object. A copy is realized so thegraph
object 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 thegraph
object. A copy is realized so thegraph
object 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:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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 theworld
passed) if theworld
passed 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
-
-