CS539 Program 4 -- Due February 28, 2000

In this assignment, you will write the gatherEvidence, distributeEvidence, and huginPropagation routines for inference in Junction Trees. Then you will do some simple experiments with these junction trees.

The file program4.tar is a tar file containing all of the files necessary for this assignment. Here is a brief explanation of the important files:

There are several other programs provided, including several programs for manipulating single probability tables (e.g., product, quotient, marginalize, print, etc.). But you should not need these.

I have provided you with a complete junction tree implementation except for three routines in jt.C. You must write the bodies of these routines (consult Jensen for details of how these routines work):

I encourage you to print out trace information to help in debugging. There is a global variable TRACE that can be set by passing the -t command line argument (e.g., jtdriver -t gas.net). It is helpful (and interesting) to follow the message passing process.

To debug your code, I have provided four belief networks:

After you have your code working, please do the following:

Your assignment is to compute the probability of each of the following 10 causes after each observation:

SparkPlugs Distributor FuelPump Leak2 Starter 
BatteryAge Alternator FanBelt Leak GasInTank
The observations are the following:
  1. Prior to any observations.
  2. After observing Starts is 1. (car won't start)
  3. After observing EngineCranks is 1. (engine won't crank)
  4. After observing GasGauge is 1. (gas gauge reads empty)
  5. After observing Radio is 1. (radio doesn't work)
  6. After observing FuelPump is 0. (fuel pump ok)
Note that this kind of "all marginals" query is exactly what the junction tree algorithm was designed for.

In addition to this computational experiment, please apply (by hand) the graphical method for constructing a junction tree to the car.net belief network. Turn in a drawing of the resulting network.

What to turn in: Turn in a hardcopy of your version of jt.C, a trace of your program producing the desired fault probabilities after each observation, and a drawing of your hand-generated junction tree. Also, please email me your verion of jt.C.

For extra credit, add instrumentation to both the junction tree and SPI algorithms to count the number of multiplications that they perform while answering a query. Then compare the cost of each of these algorithms for answering the queries for car.net. Which method is more efficient in terms of number of multiplications? You may ignore the initial multiplications required to construct the junction tree.