Class ReferenceWorld
- java.lang.Object
-
- net.sf.tweety.commons.AbstractInterpretation<FolBeliefSet,FolFormula>
-
- net.sf.tweety.logics.rpcl.semantics.ReferenceWorld
-
- All Implemented Interfaces:
java.util.Map<Predicate,InstanceAssignment>
,Interpretation<FolBeliefSet,FolFormula>
public class ReferenceWorld extends AbstractInterpretation<FolBeliefSet,FolFormula> implements java.util.Map<Predicate,InstanceAssignment>
Instances of this class represent reference worlds, i.e. sets of instance assignment. Each reference world describes a set of Herbrand interpretations.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description ReferenceWorld(java.util.Collection<? extends java.util.Collection<? extends Constant>> equivalenceClasses, java.util.Collection<Predicate> predicates)
Creates a new reference world for the given equivalence classes.
-
Method Summary
Modifier and Type Method Description void
clear()
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
java.util.Set<java.util.Map.Entry<Predicate,InstanceAssignment>>
entrySet()
static java.util.Set<ReferenceWorld>
enumerateReferenceWorlds(java.util.Set<Predicate> predicates, java.util.Set<java.util.Set<Constant>> constants)
Determines the set of all reference worlds wrt.boolean
equals(java.lang.Object obj)
InstanceAssignment
get(java.lang.Object key)
java.lang.Integer
get(Predicate predicate, java.util.Collection<? extends Constant> constants)
Retrieves the number of true instances assigned for the given predicate and the given equivalence class of constants.static ReferenceWorld
getMapping(HerbrandInterpretation i, java.util.Set<Predicate> predicates, java.util.Set<java.util.Set<Constant>> constants)
Determines the reference world of the given interpretation wrt.java.lang.Integer
getMultiplicator(FolFormula f)
Returns the multiplicator of this reference world for the given formula, i.e.int
hashCode()
boolean
isEmpty()
java.util.Set<Predicate>
keySet()
InstanceAssignment
put(Predicate key, InstanceAssignment value)
void
putAll(java.util.Map<? extends Predicate,? extends InstanceAssignment> m)
InstanceAssignment
remove(java.lang.Object key)
boolean
satisfies(FolBeliefSet beliefBase)
Checks whether this interpretation satisfies the given knowledge base.boolean
satisfies(FolFormula formula)
Checks whether this interpretation satisfies the given formula.int
size()
java.lang.Integer
spanNumber()
Returns the span number of this reference world, i.e.java.lang.String
toString()
java.util.Collection<InstanceAssignment>
values()
-
Methods inherited from class net.sf.tweety.commons.AbstractInterpretation
satisfies
-
-
-
-
Constructor Detail
-
ReferenceWorld
public ReferenceWorld(java.util.Collection<? extends java.util.Collection<? extends Constant>> equivalenceClasses, java.util.Collection<Predicate> predicates)
Creates a new reference world for the given equivalence classes.- Parameters:
equivalenceClasses
- a set of set of constants.predicates
- a set of predicates
-
-
Method Detail
-
get
public java.lang.Integer get(Predicate predicate, java.util.Collection<? extends Constant> constants)
Retrieves the number of true instances assigned for the given predicate and the given equivalence class of constants.- Parameters:
predicate
- a predicate.constants
- a set of constants.- Returns:
- the number of true instances.
-
spanNumber
public java.lang.Integer spanNumber()
Returns the span number of this reference world, i.e. the number of Herbrand interpretations this world refers to.- Returns:
- the span number of this reference world.
-
getMultiplicator
public java.lang.Integer getMultiplicator(FolFormula f)
Returns the multiplicator of this reference world for the given formula, i.e. the number of interpretations that map to this world and satisfy the formula.- Parameters:
f
- a fol formula.- Returns:
- the multiplicator of this reference world for the given formula.
-
getMapping
public static ReferenceWorld getMapping(HerbrandInterpretation i, java.util.Set<Predicate> predicates, java.util.Set<java.util.Set<Constant>> constants)
Determines the reference world of the given interpretation wrt. the given set of equivalence classes and the given set of predicates..- Parameters:
i
- a Herbrand interpretation.constants
- the set of equivalence classes.predicates
- a set of predicates.- Returns:
- a reference world.
-
enumerateReferenceWorlds
public static java.util.Set<ReferenceWorld> enumerateReferenceWorlds(java.util.Set<Predicate> predicates, java.util.Set<java.util.Set<Constant>> constants)
Determines the set of all reference worlds wrt. the given set of predicates and equivalence classes.- Parameters:
predicates
- a set of predicates.constants
- a set of set of constants.- Returns:
- a set of reference worlds.
-
satisfies
public boolean satisfies(FolFormula formula) throws java.lang.IllegalArgumentException
Description copied from interface:Interpretation
Checks whether this interpretation satisfies the given formula.- Specified by:
satisfies
in interfaceInterpretation<FolBeliefSet,FolFormula>
- Parameters:
formula
- a formula .- Returns:
- "true" if this interpretation satisfies the given formula.
- Throws:
java.lang.IllegalArgumentException
- if the formula does not correspond to the expected language.
-
satisfies
public boolean satisfies(FolBeliefSet beliefBase) throws java.lang.IllegalArgumentException
Description copied from interface:Interpretation
Checks whether this interpretation satisfies the given knowledge base.- Specified by:
satisfies
in interfaceInterpretation<FolBeliefSet,FolFormula>
- Parameters:
beliefBase
- a knowledge base.- Returns:
- "true" if this interpretation satisfies the given knowledge base.
- Throws:
java.lang.IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValue
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
entrySet
public java.util.Set<java.util.Map.Entry<Predicate,InstanceAssignment>> entrySet()
- Specified by:
entrySet
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
get
public InstanceAssignment get(java.lang.Object key)
- Specified by:
get
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
keySet
public java.util.Set<Predicate> keySet()
- Specified by:
keySet
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
put
public InstanceAssignment put(Predicate key, InstanceAssignment value)
- Specified by:
put
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
putAll
public void putAll(java.util.Map<? extends Predicate,? extends InstanceAssignment> m)
- Specified by:
putAll
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
remove
public InstanceAssignment remove(java.lang.Object key)
- Specified by:
remove
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
size
public int size()
- Specified by:
size
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
values
public java.util.Collection<InstanceAssignment> values()
- Specified by:
values
in interfacejava.util.Map<Predicate,InstanceAssignment>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Map<Predicate,InstanceAssignment>
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfacejava.util.Map<Predicate,InstanceAssignment>
- Overrides:
equals
in classjava.lang.Object
-
-