State Names as Constants

Netica

State Names as Constants

You can use the state names of a = 4 && typeof(BSPSPopupOnMouseOver) == 'function') BSPSPopupOnMouseOver(event);" class="BSSCPopup" onclick="BSSCPopup('X_PU_discrete.htm');return false;">discrete node as constants in an equation.  For example, if node Color has states red, green, blue and yellow, and node Temperature has states cool and warm, you could write:

Temperature (Color) = member (Color, red, yellow) ? warm : cool

Specifying Node:  Each state name only has meaning relative to the node it’s for.  Usually when you use a state name, Netica can identify that node from context.  However, if Netica doesn’t know which node a state name refers to (e.g. it gives an unknown value error message), you can indicate which node by following the state name with a double-dash and then the name of the node.  Continuing with the above example, if node Switch had the states 0, 1 and 2, you could write:

Color (Switch) = select0 (Switch, red--Color, yellow, blue)

The “--Color” was not required on “yellow” and “blue”, because the context was carried over from “red--Color”, but it could be put there as well.

State Numbers:  Instead of state names, you can just use the state number (numbering starts at 0), but it is highly recommended to use the names, because they are more readable and less error-prone.  Also, it is not as serious if later states are added or re-ordered.