euclidean_distance_single.jl 827 Bytes
 Bentriou Mahmoud committed Jan 27, 2021 1 2 3 4 5 `````` using MarkovProcesses import LinearAlgebra: dot import Distributions: Uniform `````` Bentriou Mahmoud committed Feb 22, 2021 6 7 ``````MAKE_SECOND_AUTOMATON_TESTS = false `````` Bentriou Mahmoud committed Jan 27, 2021 8 9 10 11 ``````load_model("SIR") tml_obs = 0:0.5:200 set_time_bound!(SIR, 200.0) y_obs = vectorize(simulate(SIR), :I, tml_obs) `````` Bentriou Mahmoud committed Feb 16, 2021 12 `````` `````` Bentriou Mahmoud committed Feb 22, 2021 13 ``````load_automaton("euclidean_distance_automaton") `````` Bentriou Mahmoud committed Feb 16, 2021 14 15 16 17 18 ``````aut1 = create_euclidean_distance_automaton(SIR, tml_obs, y_obs, :I) sync_SIR = SIR * aut1 σ = simulate(sync_SIR) test = euclidean_distance(σ, :I, tml_obs, y_obs) == σ.state_lha_end[:d] `````` Bentriou Mahmoud committed Feb 22, 2021 19 20 21 22 23 24 25 26 27 ``````if MAKE_SECOND_AUTOMATON_TESTS load_automaton("euclidean_distance_automaton_2") aut2 = create_euclidean_distance_automaton_2(SIR, tml_obs, y_obs, :I) sync_SIR = SIR * aut2 σ = simulate(sync_SIR) test2 = euclidean_distance(σ, :I, tml_obs, y_obs) == σ.state_lha_end[:d] else test2 = true end `````` 28 29 `````` test_all = test && test2 `````` Bentriou Mahmoud committed Jan 27, 2021 30 `````` `````` 31 ``````return test_all `````` Bentriou Mahmoud committed Jan 27, 2021 32