Package net.sf.tweety.logics.mln.syntax
Class MlnFormula
- java.lang.Object
-
- net.sf.tweety.logics.commons.syntax.RelationalFormula
-
- net.sf.tweety.logics.mln.syntax.MlnFormula
-
- All Implemented Interfaces:
net.sf.tweety.commons.Formula,net.sf.tweety.logics.commons.syntax.interfaces.ClassicalFormula,net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula,net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable,net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable,net.sf.tweety.logics.commons.syntax.interfaces.Invertable,net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure,net.sf.tweety.logics.commons.syntax.interfaces.ProbabilityAware,net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula,net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
public class MlnFormula extends net.sf.tweety.logics.commons.syntax.RelationalFormulaInstances of this class represent first-order formulas with a weight.- Author:
- Matthias Thimm, Tim Janus
-
-
Constructor Summary
Constructors Constructor Description MlnFormula(net.sf.tweety.logics.fol.syntax.FolFormula formula)Creates a new strict MLN formula with the given formula.MlnFormula(net.sf.tweety.logics.fol.syntax.FolFormula formula, Double weight)Creates a new MLN formula with the given formula and weight.MlnFormula(net.sf.tweety.logics.fol.syntax.FolFormula formula, net.sf.tweety.math.probability.Probability p)Creates a new MLN formula and estimates its weight w by the given probability p using the formula w = log(p/(1-p)*f) where "f" is the ratio of the number of worlds not satisfying the formula and the worlds satisfying the formula.
-
Method Summary
Modifier and Type Method Description net.sf.tweety.logics.commons.syntax.RelationalFormulaclone()net.sf.tweety.logics.fol.syntax.ConjunctioncombineWithAnd(net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable f)net.sf.tweety.logics.fol.syntax.DisjunctioncombineWithOr(net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable f)net.sf.tweety.logics.commons.syntax.RelationalFormulacomplement()booleancontainsQuantifier()Set<net.sf.tweety.logics.fol.syntax.FolAtom>getAtoms()net.sf.tweety.logics.fol.syntax.FolFormulagetFormula()Returns the inner formula.Set<net.sf.tweety.logics.commons.syntax.Functor>getFunctors()Set<? extends net.sf.tweety.logics.commons.syntax.Predicate>getPredicates()Set<net.sf.tweety.logics.commons.syntax.Variable>getQuantifierVariables()net.sf.tweety.logics.fol.syntax.FolSignaturegetSignature()Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>getTerms()<C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>
Set<C>getTerms(Class<C> cls)Set<net.sf.tweety.logics.commons.syntax.Variable>getUnboundVariables()net.sf.tweety.math.probability.ProbabilitygetUniformProbability()DoublegetWeight()Returns the weight.booleanisClosed()booleanisClosed(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)booleanisLiteral()booleanisStrict()Returns "true" iff this formula is strict.booleanisWellBound()booleanisWellBound(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)net.sf.tweety.logics.commons.syntax.RelationalFormulasubstitute(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)StringtoString()-
Methods inherited from class net.sf.tweety.logics.commons.syntax.RelationalFormula
allGroundInstances, allSubstitutions, containsTermsOfType, exchange, getPredicateCls, getSatisfactionRatio, isGround, isWellFormed, substitute
-
-
-
-
Constructor Detail
-
MlnFormula
public MlnFormula(net.sf.tweety.logics.fol.syntax.FolFormula formula)
Creates a new strict MLN formula with the given formula.- Parameters:
formula- the first-order formula.
-
MlnFormula
public MlnFormula(net.sf.tweety.logics.fol.syntax.FolFormula formula, Double weight)Creates a new MLN formula with the given formula and weight.- Parameters:
formula- the first-order formula.weight- the weight of the formula (null means that the formula is strict).
-
MlnFormula
public MlnFormula(net.sf.tweety.logics.fol.syntax.FolFormula formula, net.sf.tweety.math.probability.Probability p)Creates a new MLN formula and estimates its weight w by the given probability p using the formula w = log(p/(1-p)*f) where "f" is the ratio of the number of worlds not satisfying the formula and the worlds satisfying the formula.- Parameters:
formula- the first-order formula.p- the intended probability of the formula.
-
-
Method Detail
-
combineWithAnd
public net.sf.tweety.logics.fol.syntax.Conjunction combineWithAnd(net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable f)
- Specified by:
combineWithAndin interfacenet.sf.tweety.logics.commons.syntax.interfaces.Conjunctable- Specified by:
combineWithAndin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
combineWithOr
public net.sf.tweety.logics.fol.syntax.Disjunction combineWithOr(net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable f)
- Specified by:
combineWithOrin interfacenet.sf.tweety.logics.commons.syntax.interfaces.Disjunctable- Specified by:
combineWithOrin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
complement
public net.sf.tweety.logics.commons.syntax.RelationalFormula complement()
- Specified by:
complementin interfacenet.sf.tweety.logics.commons.syntax.interfaces.Invertable- Specified by:
complementin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
getPredicates
public Set<? extends net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()
-
getAtoms
public Set<net.sf.tweety.logics.fol.syntax.FolAtom> getAtoms()
- Specified by:
getAtomsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
getAtomsin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
containsQuantifier
public boolean containsQuantifier()
-
substitute
public net.sf.tweety.logics.commons.syntax.RelationalFormula substitute(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t) throws IllegalArgumentException- Specified by:
substitutein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Specified by:
substitutein classnet.sf.tweety.logics.commons.syntax.RelationalFormula- Throws:
IllegalArgumentException
-
getUnboundVariables
public Set<net.sf.tweety.logics.commons.syntax.Variable> getUnboundVariables()
-
isClosed
public boolean isClosed()
-
isClosed
public boolean isClosed(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)
-
isWellBound
public boolean isWellBound()
-
isWellBound
public boolean isWellBound(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)
-
toString
public String toString()
- Specified by:
toStringin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
getFunctors
public Set<net.sf.tweety.logics.commons.syntax.Functor> getFunctors()
- Specified by:
getFunctorsin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
getFormula
public net.sf.tweety.logics.fol.syntax.FolFormula getFormula()
Returns the inner formula.- Specified by:
getFormulain interfacenet.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula- Overrides:
getFormulain classnet.sf.tweety.logics.commons.syntax.RelationalFormula- Returns:
- the inner formula.
-
getWeight
public Double getWeight()
Returns the weight.- Returns:
- the weight.
-
isStrict
public boolean isStrict()
Returns "true" iff this formula is strict.- Returns:
- "true" iff this formula is strict.
-
getUniformProbability
public net.sf.tweety.math.probability.Probability getUniformProbability()
- Specified by:
getUniformProbabilityin interfacenet.sf.tweety.logics.commons.syntax.interfaces.ProbabilityAware- Specified by:
getUniformProbabilityin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
isLiteral
public boolean isLiteral()
-
getTerms
public Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()
-
getTerms
public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> Set<C> getTerms(Class<C> cls)
-
getQuantifierVariables
public Set<net.sf.tweety.logics.commons.syntax.Variable> getQuantifierVariables()
-
clone
public net.sf.tweety.logics.commons.syntax.RelationalFormula clone()
- Specified by:
clonein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Specified by:
clonein interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
clonein classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
getSignature
public net.sf.tweety.logics.fol.syntax.FolSignature getSignature()
-
-