View Javadoc

1   
2   package unbbayes.util.extension.bn.inference;
3   
4   import unbbayes.prs.Graph;
5   
6   /**
7    * This is a interface which every inference algorithm should implement.
8    * Plugins adding new inference algorithms should also implement this
9    * interface.
10   * @author Shou Matsumoto
11   *
12   */
13  public interface IInferenceAlgorithm {
14  	
15  	/**
16  	 * Sets the network (graph) treated by this algorithm.
17  	 * @param g : the network (graph) to set.
18  	 * @throws IllegalArgumentException : if the given graph is not appropriate
19  	 * for this algorithm.
20  	 */
21  	public void setNetwork(Graph g) throws IllegalArgumentException;
22  	
23  	/**
24  	 * @return Gets the network (graph) treated by this algorithm.
25  	 * 
26  	 */
27  	public Graph getNetwork();
28  	
29  	
30  	/**
31  	 * Runs the algorithm given the current state
32  	 * of the attributes.
33  	 * @throws IllegalStateException : this exception
34  	 * may also be used for general purpose.
35  	 */
36  	public void run() throws IllegalStateException;
37  	
38  	/**
39  	 * Obtains the name of this algorithm
40  	 * @return : name of this algorithm.
41  	 */
42  	public String getName();
43  	
44  	
45  	/**
46  	 * Obtains the description of this algorithm.
47  	 * This information is generally used as a tool tip text.
48  	 * @return : name of this algorithm.
49  	 */
50  	public String getDescription();
51  	
52  	/**
53  	 * Resets the algorithm and optionally the network state.
54  	 */
55  	public void reset();
56  	
57  	/**
58  	 * Propagate evidences.
59  	 */
60  	public void propagate();
61  	
62  }