Show 
State Names as Constants in Equations

You can use the state names of a 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 Index:  Instead of state names, you can just use the state index (numbering starts at 0), by preceding the number with a # symbol, as in:  #2.  However, under most circumstances it is highly recommended to use the names, because they are more readable, less error-prone, and easier to manage if sometime later states are added or re-ordered.

Home > Equations > State Names as Constants in Equations