Class SimpleCReasoner

  • All Implemented Interfaces:
    ModelProvider<Conditional,​ClBeliefSet,​RankingFunction>, QualitativeReasoner<ClBeliefSet,​PlFormula>, Reasoner<java.lang.Boolean,​ClBeliefSet,​PlFormula>

    public class SimpleCReasoner
    extends AbstractConditionalLogicReasoner
    This class models a brute force c-reasoner for conditional logic. Reasoning is performed by computing a minimal c-representation for the given knowledge base.
    A c-representation for a conditional knowledge base R={r1,...,rn} is a ranking function k such that k accepts every conditional in R (k |= R) and if there are numbers k0,k1+,k1-,...,kn+,kn- with
    k(w)=k0 + \sum_{w verifies ri} ki+ + \sum_{w falsifies ri} kj- for every w. A c-representation is minimal if k0+...+kn- is minimal.
    The c-representation is computed using a brute force approach.

    See Gabriele Kern-Isberner. Conditionals in nonmonotonic reasoning and belief revision. Lecture Notes in Computer Science, Volume 2087. 2001.
    Author:
    Matthias Thimm
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.Integer,​Conditional> indexToConditional
      Maps the indices of the kappa vector to their corresponding conditionals.
      private java.util.List<java.lang.Integer[]> kappa
      The current vectors of kappa values.
      private int numConditionals
      The number of conditionals in the given knowledge base.
      private boolean simple
      indicates whether the computed c-representation is simple.
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleCReasoner()
      Creates a new simple c-representation reasoner.
      SimpleCReasoner​(boolean simple)
      Creates a new c-representation reasoner
    • Method Summary

      Modifier and Type Method Description
      private RankingFunction constructRankingFunction​(ClBeliefSet beliefset, java.lang.Integer[] kappa)
      Constructs a ranking function with the given kappa values [k1+,k1-,...,kn+,kn-], i.e.
      private void filter​(java.util.ArrayList<PlFormula> list, ClBeliefSet beliefset)  
      RankingFunction getModel​(ClBeliefSet beliefset)
      Returns a single (dedicated) model of the given belief base.
      private java.lang.Integer[] increment​(java.lang.Integer[] kappa)
      This method increments the given array by one value.
      private boolean incrementStep​(java.lang.Integer[] kappaRow)
      This method increments the given vector (which composes of exactly one "1" entry and zeros otherwise), e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • kappa

        private java.util.List<java.lang.Integer[]> kappa
        The current vectors of kappa values.
      • numConditionals

        private int numConditionals
        The number of conditionals in the given knowledge base.
      • indexToConditional

        private java.util.Map<java.lang.Integer,​Conditional> indexToConditional
        Maps the indices of the kappa vector to their corresponding conditionals.
      • simple

        private boolean simple
        indicates whether the computed c-representation is simple.
    • Constructor Detail

      • SimpleCReasoner

        public SimpleCReasoner​(boolean simple)
        Creates a new c-representation reasoner
        Parameters:
        simple - whether the computed c-representation is simple.
      • SimpleCReasoner

        public SimpleCReasoner()
        Creates a new simple c-representation reasoner.
    • Method Detail

      • constructRankingFunction

        private RankingFunction constructRankingFunction​(ClBeliefSet beliefset,
                                                         java.lang.Integer[] kappa)
        Constructs a ranking function with the given kappa values [k1+,k1-,...,kn+,kn-], i.e. for every possible world w set
        k(w)=k0 + \sum_{w verifies ri} ki+ + \sum_{w falsifies ri} kj-
        Parameters:
        beliefset - a belief set
        kappa - the kappa values
        Returns:
        a ranking function
      • increment

        private java.lang.Integer[] increment​(java.lang.Integer[] kappa)
        This method increments the given array by one value.
        Parameters:
        kappa - an array of integers.
        Returns:
        an array of integers.
      • incrementStep

        private boolean incrementStep​(java.lang.Integer[] kappaRow)
        This method increments the given vector (which composes of exactly one "1" entry and zeros otherwise), e.g. [0,0,1,0] -> [0,0,0,1] and [0,0,0,1] -> [1,0,0,0]
        Parameters:
        kappaRow - a vector of zeros and one "1"
        Returns:
        "true" if there is an overflow, i.e. when [0,0,0,1] -> [1,0,0,0], otherwise "false".