Class AbstractMlnReasoner
- java.lang.Object
-
- net.sf.tweety.logics.mln.reasoner.AbstractMlnReasoner
-
- All Implemented Interfaces:
QuantitativeReasoner<MarkovLogicNetwork,FolFormula>,Reasoner<java.lang.Double,MarkovLogicNetwork,FolFormula>
- Direct Known Subclasses:
AlchemyMlnReasoner,ApproximateNaiveMlnReasoner,IteratingMlnReasoner,SimpleMlnReasoner,SimpleSamplingMlnReasoner
public abstract class AbstractMlnReasoner extends java.lang.Object implements QuantitativeReasoner<MarkovLogicNetwork,FolFormula>
This class provides common methods for MLN reasoner.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description AbstractMlnReasoner()
-
Method Summary
Modifier and Type Method Description protected doublecomputeWeight(MarkovLogicNetwork mln, HerbrandInterpretation hInt, FolSignature signature)Computes the (unnormalized) weight of the given Herbrand interpretation with respect to the formulas in this reasoner's MLN.protected abstract doubledoQuery(MarkovLogicNetwork mln, FolFormula query, FolSignature signature)Performs the actual querying.protected intnumberOfGroundSatisfactions(FolFormula formula, HerbrandInterpretation hInt, FolSignature signature)Computes the number of instantiations of the formula, wrt.java.lang.Doublequery(MarkovLogicNetwork mln, FolFormula query)Queries the given belief base for the given formula.java.lang.Doublequery(MarkovLogicNetwork mln, FolFormula query, FolSignature signature)Queries the given MLN wrt.
-
-
-
Method Detail
-
query
public java.lang.Double query(MarkovLogicNetwork mln, FolFormula query)
Description copied from interface:ReasonerQueries the given belief base for the given formula.- Specified by:
queryin interfaceReasoner<java.lang.Double,MarkovLogicNetwork,FolFormula>- Parameters:
mln- a belief basequery- a formula- Returns:
- the answer to the query
-
query
public java.lang.Double query(MarkovLogicNetwork mln, FolFormula query, FolSignature signature)
Queries the given MLN wrt. the given signature- Parameters:
mln- some mlnquery- some querysignature- some signature- Returns:
- the answer to the query
-
computeWeight
protected double computeWeight(MarkovLogicNetwork mln, HerbrandInterpretation hInt, FolSignature signature)
Computes the (unnormalized) weight of the given Herbrand interpretation with respect to the formulas in this reasoner's MLN.- Parameters:
mln- an MLNhInt- a Herbrand interpretationsignature- the underlying signature- Returns:
- the (unnormalized) weight of the given Herbrand interpretation
-
numberOfGroundSatisfactions
protected int numberOfGroundSatisfactions(FolFormula formula, HerbrandInterpretation hInt, FolSignature signature)
Computes the number of instantiations of the formula, wrt. the given signature, that are satisfied in the given Herbrand interpretation.- Parameters:
formula- some fol formula.hInt- a Herbrand interpretation.signature- the underlying signature- Returns:
- the number of instantiations of the formula, wrt. the given signature, that are satisfied in the given Herbrand interpretation.
-
doQuery
protected abstract double doQuery(MarkovLogicNetwork mln, FolFormula query, FolSignature signature)
Performs the actual querying.- Parameters:
mln- an MLNquery- a fol formula guaranteed to be ground.signature- the signature- Returns:
- the answer of the query.
-
-