From DSL
public void InferenceWithInfluenceDiagram() {
try {
// Loading and updating the influence diagram:
Network net = new Network();
net.ReadFile("tutorial_b.xdsl");
net.UpdateBeliefs();
// Getting the handle and the name of value indexing parent (decision node):
int[] aValueIndexingParents = net.GetValueIndexingParents("Gain");
int nodeDecision = aValueIndexingParents[0];
String decisionName = net.GetNodeName(nodeDecision);
// Displaying the possible expected values:
Console.WriteLine("These are the expected utilities:");
for (int i = 0; i < net.GetOutcomeCount(nodeDecision); i++) {
String parentOutcomeId = net.GetOutcomeId(nodeDecision, i);
double expectedUtility = net.GetNodeValue("Gain")[i];
Console.Write(" - \"" + decisionName + "\" = " + parentOutcomeId + ": ");
Console.WriteLine("Expected Utility = " + expectedUtility);
}
}
catch (SmileException e) {
Console.WriteLine(e.Message);
}
}