/// <summary> /// Add a new line. /// </summary> /// <param name="prob">The probability.</param> /// <param name="result">The resulting probability.</param> /// <param name="args">The arguments.</param> public void AddLine(double prob, int result, params int[] args) { if (args.Length != _event.Parents.Count) { throw new BayesianError("Truth table line with " + args.Length + ", specified for event with " + _event.Parents.Count + " parents. These numbers must be the same"); } TableLine line = FindLine(result, args); if (line == null) { if (_lines.Count == this.MaxLines) { throw new BayesianError("This truth table is already full."); } line = new TableLine(prob, result, args); _lines.Add(line); } else { line.Probability = prob; } }
/// <summary> /// Add a new line. /// </summary> /// <param name="prob">The probability.</param> /// <param name="result">The resulting probability.</param> /// <param name="args">The arguments.</param> public void AddLine(double prob, int result, params int[] args) { if (args.Length != _event.Parents.Count) { throw new BayesianError("Truth table line with " + args.Length + ", specied for event with " + _event.Parents.Count + " parents. These numbers must be the same"); } TableLine line = FindLine(result, args); if (line == null) { if (_lines.Count == this.MaxLines) { throw new BayesianError("This truth table is already full."); } line = new TableLine(prob, result, args); _lines.Add(line); } else { line.Probability = prob; } }