public class ReferenceWorld extends AbstractInterpretation<FolBeliefSet,FolFormula> implements java.util.Map<Predicate,InstanceAssignment>
Modifier and Type | Field and Description |
---|---|
private java.util.Map<Predicate,InstanceAssignment> |
assignments
The instance assignments of this reference worlds
|
private java.util.Collection<? extends java.util.Collection<? extends Constant>> |
equivalenceClasses
The equivalence classes this reference world bases on.
|
private static org.slf4j.Logger |
log
Logger.
|
private java.util.Map<FolFormula,java.lang.Integer> |
multiplicators
Multiplicators for formulas; saved for efficiency.
|
private java.util.Collection<Predicate> |
predicates
The set of predicates this reference world bases on.
|
private java.lang.Integer |
spanNumber
The span number of this reference world; saved for efficiency.
|
Constructor and 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.
|
Modifier and Type | Method and 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.
|
private java.lang.Integer |
getMultiplicatorForConjunction(FolFormula f)
Returns the multiplicator of this reference world for the given formula
(which is a conjunction of literals or a single literal),
i.e.
|
private java.lang.Integer |
getNumberOfOccurences(FolFormula f,
Predicate p,
java.util.Collection<? extends Constant> constants,
boolean positive)
Determines the number of occurrences of instances of predicate "p" with a constant in "constants".
|
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() |
satisfies
private static org.slf4j.Logger log
private java.util.Map<Predicate,InstanceAssignment> assignments
private java.util.Collection<? extends java.util.Collection<? extends Constant>> equivalenceClasses
private java.util.Collection<Predicate> predicates
private java.lang.Integer spanNumber
private java.util.Map<FolFormula,java.lang.Integer> multiplicators
public ReferenceWorld(java.util.Collection<? extends java.util.Collection<? extends Constant>> equivalenceClasses, java.util.Collection<Predicate> predicates)
equivalenceClasses
- a set of set of constants.predicates
- a set of predicatespublic java.lang.Integer get(Predicate predicate, java.util.Collection<? extends Constant> constants)
predicate
- a predicate.constants
- a set of constants.public java.lang.Integer spanNumber()
public java.lang.Integer getMultiplicator(FolFormula f)
f
- a fol formula.private java.lang.Integer getMultiplicatorForConjunction(FolFormula f)
f
- a fol formula (either a conjunction of literals or a single literal).private java.lang.Integer getNumberOfOccurences(FolFormula f, Predicate p, java.util.Collection<? extends Constant> constants, boolean positive)
f
- a fol formula.p
- a predicate.constants
- a set of constants.positive
- whether the instances are to be positive.public static ReferenceWorld getMapping(HerbrandInterpretation i, java.util.Set<Predicate> predicates, java.util.Set<java.util.Set<Constant>> constants)
i
- a Herbrand interpretation.constants
- the set of equivalence classes.predicates
- a set of predicates.public static java.util.Set<ReferenceWorld> enumerateReferenceWorlds(java.util.Set<Predicate> predicates, java.util.Set<java.util.Set<Constant>> constants)
predicates
- a set of predicates.constants
- a set of set of constants.public boolean satisfies(FolFormula formula) throws java.lang.IllegalArgumentException
Interpretation
satisfies
in interface Interpretation<FolBeliefSet,FolFormula>
formula
- a formula .java.lang.IllegalArgumentException
- if the formula does not correspond
to the expected language.public boolean satisfies(FolBeliefSet beliefBase) throws java.lang.IllegalArgumentException
Interpretation
satisfies
in interface Interpretation<FolBeliefSet,FolFormula>
beliefBase
- a knowledge base.java.lang.IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond
to the expected language.public void clear()
clear
in interface java.util.Map<Predicate,InstanceAssignment>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<Predicate,InstanceAssignment>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<Predicate,InstanceAssignment>
public java.util.Set<java.util.Map.Entry<Predicate,InstanceAssignment>> entrySet()
entrySet
in interface java.util.Map<Predicate,InstanceAssignment>
public InstanceAssignment get(java.lang.Object key)
get
in interface java.util.Map<Predicate,InstanceAssignment>
public boolean isEmpty()
isEmpty
in interface java.util.Map<Predicate,InstanceAssignment>
public java.util.Set<Predicate> keySet()
keySet
in interface java.util.Map<Predicate,InstanceAssignment>
public InstanceAssignment put(Predicate key, InstanceAssignment value)
put
in interface java.util.Map<Predicate,InstanceAssignment>
public void putAll(java.util.Map<? extends Predicate,? extends InstanceAssignment> m)
putAll
in interface java.util.Map<Predicate,InstanceAssignment>
public InstanceAssignment remove(java.lang.Object key)
remove
in interface java.util.Map<Predicate,InstanceAssignment>
public int size()
size
in interface java.util.Map<Predicate,InstanceAssignment>
public java.util.Collection<InstanceAssignment> values()
values
in interface java.util.Map<Predicate,InstanceAssignment>
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Map<Predicate,InstanceAssignment>
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Map<Predicate,InstanceAssignment>
equals
in class java.lang.Object