public class RelationalRankingFunction extends AbstractInterpretation
Modifier and Type | Field and Description |
---|---|
static java.lang.Integer |
INFINITY
Integer used to define infinity.
|
private java.util.Map<HerbrandInterpretation,java.lang.Integer> |
ranks
The ranks of the Herbrand interpretations.
|
private FolSignature |
signature
The signature of the language this ranking function
is defined on.
|
Constructor and Description |
---|
RelationalRankingFunction(FolSignature signature)
Creates a new ranking function mapping each
given interpretation to zero.
|
Modifier and Type | Method and Description |
---|---|
java.util.Set<HerbrandInterpretation> |
getPossibleInterpretations()
Returns all interpretations that are mapped to a rank
unequal to INFINITY.
|
private java.util.Set<RelationalConditional> |
getPrototypes(RelationalConditional rc)
Returns the set of instances with prototypes.
|
private java.util.Set<RelationalConditional> |
getWeakPrototypes(RelationalConditional rc)
Returns the set of instances with weak prototypes.
|
private java.lang.Integer |
minimalRank()
Returns the minimal rank of this OCF.
|
void |
normalize()
Normalizes this OCF, i.e.
|
java.lang.Integer |
numFalsifiedInstances(HerbrandInterpretation w,
RelationalConditional rc)
Returns the number of instances of "rc" that are falsified by
the given interpretation.
|
java.lang.Integer |
numVerifiedInstances(HerbrandInterpretation w,
RelationalConditional rc)
Returns the number of instances of "rc" that are verified by
the given interpretation.
|
java.lang.Integer |
rank(FolFormula formula)
Gets the rank of the given sentence (ground formula).
|
java.lang.Integer |
rank(HerbrandInterpretation w)
Gets the rank of the given Herbrand interpretation.
|
boolean |
satisfies(BeliefBase beliefBase)
Checks whether this interpretation satisfies the given knowledge base.
|
boolean |
satisfies(Formula formula)
Checks whether this interpretation satisfies the given formula.
|
void |
setRank(HerbrandInterpretation w,
java.lang.Integer value)
Sets the rank for the given Herbrand interpretation.
|
java.lang.String |
toString() |
satisfies
public static final java.lang.Integer INFINITY
private java.util.Map<HerbrandInterpretation,java.lang.Integer> ranks
private FolSignature signature
public RelationalRankingFunction(FolSignature signature)
signature
- the signature of the language this ranking function
is defined on.public java.lang.Integer rank(HerbrandInterpretation w) throws java.lang.IllegalArgumentException
w
- a Herbrand interpretation.java.lang.IllegalArgumentException
- if the given Herbrand interpretation has no
rank in this ranking function.public void setRank(HerbrandInterpretation w, java.lang.Integer value)
w
- a Herbrand interpretation.value
- the rank for the Herbrand interpretation.public java.lang.Integer rank(FolFormula formula) throws java.lang.IllegalArgumentException
formula
- a formula.java.lang.IllegalArgumentException
- if the languages of the formula does not correspond to the language of the
interpretations this ranking function is defined on or the formula is not a sentence.public boolean satisfies(Formula formula) throws java.lang.IllegalArgumentException
Interpretation
formula
- a formula .java.lang.IllegalArgumentException
- if the formula does not correspond
to the expected language.private java.util.Set<RelationalConditional> getWeakPrototypes(RelationalConditional rc)
rc
- a relational conditionalprivate java.util.Set<RelationalConditional> getPrototypes(RelationalConditional rc)
rc
- a relational conditionalpublic boolean satisfies(BeliefBase beliefBase) throws java.lang.IllegalArgumentException
Interpretation
beliefBase
- a knowledge base.java.lang.IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond
to the expected language.private java.lang.Integer minimalRank()
public void normalize()
public java.util.Set<HerbrandInterpretation> getPossibleInterpretations()
public java.lang.Integer numFalsifiedInstances(HerbrandInterpretation w, RelationalConditional rc)
w
- a Herbrand interpretation.rc
- a relational conditional.public java.lang.Integer numVerifiedInstances(HerbrandInterpretation w, RelationalConditional rc)
w
- a Herbrand interpretation.rc
- a relational conditional.public java.lang.String toString()
toString
in class java.lang.Object