edu.ucla.belief
Class Prune

Object
  extended by Prune

public class Prune
extends Object

A class containing utility methods that assist code that wants to work with a pruned network.

Author:
Mark Chavira

Constructor Summary
Prune()
           
 
Method Summary
static HashMap idToVariableMap(BeliefNetwork bn)
          Returns a map from id to variable for the given belief network.
static HashSet image(Set s, Map m)
          Returns the image of the given set according to the given map.
static BeliefNetwork prune(BeliefNetwork bn, Set queryVars, Map evidence, Map oldToNew, Map newToOld, Set newQueryVars, Map newEvidence)
          Returns a copy of the given network pruned according to the given query variables and the given evidence.
static HashMap renameInstantiation(Map pw, Map m)
          Renames the variables in the given instantiation.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Prune

public Prune()
Method Detail

idToVariableMap

public static HashMap idToVariableMap(BeliefNetwork bn)
Returns a map from id to variable for the given belief network.

Parameters:
bn - the given belief network.
Returns:
the map.

image

public static HashSet image(Set s,
                            Map m)
Returns the image of the given set according to the given map.

Parameters:
s - the given set.
m - the given map.
Returns:
the image.

renameInstantiation

public static HashMap renameInstantiation(Map pw,
                                          Map m)
Renames the variables in the given instantiation. In the result, the key set of the new instantiation will be the image of the key set in the old instantiation according to the given map. A value for a variable in the new instantiation will have the same index as the value for the corresponding variable in the old instantiation.

Parameters:
pw - the given instantiation.
m - the map from old variable to new variable.
Returns:
the renamed instantiation.

prune

public static BeliefNetwork prune(BeliefNetwork bn,
                                  Set queryVars,
                                  Map evidence,
                                  Map oldToNew,
                                  Map newToOld,
                                  Set newQueryVars,
                                  Map newEvidence)
Returns a copy of the given network pruned according to the given query variables and the given evidence. One may then perform inference with the pruned version. However, since the pruned version is a copy, its variables are distinct from those in the given network, and we therefore need a mechanism for translating between the variables of the given network and those of the pruned copy. As a result, this method accepts two parameters which should be empty maps upon input and which upon exit will encode the translations. In addition, this method accepts two parameters which upon exit will contain the pruned copy's map variables and evidence.

Parameters:
bn - the given network.
queryVars - the given query variables.
evidence - the given evidence.
oldToNew - on entry, an empty map; on exit, a map from the given network's variables to those of the pruned copy.
newToOld - on entry, an empty map; on exit, a map from the pruned copy's variables to those of the given network.
newQueryVars - upon entry, an empty set; upon exit, the set of query variables in the pruned copy.
newEvidence - upon entry, an empty map; upon exit, the evidence of the pruned copy.
Returns:
the pruned copy of the network.


Copyright 2010 UCLA Automated Reasoning Group