Class RelationalRankingFunction

  • All Implemented Interfaces:
    Interpretation<RclBeliefSet,​RelationalConditional>

    public class RelationalRankingFunction
    extends AbstractInterpretation<RclBeliefSet,​RelationalConditional>
    A relational ranking function (or relational ordinal conditional function, ROCF) that maps Herbrand interpretations 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.

    See also [Kern-Isberner,Thimm, "A Ranking Semantics for Relational Defaults", in preparation].
    Author:
    Matthias Thimm
    • Field Detail

      • INFINITY

        public static final java.lang.Integer INFINITY
        Integer used to define infinity.
      • ranks

        private java.util.Map<HerbrandInterpretation,​java.lang.Integer> ranks
        The ranks of the Herbrand interpretations.
      • signature

        private FolSignature signature
        The signature of the language this ranking function is defined on.
    • Constructor Detail

      • RelationalRankingFunction

        public RelationalRankingFunction​(FolSignature 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​(HerbrandInterpretation w)
                               throws java.lang.IllegalArgumentException
        Gets the rank of the given Herbrand interpretation.
        Parameters:
        w - a Herbrand interpretation.
        Returns:
        the rank of the given Herbrand interpretation.
        Throws:
        java.lang.IllegalArgumentException - if the given Herbrand interpretation has no rank in this ranking function.
      • setRank

        public void setRank​(HerbrandInterpretation w,
                            java.lang.Integer value)
        Sets the rank for the given Herbrand interpretation.
        Parameters:
        w - a Herbrand interpretation.
        value - the rank for the Herbrand interpretation.
      • rank

        public java.lang.Integer rank​(FolFormula formula)
                               throws java.lang.IllegalArgumentException
        Gets the rank of the given sentence (ground 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 or the formula is not a sentence. 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 or the formula is not a sentence.
      • satisfies

        public boolean satisfies​(RelationalConditional formula)
                          throws java.lang.IllegalArgumentException
        Description copied from interface: Interpretation
        Checks 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.
      • getWeakPrototypes

        private java.util.Set<RelationalConditional> getWeakPrototypes​(RelationalConditional rc)
        Returns the set of instances with weak prototypes.
        Parameters:
        rc - a relational conditional
        Returns:
        the set of instances with weak prototypes.
      • getPrototypes

        private java.util.Set<RelationalConditional> getPrototypes​(RelationalConditional rc)
        Returns the set of instances with prototypes.
        Parameters:
        rc - a relational conditional
        Returns:
        the set of instances with prototypes.
      • satisfies

        public boolean satisfies​(RclBeliefSet beliefBase)
                          throws java.lang.IllegalArgumentException
        Description copied from interface: Interpretation
        Checks whether this interpretation satisfies the given knowledge base.
        Parameters:
        beliefBase - a knowledge base.
        Returns:
        "true" if this interpretation satisfies the given knowledge base.
        Throws:
        java.lang.IllegalArgumentException - IllegalArgumentException if the knowledgebase does not correspond to the expected language.
      • minimalRank

        private java.lang.Integer minimalRank()
        Returns the minimal rank of this OCF.
        Returns:
        the minimal rank of this OCF.
      • normalize

        public void normalize()
        Normalizes this OCF, i.e. appropriately shifts the ranks such that the minimal rank equals zero.
      • getPossibleInterpretations

        public java.util.Set<HerbrandInterpretation> getPossibleInterpretations()
        Returns all interpretations that are mapped to a rank unequal to INFINITY.
        Returns:
        all interpretations that are mapped to a rank unequal to INFINITY.
      • numFalsifiedInstances

        public java.lang.Integer numFalsifiedInstances​(HerbrandInterpretation w,
                                                       RelationalConditional rc)
        Returns the number of instances of "rc" that are falsified by the given interpretation.
        Parameters:
        w - a Herbrand interpretation.
        rc - a relational conditional.
        Returns:
        the number of instances of "rc" that are falsified by the given interpretation.
      • numVerifiedInstances

        public java.lang.Integer numVerifiedInstances​(HerbrandInterpretation w,
                                                      RelationalConditional rc)
        Returns the number of instances of "rc" that are verified by the given interpretation.
        Parameters:
        w - a Herbrand interpretation.
        rc - a relational conditional.
        Returns:
        the number of instances of "rc" that are verified by the given interpretation.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object