Skip to content

Commit 6efb459

Browse files
authored
Added a check for number of probability matrices (#41)
* Added a check for number of probability matrices * Update package version
1 parent 1388ab8 commit 6efb459

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DecisionProgramming"
22
uuid = "0e836bf4-a496-11ea-2c13-edcbe498ce6b"
33
authors = ["Jaan Tollander de Balsch", "Helmi Hankimaa", "Olli Herrala", "Fabricio Oliveira"]
4-
version = "1.0.2"
4+
version = "1.0.3"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

src/influence_diagram.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,12 @@ struct DefaultPathProbability <: AbstractPathProbability
301301
I_c::Vector{Vector{Node}}
302302
X::Vector{Probabilities}
303303
function DefaultPathProbability(C, I_c, X)
304-
if length(C) == length(I_c)
305-
new(C, I_c, X)
306-
else
304+
if length(C) != length(I_c)
307305
throw(DomainError("The number of chance nodes and information sets given to DefaultPathProbability should be equal."))
306+
elseif length(C) != length(X)
307+
throw(DomainError("The number of chance nodes and probability matrices given to DefaultPathProbability should be equal."))
308+
else
309+
new(C, I_c, X)
308310
end
309311
end
310312

0 commit comments

Comments
 (0)