Package net.sf.tweety.logics.cl.reasoner
Class SimpleCReasoner
- java.lang.Object
-
- net.sf.tweety.logics.cl.reasoner.AbstractConditionalLogicReasoner
-
- net.sf.tweety.logics.cl.reasoner.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>indexToConditionalMaps the indices of the kappa vector to their corresponding conditionals.private java.util.List<java.lang.Integer[]>kappaThe current vectors of kappa values.private intnumConditionalsThe number of conditionals in the given knowledge base.private booleansimpleindicates 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 RankingFunctionconstructRankingFunction(ClBeliefSet beliefset, java.lang.Integer[] kappa)Constructs a ranking function with the given kappa values [k1+,k1-,...,kn+,kn-], i.e.private voidfilter(java.util.ArrayList<PlFormula> list, ClBeliefSet beliefset)RankingFunctiongetModel(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 booleanincrementStep(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 net.sf.tweety.logics.cl.reasoner.AbstractConditionalLogicReasoner
getModels, query
-
-
-
-
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.
-
-
Method Detail
-
filter
private void filter(java.util.ArrayList<PlFormula> list, ClBeliefSet beliefset)
-
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 setkappa- 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".
-
getModel
public RankingFunction getModel(ClBeliefSet beliefset)
Description copied from interface:ModelProviderReturns a single (dedicated) model of the given belief base. If the implemented method allows for more than one dedicated model, the selection may be non-deterministic.- Specified by:
getModelin interfaceModelProvider<Conditional,ClBeliefSet,RankingFunction>- Specified by:
getModelin classAbstractConditionalLogicReasoner- Parameters:
beliefset- some belief base- Returns:
- a selected model of the belief base.
-
-