public void iterate(IMap <IRandomVariable, object> possibleWorld, double probability) { int i = 0; foreach (IRandomVariable rv in summedOut.randomVarInfo.GetKeys()) { termValues[i] = possibleWorld.Get(rv); ++i; } summedOut.getValues()[summedOut.getIndex(termValues)] += probability; }
private int termIdx(object[] termValues, ProbabilityTable d, IMap <IRandomVariable, object> possibleWorld) { if (0 == termValues.Length) { // The term has no variables so always position 0. return(0); } int i = 0; foreach (IRandomVariable rv in d.randomVarInfo.GetKeys()) { termValues[i] = possibleWorld.Get(rv); ++i; } return(d.getIndex(termValues)); }