Class ReferenceWorld
java.lang.Object
org.tweetyproject.commons.AbstractInterpretation<FolBeliefSet, FolFormula>
org.tweetyproject.logics.rpcl.semantics.ReferenceWorld
- All Implemented Interfaces:
Map<Predicate, InstanceAssignment>,Interpretation<FolBeliefSet, FolFormula>
public class ReferenceWorld
extends AbstractInterpretation<FolBeliefSet, FolFormula>
implements 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
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionReferenceWorld(Collection<? extends Collection<? extends Constant>> equivalenceClasses, Collection<Predicate> predicates) Creates a new reference world for the given equivalence classes. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()static Set<ReferenceWorld> Determines the set of all reference worlds wrt.booleanget(Predicate predicate, 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, Set<Predicate> predicates, Set<Set<Constant>> constants) Determines the reference world of the given interpretation wrt.Returns the multiplicator of this reference world for the given formula, i.e.inthashCode()booleanisEmpty()keySet()put(Predicate key, InstanceAssignment value) voidputAll(Map<? extends Predicate, ? extends InstanceAssignment> m) booleansatisfies(FolBeliefSet beliefBase) Checks whether this interpretation satisfies the given knowledge base.booleansatisfies(FolFormula formula) Checks whether this interpretation satisfies the given formula.intsize()Returns the span number of this reference world, i.e.toString()values()Methods inherited from class org.tweetyproject.commons.AbstractInterpretation
satisfiesMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ReferenceWorld
public ReferenceWorld(Collection<? extends Collection<? extends Constant>> equivalenceClasses, 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 Details
-
get
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
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
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, Set<Predicate> predicates, Set<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.predicates- a set of predicates.constants- the set of equivalence classes.- Returns:
- a reference world.
-
enumerateReferenceWorlds
public static Set<ReferenceWorld> enumerateReferenceWorlds(Set<Predicate> predicates, Set<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
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:
IllegalArgumentException- if the formula does not correspond to the expected language.
-
satisfies
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:
IllegalArgumentException- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
-
clear
public void clear()- Specified by:
clearin interfaceMap<Predicate, InstanceAssignment>
-
containsKey
- Specified by:
containsKeyin interfaceMap<Predicate, InstanceAssignment>
-
containsValue
- Specified by:
containsValuein interfaceMap<Predicate, InstanceAssignment>
-
entrySet
- Specified by:
entrySetin interfaceMap<Predicate, InstanceAssignment>
-
get
- Specified by:
getin interfaceMap<Predicate, InstanceAssignment>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMap<Predicate, InstanceAssignment>
-
keySet
-
put
- Specified by:
putin interfaceMap<Predicate, InstanceAssignment>
-
putAll
- Specified by:
putAllin interfaceMap<Predicate, InstanceAssignment>
-
remove
- Specified by:
removein interfaceMap<Predicate, InstanceAssignment>
-
size
public int size()- Specified by:
sizein interfaceMap<Predicate, InstanceAssignment>
-
values
- Specified by:
valuesin interfaceMap<Predicate, InstanceAssignment>
-
toString
-
hashCode
-
equals
-