ve
Class FactorStoreIndexed

java.lang.Object
  |
  +--ve.FactorStore
        |
        +--ve.FactorStoreIndexed

public class FactorStoreIndexed
extends FactorStore

a place to store factors during computation. This indexesto find the the muinimal deficiency variable or the min-size variable efficiently.


Inner Class Summary
private  class FactorStoreIndexed.EnumFacsRem
           
private  class FactorStoreIndexed.EnumFacsRemaining
           
private  class FactorStoreIndexed.FactorLink
          this is essentially, for each factor, a doubly linked list for each variable in the factor.
private  class FactorStoreIndexed.VariableToEliminate
          this class provides the infrastructure for the variable in the priority queue.
 
Field Summary
private  Factor[] finalFacs
           
private  FactorStoreIndexed.VariableToEliminate last
           
private  int numFinalFacs
           
private  int numVariables
           
private  FactorStoreIndexed.VariableToEliminate[] varsPQ
           
(package private)  java.util.Hashtable varToVarInQuery
           
 
Constructor Summary
FactorStoreIndexed(Variable[] toSumOut, Factor[] initFactors, int numInitFactors)
           
 
Method Summary
 void addFactor(Factor fac)
          adds the factor to the factor store.
private  void cleanUp(Factor fac)
           
 FactorIterator emunFactorsRemaining()
          returns an enumerator over the variables for the last variable returned.
 FactorIterator emunFactorsRemoved()
          returns an enumerator over the variables for the last variable returned.
 boolean hasNext()
          is true if there is a next variable to eliminate.
 Variable next()
          returns the next variable to eliminate according to the current heuristic.
private  void shuffleDown(int pos)
          make into a heap by shuffling down the value at position pos.
private  void shuffleUp(int pos)
          make into a heap by shuffling up the value at position pos.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

varsPQ

private FactorStoreIndexed.VariableToEliminate[] varsPQ

numVariables

private int numVariables

last

private FactorStoreIndexed.VariableToEliminate last

varToVarInQuery

java.util.Hashtable varToVarInQuery

finalFacs

private Factor[] finalFacs

numFinalFacs

private int numFinalFacs
Constructor Detail

FactorStoreIndexed

public FactorStoreIndexed(Variable[] toSumOut,
                          Factor[] initFactors,
                          int numInitFactors)
Method Detail

hasNext

public boolean hasNext()
is true if there is a next variable to eliminate.
Overrides:
hasNext in class FactorStore

next

public Variable next()
returns the next variable to eliminate according to the current heuristic.
Overrides:
next in class FactorStore

addFactor

public void addFactor(Factor fac)
adds the factor to the factor store. Note that this is only used for computed factors.
Overrides:
addFactor in class FactorStore

cleanUp

private void cleanUp(Factor fac)

emunFactorsRemoved

public FactorIterator emunFactorsRemoved()
returns an enumerator over the variables for the last variable returned.
Overrides:
emunFactorsRemoved in class FactorStore

emunFactorsRemaining

public FactorIterator emunFactorsRemaining()
returns an enumerator over the variables for the last variable returned.
Overrides:
emunFactorsRemaining in class FactorStore

shuffleDown

private void shuffleDown(int pos)
make into a heap by shuffling down the value at position pos. This assumes that varsPQ is a heap except maybe that the value at position pos is larger than it's children.

shuffleUp

private void shuffleUp(int pos)
make into a heap by shuffling up the value at position pos. This assumes that varsPQ is a heap except maybe that the value at position pos is smallerer than it's parent.