HAPI::DiscreteNode Class Reference

This class is the ancestor of all discrete nodes. More...

Inheritance diagram for HAPI::DiscreteNode:
HAPI::Node HAPI::DiscreteChanceNode HAPI::DiscreteDecisionNode HAPI::BooleanDCNode HAPI::IntervalDCNode HAPI::LabelledDCNode HAPI::NumberedDCNode HAPI::BooleanDDNode HAPI::IntervalDDNode HAPI::LabelledDDNode HAPI::NumberedDDNode

List of all members.

Public Member Functions

bool caseIsSet (size_t index) const
 Test whether the value of this node in case index currently is set.
void enterFinding (size_t state, Number value)
 This method specifies a finding value for the specified state and all other states are not effected.
Number getBelief (size_t state) const
 Return the belief of the specified state.
size_t getCaseState (size_t index) const
 Retrieve the state value of this node associated with the case index.
Number getEnteredFinding (size_t state) const
 Retrieve the finding currently registered at this node for state.
double getEntropy () const
 Compute the entropy of this node.
Number getExpectedUtility (size_t state) const
 Return the expected utility associated with the specified state.
Kind getKind () const
 Return the node kind.
double getMutualInformation (const DiscreteNode *node) const
 Compute the mutual information between this node and the specified node.
size_t getNumberOfStates () const
 Return the number of states of this node.
Number getPropagatedFinding (size_t state) const
 Retrieve the propagated finding.
size_t getSampledState () const
 Returns the state sampled for this node.
NumberList getSensitivityConstants (size_t input, size_t output) const
 Return the four constants of the specified sensitivity function.
NumberList getSensitivityConstants (size_t input) const
 Return the four constants of the specified sensitivity function.
Index getStateIndex (const char *label) const
 Return the index of the state matching the specified label.
Index getStateIndex (const std::string &label) const
 Return the index of the state matching the specified label.
std::string getStateLabel (size_t state) const
 Return the label of state.
bool isEvidenceEntered () const
 Test whether evidence is entered into this node.
bool isEvidencePropagated () const
 Test whether evidence has been propagated from this node.
void retractFindings ()
 Retract all findings for this node.
void selectState (size_t state)
 Select the specified state of this node.
void setCaseState (size_t index, size_t state)
 Specify the case state of this node associated with case index to be state.
void setNumberOfStates (size_t states)
 Set the number of states of this node to states.
void setStateLabel (size_t state, const std::string &label)
 Set the state label of the node.
void setStateLabel (size_t state, const char *label)
 Set the state label of the node.
void unsetCase (size_t index)
 Specify that the value of this node for case index is unknown.

Detailed Description

This class is the ancestor of all discrete nodes.


Member Function Documentation

bool HAPI::DiscreteNode::caseIsSet ( size_t  index  )  const

Test whether the value of this node in case index currently is set.

Parameters:
index Case index.
void HAPI::DiscreteNode::enterFinding ( size_t  state,
Number  value 
)

This method specifies a finding value for the specified state and all other states are not effected.

Parameters:
state An integer designating which state to be selected. States are numbered consecutively from 0 and upwards.
value A non-negative real number as the finding value.
Number HAPI::DiscreteNode::getBelief ( size_t  state  )  const

Return the belief of the specified state.

Note that if findings have been entered since the most recent propagation, the beliefs returned may not be up-to-date.

Parameters:
state An integer value designating which state to examine.
Number HAPI::DiscreteNode::getEnteredFinding ( size_t  state  )  const

Retrieve the finding currently registered at this node for state.

Parameters:
state An integer designating the state to be examined.
Returns:
A real number expressing the entered finding.
Number HAPI::DiscreteNode::getExpectedUtility ( size_t  state  )  const

Return the expected utility associated with the specified state.

Parameters:
state An integer value designating which state to examine.
Kind HAPI::DiscreteNode::getKind (  )  const [inline, virtual]

Return the node kind.

Returns:
H_KIND_DISCRETE

Implements HAPI::Node.

double HAPI::DiscreteNode::getMutualInformation ( const DiscreteNode node  )  const

Compute the mutual information between this node and the specified node.

Parameters:
node the other node
size_t HAPI::DiscreteNode::getNumberOfStates (  )  const

Return the number of states of this node.

The states are numbered from 0 to N-1.

Number HAPI::DiscreteNode::getPropagatedFinding ( size_t  state  )  const

Retrieve the propagated finding.

That is, retrieve the finding value incorporated within the current junction tree potentials for the specified state of this node.

Parameters:
state An integer designating the state to be examined.
Returns:
A real number expressing the propagated finding.
NumberList HAPI::DiscreteNode::getSensitivityConstants ( size_t  input,
size_t  output 
) const

Return the four constants of the specified sensitivity function.

The output probability of this function must be one of the output probabilities specified in the preceding call to Domain::computeSensitivityData. If the results produced by that call have been invalidated, a usage exception is thrown.

Parameters:
input specifies a conditional probability (or policy) parameter of this node (i.e., input is the index of an entry in the CPT/policy of this node).
output identifies one of the output probabilities specified in the call to Domain::computeSensitivityData.
Returns:
an array of size 4 containing the constants of the specified sensitivity function.
NumberList HAPI::DiscreteNode::getSensitivityConstants ( size_t  input  )  const

Return the four constants of the specified sensitivity function.

The output probability of the sensitivity function was specified in the preceding call to DiscreteChanceNode::computeSensitivityData. If the results produced by that call have been invalidated, a usage exception is thrown.

Parameters:
input specifies a conditional probability (or policy) parameter of this node (i.e., input is the index of an entry in the CPT/policy of this node).
Returns:
a NumberList of size 4 containing the constants of the specified sensitivity function.
Index HAPI::DiscreteNode::getStateIndex ( const char *  label  )  const

Return the index of the state matching the specified label.

If there is no (unique) state with the specified state label, -1 is returned.

Parameters:
label the state label to search for
Returns:
the index of the state having the specified state label.
Index HAPI::DiscreteNode::getStateIndex ( const std::string &  label  )  const

Return the index of the state matching the specified label.

If there is no (unique) state with the specified state label, -1 is returned.

Parameters:
label the state label to search for
Returns:
the index of the state having the specified state label.
std::string HAPI::DiscreteNode::getStateLabel ( size_t  state  )  const

Return the label of state.

0 < state < N, where N is the number of states in the node.

Returns:
Standard C++ Library string.
bool HAPI::DiscreteNode::isEvidencePropagated (  )  const

Test whether evidence has been propagated from this node.

Returns:
Boolean.
void HAPI::DiscreteNode::retractFindings (  ) 

Retract all findings for this node.

This is equivalent to setting the finding value to 1 for all states of this node.

void HAPI::DiscreteNode::selectState ( size_t  state  ) 

Select the specified state of this node.

This is equivalent to specifying the finding value 1 for the specified state and 0 for all other states.

Parameters:
state An integer designating which state to be selected. States are numbered consecutively from 0 and upwards.
void HAPI::DiscreteNode::setCaseState ( size_t  index,
size_t  state 
)

Specify the case state of this node associated with case index to be state.

Parameters:
index The case index.
state The node state.
void HAPI::DiscreteNode::setNumberOfStates ( size_t  states  ) 

Set the number of states of this node to states.

The underlying domain will be uncompiled.

void HAPI::DiscreteNode::setStateLabel ( size_t  state,
const std::string &  label 
)

Set the state label of the node.

Parameters:
state The state number.
label The desired state label.
void HAPI::DiscreteNode::setStateLabel ( size_t  state,
const char *  label 
)

Set the state label of the node.

Parameters:
state The state number.
label The desired state label.

Copyright Hugin Expert A/S 1993-2010