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 voidclear()booleancontainsKey(java.lang.Object key)booleancontainsValue(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.booleanequals(java.lang.Object obj)InstanceAssignmentget(java.lang.Object key)java.lang.Integerget(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 ReferenceWorldgetMapping(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.IntegergetMultiplicator(FolFormula f)Returns the multiplicator of this reference world for the given formula, i.e.inthashCode()booleanisEmpty()java.util.Set<Predicate>keySet()InstanceAssignmentput(Predicate key, InstanceAssignment value)voidputAll(java.util.Map<? extends Predicate,? extends InstanceAssignment> m)InstanceAssignmentremove(java.lang.Object key)booleansatisfies(FolBeliefSet beliefBase)Checks whether this interpretation satisfies the given knowledge base.booleansatisfies(FolFormula formula)Checks whether this interpretation satisfies the given formula.intsize()java.lang.IntegerspanNumber()Returns the span number of this reference world, i.e.java.lang.StringtoString()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:InterpretationChecks whether this interpretation satisfies the given formula.- Specified by:
satisfiesin 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:InterpretationChecks whether this interpretation satisfies the given knowledge base.- Specified by:
satisfiesin 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:
clearin interfacejava.util.Map<Predicate,InstanceAssignment>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKeyin interfacejava.util.Map<Predicate,InstanceAssignment>
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValuein interfacejava.util.Map<Predicate,InstanceAssignment>
-
entrySet
public java.util.Set<java.util.Map.Entry<Predicate,InstanceAssignment>> entrySet()
- Specified by:
entrySetin interfacejava.util.Map<Predicate,InstanceAssignment>
-
get
public InstanceAssignment get(java.lang.Object key)
- Specified by:
getin interfacejava.util.Map<Predicate,InstanceAssignment>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Map<Predicate,InstanceAssignment>
-
keySet
public java.util.Set<Predicate> keySet()
- Specified by:
keySetin interfacejava.util.Map<Predicate,InstanceAssignment>
-
put
public InstanceAssignment put(Predicate key, InstanceAssignment value)
- Specified by:
putin interfacejava.util.Map<Predicate,InstanceAssignment>
-
putAll
public void putAll(java.util.Map<? extends Predicate,? extends InstanceAssignment> m)
- Specified by:
putAllin interfacejava.util.Map<Predicate,InstanceAssignment>
-
remove
public InstanceAssignment remove(java.lang.Object key)
- Specified by:
removein interfacejava.util.Map<Predicate,InstanceAssignment>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Map<Predicate,InstanceAssignment>
-
values
public java.util.Collection<InstanceAssignment> values()
- Specified by:
valuesin interfacejava.util.Map<Predicate,InstanceAssignment>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Map<Predicate,InstanceAssignment>- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfacejava.util.Map<Predicate,InstanceAssignment>- Overrides:
equalsin classjava.lang.Object
-
-