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

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
              extended by uk.co.agena.minerva.model.extendedbn.IntegerIntervalEN
All Implemented Interfaces:
java.lang.Comparable, java.util.EventListener, ExtendedNodeListener, ExtendedStateListener, Identifiable, Nameable, Writable

public class IntegerIntervalEN
extends ContinuousEN

This class is used to represent intervals that contain only integers; floating point numbers in between are ignored. e.g. {0 - 10, 10 - 20, 20 - 30}, where "0 - 10" contains the integers {0, 1, 2, 3,.... 9} etc.


Field Summary
protected static java.lang.String[][] defaultStateNames
           
 
Fields inherited from class uk.co.agena.minerva.model.extendedbn.ContinuousEN
continueToDynamicallyDiscretise, ddRelativeSumWidthEntropyErrors, dynamicallyDiscretisable, entropyConvergenceThreshold, supportedFunctionTypes, uniformJustSet
 
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
IntegerIntervalEN()
          Creates a default DiscreteRealEN.
IntegerIntervalEN(NameDescription name, uk.co.agena.minerva.model.corebn.CoreBN connBn)
           
IntegerIntervalEN(NameDescription name, java.lang.String connNodeId, uk.co.agena.minerva.model.corebn.CoreBN connBn)
           
 
Method Summary
 void configureDefaultExtendedStates()
          Sets up a default list of ExtendedStates for this node based on the default state names for this class.
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.
 java.util.List createExtendedStates(DataSet ds)
          Takes the supplied DataSet and uses it to generate a List of ExtendedStates which are then returned.
 void extendedNodeVariableRemoved(ExtendedNodeEvent ene, Variable removedVarible)
          Invoked when a Variable is removed from the ExtendedNodes VariableList.
protected  void fillArraysUsingAbsolutes(double[] xVals, double[] pXs)
          Fills the two specified arrays with numerical values and their associated probabilities using the node marginals.
protected  void fillArraysUsingIntervals(Range[] xIntervals, double[] pXs)
          Fills the two specified arrays with Ranges and their associated probabilities using the node marginals.
static java.lang.String[][] getDefaultStateNames()
           
protected  int getIndexOfStateThatContains(double value, boolean upperBoundIsExclusive)
          This method will always treat the upperbound as exclusive.
 double getLastBound()
          Differs from the superclass method because the Range doesn't actually contain the last value.
 java.lang.Object getSamplesForState(int index, boolean boundsOnly, boolean asContinous)
          Returns a set of samples from the range of the state in question.
 boolean isStateSplitable(int stateindex)
          This method checks if the state at the given stateindex is splitable.
protected  java.util.List performSplit(Range rangeToSplit, int numDivisions)
           
 void replicateNodeStates(ExtendedNode states2copyNode)
          This method will take the states from the argument extended node and copy them to this node.
 void setNameOfIntervalDataPoint(IntervalDataPoint idp)
           
 void setNameOfStateUsingRange(ExtendedState es, Range r)
           
 
Methods inherited from class uk.co.agena.minerva.model.extendedbn.ContinuousEN
addDDRelativeSumWidthEntropyError, addRangeNotToBeSplit, areNeighboringStatesDisceteValues, cloneTypeSpecific, constructExtraFieldString, copy, createEmptyDataSet, createLogStates, createLogStates, createNewExtendedState, createNewExtendedState, extendedStateRangesForValue, getClosestMedianStateIndex, getDdRelativeSumWidthEntropyErrors, getDisceteValues, getDisceteValuesStateIndexes, getEntropyConvergenceThreshold, getFirstBound, getRangesNotToBeSplit, getSamplesForState, getSamplesForState, getSampleSize, getScaledTargetValue, getSupportedFunctionTypes, getTargetValueAsString, getTargetValueRange, insertExtendedState, insertExtendedState, insertStatesForValues, isContinueToDynamicallyDiscretise, isDynamicallyDiscretisable, isSimulationNode, isUniformJustSet, mergeExtendedStates, mergeExtendedStates, processExtraFields, replaceState, replaceState, resetRangesNotToBeSplitList, setContinueToDynamicallyDiscretise, setDdRelativeSumWidthEntropyErrors, setDynamicallyDiscretisable, setEntropyConvergenceThreshold, setSampleSize, setSimulationNode, setTargetValueFromString, setUniform, setUniformJustSet, truncateStates
 
Methods inherited from class uk.co.agena.minerva.model.extendedbn.NumericalEN
mean, median, percentile, standardDeviation, variance
 
Methods inherited from class uk.co.agena.minerva.model.extendedbn.ExtendedNode
addChild, addExpressionVariable, addExtendedNodeListener, addExtendedState, addExtendedState, addExtendedStates, addParent, compareTo, containsFunctionOfType, containsOnlyStatisticalFunctions, cropFunctions, enterDistributionOfEvidence, enterDistributionOfEvidence, enterHardEvidence, enterHardEvidence, extendedNodeAttributeChanged, extendedNodeConnBNNotFound, extendedNodeConnNodeIdChanged, extendedNodeInconsistentEvidenceEntered, extendedNodeMarginalsChanged, extendedNodeNameDescriptionChanged, extendedNodeStateNameChanged, extendedNodeStatesReplaced, extendedNodeVariableAdded, 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, 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

defaultStateNames

protected static java.lang.String[][] defaultStateNames
Constructor Detail

IntegerIntervalEN

public IntegerIntervalEN()
Creates a default DiscreteRealEN.


IntegerIntervalEN

public IntegerIntervalEN(NameDescription name,
                         java.lang.String connNodeId,
                         uk.co.agena.minerva.model.corebn.CoreBN connBn)
                  throws ExtendedBNException
Parameters:
name -
connNodeId -
connBn -
Throws:
ExtendedBNException

IntegerIntervalEN

public IntegerIntervalEN(NameDescription name,
                         uk.co.agena.minerva.model.corebn.CoreBN connBn)
                  throws ExtendedBNException
Parameters:
name -
connBn -
Throws:
ExtendedBNException
Method Detail

getDefaultStateNames

public static java.lang.String[][] getDefaultStateNames()

configureDefaultExtendedStates

public void configureDefaultExtendedStates()
                                    throws ExtendedStateException
Sets up a default list of ExtendedStates for this node based on the default state names for this class.

Specified by:
configureDefaultExtendedStates in class ExtendedNode
Throws:
ExtendedStateException

createExtendedStates

public java.util.List createExtendedStates(DataSet ds)
                                    throws ExtendedStateNumberingException,
                                           ExtendedStateException
Description copied from class: ExtendedNode
Takes the supplied DataSet and uses it to generate a List of ExtendedStates which are then returned. Each type of node can potentially use the DataSet to generate states in a different. Implementations are provided lower down in the hierarchy.

Specified by:
createExtendedStates in class ExtendedNode
Parameters:
ds - the DataSet used for creating the ExtendedStates
Returns:
a List of created ExtendedStates
Throws:
ExtendedStateNumberingException
ExtendedStateException

createDataPointFromExtendedState

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

Overrides:
createDataPointFromExtendedState in class ContinuousEN
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

replicateNodeStates

public void replicateNodeStates(ExtendedNode states2copyNode)
                         throws ExtendedBNException
This method will take the states from the argument extended node and copy them to this node. This is useful in message passing and other areas where you require 2 nodes to have the same state information.

Overrides:
replicateNodeStates in class ExtendedNode
Parameters:
states2copyNode -
Throws:
ExtendedBNException

extendedNodeVariableRemoved

public void extendedNodeVariableRemoved(ExtendedNodeEvent ene,
                                        Variable removedVarible)
Invoked when a Variable is removed from the ExtendedNodes VariableList.

Specified by:
extendedNodeVariableRemoved in interface ExtendedNodeListener
Overrides:
extendedNodeVariableRemoved in class ExtendedNode
Parameters:
ene - The ExtendedNode event.
removedVarible - The Variable that was removed.

getSamplesForState

public java.lang.Object getSamplesForState(int index,
                                           boolean boundsOnly,
                                           boolean asContinous)
                                    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:
numberOfSamples - the number of samples to take
index - the index of the state to sample
Returns:
an array containing the samples
Throws:
ExtendedStateNotFoundException - if there is no state at the supplied index
ExtendedStateException

createDataSetFromNumericValue

public DataSet createDataSetFromNumericValue(double value,
                                             NameDescription name)
                                      throws ExtendedBNException
Description copied from class: ContinuousEN
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.

Overrides:
createDataSetFromNumericValue in class ContinuousEN
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

performSplit

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

setNameOfStateUsingRange

public void setNameOfStateUsingRange(ExtendedState es,
                                     Range r)
Overrides:
setNameOfStateUsingRange in class ContinuousEN

setNameOfIntervalDataPoint

public void setNameOfIntervalDataPoint(IntervalDataPoint idp)
Overrides:
setNameOfIntervalDataPoint in class ContinuousEN

createDataSetForExtendedStates

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

Overrides:
createDataSetForExtendedStates in class ContinuousEN
Returns:
Throws:
ExtendedStateException

getIndexOfStateThatContains

protected int getIndexOfStateThatContains(double value,
                                          boolean upperBoundIsExclusive)
This method will always treat the upperbound as exclusive.

Overrides:
getIndexOfStateThatContains in class ContinuousEN
Parameters:
value - the value being sought
Returns:
the index or -1 if the value isn't found

fillArraysUsingAbsolutes

protected void fillArraysUsingAbsolutes(double[] xVals,
                                        double[] pXs)
                                 throws ExtendedBNException
Fills the two specified arrays with numerical values and their associated probabilities using the node marginals. For example, the xVals array might end up containing [1, 2, 3] and the pXs array might end up containing [0.5, 0.3, 0.2].

Overrides:
fillArraysUsingAbsolutes in class NumericalEN
Parameters:
xVals - the array to be filled with numerical values
pXs - the array to be filled with probabilities
Throws:
ExtendedBNException - if there is a problem accessing the marginals or looking up an ExtendedState

fillArraysUsingIntervals

protected void fillArraysUsingIntervals(Range[] xIntervals,
                                        double[] pXs)
                                 throws ExtendedBNException
Fills the two specified arrays with Ranges and their associated probabilities using the node marginals. For example, the xVals array might end up containing [0 - 1, 1 - 2, 2 - 3] and the pXs array might end up containing [0.5, 0.3, 0.2].

Overrides:
fillArraysUsingIntervals in class NumericalEN
Parameters:
xIntervals - the array to be filled with Ranges
pXs - the array to be filled with probabilities
Throws:
ExtendedBNException - if there is a problem filling the arrays

getLastBound

public double getLastBound()
Differs from the superclass method because the Range doesn't actually contain the last value.

Overrides:
getLastBound in class ContinuousEN

isStateSplitable

public boolean isStateSplitable(int stateindex)
This method checks if the state at the given stateindex is splitable. If the state is just of size 1, then it cannot be split.

Overrides:
isStateSplitable in class ContinuousEN
Parameters:
i -
Returns:


Copyright © 2006 Agena Ltd. All Rights Reserved.