Class 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.RelationalFormula
    Instances 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.RelationalFormula clone()  
      net.sf.tweety.logics.fol.syntax.Conjunction combineWithAnd​(net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable f)  
      net.sf.tweety.logics.fol.syntax.Disjunction combineWithOr​(net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable f)  
      net.sf.tweety.logics.commons.syntax.RelationalFormula complement()  
      boolean containsQuantifier()  
      Set<net.sf.tweety.logics.fol.syntax.FolAtom> getAtoms()  
      net.sf.tweety.logics.fol.syntax.FolFormula getFormula()
      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.FolSignature getSignature()  
      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.Probability getUniformProbability()  
      Double getWeight()
      Returns the weight.
      boolean isClosed()  
      boolean isClosed​(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)  
      boolean isLiteral()  
      boolean isStrict()
      Returns "true" iff this formula is strict.
      boolean isWellBound()  
      boolean isWellBound​(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)  
      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)  
      String toString()  
      • Methods inherited from class net.sf.tweety.logics.commons.syntax.RelationalFormula

        allGroundInstances, allSubstitutions, containsTermsOfType, exchange, getPredicateCls, getSatisfactionRatio, isGround, isWellFormed, substitute
      • Methods inherited from interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula

        equals, hashCode
    • 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:
        combineWithAnd in interface net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable
        Specified by:
        combineWithAnd in class net.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:
        combineWithOr in interface net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable
        Specified by:
        combineWithOr in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • complement

        public net.sf.tweety.logics.commons.syntax.RelationalFormula complement()
        Specified by:
        complement in interface net.sf.tweety.logics.commons.syntax.interfaces.Invertable
        Specified by:
        complement in class net.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:
        getAtoms in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        getAtoms in class net.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:
        substitute in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Specified by:
        substitute in class net.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:
        toString in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • getFunctors

        public Set<net.sf.tweety.logics.commons.syntax.Functor> getFunctors()
        Specified by:
        getFunctors in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • getFormula

        public net.sf.tweety.logics.fol.syntax.FolFormula getFormula()
        Returns the inner formula.
        Specified by:
        getFormula in interface net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
        Overrides:
        getFormula in class net.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:
        getUniformProbability in interface net.sf.tweety.logics.commons.syntax.interfaces.ProbabilityAware
        Specified by:
        getUniformProbability in class net.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:
        clone in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Specified by:
        clone in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        clone in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • getSignature

        public net.sf.tweety.logics.fol.syntax.FolSignature getSignature()