Class RpclProbabilityDistribution<T extends Interpretation<FolBeliefSet,FolFormula>>
- java.lang.Object
-
- net.sf.tweety.commons.AbstractInterpretation<RpclBeliefSet,RelationalProbabilisticConditional>
-
- net.sf.tweety.logics.rpcl.semantics.RpclProbabilityDistribution<T>
-
- Type Parameters:
T
- the type of interpretations
- All Implemented Interfaces:
java.util.Map<T,Probability>
,Interpretation<RpclBeliefSet,RelationalProbabilisticConditional>
- Direct Known Subclasses:
CondensedProbabilityDistribution
public class RpclProbabilityDistribution<T extends Interpretation<FolBeliefSet,FolFormula>> extends AbstractInterpretation<RpclBeliefSet,RelationalProbabilisticConditional> implements java.util.Map<T,Probability>
Objects of this class represent probability distributions on the interpretations of an underlying first-order signature for a relational probabilistic conditional knowledge base.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description RpclProbabilityDistribution(RpclSemantics semantics, FolSignature signature)
Creates a new probability distribution for the given signature.
-
Method Summary
Modifier and Type Method Description void
clear()
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
RpclProbabilityDistribution<T>
convexCombination(double d, RpclProbabilityDistribution<T> other)
Computes the convex combination of this P1 and the given probability distribution P2 with parameter d, i.e.double
entropy()
Returns the entropy of this probability distribution.java.util.Set<java.util.Map.Entry<T,Probability>>
entrySet()
Probability
get(java.lang.Object key)
RpclSemantics
getSemantics()
Returns the semantics of this distribution.Signature
getSignature()
Returns the signature of the underlying language.static RpclProbabilityDistribution<HerbrandInterpretation>
getUniformDistribution(RpclSemantics semantics, FolSignature signature)
Returns the uniform distribution on the given signature.boolean
isEmpty()
java.util.Set<T>
keySet()
Probability
probability(FolFormula f)
Gets the probability of the given closed formula, i.e.Probability
probability(RelationalConditional re)
Gets the probability of the given closed relational conditional "re", i.e.Probability
put(T key, Probability value)
void
putAll(java.util.Map<? extends T,? extends Probability> m)
Probability
remove(java.lang.Object key)
boolean
satisfies(RelationalProbabilisticConditional formula)
Checks whether this interpretation satisfies the given formula.boolean
satisfies(RpclBeliefSet kb)
Checks whether this interpretation satisfies the given knowledge base.int
size()
java.lang.String
toString()
java.util.Collection<Probability>
values()
-
Methods inherited from class net.sf.tweety.commons.AbstractInterpretation
satisfies
-
-
-
-
Constructor Detail
-
RpclProbabilityDistribution
public RpclProbabilityDistribution(RpclSemantics semantics, FolSignature signature)
Creates a new probability distribution for the given signature.- Parameters:
semantics
- the used RPCL semanticssignature
- a fol signature.
-
-
Method Detail
-
getSemantics
public RpclSemantics getSemantics()
Returns the semantics of this distribution.- Returns:
- the semantics of this distribution.
-
satisfies
public boolean satisfies(RelationalProbabilisticConditional formula) throws java.lang.IllegalArgumentException
Description copied from interface:Interpretation
Checks whether this interpretation satisfies the given formula.- Specified by:
satisfies
in interfaceInterpretation<RpclBeliefSet,RelationalProbabilisticConditional>
- Parameters:
formula
- a formula .- Returns:
- "true" if this interpretation satisfies the given formula.
- Throws:
java.lang.IllegalArgumentException
- if the formula does not correspond to the expected language.
-
satisfies
public boolean satisfies(RpclBeliefSet kb) throws java.lang.IllegalArgumentException
Description copied from interface:Interpretation
Checks whether this interpretation satisfies the given knowledge base.- Specified by:
satisfies
in interfaceInterpretation<RpclBeliefSet,RelationalProbabilisticConditional>
- Parameters:
kb
- a knowledge base.- Returns:
- "true" if this interpretation satisfies the given knowledge base.
- Throws:
java.lang.IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
-
probability
public Probability probability(FolFormula f)
Gets the probability of the given closed formula, i.e. the sum of the probabilities of all interpretations satisfying it.- Parameters:
f
- a closed fol formula.- Returns:
- a probability.
-
probability
public Probability probability(RelationalConditional re)
Gets the probability of the given closed relational conditional "re", i.e. the probability of the head of "re" given its body.- Parameters:
re
- a closed relational conditional.- Returns:
- a probability.
-
entropy
public double entropy()
Returns the entropy of this probability distribution.- Returns:
- the entropy of this probability distribution.
-
convexCombination
public RpclProbabilityDistribution<T> convexCombination(double d, RpclProbabilityDistribution<T> other)
Computes the convex combination of this P1 and the given probability distribution P2 with parameter d, i.e. it returns a P with P(i)=d P1(i) + (1-d) P2(i) for every interpretation i.- Parameters:
d
- a doubleother
- a probability distribution- Returns:
- the convex combination of this P1 and the given probability distribution P2 with parameter d.
- Throws:
java.lang.IllegalArgumentException
- if either d is not in [0,1] or this and the given probability distribution are not defined on the same set of interpretations.
-
getUniformDistribution
public static RpclProbabilityDistribution<HerbrandInterpretation> getUniformDistribution(RpclSemantics semantics, FolSignature signature)
Returns the uniform distribution on the given signature.- Parameters:
semantics
- the semantics for the distribution.signature
- a fol signature- Returns:
- the uniform distribution on the given signature.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValue
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
entrySet
public java.util.Set<java.util.Map.Entry<T,Probability>> entrySet()
- Specified by:
entrySet
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
get
public Probability get(java.lang.Object key)
- Specified by:
get
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
put
public Probability put(T key, Probability value)
- Specified by:
put
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
putAll
public void putAll(java.util.Map<? extends T,? extends Probability> m)
- Specified by:
putAll
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
remove
public Probability remove(java.lang.Object key)
- Specified by:
remove
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
size
public int size()
- Specified by:
size
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
values
public java.util.Collection<Probability> values()
- Specified by:
values
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
keySet
public java.util.Set<T> keySet()
- Specified by:
keySet
in interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
getSignature
public Signature getSignature()
Returns the signature of the underlying language.- Returns:
- the signature of the underlying language.
-
-