by andrew_ling » Sat Sep 20, 2008 12:44 am
To retrieve the value of the decision node I am using the following code:
1. Clear the evidence: net.ClearAllEvidence()
2. Set the evidence if this is required: net.SetEvidence(nodeID, optionID)
3. Update the beliefs in the network: net.UpdateBeliefs()
4. Get the node value: net.GetNodeValue(nodeID)
To add nodes and links to the network I am using the following code:
1. net.AddNode(NodeType, nodeID) where NodeType is one of the following:
a. NodeType.Cpt for all nature nodes
b. NodeType.List for all decision nodes
c. NodeType.Table for all utility nodes
2. Set the position, background colour and description for the node using net.SetNodePosition, net.SetNodeDescription and net.SetNodeBgColor
3. Add outcomes to the nodes using net.AddOutcome(nodeID, optionID)
4. Add links to the nodes using net.AddArc(parentNodeID, childNodeID)
5. Set the probabilities for the nodes using net.SetNodeDefinition(nodeID, utilities)