public class MlnFormula extends RelationalFormula
Modifier and Type | Field and Description |
---|---|
private FolFormula |
formula
the first-order formula.
|
private java.lang.Double |
weight
The weight of the formula (null means that the formula is strict).
|
Constructor and Description |
---|
MlnFormula(FolFormula formula)
Creates a new strict MLN formula with the given formula.
|
MlnFormula(FolFormula formula,
java.lang.Double weight)
Creates a new MLN formula with the given formula and weight.
|
MlnFormula(FolFormula formula,
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.
|
Modifier and Type | Method and Description |
---|---|
RelationalFormula |
clone()
Creates a deep copy of this formula
|
Conjunction |
combineWithAnd(Conjuctable f)
Returns a conjunction of this and the given formula.
|
Disjunction |
combineWithOr(Disjunctable f) |
RelationalFormula |
complement() |
boolean |
containsQuantifier()
Checks whether this formula contains any quantification.
|
java.util.Set<FOLAtom> |
getAtoms()
Processes the set of all atoms which appear in this formula
|
FolFormula |
getFormula()
Returns the inner formula.
|
java.util.Set<Functor> |
getFunctors() |
java.util.Set<? extends Predicate> |
getPredicates()
Processes the set of all predicates which appear in this
formula
|
java.util.Set<Variable> |
getQuantifierVariables() |
java.util.Set<Term<?>> |
getTerms() |
<C extends Term<?>> |
getTerms(java.lang.Class<C> cls)
Processes the set containing all terms of type C.
|
java.util.Set<Variable> |
getUnboundVariables() |
Probability |
getUniformProbability() |
java.lang.Double |
getWeight()
Returns the weight.
|
boolean |
isClosed()
Checks whether this formula is closed, i.e.
|
boolean |
isClosed(java.util.Set<Variable> boundVariables)
Checks whether this formula is closed, i.e.
|
boolean |
isLiteral() |
boolean |
isStrict()
Returns "true" iff this formula is strict.
|
boolean |
isWellBound()
Checks whether this formula is well-bound, i.e.
|
boolean |
isWellBound(java.util.Set<Variable> boundVariables)
Checks whether this formula is well-bound, i.e.
|
RelationalFormula |
substitute(Term<?> v,
Term<?> t)
Substitutes all occurrences of term "v" in this formula
by term "t" and returns the new formula.
|
java.lang.String |
toString() |
allGroundInstances, allSubstitutions, containsTermsOfType, exchange, getPredicateCls, getSatisfactionRatio, getSignature, isGround, isWellFormed, substitute
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode
private FolFormula formula
private java.lang.Double weight
public MlnFormula(FolFormula formula)
formula
- the first-order formula.public MlnFormula(FolFormula formula, java.lang.Double weight)
formula
- the first-order formula.weight
- the weight of the formula (null means that the formula is strict).public MlnFormula(FolFormula formula, Probability p)
formula
- the first-order formula.p
- the intended probability of the formula.public Conjunction combineWithAnd(Conjuctable f)
Conjuctable
combineWithAnd
in interface Conjuctable
combineWithAnd
in class RelationalFormula
f
- a formula to be combined with AND and this.public Disjunction combineWithOr(Disjunctable f)
combineWithOr
in interface Disjunctable
combineWithOr
in class RelationalFormula
f
- a formula to be combined with OR and this.public RelationalFormula complement()
complement
in interface Invertable
complement
in class RelationalFormula
public java.util.Set<? extends Predicate> getPredicates()
SimpleLogicalFormula
public java.util.Set<FOLAtom> getAtoms()
SimpleLogicalFormula
getAtoms
in interface SimpleLogicalFormula
getAtoms
in class RelationalFormula
public boolean containsQuantifier()
QuantifiedFormula
public RelationalFormula substitute(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
RelationalFormula
substitute
in interface ComplexLogicalFormula
substitute
in class RelationalFormula
v
- the term to be substituted.t
- the term to substitute.java.lang.IllegalArgumentException
- if "v" and "t" are of different sorts
(NOTE: this exception is only thrown when "v" actually appears in this
formula).public java.util.Set<Variable> getUnboundVariables()
public boolean isClosed()
QuantifiedFormula
public boolean isClosed(java.util.Set<Variable> boundVariables)
QuantifiedFormula
boundVariables
- the variables assumed to be bound.public boolean isWellBound()
QuantifiedFormula
public boolean isWellBound(java.util.Set<Variable> boundVariables)
QuantifiedFormula
boundVariables
- the variables assumed to be bound.public java.lang.String toString()
toString
in class RelationalFormula
public java.util.Set<Functor> getFunctors()
getFunctors
in class RelationalFormula
public FolFormula getFormula()
getFormula
in interface QuantifiedFormula
getFormula
in class RelationalFormula
public java.lang.Double getWeight()
public boolean isStrict()
public Probability getUniformProbability()
getUniformProbability
in interface ProbabilityAware
getUniformProbability
in class RelationalFormula
public boolean isLiteral()
public java.util.Set<Term<?>> getTerms()
public <C extends Term<?>> java.util.Set<C> getTerms(java.lang.Class<C> cls)
LogicStructure
cls
- The Class structure containing type information about the
searched termpublic java.util.Set<Variable> getQuantifierVariables()
public RelationalFormula clone()
SimpleLogicalFormula
clone
in interface ComplexLogicalFormula
clone
in interface SimpleLogicalFormula
clone
in class RelationalFormula