int GetNodeFuncState_bn ( const node_bn*  node,   const state_bn*  parent_states )

This is for discrete or discretized nodes that are deterministic. Given a vector of states for the parents of node, this returns the state of node (which is functionally determined by the parent values) by looking it up in the nodes function tablse. If the function table between node and its parents has not yet been created, or if it is probabilistic (i.e., a CPT) rather than deterministic, this returns UNDEF_STATE, without generating an error.

If node is continuous, and not discretized, an error will be generated (use GetNodeFuncReal_bn instead).

The order of the states in parent_states should match the order of the nodes in the list returned by GetNodeParents_bn (this will be the same order that parents were added using AddLink_bn). MapStateList_bn may be useful for that. parent_states can be NULL if node has no parents.

If the node has been given a deterministic equation with SetNodeEquation_bn, you must call EquationToTable_bn before this can be used to retrieve values (if you needed to find values without generating the whole table you would enter findings for the parents, and use CalcNodeState_bn).

If node is a decision node in a decision net which has been compiled, and belief propagation has been done by calling GetNodeExpectedUtils_bn on node, then this function can be used to read out the table of optimal decisions under the different scenarios indicated by parent_states.

If SetNodeProbs_bn was used to provide node with conditional probabilities that were all 0 or 1, GetNodeFuncState_bn can be used to retrieve the deterministic state of node as a function of its parents.

This function ignores any findings entered in the net.

To cycle through all the possibilities of parent_states, see the NeticaEx function NextStates.


Versions 2.06 and earlier didn't have this function, but had one called GetNodeFuncValue_bn, which worked almost the same, but took both discrete and continuous nodes (i.e., combined this and GetNodeFuncReal_bn).

See also:

SetNodeFuncState_bn    Sets it
GetNodeFuncReal_bn    Same, but returns real value instead of state integer
IsNodeDeterministic_bn    To check if this function is applicable
GetNodeProbs_bn    For nondeterministic discrete nodes
MapStateList_bn    To create the state list passed in