Class ReferenceWorld
- java.lang.Object
-
- net.sf.tweety.commons.AbstractInterpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula>
-
- net.sf.tweety.logics.rpcl.semantics.ReferenceWorld
-
- All Implemented Interfaces:
Map<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>,net.sf.tweety.commons.Interpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula>
public class ReferenceWorld extends net.sf.tweety.commons.AbstractInterpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula> implements Map<net.sf.tweety.logics.commons.syntax.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(Collection<? extends Collection<? extends net.sf.tweety.logics.commons.syntax.Constant>> equivalenceClasses, Collection<net.sf.tweety.logics.commons.syntax.Predicate> predicates)Creates a new reference world for the given equivalence classes.
-
Method Summary
Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>>entrySet()static Set<ReferenceWorld>enumerateReferenceWorlds(Set<net.sf.tweety.logics.commons.syntax.Predicate> predicates, Set<Set<net.sf.tweety.logics.commons.syntax.Constant>> constants)Determines the set of all reference worlds wrt.booleanequals(Object obj)InstanceAssignmentget(Object key)Integerget(net.sf.tweety.logics.commons.syntax.Predicate predicate, Collection<? extends net.sf.tweety.logics.commons.syntax.Constant> constants)Retrieves the number of true instances assigned for the given predicate and the given equivalence class of constants.static ReferenceWorldgetMapping(net.sf.tweety.logics.fol.semantics.HerbrandInterpretation i, Set<net.sf.tweety.logics.commons.syntax.Predicate> predicates, Set<Set<net.sf.tweety.logics.commons.syntax.Constant>> constants)Determines the reference world of the given interpretation wrt.IntegergetMultiplicator(net.sf.tweety.logics.fol.syntax.FolFormula f)Returns the multiplicator of this reference world for the given formula, i.e.inthashCode()booleanisEmpty()Set<net.sf.tweety.logics.commons.syntax.Predicate>keySet()InstanceAssignmentput(net.sf.tweety.logics.commons.syntax.Predicate key, InstanceAssignment value)voidputAll(Map<? extends net.sf.tweety.logics.commons.syntax.Predicate,? extends InstanceAssignment> m)InstanceAssignmentremove(Object key)booleansatisfies(net.sf.tweety.logics.fol.syntax.FolBeliefSet beliefBase)booleansatisfies(net.sf.tweety.logics.fol.syntax.FolFormula formula)intsize()IntegerspanNumber()Returns the span number of this reference world, i.e.StringtoString()Collection<InstanceAssignment>values()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
ReferenceWorld
public ReferenceWorld(Collection<? extends Collection<? extends net.sf.tweety.logics.commons.syntax.Constant>> equivalenceClasses, Collection<net.sf.tweety.logics.commons.syntax.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 Integer get(net.sf.tweety.logics.commons.syntax.Predicate predicate, Collection<? extends net.sf.tweety.logics.commons.syntax.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 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 Integer getMultiplicator(net.sf.tweety.logics.fol.syntax.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(net.sf.tweety.logics.fol.semantics.HerbrandInterpretation i, Set<net.sf.tweety.logics.commons.syntax.Predicate> predicates, Set<Set<net.sf.tweety.logics.commons.syntax.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 Set<ReferenceWorld> enumerateReferenceWorlds(Set<net.sf.tweety.logics.commons.syntax.Predicate> predicates, Set<Set<net.sf.tweety.logics.commons.syntax.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(net.sf.tweety.logics.fol.syntax.FolFormula formula) throws IllegalArgumentException- Specified by:
satisfiesin interfacenet.sf.tweety.commons.Interpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula>- Throws:
IllegalArgumentException
-
satisfies
public boolean satisfies(net.sf.tweety.logics.fol.syntax.FolBeliefSet beliefBase) throws IllegalArgumentException- Specified by:
satisfiesin interfacenet.sf.tweety.commons.Interpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula>- Throws:
IllegalArgumentException
-
clear
public void clear()
- Specified by:
clearin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
entrySet
public Set<Map.Entry<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>> entrySet()
- Specified by:
entrySetin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
get
public InstanceAssignment get(Object key)
- Specified by:
getin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
keySet
public Set<net.sf.tweety.logics.commons.syntax.Predicate> keySet()
- Specified by:
keySetin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
put
public InstanceAssignment put(net.sf.tweety.logics.commons.syntax.Predicate key, InstanceAssignment value)
- Specified by:
putin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
putAll
public void putAll(Map<? extends net.sf.tweety.logics.commons.syntax.Predicate,? extends InstanceAssignment> m)
- Specified by:
putAllin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
remove
public InstanceAssignment remove(Object key)
- Specified by:
removein interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
size
public int size()
- Specified by:
sizein interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
values
public Collection<InstanceAssignment> values()
- Specified by:
valuesin interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceMap<net.sf.tweety.logics.commons.syntax.Predicate,InstanceAssignment>- Overrides:
hashCodein classObject
-
-