edu.duke.cs.banjo.bayesnet
Class BayesNetManager

java.lang.Object
  extended byedu.duke.cs.banjo.bayesnet.BayesNetManager
All Implemented Interfaces:
BayesNetManagerI

public class BayesNetManager
extends java.lang.Object
implements BayesNetManagerI

Contains the implementation of the network.

Details:
- Consists of a collection of objects that describe the state of the network, including "parentMatrices" for various subsets of network nodes, such as the addable and deleteable, mustBePresent and mustBeAbsent, initial and current nodes (parents).
- Geared towards performance: frequently trades additional storage and code for execution speed.

Change History:
Created on Mar 10, 2004
(v2.0) Use of the more efficient parent set implementations. Note that the original parent sets from version 1.0.x will be deprecated in an upcoming maintenance release.
3/24/2008 (v2.2) hjs Modify access to random numbers.
4/2/2008 (v2.2) hjs Eliminate nodeScores and changedNodeScores arrays, as well as related methods (<--> changes to interface)

Author:
Jurgen Sladeczek (hjs)
For the latest info, please visit www.cs.duke.edu.

Field Summary
private  EdgesWithCachedStatisticsI addableParents
           
protected  boolean checkThenApply
           
private  java.lang.String configCycleCheckerMethod
           
private  EdgesWithCachedStatisticsI currentParents
           
private  boolean cycleCheckingNeedsAdjustment
           
private  int[] dbnMandatoryIdentityLags
           
private  EdgesWithCachedStatisticsI deleteableParents
           
private  EdgesWithCachedStatisticsI initialParents
           
private  int maxMarkovLag
           
private  int maxParentCountForRestart
           
private  int minMarkovLag
           
private  EdgesWithCachedStatisticsI mustBeAbsentParents
           
private  EdgesWithCachedStatisticsI mustBePresentParents
           
protected  Settings processData
           
protected  boolean restartWithRandomNetwork
           
protected  java.util.Random rnd
           
private  java.lang.String strDbnMandatoryIdentityLags
           
private  int varCount
           
 
Constructor Summary
BayesNetManager(Settings _processData)
           
 
Method Summary
 void applyChange(BayesNetChangeI bayesNetChange)
           
 EdgesWithCachedStatisticsI getAddableParents()
           
 EdgesWithCachedStatisticsI getCurrentParents()
           
 EdgesWithCachedStatisticsI getDeleteableParents()
           
 EdgesWithCachedStatisticsI getInitialParents()
           
 int getMaxMarkovLag()
           
 int getMinMarkovLag()
           
 EdgesWithCachedStatisticsI getMustBeAbsentParents()
           
 EdgesWithCachedStatisticsI getMustBePresentParents()
           
 int getVarCount()
           
 void initializeBayesNet()
           
 void initializeBayesNet(EdgesWithCachedStatisticsI parentsToAssign)
           
 void setCurrentParents(EdgesWithCachedStatisticsI currentParents)
           
 void undoChange(BayesNetChangeI _bayesNetChange)
           
private  boolean validateRequiredData()
          Validates the settings values required for the BayesNetManager (i.e., and special requirements on edges, and the optional initial structure).
 java.lang.Object validChoices()
          Provides the valid choices for this class, here: the available cycle checking methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialParents

private final EdgesWithCachedStatisticsI initialParents

mustBePresentParents

private final EdgesWithCachedStatisticsI mustBePresentParents

mustBeAbsentParents

private final EdgesWithCachedStatisticsI mustBeAbsentParents

deleteableParents

private EdgesWithCachedStatisticsI deleteableParents

addableParents

private EdgesWithCachedStatisticsI addableParents

currentParents

private EdgesWithCachedStatisticsI currentParents

varCount

private final int varCount

minMarkovLag

private final int minMarkovLag

maxMarkovLag

private final int maxMarkovLag

dbnMandatoryIdentityLags

private int[] dbnMandatoryIdentityLags

strDbnMandatoryIdentityLags

private java.lang.String strDbnMandatoryIdentityLags

maxParentCountForRestart

private final int maxParentCountForRestart

restartWithRandomNetwork

protected final boolean restartWithRandomNetwork

checkThenApply

protected boolean checkThenApply

processData

protected Settings processData

configCycleCheckerMethod

private final java.lang.String configCycleCheckerMethod

cycleCheckingNeedsAdjustment

private final boolean cycleCheckingNeedsAdjustment

rnd

protected final java.util.Random rnd
Constructor Detail

BayesNetManager

public BayesNetManager(Settings _processData)
                throws java.lang.Exception
Method Detail

validateRequiredData

private boolean validateRequiredData()
                              throws java.lang.Exception
Validates the settings values required for the BayesNetManager (i.e., and special requirements on edges, and the optional initial structure).

Returns:
Returns the boolean flag that indicates whether a crucial setting could not be validated.
Throws:
java.lang.Exception

validChoices

public java.lang.Object validChoices()
Provides the valid choices for this class, here: the available cycle checking methods.


initializeBayesNet

public void initializeBayesNet()
                        throws java.lang.Exception
Specified by:
initializeBayesNet in interface BayesNetManagerI
Throws:
java.lang.Exception

initializeBayesNet

public void initializeBayesNet(EdgesWithCachedStatisticsI parentsToAssign)
                        throws java.lang.Exception
Specified by:
initializeBayesNet in interface BayesNetManagerI
Throws:
java.lang.Exception

applyChange

public void applyChange(BayesNetChangeI bayesNetChange)
                 throws java.lang.Exception
Specified by:
applyChange in interface BayesNetManagerI
Throws:
java.lang.Exception

undoChange

public void undoChange(BayesNetChangeI _bayesNetChange)
                throws java.lang.Exception
Specified by:
undoChange in interface BayesNetManagerI
Throws:
java.lang.Exception

getCurrentParents

public EdgesWithCachedStatisticsI getCurrentParents()
Specified by:
getCurrentParents in interface BayesNetManagerI
Returns:
Returns the currentParents.

getAddableParents

public EdgesWithCachedStatisticsI getAddableParents()
Specified by:
getAddableParents in interface BayesNetManagerI
Returns:
Returns the addableParents.

getDeleteableParents

public EdgesWithCachedStatisticsI getDeleteableParents()
Specified by:
getDeleteableParents in interface BayesNetManagerI
Returns:
Returns the deleteableParents.

getMustBeAbsentParents

public EdgesWithCachedStatisticsI getMustBeAbsentParents()
Specified by:
getMustBeAbsentParents in interface BayesNetManagerI
Returns:
Returns the mustBeAbsentParents.

getMustBePresentParents

public EdgesWithCachedStatisticsI getMustBePresentParents()
Specified by:
getMustBePresentParents in interface BayesNetManagerI
Returns:
Returns the mustBePresentParents.

getMinMarkovLag

public int getMinMarkovLag()
Returns:
Returns the min Markov lag.

getMaxMarkovLag

public final int getMaxMarkovLag()
Returns:
Returns the max Markov lag.

getVarCount

public final int getVarCount()
Returns:
Returns the variable count.

getInitialParents

public EdgesWithCachedStatisticsI getInitialParents()
Returns:
Returns the initialParents.

setCurrentParents

public void setCurrentParents(EdgesWithCachedStatisticsI currentParents)
                       throws java.lang.Exception
Specified by:
setCurrentParents in interface BayesNetManagerI
Parameters:
currentParents - The currentParents to set.
Throws:
java.lang.Exception