javaslam.tjt
Class JunctionTree.Cluster

java.lang.Object
  |
  +--javaslam.tjt.graph.Node
        |
        +--javaslam.tjt.JunctionTree.Cluster
Enclosing class:
JunctionTree

public class JunctionTree.Cluster
extends Node

A cluster of a junction tree.


Field Summary
protected  Gaussian p
          The potential of this cluster.
 
Fields inherited from class javaslam.tjt.graph.Node
edges
 
Constructor Summary
JunctionTree.Cluster()
          Creates an empty cluster.
JunctionTree.Cluster(Gaussian p)
          Creates a cluster with the supplied potential.
JunctionTree.Cluster(JunctionTree.Cluster c)
          Copy constructor.
 
Method Summary
 void collectEvidence(JunctionTree.Cluster parent, boolean local)
          Collects evidence to this cluster.
 boolean contains(Set vars)
          Returns true if this cluster contains the supplied set of variables.
 boolean contains(Variable v)
          Returns true if this cluster contains the supplied variable.
 void distributeEvidence(JunctionTree.Cluster parent)
          Distributes evidence from this cluster.
 void distributeEvidence(JunctionTree.Cluster parent, double thresh)
          Distributes evidence from this cluster so long as the propagated messages are having a significant effect on the belief state.
 void extend(Set vars)
          Extends this cluster to contain the supplied set of Variables.
 int getDimension()
          Returns the dimension of this cluster, which is the dimension of its potential.
 JunctionTree getJunctionTree()
          Returns the junction tree this cluster resides in.
 Gaussian getPotential()
          Returns this cluster's potential.
 int getSize()
          Returns the size of this cluster, which is the size of its potential.
 JunctionTree.Cluster getSubsumedNeighbor()
          Searches for an adjacent cluster that whose variables are all contained in this cluster.
 JunctionTree.Cluster getSubsumingNeighbor()
          Searches for an adjacent cluster that contains all the variables contained in this cluster.
 Set getVariables()
          Returns an unmodifiable set of this cluster's variables.
 boolean isLeaf()
          Returns true if this cluster is a leaf.
 void marginalizeOut(Set vars)
          Marginalizes out a set of variables from this cluster.
 void rename(Variable var, Variable subst)
          Renames a variable in this cluster.
 String toString()
          Returns a string representation of this cluster.
 
Methods inherited from class javaslam.tjt.graph.Node
addEdge, edges, equals, getEdge, getShortestPath, hashCode, removeEdge, swingEdge, swingEdgesTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

p

protected Gaussian p
The potential of this cluster.

Constructor Detail

JunctionTree.Cluster

public JunctionTree.Cluster()
Creates an empty cluster.


JunctionTree.Cluster

public JunctionTree.Cluster(Gaussian p)
Creates a cluster with the supplied potential.

Parameters:
p - a potential

JunctionTree.Cluster

public JunctionTree.Cluster(JunctionTree.Cluster c)
Copy constructor. This cluster is initialized to have the same potential as the supplied cluster, but to have no edges.

Parameters:
c - a cluster
Method Detail

getJunctionTree

public JunctionTree getJunctionTree()
Returns the junction tree this cluster resides in.

Returns:
the junction tree this cluster resides in.

rename

public void rename(Variable var,
                   Variable subst)
Renames a variable in this cluster.

Parameters:
var - the original variable
subst - the variable substituted for the original variable
Throws:
IllegalArgumentException - if var and subst have differing dimensions

getPotential

public Gaussian getPotential()
Returns this cluster's potential.


getDimension

public int getDimension()
Returns the dimension of this cluster, which is the dimension of its potential.

Returns:
the dimension of this cluster
See Also:
Gaussian.getDimension()

getSize

public int getSize()
Returns the size of this cluster, which is the size of its potential.

Returns:
the size of this cluster
See Also:
Gaussian.getSize()

getVariables

public Set getVariables()
Returns an unmodifiable set of this cluster's variables.

Returns:
an unmodifiable set of this cluster's variables

isLeaf

public boolean isLeaf()
Returns true if this cluster is a leaf.

Returns:
true if this cluster is a leaf.

contains

public boolean contains(Variable v)
Returns true if this cluster contains the supplied variable.

Returns:
true if this cluster contains v

contains

public boolean contains(Set vars)
Returns true if this cluster contains the supplied set of variables.

Parameters:
vars - a set of Variables
Returns:
true if this cluster contains the variables in vars

extend

public void extend(Set vars)
Extends this cluster to contain the supplied set of Variables. The potential and the cluster's identifiers are both updated.

Parameters:
vars - a set of Variables

marginalizeOut

public void marginalizeOut(Set vars)
Marginalizes out a set of variables from this cluster.

Parameters:
vars - a set of Variables

getSubsumedNeighbor

public JunctionTree.Cluster getSubsumedNeighbor()
Searches for an adjacent cluster that whose variables are all contained in this cluster. If no such cluster is found, null is returned.

Returns:
an adjacent cluster whose variables are all contained in this cluster, or null if no such cluster exists

getSubsumingNeighbor

public JunctionTree.Cluster getSubsumingNeighbor()
Searches for an adjacent cluster that contains all the variables contained in this cluster. If no such cluster is found, null is returned.

Returns:
an adjacent cluster that contains all the variables in this cluster, or null if no such cluster exists

collectEvidence

public void collectEvidence(JunctionTree.Cluster parent,
                            boolean local)
Collects evidence to this cluster. The neighbors of this cluster (except parent)are asked to collect evidence (with this node as their parent) and this cluster passes a flow to parent.

Parameters:
local - if true, then the children are not asked to collect evidence
parent - a neighbor of this cluster that is its parent in the flow-passing tree, or null if this cluster is the root of the flow-passing tree

distributeEvidence

public void distributeEvidence(JunctionTree.Cluster parent)
Distributes evidence from this cluster. A flow is passed to each neighbor (except parent) and then distributeEvidence is called recursively on all neighbors (except parent).

Parameters:
parent - a neighbor of this cluster that is its parent in the flow-passing tree, or null if this cluster is the root of the flow-passing tree
See Also:
distributeEvidence(JunctionTree.Cluster,double)

distributeEvidence

public void distributeEvidence(JunctionTree.Cluster parent,
                               double thresh)
Distributes evidence from this cluster so long as the propagated messages are having a significant effect on the belief state. The significance of a change caused by passing a message is measured in terms of the relative entropy (in nats, i.e., natural logarithmic units) from the old separator potential to its new value after the message is passed. If a message is passed and the significance is less than a prescribed threshold, then distributeEvidence is not recursively called on the target cluster.

Parameters:
parent - the parent of this cluster in the flow-passing tree, or null if this cluster is the root
thresh - the relative entropy (in nats) required from the old separator potential to the new separator potential in order to continue distributing evidence
See Also:
Gaussian.kl(Gaussian), distributeEvidence(JunctionTree.Cluster)

toString

public String toString()
Returns a string representation of this cluster.

Overrides:
toString in class Object