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
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<T,Probability>probabilitiesThe probabilities of the interpretations.private RpclSemanticssemanticsThe semantics used for this probability distribution.private FolSignaturesignatureThe used FOL signature
-
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 voidclear()booleancontainsKey(java.lang.Object key)booleancontainsValue(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.doubleentropy()Returns the entropy of this probability distribution.java.util.Set<java.util.Map.Entry<T,Probability>>entrySet()Probabilityget(java.lang.Object key)RpclSemanticsgetSemantics()Returns the semantics of this distribution.SignaturegetSignature()Returns the signature of the underlying language.static RpclProbabilityDistribution<HerbrandInterpretation>getUniformDistribution(RpclSemantics semantics, FolSignature signature)Returns the uniform distribution on the given signature.booleanisEmpty()java.util.Set<T>keySet()Probabilityprobability(FolFormula f)Gets the probability of the given closed formula, i.e.Probabilityprobability(RelationalConditional re)Gets the probability of the given closed relational conditional "re", i.e.Probabilityput(T key, Probability value)voidputAll(java.util.Map<? extends T,? extends Probability> m)Probabilityremove(java.lang.Object key)booleansatisfies(RelationalProbabilisticConditional formula)Checks whether this interpretation satisfies the given formula.booleansatisfies(RpclBeliefSet kb)Checks whether this interpretation satisfies the given knowledge base.intsize()java.lang.StringtoString()java.util.Collection<Probability>values()-
Methods inherited from class net.sf.tweety.commons.AbstractInterpretation
satisfies
-
-
-
-
Field Detail
-
probabilities
private java.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability> probabilities
The probabilities of the interpretations.
-
semantics
private RpclSemantics semantics
The semantics used for this probability distribution.
-
signature
private FolSignature signature
The used FOL signature
-
-
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:InterpretationChecks whether this interpretation satisfies the given formula.- Specified by:
satisfiesin 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:InterpretationChecks whether this interpretation satisfies the given knowledge base.- Specified by:
satisfiesin 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:
toStringin classjava.lang.Object
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKeyin interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValuein interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
entrySet
public java.util.Set<java.util.Map.Entry<T,Probability>> entrySet()
- Specified by:
entrySetin interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
get
public Probability get(java.lang.Object key)
- Specified by:
getin interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
put
public Probability put(T key, Probability value)
- Specified by:
putin interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
putAll
public void putAll(java.util.Map<? extends T,? extends Probability> m)
- Specified by:
putAllin interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
remove
public Probability remove(java.lang.Object key)
- Specified by:
removein interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
values
public java.util.Collection<Probability> values()
- Specified by:
valuesin interfacejava.util.Map<T extends Interpretation<FolBeliefSet,FolFormula>,Probability>
-
keySet
public java.util.Set<T> keySet()
- Specified by:
keySetin 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.
-
-