Skip to content

Commit

Permalink
Add warning about fail of all initial pathfinder runs
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelBrand1 committed Mar 7, 2024
1 parent 957944a commit 42b0b1b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion EpiAware/src/inference-methods.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""
Run pathfinder multiple times and store the results in an array. Fails safely.
# Arguments
Expand Down Expand Up @@ -39,6 +40,9 @@ of tries is reached.
"""
function _continue_manypathfinder!(pfs, mdl::DynamicPPL.Model; max_tries, kwargs...)
tryiter = 1
if all(pfs .== :fail)
@warn "All initial pathfinder runs failed, trying again for $max_tries tries."
end
while all(pfs .== :fail) && tryiter <= max_tries
new_pf = try
pathfinder(mdl; kwargs...)
Expand All @@ -49,7 +53,8 @@ function _continue_manypathfinder!(pfs, mdl::DynamicPPL.Model; max_tries, kwargs
tryiter += 1
end
if all(pfs .== :fail)
@warn "All pathfinder runs failed"
@warn "All pathfinder runs failed after $max_tries tries. Returning failed
pathfinder."
end
return pfs
end
Expand Down

0 comments on commit 42b0b1b

Please sign in to comment.