uk.co.agena.minerva.model.extendedbn
Class ContinuousEN

java.lang.Object
  extended by uk.co.agena.minerva.model.extendedbn.ExtendedNode
      extended by uk.co.agena.minerva.model.extendedbn.NumericalEN
          extended by uk.co.agena.minerva.model.extendedbn.ContinuousEN
All Implemented Interfaces:
java.lang.Comparable, java.util.EventListener, ExtendedNodeListener, ExtendedStateListener, Identifiable, Nameable, Writable
Direct Known Subclasses:
ContinuousIntervalEN, IntegerIntervalEN

public abstract class ContinuousEN
extends NumericalEN


Field Summary
protected  boolean continueToDynamicallyDiscretise
          This flag is set/unset during the DD propagation.
protected  double[] ddRelativeSumWidthEntropyErrors
          This is the relative sum entropy errors for this node.
protected  boolean dynamicallyDiscretisable
          This indicates whether the node is dynamically discretisable.
protected  double entropyConvergenceThreshold
           
protected static java.lang.String[] supportedFunctionTypes
           
protected  boolean uniformJustSet
          This flag monitors whether a uniform distribution has just been automatically set on a node after it's type was changed and/or DD was enabled.
 
Fields inherited from class uk.co.agena.minerva.model.extendedbn.ExtendedNode
actOnMarginalsChangedEvent, answerable, connBn, connectableInputNode, connectableOutputNode, connNodeId, CONTINUOUS_INTERVAL_E_N, CURRENT_FUNCTION_STRING, currentNodeFunction, currentParentModelNodeAltId, currentPartitionedModelNodeFunctions, currentPartitionedParentModelNodeAltIds, currentPartitionedParentModelNodes, DEFAULT_FUNCTION_STRING, defaultNodeFunction, defaultParentModelNodeAltId, defaultPartitionedModelNodeFunctions, defaultPartitionedParentModelNodeAltIds, defaultPartitionedParentModelNodes, DELTA, DISCRETE_REAL_E_N, EDITABLE_NODE_FUNCTION, EDITABLE_NPT, EDITABLE_PARENT_STATE_FUNCTIONS, extendedStates, functionMode, id, inputNodeReceivedMarginals, LABELLED_E_N, name, nptReCalcRequired, nptSynchronisedWithFormula, NUMERICAL_E_N, PROBS_NOT_EDITABLE, reportable, targetValue, targetValuePresent, version, visible
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
ContinuousEN()
          Default constructor.
ContinuousEN(NameDescription name, uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Creates a new ContinuousEN with the supplied name and connected Core BN.
ContinuousEN(NameDescription name, java.lang.String connNodeId, uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Constructs a ContinuousEN with the specified name, connected node ID and connected BN.
 
Method Summary
 void addDDRelativeSumWidthEntropyError(double newWidthEntropyErrorValue)
          Add the argument entropy error value to the end of the list and moves the rest along by one, removing the oldest.
 void addRangeNotToBeSplit(Range doNotSplit)
           
 boolean[] areNeighboringStatesDisceteValues(int stateIndex)
          For any given stateIndex, this method checks if the adjacent/neighbouring states are discreteValue states.
 void cloneTypeSpecific(ExtendedNode oldEXN)
          Data specific to the ContinuousEN node type is cloned from the specified old node into this one.
protected  java.lang.String constructExtraFieldString()
          This should be overridden by any subclass of ExtendedNode that has additional fields that need to be written out.
 ExtendedNode copy(java.lang.Class type)
          Creates a shallow copy of this ExtendedNode by copying references to all of its data into a new instance of the supplied node type.
protected  DataPoint createDataPointFromExtendedState(ExtendedState es, double value)
          Creates a DataPoint from the supplied ExtendedState and probability value.
 DataSet createDataSetForExtendedStates()
          Create a DatsSet from the Extended States of this node.
 DataSet createDataSetFromNumericValue(double value, NameDescription name)
          Takes the supplied value and creates a DataSet (the first) of likelihood evidence based upon where the value falls with respect to the ExtendedNode's ExtendedStates.
protected  DataSet createEmptyDataSet()
          Creates a DataSet containing Ranges that correspond to the ExtendedStates in this ContinuousIntervalEN.
 void createLogStates(boolean updateCoreNPTSizes)
          Creates all the log states for this node.
 void createLogStates(double from, double to, boolean updateCoreNPTSizes)
          Creates the log states for this node between the argument doubles.
 ExtendedState createNewExtendedState(int index)
          Creates a new ExtendedState, all the way to the core.
 ExtendedState createNewExtendedState(int index, boolean updateCoreNPTSizes)
           
 void extendedStateRangesForValue(double valueToInclude, int percentageBufferSize, boolean insertLogStates, boolean updateCoreNPTSizes)
          This method should extended the state ranges of this node to allow the value supplied in the argument to be included.
protected  int getClosestMedianStateIndex(int indexOfES, DataSet marginals)
           
 double[] getDdRelativeSumWidthEntropyErrors()
           
 double[] getDisceteValues()
          Returns a double[] of all the discrete values in this node - that is the states which have an range of 0.
 double[] getDisceteValuesStateIndexes()
          Returns a int[] of all the discrete values state indexes in this node - that is the states which have an range of 0.
 double getEntropyConvergenceThreshold()
           
 double getFirstBound()
           
protected  int getIndexOfStateThatContains(double value, boolean upperBoundIsExclusive)
          Returns the index of the state that contains the specified value.
 double getLastBound()
           
 java.util.List getRangesNotToBeSplit()
           
 java.lang.Object getSamplesForState(int index, boolean boundsOnly)
          Returns a set of values that are sampled from the state at the supplied index.
protected  java.lang.Object getSamplesForState(int index, boolean boundsOnly, int numberOfSamples)
          Returns a set of samples from the range of the state in question.
static int getSampleSize()
           
 double getScaledTargetValue()
          Returns the scaled target value.
 java.lang.String[] getSupportedFunctionTypes()
          Returns a list of the function classes supported by this node type.
 java.lang.String getTargetValueAsString()
          Returns the target value of this ContinuousIntervalEN as a String.
 Range getTargetValueRange(boolean scaledInfinities)
          Returns the Range in which the target value has to lie.
 ExtendedState insertExtendedState(int index, Range r)
          Inserts a state with the supplied range at the specified index.
 ExtendedState insertExtendedState(int index, Range r, boolean resizeCoreNPTs)
          Inserts a state with the supplied range at the specified index.
 void insertStatesForValues(double[] valuesToInsert, boolean discreteValueStates, boolean updateCoreNPTSizes, boolean allowExtensionToRange)
          This method will insert these double values into this node.
 boolean isContinueToDynamicallyDiscretise()
           
 boolean isDynamicallyDiscretisable()
           
 boolean isSimulationNode()
           
 boolean isStateSplitable(int stateindex)
          This method checks if the state at the given stateindex is splitable.
 boolean isUniformJustSet()
           
 ExtendedState mergeExtendedStates(int startIndex, int endIndex)
           
 ExtendedState mergeExtendedStates(int startIndex, int endIndex, boolean resizeCoreNPTs)
           
protected  java.util.List performSplit(Range rangeToSplit, int numDivisions)
           
protected  void processExtraFields(java.util.StringTokenizer extraFields, double localVersion)
          This should be overridden by any subclass of ExtendedNode that has additional fields that need to be read in.
 java.util.List replaceState(int index, int numDivisions)
          Takes the state at the specified index and replaces it with the required number of new states.
 java.util.List replaceState(int index, int numDivisions, boolean updateCoreNPTSizes)
          Takes the state at the specified index and replaces it with the required number of new states.
 void resetRangesNotToBeSplitList()
          Clears the list of ranges that should not be split.
 void setContinueToDynamicallyDiscretise(boolean continueToDynamicallyDiscretise)
           
 void setDdRelativeSumWidthEntropyErrors(double[] ddRelativeSumWidthEntropyError)
           
 void setDynamicallyDiscretisable(boolean dynamicallyDiscretisable)
           
 void setEntropyConvergenceThreshold(double entropyConvergenceThreshold)
           
 void setNameOfIntervalDataPoint(IntervalDataPoint idp)
           
 void setNameOfStateUsingRange(ExtendedState es, Range r)
           
static void setSampleSize(int sampleSize)
           
 void setSimulationNode(boolean simulationNode)
          Sets (or unsets) this node as a simulation node.
 void setTargetValueFromString(java.lang.String text)
          Sets the target value of this ContinuousIntervalEN using the supplied String.
 void setUniform()
          Sets the ExtendedNodeFunction to be a simple Uniform.
 void setUniformJustSet(boolean uniformJustSet)
           
 void truncateStates(double lowerCutoff, double upperCutoff)
          Manipulates the ExtendedStates so that the new first one has the specified lower bound and the last one has the specified upper bound.
 
Methods inherited from class uk.co.agena.minerva.model.extendedbn.NumericalEN
fillArraysUsingAbsolutes, fillArraysUsingIntervals, mean, median, percentile, standardDeviation, variance
 
Methods inherited from class uk.co.agena.minerva.model.extendedbn.ExtendedNode
addChild, addExpressionVariable, addExtendedNodeListener, addExtendedState, addExtendedState, addExtendedStates, addParent, compareTo, configureDefaultExtendedStates, containsFunctionOfType, containsOnlyStatisticalFunctions, createExtendedStates, cropFunctions, enterDistributionOfEvidence, enterDistributionOfEvidence, enterHardEvidence, enterHardEvidence, extendedNodeAttributeChanged, extendedNodeConnBNNotFound, extendedNodeConnNodeIdChanged, extendedNodeInconsistentEvidenceEntered, extendedNodeMarginalsChanged, extendedNodeNameDescriptionChanged, extendedNodeStateNameChanged, extendedNodeStatesReplaced, extendedNodeVariableAdded, extendedNodeVariableRemoved, extendedNodeVisibleAttributeChanged, extendedStateAdded, extendedStateNameDescriptionChanged, extendedStateRemoved, fireMarginalsChangedEvent, getActOnMarginalsChangedEvent, getAnswerable, getConcreteNodeName, getConcreteNodeType, getConcreteNodeTypeNames, getConnBn, getConnNodeId, getCoreBNNodeEquivalents, getCurrentNodeFunction, getCurrentParentModelNodeAltId, getCurrentPartitionedModelNodeFunctions, getCurrentPartitionedParentModelNodeAltIds, getCurrentPartitionedParentModelNodes, getDefaultNodeFunction, getDefaultParentModelNodeAltId, getDefaultPartitionedModelNodeFunctions, getDefaultPartitionedParentModelNodeAltIds, getDefaultPartitionedParentModelNodes, getExpression, getExpressionVariables, getExtendedState, getExtendedStateAtIndex, getExtendedStates, getExtendedStateShortNames, getExtendedStateWithName, getExtendedStateWithShortDesc, getFunctionMode, getHardEvidence, getId, getInputNodeRecivedMarginalsAsEvidenceDS, getLastSavedPriorIndex, getMarginals, getName, getNextExtendedStateId, getNodeType, getNotes, getNPT, getNPTPopulationMethodAsString, getNPTSize, getNumberOfStateCombsForModelNodes, getPartitionedExpressionModelNodes, getPartitionedExpressions, getReportable, getRowMajorNPT, getSavedPriors, getSuitableMessagePassingNodes, getTargetValue, getTargetValueRangeAsString, getTotalNumberOfExtendedFunctions, getVersion, getVisible, hasParents, isChangeStatesOnInputNodeIfRequired, isConnectableInputNode, isConnectableOutputNode, isInputNodeReceivedMarginals, isInputNodeRecivedMarginalsAsEvidence, isNptReCalcRequired, isNptSynchronisedWithFormula, isTargetValuePresent, isTemporaryNodeOrderFlag, mode, nodeChanged, read, recalculateConnStateIndices, removeAllFurtherSavedPriors, removeExpressionVariable, removeExtendedNodeListener, removeExtendedState, replicateNodeStates, revert2savedPrior, savePrior, setActOnMarginalsChangedEvent, setAnswerable, setChangeStatesOnInputNodeIfRequired, setConnBn, setConnectableInputNode, setConnectableOutputNode, setConnNodeId, setCurrentNodeFunction, setCurrentParentModelNodeAltId, setCurrentPartitionedModelNodeFunctions, setCurrentPartitionedParentModelNodeAltIds, setCurrentPartitionedParentModelNodes, setDefaultNodeFunction, setDefaultParentModelNodeAltId, setDefaultPartitionedModelNodeFunctions, setDefaultPartitionedParentModelNodeAltIds, setDefaultPartitionedParentModelNodes, setExpression, setExpressionVariables, setExtendedStates, setExtendedStates, setFunctionMode, setId, setInputNodeReceivedMarginals, setInputNodeRecivedMarginalsAsEvidence, setInputNodeRecivedMarginalsAsEvidenceDS, setName, setNotes, setNPT, setNPT, setNPT, setNPTForSingleModelParentNode, setNptReCalcRequired, setNptSynchronisedWithFormula, setPartitionedExpressionModelNodes, setPartitionedExpressions, setReportable, setSavedPriors, setTargetValue, setTargetValuePresent, setTemporaryNodeOrderFlag, setupActionForMarginalsChangedEvent, setVersion, setVisible, storeFunctionsCorrectly, toString, updateConnNodeId, updateExpressionVariable, updateFunctionsParentConnNodeId, updateFunctionType, usedInCurrentExpression, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

supportedFunctionTypes

protected static java.lang.String[] supportedFunctionTypes

dynamicallyDiscretisable

protected boolean dynamicallyDiscretisable
This indicates whether the node is dynamically discretisable.


ddRelativeSumWidthEntropyErrors

protected double[] ddRelativeSumWidthEntropyErrors
This is the relative sum entropy errors for this node. This is used when deciding if a node needs to continue being discretised or not. We always want to store the last 4.


entropyConvergenceThreshold

protected double entropyConvergenceThreshold

continueToDynamicallyDiscretise

protected boolean continueToDynamicallyDiscretise
This flag is set/unset during the DD propagation. From which it can work out when the DD should stop.


uniformJustSet

protected boolean uniformJustSet
This flag monitors whether a uniform distribution has just been automatically set on a node after it's type was changed and/or DD was enabled.

Constructor Detail

ContinuousEN

public ContinuousEN()
Default constructor.


ContinuousEN

public ContinuousEN(NameDescription name,
                    uk.co.agena.minerva.model.corebn.CoreBN connBn)
             throws ExtendedBNException
Creates a new ContinuousEN with the supplied name and connected Core BN. Note that in this constructor, the Core BN node is created afterwards.

Parameters:
name - the name of the node
connBn - the Core BN to which it is connect
Throws:
ExtendedBNException

ContinuousEN

public ContinuousEN(NameDescription name,
                    java.lang.String connNodeId,
                    uk.co.agena.minerva.model.corebn.CoreBN connBn)
             throws ExtendedBNException
Constructs a ContinuousEN with the specified name, connected node ID and connected BN.

Parameters:
name - the name of the NumericalEN
connNodeId - the ID of the connected node in the underlying BN.
connBn - a reference to the underlying CoreBN
Throws:
ExtendedBNException - if there is a problem creating the node
Method Detail

getSampleSize

public static int getSampleSize()
Returns:
Returns the sampleSize.

setSampleSize

public static void setSampleSize(int sampleSize)
Parameters:
sampleSize - The sampleSize to set.

isSimulationNode

public boolean isSimulationNode()
Returns:
true if the node is a simulation node, false otherwise.

setSimulationNode

public void setSimulationNode(boolean simulationNode)
Sets (or unsets) this node as a simulation node.

Parameters:
simulationNode - true if the node is being made a simulation node, false if not

isDynamicallyDiscretisable

public boolean isDynamicallyDiscretisable()
Returns:
Returns the dynamicallyDiscretisable.

setDynamicallyDiscretisable

public void setDynamicallyDiscretisable(boolean dynamicallyDiscretisable)
Parameters:
dynamicallyDiscretisable - The dynamicallyDiscretisable to set.

constructExtraFieldString

protected java.lang.String constructExtraFieldString()
Description copied from class: ExtendedNode
This should be overridden by any subclass of ExtendedNode that has additional fields that need to be written out. The default behaviour is to return an empty String. The first character should always be the field separator.

Overrides:
constructExtraFieldString in class ExtendedNode
Returns:
a String containing the concatenated fields

processExtraFields

protected void processExtraFields(java.util.StringTokenizer extraFields,
                                  double localVersion)
Description copied from class: ExtendedNode
This should be overridden by any subclass of ExtendedNode that has additional fields that need to be read in. The default behaviour is to do nothing.

Overrides:
processExtraFields in class ExtendedNode

getDdRelativeSumWidthEntropyErrors

public double[] getDdRelativeSumWidthEntropyErrors()
Returns:
Returns the ddSumEntropyError.

setDdRelativeSumWidthEntropyErrors

public void setDdRelativeSumWidthEntropyErrors(double[] ddRelativeSumWidthEntropyError)
                                        throws ExtendedBNException
Parameters:
ddSumEntropyError - The ddSumEntropyError to set.
Throws:
ExtendedBNException

addDDRelativeSumWidthEntropyError

public void addDDRelativeSumWidthEntropyError(double newWidthEntropyErrorValue)
Add the argument entropy error value to the end of the list and moves the rest along by one, removing the oldest.

Parameters:
newEntropyErrorValue -

isContinueToDynamicallyDiscretise

public boolean isContinueToDynamicallyDiscretise()
Returns:
Returns the continueToDynamicallyDiscretise.

setContinueToDynamicallyDiscretise

public void setContinueToDynamicallyDiscretise(boolean continueToDynamicallyDiscretise)
Parameters:
continueToDynamicallyDiscretise - The continueToDynamicallyDiscretise to set.

addRangeNotToBeSplit

public void addRangeNotToBeSplit(Range doNotSplit)
Parameters:
doNotSplit -

getRangesNotToBeSplit

public java.util.List getRangesNotToBeSplit()
Returns:
List of ranges not to be split

resetRangesNotToBeSplitList

public void resetRangesNotToBeSplitList()
Clears the list of ranges that should not be split.


createDataSetFromNumericValue

public DataSet createDataSetFromNumericValue(double value,
                                             NameDescription name)
                                      throws ExtendedBNException
Takes the supplied value and creates a DataSet (the first) of likelihood evidence based upon where the value falls with respect to the ExtendedNode's ExtendedStates.

Specified by:
createDataSetFromNumericValue in class NumericalEN
Parameters:
value - the value entered as an observation
name - the name of the DataSet derived from the Scenario name
Returns:
the created DataSet
Throws:
ExtendedBNException - if there is a problem creating the DataSet

getTargetValueAsString

public java.lang.String getTargetValueAsString()
Returns the target value of this ContinuousIntervalEN as a String.

Overrides:
getTargetValueAsString in class ExtendedNode
Returns:
the target value of this ContinuousIntervalEN as a String

setTargetValueFromString

public void setTargetValueFromString(java.lang.String text)
Sets the target value of this ContinuousIntervalEN using the supplied String. If the value falls outside the required range it is set to the appropriate bound (i.e. upper or lower).

Overrides:
setTargetValueFromString in class ExtendedNode
Parameters:
text - the target value of this ContinuousIntervalEN as a String

getTargetValueRange

public Range getTargetValueRange(boolean scaledInfinities)
                          throws ExtendedBNException
Returns the Range in which the target value has to lie.

Overrides:
getTargetValueRange in class ExtendedNode
Returns:
the Range in which the target value has to lie
Throws:
ExtendedBNException - if there is a problem creating the Range

getScaledTargetValue

public double getScaledTargetValue()
                            throws ExtendedBNException
Returns the scaled target value. Firstly the state ranges are smoothed if a smoothing strategy has been specified. Then interpolation is used to find out what the equivalent of the target value is when the scale is converted to one beginning at 0.

Overrides:
getScaledTargetValue in class ExtendedNode
Returns:
the scaled target value
Throws:
ExtendedBNException - if there is a problem when trying to smoothe the state ranges

getClosestMedianStateIndex

protected int getClosestMedianStateIndex(int indexOfES,
                                         DataSet marginals)
                                  throws MinervaRangeException
Parameters:
indexOfES -
marginals -
Returns:
Throws:
MinervaRangeException

createDataPointFromExtendedState

protected DataPoint createDataPointFromExtendedState(ExtendedState es,
                                                     double value)
                                              throws ExtendedBNException
Creates a DataPoint from the supplied ExtendedState and probability value.

Overrides:
createDataPointFromExtendedState in class ExtendedNode
Parameters:
es - the ExtendedState whose information is used to create the DataPoint.
value - the probability value that will appear in the DataPoint
Returns:
the newly-created DataPoint
Throws:
ExtendedBNException - if there is a problem creating the DataPoint

createEmptyDataSet

protected DataSet createEmptyDataSet()
                              throws ExtendedBNException
Creates a DataSet containing Ranges that correspond to the ExtendedStates in this ContinuousIntervalEN.

Returns:
a DataSet containing the state ranges
Throws:
ExtendedBNException - if there is a problem creating the DataSet

cloneTypeSpecific

public void cloneTypeSpecific(ExtendedNode oldEXN)
                       throws ExtendedBNException
Data specific to the ContinuousEN node type is cloned from the specified old node into this one.

Overrides:
cloneTypeSpecific in class ExtendedNode
Parameters:
oldEXN - The ExtendedNode the specific type data must be cloned from.
Throws:
ExtendedBNException

copy

public ExtendedNode copy(java.lang.Class type)
                  throws ExtendedBNException
Creates a shallow copy of this ExtendedNode by copying references to all of its data into a new instance of the supplied node type. This should only be used if the original node is to be deleted immediately afterwards.

Overrides:
copy in class ExtendedNode
Parameters:
type - the type of node that will be created
Returns:
the newly created node
Throws:
ExtendedBNException
ExtendedNodeCreationException - if there is a problem during creation

setUniform

public void setUniform()
Sets the ExtendedNodeFunction to be a simple Uniform. Note: Regardless of the current NPT mode, it will be set to EDITABLE_NODE_FUNCTION first.


isUniformJustSet

public boolean isUniformJustSet()

setUniformJustSet

public void setUniformJustSet(boolean uniformJustSet)

mergeExtendedStates

public ExtendedState mergeExtendedStates(int startIndex,
                                         int endIndex)
                                  throws ExtendedNodeMethodNotSupportedException,
                                         ExtendedBNException,
                                         MinervaRangeException
Throws:
ExtendedNodeMethodNotSupportedException
ExtendedBNException
MinervaRangeException

mergeExtendedStates

public ExtendedState mergeExtendedStates(int startIndex,
                                         int endIndex,
                                         boolean resizeCoreNPTs)
                                  throws ExtendedNodeMethodNotSupportedException,
                                         ExtendedBNException,
                                         MinervaRangeException
Throws:
ExtendedNodeMethodNotSupportedException
ExtendedBNException
MinervaRangeException

insertExtendedState

public ExtendedState insertExtendedState(int index,
                                         Range r)
                                  throws ExtendedNodeMethodNotSupportedException,
                                         ExtendedBNException
Inserts a state with the supplied range at the specified index.

Parameters:
index - where to add the state
r - the range that the state will have
Returns:
the inserted state
Throws:
ExtendedNodeMethodNotSupportedException
ExtendedBNException

insertExtendedState

public ExtendedState insertExtendedState(int index,
                                         Range r,
                                         boolean resizeCoreNPTs)
                                  throws ExtendedNodeMethodNotSupportedException,
                                         ExtendedBNException
Inserts a state with the supplied range at the specified index.

Parameters:
index - where to add the state
r - the range that the state will have
resizeCoreNPTs - if false the the cores NPTs will not resize, this can be postponed until later.
Returns:
the inserted state
Throws:
ExtendedNodeMethodNotSupportedException
ExtendedBNException

createNewExtendedState

public ExtendedState createNewExtendedState(int index)
                                     throws ExtendedNodeMethodNotSupportedException,
                                            ExtendedBNException
Description copied from class: ExtendedNode
Creates a new ExtendedState, all the way to the core. It will add the state at the index specified. Give a -1 value if you wish the state to be added to the end of the list of existing states.

Specified by:
createNewExtendedState in class ExtendedNode
Returns:
Throws:
ExtendedBNException
ExtendedNodeMethodNotSupportedException

createNewExtendedState

public ExtendedState createNewExtendedState(int index,
                                            boolean updateCoreNPTSizes)
                                     throws ExtendedNodeMethodNotSupportedException,
                                            ExtendedBNException
Throws:
ExtendedNodeMethodNotSupportedException
ExtendedBNException

createDataSetForExtendedStates

public DataSet createDataSetForExtendedStates()
                                       throws ExtendedStateException
Create a DatsSet from the Extended States of this node.

Specified by:
createDataSetForExtendedStates in class ExtendedNode
Returns:
Throws:
ExtendedStateException

replaceState

public java.util.List replaceState(int index,
                                   int numDivisions)
                            throws ExtendedStateException
Takes the state at the specified index and replaces it with the required number of new states. The new states will have ranges corresponding to the original range divided into numDivisions intervals.

Specified by:
replaceState in class ExtendedNode
Parameters:
index - the index of the state to split
numDivisions - the number of divisions it should be split into
Returns:
a List of the ExtendedStates that were created as part of the process
Throws:
ExtendedStateException

replaceState

public java.util.List replaceState(int index,
                                   int numDivisions,
                                   boolean updateCoreNPTSizes)
                            throws ExtendedStateException
Takes the state at the specified index and replaces it with the required number of new states. The new states will have ranges corresponding to the original range divided into numDivisions intervals.

Parameters:
index - the index of the state to split
numDivisions - the number of divisions it should be split into
Returns:
a List of the ExtendedStates that were created as part of the process
Throws:
ExtendedStateException

setNameOfStateUsingRange

public void setNameOfStateUsingRange(ExtendedState es,
                                     Range r)

performSplit

protected java.util.List performSplit(Range rangeToSplit,
                                      int numDivisions)
                               throws MinervaRangeException
Throws:
MinervaRangeException

getSupportedFunctionTypes

public java.lang.String[] getSupportedFunctionTypes()
Returns a list of the function classes supported by this node type.

Overrides:
getSupportedFunctionTypes in class ExtendedNode
Returns:

insertStatesForValues

public void insertStatesForValues(double[] valuesToInsert,
                                  boolean discreteValueStates,
                                  boolean updateCoreNPTSizes,
                                  boolean allowExtensionToRange)
                           throws MinervaRangeException,
                                  ExtendedNodeMethodNotSupportedException,
                                  ExtendedBNException
This method will insert these double values into this node. So it will create new states to accomodate these values. If the boolean discreteValueStates is true then the states which are created will be discrete value states. The value for allowExtensionToRange should ONLY be true in the 'createRequiredDiscreteValueStates' method of DD, as this creates the required discrete states before DD starts. All other calls should make this false.

Parameters:
valuesToInsert -
Throws:
MinervaRangeException
ExtendedBNException
ExtendedNodeMethodNotSupportedException

getEntropyConvergenceThreshold

public double getEntropyConvergenceThreshold()
Returns:
Returns the entropyConvergenceThreshold.

setEntropyConvergenceThreshold

public void setEntropyConvergenceThreshold(double entropyConvergenceThreshold)
Parameters:
entropyConvergenceThreshold - The entropyConvergenceThreshold to set.

truncateStates

public void truncateStates(double lowerCutoff,
                           double upperCutoff)
                    throws ExtendedStateException
Manipulates the ExtendedStates so that the new first one has the specified lower bound and the last one has the specified upper bound. States are removed as required.

Parameters:
lowerCutoff - the new lower bound of the first state
upperCutoff - the new upper bound of the last state
Throws:
ExtendedStateException

getIndexOfStateThatContains

protected int getIndexOfStateThatContains(double value,
                                          boolean upperBoundIsExclusive)
Returns the index of the state that contains the specified value.

Parameters:
value - the value being sought
Returns:
the index or -1 if the value isn't found

getFirstBound

public double getFirstBound()

getLastBound

public double getLastBound()

setNameOfIntervalDataPoint

public void setNameOfIntervalDataPoint(IntervalDataPoint idp)

extendedStateRangesForValue

public void extendedStateRangesForValue(double valueToInclude,
                                        int percentageBufferSize,
                                        boolean insertLogStates,
                                        boolean updateCoreNPTSizes)
                                 throws ExtendedStateException,
                                        MinervaRangeException
This method should extended the state ranges of this node to allow the value supplied in the argument to be included.

Parameters:
valueToInclude -
Throws:
ExtendedStateException
MinervaRangeException

isStateSplitable

public boolean isStateSplitable(int stateindex)
This method checks if the state at the given stateindex is splitable.

Parameters:
i -
Returns:

getSamplesForState

public java.lang.Object getSamplesForState(int index,
                                           boolean boundsOnly)
                                    throws ExtendedStateException
Description copied from class: ExtendedNode
Returns a set of values that are sampled from the state at the supplied index. Different subtypes use different sampling algorithms and will return different types (e.g. doubles, Strings).

Specified by:
getSamplesForState in class ExtendedNode
Parameters:
index - the index of the state that is to be sampled
boundsOnly - TODO
Returns:
an Object encapsulating an array of samples
Throws:
ExtendedStateException

getSamplesForState

protected java.lang.Object getSamplesForState(int index,
                                              boolean boundsOnly,
                                              int numberOfSamples)
                                       throws ExtendedStateException
Returns a set of samples from the range of the state in question. The number of samples to take is a system level property.

Parameters:
index - the index of the state to sample
numberOfSamples - the number of samples to take
Returns:
an array of doubles containing the samples
Throws:
ExtendedStateNotFoundException - if there is no state at the supplied index
ExtendedStateException

getDisceteValues

public double[] getDisceteValues()
Returns a double[] of all the discrete values in this node - that is the states which have an range of 0.

Overrides:
getDisceteValues in class NumericalEN
Returns:

getDisceteValuesStateIndexes

public double[] getDisceteValuesStateIndexes()
Returns a int[] of all the discrete values state indexes in this node - that is the states which have an range of 0.

Returns:

areNeighboringStatesDisceteValues

public boolean[] areNeighboringStatesDisceteValues(int stateIndex)
For any given stateIndex, this method checks if the adjacent/neighbouring states are discreteValue states. The return array are 2 boolean values. Booleans indicating if the lower or upper states are discrete.

Parameters:
stateIndex -
Returns:

createLogStates

public void createLogStates(boolean updateCoreNPTSizes)
                     throws ExtendedBNException,
                            ExtendedStateException,
                            MinervaRangeException
Creates all the log states for this node.

Parameters:
node -
Throws:
ExtendedBNException
ExtendedStateException
MinervaRangeException

createLogStates

public void createLogStates(double from,
                            double to,
                            boolean updateCoreNPTSizes)
                     throws ExtendedBNException,
                            ExtendedStateException,
                            MinervaRangeException
Creates the log states for this node between the argument doubles.

Parameters:
node -
from -
to -
Throws:
ExtendedBNException
ExtendedStateException
MinervaRangeException


Copyright © 2006 Agena Ltd. All Rights Reserved.