private void AddMethod(string methodName, double[] trueProbs) { var probs = ExpandProbs(trueProbs); var handle = _net.AddNode(Network.NodeType.Cpt); _net.AddArc(_patternNodeHandle, handle); _net.SetNodeId(handle, methodName); _net.SetNodeName(handle, methodName); _net.SetNodeDefinition(handle, probs); _net.SetOutcomeId(handle, 0, "true"); _net.SetOutcomeId(handle, 1, "false"); }
private static void AddNode( Network net, int patternNodeHandle, string nodeId, string nodeName, IEnumerable <string> states, double[] probs) { var handle = net.AddNode(Network.NodeType.Cpt, nodeId); net.SetNodeName(handle, nodeName); net.AddArc(patternNodeHandle, handle); net.SetNodeProperties(handle, states, probs); }
private void AddRevealedSectorsToNetwork(Network net) { string yName, xName; int parentsCount = 0; List <Sector> causes; for (int i = 0; i < sectorsOnBoundaries.Count; i++) { if (sectorsOnBoundaries[i].State != Sector.SectorState.UN_REVEALED && sectorsOnBoundaries[i].State != Sector.SectorState.MARKED)//Revealed Sector { parentsCount = 0; yName = GetSectorName(sectorsOnBoundaries[i]); net.AddNode(Network.NodeType.TruthTable, yName); net.SetOutcomeId(yName, 0, "S0"); net.SetOutcomeId(yName, 1, "S1"); net.AddOutcome(yName, "S2"); net.AddOutcome(yName, "S3"); net.AddOutcome(yName, "S4"); net.AddOutcome(yName, "S5"); net.AddOutcome(yName, "S6"); net.AddOutcome(yName, "S7"); net.AddOutcome(yName, "S8"); causes = GetAdjacentBoundarySectors(sectorsOnBoundaries[i]); foreach (Sector cause in causes) { if (cause.State == Sector.SectorState.UN_REVEALED || cause.State == Sector.SectorState.MARKED)//UnRevealed Sector Or Marked { xName = GetSectorName(cause); net.AddArc(xName, yName); parentsCount++; } } yDefinition = GetYDefinitionTabel(parentsCount); net.SetNodeDefinition(yName, yDefinition); } } }