From 2cc0a568ef734817b738e1e38ad6518050faf531 Mon Sep 17 00:00:00 2001 From: Mahmoud Bentriou <mahmoud.bentriou@centralesupelec.fr> Date: Tue, 9 Feb 2021 21:57:10 +0100 Subject: [PATCH] small rewrite of smc function --- core/MarkovProcesses.jl | 3 ++- core/model.jl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/MarkovProcesses.jl b/core/MarkovProcesses.jl index 54ff8a2..a1746b8 100644 --- a/core/MarkovProcesses.jl +++ b/core/MarkovProcesses.jl @@ -29,7 +29,8 @@ export get_index, get_value, length_var, isaccepted # Model related methods export simulate, volatile_simulate -export distribute_mean_value_lha, mean_value_lha, distribute_prob_accept_lha, probability_var_value_lha, smc_chernoff +export distribute_mean_value_lha, mean_value_lha, distribute_prob_accept_lha, probability_var_value_lha +export number_simulations_smc_chernoff, smc_chernoff export set_param!, set_x0!, set_time_bound!, set_observed_var!, observe_all! export get_param, get_x0, getproperty, get_proba_model, get_observed_var export isbounded, isaccepted, check_consistency diff --git a/core/model.jl b/core/model.jl index 4b33561..9a99225 100644 --- a/core/model.jl +++ b/core/model.jl @@ -402,9 +402,10 @@ function probability_var_value_lha(sm::SynchronizedModel, nbr_sim::Int; return sum_val / nbr_sim end +number_simulations_smc_chernoff(approx::Float64, conf::Float64) = log(2/(1-conf)) / (2*approx^2) function smc_chernoff(sm::SynchronizedModel; approx::Float64 = 0.01, confidence::Float64 = 0.99) @assert sm.automaton.name in ["F property", "G property", "G and F property"] - nbr_sim = log(2/(1-confidence)) / (2*approx^2) + nbr_sim = number_simulations_smc_chernoff(approx, confidence) nbr_sim = convert(Int, trunc(nbr_sim)+1) return probability_var_value_lha(sm, nbr_sim) end -- GitLab