|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.co.agena.minerva.util.nptgenerator.NPTGenerator
public class NPTGenerator
This class holds a list of functions for generating an NPT for a node. This will now allow every parent state combination of a node to have a different function defined for it. That means that we can have multiple model nodes once the GUI has the ability to add this.
Field Summary | |
---|---|
static java.util.Map |
functionParametersMap
Map of functions along with their parameter names. |
protected int |
lengthOfProgressableTask
Represnts the length of the operation which is currently being monitored in this class. |
protected int |
progress
Represnts the current progress of any operation which is currently being monitored in this class. |
static int |
PROGRESSABLE_GENERATE_NPT
To indicate we are monitoring the GenerateNPT operation. |
protected boolean |
progressableTaskDone
When set to true the current task being monitored will have been completed. |
protected boolean |
terminateProgressableTask
When set to true the current propagation will be terminated/cancelled. |
Constructor Summary | |
---|---|
NPTGenerator(ExtendedBN ebn,
ExtendedNode functionNode)
|
Method Summary | |
---|---|
boolean |
createFunctionListForModelNodes(java.util.List choosenModelNodes,
java.util.List modelFunctions)
This method creates a full list of Functions (function array) whoses length is equal to the noOfParentsStateCombinations. |
void |
generateNPT(boolean autoExtendStatesAsRequired,
boolean autoRestrictStates,
boolean imitateNewEvidence,
boolean duringDD)
This will actually create the NPT for the Node which has a Funtions Defined on it. |
int |
getCurrentProgress()
Represents the current progress of any operation which is currently being monitored in this class. |
ExtendedNodeFunction |
getFunctionFromArray(int[] pattern,
int[][] stateCombos,
java.util.List allFunctions)
Similar to putFunctionInArray but instead when we find the first occurance of the pattern in the state combination array we return the ExtendedNodeFunction at the appropiate position in the allFunctions List. |
static java.util.Map |
getFunctionParametersMap()
|
int |
getLengthOfProgressableTask()
The length of the current task being monitored. |
static int |
getMaxNumParameters()
|
static int |
getNumParameters(java.lang.String function)
|
int[] |
getTrueOrderStateCode(java.util.List userSelectedModelNodes,
int[] userStateCombo,
java.util.List reqNodeOrder)
The order in which the user selected model nodes are added to the specified list may not be the correct order in which the Model nodes exist in the reqNodeOrder List. |
int |
howManyFunctionsDoINeed()
This returns the Number of Functions that is required before we can generate the NPT. |
boolean |
isCanContinueFromError()
Flag used by the method createFunctionListForModelNodes to indicate when throwing an exception whether it is one from which the calling method can continue from. |
boolean |
isProgressableTaskDone()
When set to true the current task being monitored will have been completed. |
void |
populateStateCombinationArray(int[][] combos,
int noOfCombinations,
java.util.List parentsOfInterest)
Builds up an array of ints that can be used to uniquly represent each possible state combination for all the specifed parents. |
void |
resetProgressableTask()
Reset the variables used in the monitoring of the current task. |
void |
setFunctions(Function[] functions)
Sets the functions used for this node. |
void |
setFunctions(java.lang.String functionType,
java.util.List functionParams)
Convience method, applys the specified function to the NPT generator, using the specified parameters. |
void |
terminateProgressableTask()
Stop the current progressable task. |
void |
updateCurrentProgress(int inc)
Increment the currentProgress by the specified value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.Map functionParametersMap
protected int lengthOfProgressableTask
protected int progress
protected boolean progressableTaskDone
protected boolean terminateProgressableTask
public static final int PROGRESSABLE_GENERATE_NPT
Constructor Detail |
---|
public NPTGenerator(ExtendedBN ebn, ExtendedNode functionNode) throws ExtendedBNException, InconsistentEvidenceException
functionNode
-
ExtendedBNException
InconsistentEvidenceException
Method Detail |
---|
public static java.util.Map getFunctionParametersMap()
public static int getNumParameters(java.lang.String function)
public static int getMaxNumParameters()
public int howManyFunctionsDoINeed()
public void setFunctions(Function[] functions) throws NPTGeneratorException
functions
-
NPTGeneratorException
public void setFunctions(java.lang.String functionType, java.util.List functionParams) throws NPTGeneratorException, NPTGeneratorException, InconsistentEvidenceException
functionType
- functionParams
-
NPTGeneratorException
NPTGeneratorException
InconsistentEvidenceException
public void generateNPT(boolean autoExtendStatesAsRequired, boolean autoRestrictStates, boolean imitateNewEvidence, boolean duringDD) throws InconsistentEvidenceException, NPTGeneratorInsufficientStateRangeException, NPTGeneratorException
autoExtendStatesAsRequired
- This flag should be set to true if you require the node to
automatically change its state ranges if an
NPTGeneratorInsufficientStateRangeException is encountered.
Setting this to false will cause the Exception to be thrown up.imitateNewEvidence
- TODOduringDD
- TODO
InconsistentEvidenceException
NPTGeneratorInsufficientStateRangeException
NPTGeneratorException
public void populateStateCombinationArray(int[][] combos, int noOfCombinations, java.util.List parentsOfInterest)
combos
- The array to populate.noOfCombinations
- The nunmber of state combinations.parentsOfInterest
- The parents ExtendedNodes we are building the array for.public int[] getTrueOrderStateCode(java.util.List userSelectedModelNodes, int[] userStateCombo, java.util.List reqNodeOrder)
userSelectedModelNodes
- The user selected model nodesuserStateCombo
- The state combination we are trying to re order.reqNodeOrder
- The order the node are required to follow
public ExtendedNodeFunction getFunctionFromArray(int[] pattern, int[][] stateCombos, java.util.List allFunctions) throws NPTGeneratorException, InconsistentEvidenceException
pattern
- The pattern we are looking for.stateCombos
- The state combination array we are searching.allFunctions
- The list we get the appropiate function from if a match is found.
NPTGeneratorException
InconsistentEvidenceException
public boolean createFunctionListForModelNodes(java.util.List choosenModelNodes, java.util.List modelFunctions) throws InconsistentEvidenceException, NPTGeneratorException
InconsistentEvidenceException
NPTGeneratorException
public boolean isCanContinueFromError()
public int getCurrentProgress()
getCurrentProgress
in interface Progressable
public int getLengthOfProgressableTask()
getLengthOfProgressableTask
in interface Progressable
public void terminateProgressableTask()
terminateProgressableTask
in interface Progressable
public boolean isProgressableTaskDone()
isProgressableTaskDone
in interface Progressable
public void resetProgressableTask()
resetProgressableTask
in interface Progressable
public void updateCurrentProgress(int inc)
inc
- The amount by which we are updating the Current Progress.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |