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
ConstructorDescriptionReferenceWorld
(Collection<? extends Collection<? extends Constant>> equivalenceClasses, Collection<Predicate> predicates) Creates a new reference world for the given equivalence classes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
static Set
<ReferenceWorld> Determines the set of all reference worlds wrt.boolean
get
(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 ReferenceWorld
getMapping
(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.int
hashCode()
boolean
isEmpty()
keySet()
put
(Predicate key, InstanceAssignment value) void
putAll
(Map<? extends Predicate, ? extends InstanceAssignment> m) 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()
Returns the span number of this reference world, i.e.toString()
values()
Methods inherited from class org.tweetyproject.commons.AbstractInterpretation
satisfies
Methods 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: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:
IllegalArgumentException
- if the formula does not correspond to the expected language.
-
satisfies
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:
IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
-
clear
public void clear()- Specified by:
clear
in interfaceMap<Predicate,
InstanceAssignment>
-
containsKey
- Specified by:
containsKey
in interfaceMap<Predicate,
InstanceAssignment>
-
containsValue
- Specified by:
containsValue
in interfaceMap<Predicate,
InstanceAssignment>
-
entrySet
- Specified by:
entrySet
in interfaceMap<Predicate,
InstanceAssignment>
-
get
- Specified by:
get
in interfaceMap<Predicate,
InstanceAssignment>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceMap<Predicate,
InstanceAssignment>
-
keySet
-
put
- Specified by:
put
in interfaceMap<Predicate,
InstanceAssignment>
-
putAll
- Specified by:
putAll
in interfaceMap<Predicate,
InstanceAssignment>
-
remove
- Specified by:
remove
in interfaceMap<Predicate,
InstanceAssignment>
-
size
public int size()- Specified by:
size
in interfaceMap<Predicate,
InstanceAssignment>
-
values
- Specified by:
values
in interfaceMap<Predicate,
InstanceAssignment>
-
toString
-
hashCode
-
equals
-