uk.co.agena.minerva.model
Class DynDiscPropagation

java.lang.Object
  extended by uk.co.agena.minerva.model.Propagation
      extended by uk.co.agena.minerva.model.MinervaPropagation
          extended by uk.co.agena.minerva.model.DynDiscPropagation
All Implemented Interfaces:
java.util.EventListener, uk.co.agena.minerva.model.corebn.CoreBNListener, ModelListener, Progressable

public class DynDiscPropagation
extends MinervaPropagation
implements ModelListener


Nested Class Summary
 
Nested classes/interfaces inherited from class uk.co.agena.minerva.model.Propagation
Propagation.PropagationEventGenerator
 
Field Summary
 
Fields inherited from class uk.co.agena.minerva.model.Propagation
BASIC_PROPAGATION, DD_PROPAGATION, inconsistentEvidencePropagated, lengthOfProgressableTask, model, ONLY_PROPAGATE_MODIFIED_EXTENDEDBNS, progress, progressableTaskDone, propagationEventGenerator, terminateProgressableTask
 
Constructor Summary
DynDiscPropagation(Model model)
           
 
Method Summary
 void calculateLengthOfProgressableTask(java.util.List extendedBNsToCalculate)
          Calculates the length of a propagation task based upon the Scenario's and ExtendedBN's being propagated and the types of ExtendedNode contained in the ExtnededBN's (Normal or Simulation).
 void ddPropagate(ExtendedBN theEBN, Scenario theScenario)
           
 void destroy()
          Removes DDP as a Listener from the Model and does any other necessary cleaning up.
 java.lang.String doesBasicChecksPass()
          This method should run some basic check that need to pass before the DD propagation can continue.
 void modelChanged(ModelEvent ebne)
          Called whenever a Model changes.
 void modelPropagationFinished(ModelEvent me, boolean completionSuccessful)
          Called whenever the propagation has finished.
 void modelPropagationStarting(ModelEvent me)
          Called whenever the propagation is about to start.
protected  void propagateScenario(java.util.List extendedbns, Scenario scenario, boolean propagate, int propagationExclusivity)
          This is the method which does the application of the scenarios.
 void setupEntropyErrors(java.util.List tddNodes)
          Ensures that the DD flags are set correctly, and the entropy errors list is empty to start with
 void splitStatesForNodeWithEvidence(ContinuousEN ddNode, double evidence, Range userEnteredAnswerRange, DataSet marginals, int noOfSplits, ExtendedBN ebn)
          AKA Log serach/split This function will split a State into X new States based upon the log of the current States range.
 void updateCurrentProgressForSimulationNode(ExtendedNode exn)
          Update the currentProgress after the supplied node has been discritised.
 
Methods inherited from class uk.co.agena.minerva.model.Propagation
addCoreBNListeners, addPropagationListener, coreBNPropagationStageComplete, getCurrentProgress, getEstimatedNumberOfCalculations, getLengthOfProgressableTask, isProgressableTaskDone, modelInconsistentEvidencePropagated, removeCoreBNListeners, removePropagationListener, resetProgressableTask, restartDataCollectionStore, revertAllExtendedBNsToSavedMarginals, rollBackCores, setupExpressionVariableNodesFromScenario, setupMessagePasses, simulate, simulate, simulateCheckPoint, terminateProgressableTask, unmarkExpressionVariableNodes, updateCurrentProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.co.agena.minerva.model.ModelListener
modelInconsistentEvidencePropagated
 

Constructor Detail

DynDiscPropagation

public DynDiscPropagation(Model model)
Method Detail

destroy

public void destroy()
Removes DDP as a Listener from the Model and does any other necessary cleaning up.

Overrides:
destroy in class Propagation

propagateScenario

protected void propagateScenario(java.util.List extendedbns,
                                 Scenario scenario,
                                 boolean propagate,
                                 int propagationExclusivity)
                          throws ModelException,
                                 PropagationException,
                                 InconsistentEvidenceException,
                                 PropagationTerminatedException
Description copied from class: MinervaPropagation
This is the method which does the application of the scenarios. This method takes each extendedBN in the list and propagates it as needed.

Overrides:
propagateScenario in class MinervaPropagation
Throws:
ModelException
PropagationException
InconsistentEvidenceException
PropagationTerminatedException

ddPropagate

public void ddPropagate(ExtendedBN theEBN,
                        Scenario theScenario)
                 throws PropagationException,
                        InconsistentEvidenceException,
                        ModelException,
                        PropagationTerminatedException
Throws:
PropagationException
InconsistentEvidenceException
ModelException
PropagationTerminatedException

doesBasicChecksPass

public java.lang.String doesBasicChecksPass()
This method should run some basic check that need to pass before the DD propagation can continue. There are a few checks we need to make: - Input nodes cannot be DD nodes - DD nodes should not have more then states MAXIMUM_NUMBER_OF_INITIAL_STATES_FOR_DD_NODES

Overrides:
doesBasicChecksPass in class Propagation
Parameters:
updateStringInformation - This string should be updated by this method, to provide information to the user about why the checks may not have passed.
Returns:
A String detailing the issues that require the users attention. If the String is null or empty there are no problems and the basic checks have been passed.

setupEntropyErrors

public void setupEntropyErrors(java.util.List tddNodes)
                        throws PropagationException
Ensures that the DD flags are set correctly, and the entropy errors list is empty to start with

Throws:
PropagationException
ExtendedBNException

calculateLengthOfProgressableTask

public void calculateLengthOfProgressableTask(java.util.List extendedBNsToCalculate)
Calculates the length of a propagation task based upon the Scenario's and ExtendedBN's being propagated and the types of ExtendedNode contained in the ExtnededBN's (Normal or Simulation). The final value is used as the lengthOfTask required for this Progressable object.

Overrides:
calculateLengthOfProgressableTask in class Propagation
Parameters:
extendedBNsToCalculate - The ExtendedBN's being propagated.

updateCurrentProgressForSimulationNode

public void updateCurrentProgressForSimulationNode(ExtendedNode exn)
Update the currentProgress after the supplied node has been discritised. If a non simulation node is supplied no change will be made to the current progress.

Parameters:
exn - The node which has been discritised

splitStatesForNodeWithEvidence

public void splitStatesForNodeWithEvidence(ContinuousEN ddNode,
                                           double evidence,
                                           Range userEnteredAnswerRange,
                                           DataSet marginals,
                                           int noOfSplits,
                                           ExtendedBN ebn)
                                    throws PropagationException,
                                           ExtendedBNException,
                                           MinervaRangeException,
                                           InconsistentEvidenceException,
                                           NPTGeneratorInsufficientStateRangeException,
                                           NPTGeneratorException
AKA Log serach/split This function will split a State into X new States based upon the log of the current States range. X is based upon the number of splits that should take place, hence there will be X+1 new States created to replace the old. The State which is split is the one with the biggest HDR for the current evidence which has been entered.

Parameters:
ddNode - The ExtendedNode whose State will be split.
userEnteredAnswerRange - If the user has entered an answer then we need to be careful how much we split the states.
marginals - The current evidence data.
noOfSplits - The number of splits that should take place, hence no of new States.
ebn - The ExtendedBN the ExtendedNode belongs to.
allDDNodes - A List of all the DynDisc ExtendedNodes.
Throws:
PropagationException
ExtendedBNException
NPTGeneratorException
InconsistentEvidenceException
MinervaRangeException
NPTGeneratorInsufficientStateRangeException

modelChanged

public void modelChanged(ModelEvent ebne)
Description copied from interface: ModelListener
Called whenever a Model changes.

Specified by:
modelChanged in interface ModelListener
Parameters:
ebne - the event encapsulating the change

modelPropagationStarting

public void modelPropagationStarting(ModelEvent me)
Description copied from interface: ModelListener
Called whenever the propagation is about to start.

Specified by:
modelPropagationStarting in interface ModelListener

modelPropagationFinished

public void modelPropagationFinished(ModelEvent me,
                                     boolean completionSuccessful)
Description copied from interface: ModelListener
Called whenever the propagation has finished.

Specified by:
modelPropagationFinished in interface ModelListener
completionSuccessful - TODO


Copyright © 2006 Agena Ltd. All Rights Reserved.