Class RankingFunction
- java.lang.Object
-
- net.sf.tweety.commons.AbstractInterpretation<ClBeliefSet,Conditional>
-
- net.sf.tweety.logics.cl.semantics.RankingFunction
-
- All Implemented Interfaces:
Interpretation<ClBeliefSet,Conditional>
public class RankingFunction extends AbstractInterpretation<ClBeliefSet,Conditional>
A ranking function (or ordinal conditional function, OCF) that maps possible worlds of a propositional language to integers.
See W. Spohn. Ordinal conditional functions: a dynamic theory of epistemic states. In W.L. Harper and B. Skyrms, editors, Causation in Decision, Belief Change, and Statistics, II, pages 105-134. Kluwer Academic Publishers, 1988.- Author:
- Matthias Thimm
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.IntegerINFINITYInteger used to define infinity.
-
Constructor Summary
Constructors Constructor Description RankingFunction(PlSignature signature)Creates a new ranking function mapping each given interpretation to zero.
-
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object other)static booleanfalsifies(PossibleWorld w, Conditional c)Checks whether the given possible world w falsifies the given conditional (B|A), i.e.voidforceStrictness(java.util.Set<PlFormula> formulas)Sets the rank of every interpretation i that does not satisfy the given set of formulas to RankingFunction.INFINITY.java.util.Set<PossibleWorld>getPlausibleWorlds()Returns all interpretations that are mapped to 0java.util.Set<PossibleWorld>getPossibleWorlds()Returns all interpretations that are mapped to a rank unequal to INFINITY.PlSignaturegetSignature()Returns the signature of the first-order language this ranking function is defined on.booleanisNormalized()Checkes whether this OCF is normalized, i.e.voidnormalize()Normalizes this OCF, i.e.java.lang.Integerrank(PossibleWorld w)Gets the rank of the given possible world.java.lang.Integerrank(PlFormula formula)Gets the rank of the given formula.booleansatisfies(ClBeliefSet beliefBase)Checks whether this interpretation satisfies the given knowledge base.booleansatisfies(Conditional formula)Checks whether this interpretation satisfies the given formula.static booleansatisfies(PossibleWorld w, Conditional c)Checks whether the given possible world w satisfies the given conditional (B|A), i.e.voidsetRank(PossibleWorld w, java.lang.Integer value)Sets the rank for the given possible world.java.lang.StringtoString()static booleanverifies(PossibleWorld w, Conditional c)Checks whether the given possible world w verifies the given conditional (B|A), i.e.-
Methods inherited from class net.sf.tweety.commons.AbstractInterpretation
satisfies
-
-
-
-
Constructor Detail
-
RankingFunction
public RankingFunction(PlSignature signature)
Creates a new ranking function mapping each given interpretation to zero.- Parameters:
signature- the signature of the language this ranking function is defined on.
-
-
Method Detail
-
rank
public java.lang.Integer rank(PossibleWorld w) throws java.lang.IllegalArgumentException
Gets the rank of the given possible world.- Parameters:
w- an possible world.- Returns:
- the rank of the given possible world.
- Throws:
java.lang.IllegalArgumentException- if the given possible world has no rank in this ranking function.
-
setRank
public void setRank(PossibleWorld w, java.lang.Integer value)
Sets the rank for the given possible world.- Parameters:
w- an possible world.value- the rank for the possible world.
-
satisfies
public boolean satisfies(Conditional formula) throws java.lang.IllegalArgumentException
Description copied from interface:InterpretationChecks whether this interpretation satisfies the given formula.- Parameters:
formula- a formula .- Returns:
- "true" if this interpretation satisfies the given formula.
- Throws:
java.lang.IllegalArgumentException- if the formula does not correspond to the expected language.
-
satisfies
public boolean satisfies(ClBeliefSet beliefBase)
Description copied from interface:InterpretationChecks whether this interpretation satisfies the given knowledge base.- Parameters:
beliefBase- a knowledge base.- Returns:
- "true" if this interpretation satisfies the given knowledge base.
-
forceStrictness
public void forceStrictness(java.util.Set<PlFormula> formulas)
Sets the rank of every interpretation i that does not satisfy the given set of formulas to RankingFunction.INFINITY.- Parameters:
formulas- a set of first-order formulas.
-
rank
public java.lang.Integer rank(PlFormula formula) throws java.lang.IllegalArgumentException
Gets the rank of the given formula. Throws an IllegalArgumentException when the language of the formula does not correspond to the language of the interpretations this ranking function is defined on. Otherwise the rank of a formula is defined as the minimal rank of its satisfying interpretations.- Parameters:
formula- a formula.- Returns:
- the rank of the given formula.
- Throws:
java.lang.IllegalArgumentException- if the languages of the formula does not correspond to the language of the interpretations this ranking function is defined on.
-
normalize
public void normalize()
Normalizes this OCF, i.e. appropriately shifts the ranks such that the minimal rank equals zero.
-
isNormalized
public boolean isNormalized()
Checkes whether this OCF is normalized, i.e. whether its minimal rank value is zero.- Returns:
- "true" if this OCF is normalized
-
getPossibleWorlds
public java.util.Set<PossibleWorld> getPossibleWorlds()
Returns all interpretations that are mapped to a rank unequal to INFINITY.- Returns:
- all interpretations that are mapped to a rank unequal to INFINITY.
-
getPlausibleWorlds
public java.util.Set<PossibleWorld> getPlausibleWorlds()
Returns all interpretations that are mapped to 0- Returns:
- all interpretations that are mapped to 0
-
getSignature
public PlSignature getSignature()
Returns the signature of the first-order language this ranking function is defined on.- Returns:
- the signature of the first-order language this ranking function is defined on.
-
verifies
public static boolean verifies(PossibleWorld w, Conditional c)
Checks whether the given possible world w verifies the given conditional (B|A), i.e. whether w satisfies A and B- Parameters:
w- a possible worldc- a conditional.- Returns:
- "true" if the given possible world verifies the given conditional.
-
falsifies
public static boolean falsifies(PossibleWorld w, Conditional c)
Checks whether the given possible world w falsifies the given conditional (B|A), i.e. whether w satisfies A and not B- Parameters:
w- a possible worldc- a conditional.- Returns:
- "true" if the given possible world falsifies the given conditional.
-
satisfies
public static boolean satisfies(PossibleWorld w, Conditional c)
Checks whether the given possible world w satisfies the given conditional (B|A), i.e. whether w does not falsify c.- Parameters:
w- a possible worldc- a conditional.- Returns:
- "true" if the given possible world satisfies the given conditional.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
-