com.cra.bnet.engine
Class HuginInferenceEngine

java.lang.Object
  |
  +--com.cra.bnet.engine.JunctionTreeInferenceEngine
        |
        +--com.cra.bnet.engine.HuginInferenceEngine
All Implemented Interfaces:
InferenceEngine

public final class HuginInferenceEngine
extends JunctionTreeInferenceEngine

Implementation of the Hugin inference algorithm.


Constructor Summary
HuginInferenceEngine(BayesianNetwork network)
          Creates a new Hugin inference engine using the specified Bayesian network.
HuginInferenceEngine(BayesianNetwork network, boolean primary)
          Creates a new Hugin inference engine using the specified Bayesian network.
 
Method Summary
protected  double[] calculateBeliefs(DiscreteNode node)
          Calculates the current beliefs for the specified variable given the current evidence.
 Potential getCliquePotential(Set clique)
           
protected  void initialize()
          Initializes the junction tree potentials.
protected  void multiplyEvidence()
          Multiplies the new evidence into the junction tree potentials.
protected  void restorePotentials()
          Restores the junction tree potentials to their initialized state.
protected  void sendMessage(Set fromClique, Set toClique)
          Sends a message from the first clique to the second clique.
 
Methods inherited from class com.cra.bnet.engine.JunctionTreeInferenceEngine
clearEvidence, getBayesianNetwork, getBeliefs, getEvidence, getJunctionTree, getNewEvidence, getNewQuotients, getSaturated, makeConsistent, reconstruct, removed, removeEvidence, setEvidence, setSaturated, transferEvidence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HuginInferenceEngine

public HuginInferenceEngine(BayesianNetwork network)
Creates a new Hugin inference engine using the specified Bayesian network. This constructor just calls super(network).

Parameters:
network - Bayesian network for this inference engine.

HuginInferenceEngine

public HuginInferenceEngine(BayesianNetwork network,
                            boolean primary)
Creates a new Hugin inference engine using the specified Bayesian network. This constructor just calls super(network, temporary).

Parameters:
network - Bayesian network for this inference engine.
primary - true if this engine is the network's primary engine and false if this engine is just for temporary use.
Method Detail

initialize

protected void initialize()
Initializes the junction tree potentials.

Specified by:
initialize in class JunctionTreeInferenceEngine

restorePotentials

protected void restorePotentials()
Restores the junction tree potentials to their initialized state.

Specified by:
restorePotentials in class JunctionTreeInferenceEngine

multiplyEvidence

protected void multiplyEvidence()
Multiplies the new evidence into the junction tree potentials.

Specified by:
multiplyEvidence in class JunctionTreeInferenceEngine

sendMessage

protected void sendMessage(Set fromClique,
                           Set toClique)
Sends a message from the first clique to the second clique.

Specified by:
sendMessage in class JunctionTreeInferenceEngine
Parameters:
fromClique - origin clique of the message.
toClique - destination clique of the message.

calculateBeliefs

protected double[] calculateBeliefs(DiscreteNode node)
Calculates the current beliefs for the specified variable given the current evidence. If any nodes are currently saturated, the returned array will correspond to the joint beliefs in the saturated nodes and the specified variable given the current evidence. In this case, the order of the nodes is as follows: - the specified variable - the saturated nodes, in the order returned by getSaturated() Thus, you can create a VbnConverter object with the nodes in the above order to make sense of the returned belief values.

Specified by:
calculateBeliefs in class JunctionTreeInferenceEngine
Parameters:
node - variable whose beliefs are to be calculated.
Returns:
the current beliefs for the specified variable given the current evidence.

getCliquePotential

public Potential getCliquePotential(Set clique)