diff --git a/automata/automaton_F.jl b/automata/automaton_F.jl index f9a13683da850976327a358a1325bd467fb34906..92befe98ddbd58e94eed00ac143e7d5a0362bfc6 100644 --- a/automata/automaton_F.jl +++ b/automata/automaton_F.jl @@ -131,22 +131,22 @@ function create_automaton_F(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1 # l0 loc # l0 => l1 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l0, :l1, 1)), getfield(Main, func_name(:us, :l0, :l1, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l0, :l1, 1)), getfield(Main, func_name(:us, :l0, :l1, 1))) map_edges[:l0][:l1] = [edge1] # l1 loc # l1 => l2 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 1)), getfield(Main, func_name(:us, :l1, :l2, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 2)), getfield(Main, func_name(:us, :l1, :l2, 2))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 1)), getfield(Main, func_name(:us, :l1, :l2, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 2)), getfield(Main, func_name(:us, :l1, :l2, 2))) map_edges[:l1][:l2] = [edge1, edge2] - #edge3 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 3)), getfield(Main, func_name(:us, :l1, :l2, 3))) - #edge4 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 4)), getfield(Main, func_name(:us, :l1, :l2, 4))) + #edge3 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 3)), getfield(Main, func_name(:us, :l1, :l2, 3))) + #edge4 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 4)), getfield(Main, func_name(:us, :l1, :l2, 4))) #map_edges[:l1][:l2] = [edge1, edge2, edge3, edge4] # l1 => l3 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l3, 1)), getfield(Main, func_name(:us, :l1, :l3, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l3, 2)), getfield(Main, func_name(:us, :l1, :l3, 2))) - edge3 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l3, 3)), getfield(Main, func_name(:us, :l1, :l3, 3))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l3, 1)), getfield(Main, func_name(:us, :l1, :l3, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l3, 2)), getfield(Main, func_name(:us, :l1, :l3, 2))) + edge3 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l3, 3)), getfield(Main, func_name(:us, :l1, :l3, 3))) map_edges[:l1][:l3] = [edge1, edge2, edge3] # l3 loc @@ -155,7 +155,7 @@ function create_automaton_F(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1 map_edges[:l3][:l1] = [edge1] # l3 => l2 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l3, :l2, 1)), getfield(Main, func_name(:us, :l3, :l2, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l3, :l2, 1)), getfield(Main, func_name(:us, :l3, :l2, 1))) map_edges[:l3][:l2] = [edge1] ## Constants diff --git a/automata/automaton_G.jl b/automata/automaton_G.jl index 4a725ae320c21cb86ad0ebd0f42ef1b4036d4861..b169df1ff19cc2f851b714d0321a562f290ef523 100644 --- a/automata/automaton_G.jl +++ b/automata/automaton_G.jl @@ -193,28 +193,28 @@ function create_automaton_G(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1 # l0 loc # l0 => l1 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l0, :l1, 1)), getfield(Main, func_name(:us, :l0, :l1, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l0, :l1, 1)), getfield(Main, func_name(:us, :l0, :l1, 1))) map_edges[:l0][:l1] = [edge1] # l1 loc # l1 => l3 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l3, 1)), getfield(Main, func_name(:us, :l1, :l3, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l3, 2)), getfield(Main, func_name(:us, :l1, :l3, 2))) - edge3 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l3, 3)), getfield(Main, func_name(:us, :l1, :l3, 3))) - edge4 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l3, 4)), getfield(Main, func_name(:us, :l1, :l3, 4))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l3, 1)), getfield(Main, func_name(:us, :l1, :l3, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l3, 2)), getfield(Main, func_name(:us, :l1, :l3, 2))) + edge3 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l3, 3)), getfield(Main, func_name(:us, :l1, :l3, 3))) + edge4 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l3, 4)), getfield(Main, func_name(:us, :l1, :l3, 4))) map_edges[:l1][:l3] = [edge1, edge2, edge3, edge4] # l1 => l4 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l4, 1)), getfield(Main, func_name(:us, :l1, :l4, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l4, 2)), getfield(Main, func_name(:us, :l1, :l4, 2))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l4, 1)), getfield(Main, func_name(:us, :l1, :l4, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l4, 2)), getfield(Main, func_name(:us, :l1, :l4, 2))) map_edges[:l1][:l4] = [edge1, edge2] # l1 => l2 #= - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 1)), getfield(Main, func_name(:us, :l1, :l2, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 2)), getfield(Main, func_name(:us, :l1, :l2, 2))) - edge3 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 3)), getfield(Main, func_name(:us, :l1, :l2, 3))) - edge4 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 4)), getfield(Main, func_name(:us, :l1, :l2, 4))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 1)), getfield(Main, func_name(:us, :l1, :l2, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 2)), getfield(Main, func_name(:us, :l1, :l2, 2))) + edge3 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 3)), getfield(Main, func_name(:us, :l1, :l2, 3))) + edge4 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 4)), getfield(Main, func_name(:us, :l1, :l2, 4))) map_edges[:l1][:l2] = [edge1, edge2, edge3, edge4] =# @@ -224,8 +224,8 @@ function create_automaton_G(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1 map_edges[:l3][:l1] = [edge1] # l3 => l2 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l3, :l2, 1)), getfield(Main, func_name(:us, :l3, :l2, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l3, :l2, 2)), getfield(Main, func_name(:us, :l3, :l2, 2))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l3, :l2, 1)), getfield(Main, func_name(:us, :l3, :l2, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l3, :l2, 2)), getfield(Main, func_name(:us, :l3, :l2, 2))) map_edges[:l3][:l2] = [edge1, edge2] # l4 loc @@ -234,8 +234,8 @@ function create_automaton_G(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1 map_edges[:l4][:l1] = [edge1] # l4 => l2 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l4, :l2, 1)), getfield(Main, func_name(:us, :l4, :l2, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l4, :l2, 2)), getfield(Main, func_name(:us, :l4, :l2, 2))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l4, :l2, 1)), getfield(Main, func_name(:us, :l4, :l2, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l4, :l2, 2)), getfield(Main, func_name(:us, :l4, :l2, 2))) map_edges[:l4][:l2] = [edge1,edge2] ## Constants diff --git a/automata/automaton_G_and_F.jl b/automata/automaton_G_and_F.jl index f29bd63d110345f34fcdf5c5590d594019f15270..367eb5d6d5a75ebab18770dfca6505131473c1c3 100644 --- a/automata/automaton_G_and_F.jl +++ b/automata/automaton_G_and_F.jl @@ -282,27 +282,27 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float # l0G loc # l0G => l1G - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l0G, :l1G, 1)), getfield(Main, func_name(:us, :l0G, :l1G, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l0G, :l1G, 1)), getfield(Main, func_name(:us, :l0G, :l1G, 1))) map_edges[:l0G][:l1G] = [edge1] # l1G => l3G - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l3G, 1)), getfield(Main, func_name(:us, :l1G, :l3G, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l3G, 2)), getfield(Main, func_name(:us, :l1G, :l3G, 2))) - edge3 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l3G, 3)), getfield(Main, func_name(:us, :l1G, :l3G, 3))) - edge4 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l3G, 4)), getfield(Main, func_name(:us, :l1G, :l3G, 4))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l3G, 1)), getfield(Main, func_name(:us, :l1G, :l3G, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l3G, 2)), getfield(Main, func_name(:us, :l1G, :l3G, 2))) + edge3 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l3G, 3)), getfield(Main, func_name(:us, :l1G, :l3G, 3))) + edge4 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l3G, 4)), getfield(Main, func_name(:us, :l1G, :l3G, 4))) map_edges[:l1G][:l3G] = [edge1, edge2, edge3, edge4] # l1G => l4G - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l4G, 1)), getfield(Main, func_name(:us, :l1G, :l4G, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l4G, 2)), getfield(Main, func_name(:us, :l1G, :l4G, 2))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l4G, 1)), getfield(Main, func_name(:us, :l1G, :l4G, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l4G, 2)), getfield(Main, func_name(:us, :l1G, :l4G, 2))) map_edges[:l1G][:l4G] = [edge1, edge2] # l1G => l2G #= - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l2G, 1)), getfield(Main, func_name(:us, :l1G, :l2G, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l2G, 2)), getfield(Main, func_name(:us, :l1G, :l2G, 2))) - edge3 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l2G, 3)), getfield(Main, func_name(:us, :l1G, :l2G, 3))) - edge4 = Edge([nothing], getfield(Main, func_name(:cc, :l1G, :l2G, 4)), getfield(Main, func_name(:us, :l1G, :l2G, 4))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l2G, 1)), getfield(Main, func_name(:us, :l1G, :l2G, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l2G, 2)), getfield(Main, func_name(:us, :l1G, :l2G, 2))) + edge3 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l2G, 3)), getfield(Main, func_name(:us, :l1G, :l2G, 3))) + edge4 = Edge(nothing, getfield(Main, func_name(:cc, :l1G, :l2G, 4)), getfield(Main, func_name(:us, :l1G, :l2G, 4))) map_edges[:l1G][:l2G] = [edge3, edge4, edge1, edge2] =# @@ -312,8 +312,8 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float map_edges[:l3G][:l1G] = [edge1] # l3G => l2G - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l3G, :l2G, 1)), getfield(Main, func_name(:us, :l3G, :l2G, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l3G, :l2G, 2)), getfield(Main, func_name(:us, :l3G, :l2G, 2))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l3G, :l2G, 1)), getfield(Main, func_name(:us, :l3G, :l2G, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l3G, :l2G, 2)), getfield(Main, func_name(:us, :l3G, :l2G, 2))) map_edges[:l3G][:l2G] = [edge1, edge2] # l4 loc @@ -322,28 +322,28 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float map_edges[:l4G][:l1G] = [edge1] # l4G => l2G - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l4G, :l2G, 1)), getfield(Main, func_name(:us, :l4G, :l2G, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l4G, :l2G, 2)), getfield(Main, func_name(:us, :l4G, :l2G, 2))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l4G, :l2G, 1)), getfield(Main, func_name(:us, :l4G, :l2G, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l4G, :l2G, 2)), getfield(Main, func_name(:us, :l4G, :l2G, 2))) map_edges[:l4G][:l2G] = [edge1,edge2] # l2G loc # l2G => l1F : Transition from autF to autG - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l2G, :l1F, 1)), getfield(Main, func_name(:us, :l2G, :l1F, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l2G, :l1F, 1)), getfield(Main, func_name(:us, :l2G, :l1F, 1))) map_edges[:l2G][:l1F] = [edge1] # l1F loc # l1F => l3F - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1F, :l2F, 1)), getfield(Main, func_name(:us, :l1F, :l2F, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1F, :l2F, 2)), getfield(Main, func_name(:us, :l1F, :l2F, 2))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1F, :l2F, 1)), getfield(Main, func_name(:us, :l1F, :l2F, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1F, :l2F, 2)), getfield(Main, func_name(:us, :l1F, :l2F, 2))) map_edges[:l1F][:l2F] = [edge1, edge2] - #edge3 = Edge([nothing], getfield(Main, func_name(:cc, :l1F, :l2F, 3)), getfield(Main, func_name(:us, :l1F, :l2F, 3))) - #edge4 = Edge([nothing], getfield(Main, func_name(:cc, :l1F, :l2F, 4)), getfield(Main, func_name(:us, :l1F, :l2F, 4))) + #edge3 = Edge(nothing, getfield(Main, func_name(:cc, :l1F, :l2F, 3)), getfield(Main, func_name(:us, :l1F, :l2F, 3))) + #edge4 = Edge(nothing, getfield(Main, func_name(:cc, :l1F, :l2F, 4)), getfield(Main, func_name(:us, :l1F, :l2F, 4))) #map_edges[:l1F][:l2F] = [edge1, edge4, edge3, edge2] # l1F => l3F - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1F, :l3F, 1)), getfield(Main, func_name(:us, :l1F, :l3F, 1))) - edge2 = Edge([nothing], getfield(Main, func_name(:cc, :l1F, :l3F, 2)), getfield(Main, func_name(:us, :l1F, :l3F, 2))) - edge3 = Edge([nothing], getfield(Main, func_name(:cc, :l1F, :l3F, 3)), getfield(Main, func_name(:us, :l1F, :l3F, 3))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1F, :l3F, 1)), getfield(Main, func_name(:us, :l1F, :l3F, 1))) + edge2 = Edge(nothing, getfield(Main, func_name(:cc, :l1F, :l3F, 2)), getfield(Main, func_name(:us, :l1F, :l3F, 2))) + edge3 = Edge(nothing, getfield(Main, func_name(:cc, :l1F, :l3F, 3)), getfield(Main, func_name(:us, :l1F, :l3F, 3))) map_edges[:l1F][:l3F] = [edge1, edge2, edge3] # l3F loc @@ -352,7 +352,7 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float map_edges[:l3F][:l1F] = [edge1] # l3F => l2F - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l3F, :l2F, 1)), getfield(Main, func_name(:us, :l3F, :l2F, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l3F, :l2F, 1)), getfield(Main, func_name(:us, :l3F, :l2F, 1))) map_edges[:l3F][:l2F] = [edge1] ## Constants diff --git a/automata/euclidean_distance_automaton.jl b/automata/euclidean_distance_automaton.jl index 2d3f38e70cfdb0c972c2260d3d71ff410d8e148d..d7128a6e8dd6b71f30b3a4cab7b00e8ff5e8ab8c 100644 --- a/automata/euclidean_distance_automaton.jl +++ b/automata/euclidean_distance_automaton.jl @@ -80,7 +80,7 @@ function create_euclidean_distance_automaton(m::ContinuousTimeModel, timeline::A # l0 loc # l0 => l1 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l0, :l1, 1)), getfield(Main, func_name(:us, :l0, :l1, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l0, :l1, 1)), getfield(Main, func_name(:us, :l0, :l1, 1))) map_edges[:l0][:l1] = [edge1] # l1 loc @@ -97,15 +97,15 @@ function create_euclidean_distance_automaton(m::ContinuousTimeModel, timeline::A setindex!(getfield(S, :values), S[:idx] + 1.0, $(idx_var_idx))) end eval(meta_edge_i) - push!(map_edges[:l1][:l1], Edge([nothing], getfield(Main, func_name(:cc, :l1, :l1, 1+i)), getfield(Main, func_name(:us, :l1, :l1, 1+i)))) + push!(map_edges[:l1][:l1], Edge(nothing, getfield(Main, func_name(:cc, :l1, :l1, 1+i)), getfield(Main, func_name(:us, :l1, :l1, 1+i)))) end =# - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l1, 1)), getfield(Main, func_name(:us, :l1, :l1, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l1, 1)), getfield(Main, func_name(:us, :l1, :l1, 1))) edge2 = Edge([:ALL], getfield(Main, func_name(:cc, :l1, :l1, 2)), getfield(Main, func_name(:us, :l1, :l1, 2))) map_edges[:l1][:l1] = [edge1, edge2] # l1 => l2 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l1, :l2, 1)), getfield(Main, func_name(:us, :l1, :l2, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l1, :l2, 1)), getfield(Main, func_name(:us, :l1, :l2, 1))) map_edges[:l1][:l2] = [edge1] ## Constants diff --git a/automata/euclidean_distance_automaton_2.jl b/automata/euclidean_distance_automaton_2.jl index ed69d691485dd2b4c5a1f304d84b3074355e4894..38d30a0013db4af49a576c4906bfe9cedda8babc 100644 --- a/automata/euclidean_distance_automaton_2.jl +++ b/automata/euclidean_distance_automaton_2.jl @@ -69,11 +69,11 @@ function create_euclidean_distance_automaton_2(m::ContinuousTimeModel, timeline: eval(meta_elementary_functions) # l0 loc # l0 => l1 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, :l0, :l1, 1)), getfield(Main, func_name(:us, :l0, :l1, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, :l0, :l1, 1)), getfield(Main, func_name(:us, :l0, :l1, 1))) map_edges[:l0][:l1] = [edge1] # lnbr_obs => lfinal - edge1 = Edge([nothing], getfield(Main, func_name(:cc, loc_nbr_obs, :lfinal, 1)), getfield(Main, func_name(:us, loc_nbr_obs, :lfinal, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, loc_nbr_obs, :lfinal, 1)), getfield(Main, func_name(:us, loc_nbr_obs, :lfinal, 1))) map_edges[loc_nbr_obs][:lfinal] = [edge1] # lnbr_obs => lnbr_obs edge1 = Edge([:ALL], getfield(Main, func_name(:cc, loc_nbr_obs, loc_nbr_obs, 1)), getfield(Main, func_name(:us, loc_nbr_obs, loc_nbr_obs, 1))) @@ -100,7 +100,7 @@ function create_euclidean_distance_automaton_2(m::ContinuousTimeModel, timeline: eval(meta_elementary_functions_loci) # loci => loci+1 - edge1 = Edge([nothing], getfield(Main, func_name(:cc, loci, locip1, 1)), getfield(Main, func_name(:us, loci, locip1, 1))) + edge1 = Edge(nothing, getfield(Main, func_name(:cc, loci, locip1, 1)), getfield(Main, func_name(:us, loci, locip1, 1))) map_edges[loci][locip1] = [edge1] # loci => loci edge1 = Edge([:ALL], getfield(Main, func_name(:cc, loci, loci, 1)), getfield(Main, func_name(:us, loci, loci, 1))) diff --git a/automata/period_automaton.jl b/automata/period_automaton.jl index 9fd5e9a9ba57e4c95a297edf8b641f9ead08404f..bc4224df1b38c8a58096a90503b703d21f0b8b91 100644 --- a/automata/period_automaton.jl +++ b/automata/period_automaton.jl @@ -232,10 +232,10 @@ function create_period_automaton(m::ContinuousTimeModel, L::Float64, H::Float64, edge_1 = Edge([:ALL], getfield(Main, func_name(:cc, :l0, :l0, 1)), getfield(Main, func_name(:us, :l0, :l0, 1))) map_edges[:l0][:l0] = [edge_1] # * l0 => l0prime - edge_1 = Edge([nothing], getfield(Main, func_name(:cc, :l0, :l0prime, 1)), getfield(Main, func_name(:us, :l0, :l0prime, 1))) + edge_1 = Edge(nothing, getfield(Main, func_name(:cc, :l0, :l0prime, 1)), getfield(Main, func_name(:us, :l0, :l0prime, 1))) map_edges[:l0][:l0prime] = [edge_1] # * l0 => low - edge_1 = Edge([nothing], getfield(Main, func_name(:cc, :l0, :low, 1)), getfield(Main, func_name(:us, :l0, :low, 1))) + edge_1 = Edge(nothing, getfield(Main, func_name(:cc, :l0, :low, 1)), getfield(Main, func_name(:us, :l0, :low, 1))) map_edges[:l0][:low] = [edge_1] # l0prime @@ -243,7 +243,7 @@ function create_period_automaton(m::ContinuousTimeModel, L::Float64, H::Float64, edge_1 = Edge([:ALL], getfield(Main, func_name(:cc, :l0prime, :l0prime, 1)), getfield(Main, func_name(:us, :l0prime, :l0prime, 1))) map_edges[:l0prime][:l0prime] = [edge_1] # * l0prime => low - edge_1 = Edge([nothing], getfield(Main, func_name(:cc, :l0prime, :low, 1)), getfield(Main, func_name(:us, :l0prime, :low, 1))) + edge_1 = Edge(nothing, getfield(Main, func_name(:cc, :l0prime, :low, 1)), getfield(Main, func_name(:us, :l0prime, :low, 1))) map_edges[:l0prime][:low] = [edge_1] # low @@ -254,7 +254,7 @@ function create_period_automaton(m::ContinuousTimeModel, L::Float64, H::Float64, edge_1 = Edge([:ALL], getfield(Main, func_name(:cc, :low, :mid, 1)), getfield(Main, func_name(:us, :low, :mid, 1))) map_edges[:low][:mid] = [edge_1] # * low => final - edge_1 = Edge([nothing], getfield(Main, func_name(:cc, :low, :final, 1)), getfield(Main, func_name(:us, :low, :final, 1))) + edge_1 = Edge(nothing, getfield(Main, func_name(:cc, :low, :final, 1)), getfield(Main, func_name(:us, :low, :final, 1))) map_edges[:low][:final] = [edge_1] # mid @@ -271,7 +271,7 @@ function create_period_automaton(m::ContinuousTimeModel, L::Float64, H::Float64, edge_1 = Edge([:ALL], getfield(Main, func_name(:cc, :mid, :high, 1)), getfield(Main, func_name(:us, :mid, :high, 1))) map_edges[:mid][:high] = [edge_1] # * mid => final - edge_1 = Edge([nothing], getfield(Main, func_name(:cc, :mid, :final, 1)), getfield(Main, func_name(:us, :mid, :final, 1))) + edge_1 = Edge(nothing, getfield(Main, func_name(:cc, :mid, :final, 1)), getfield(Main, func_name(:us, :mid, :final, 1))) map_edges[:mid][:final] = [edge_1] # high @@ -282,7 +282,7 @@ function create_period_automaton(m::ContinuousTimeModel, L::Float64, H::Float64, edge_1 = Edge([:ALL], getfield(Main, func_name(:cc, :high, :mid, 1)), getfield(Main, func_name(:us, :high, :mid, 1))) map_edges[:high][:mid] = [edge_1] # * high => final - edge_1 = Edge([nothing], getfield(Main, func_name(:cc, :high, :final, 1)), getfield(Main, func_name(:us, :high, :final, 1))) + edge_1 = Edge(nothing, getfield(Main, func_name(:cc, :high, :final, 1)), getfield(Main, func_name(:us, :high, :final, 1))) map_edges[:high][:final] = [edge_1] ## Constants diff --git a/core/common.jl b/core/common.jl index b0f8360256dfab1ce57c974a0a36eaae0add316e..340783ee99c969c62a037f0a1d86185bc72ec602 100644 --- a/core/common.jl +++ b/core/common.jl @@ -39,7 +39,7 @@ struct Trajectory <: AbstractTrajectory end struct Edge - transitions::Vector{Transition} + transitions::Union{Nothing,Vector{Transition}} check_constraints::Function update_state!::Function end diff --git a/core/lha.jl b/core/lha.jl index 87ed3cdd983df1c1dc3dfcd740bb0f2358d56797..2207e848b52f30cd20db613f9d4a4fff9bb98df6 100644 --- a/core/lha.jl +++ b/core/lha.jl @@ -59,7 +59,7 @@ end function Base.show(io::IO, E::Edge) print(io, "(Edge: ") - print(io, (E.transitions[1] == nothing) ? "Asynchronous #, " : ("Synchronized with " * join(E.transitions,',') * ", ")) + print(io, (E.transitions == nothing) ? "Asynchronous #, " : ("Synchronized with " * join(E.transitions,',') * ", ")) print(io, Symbol(E.check_constraints)) print(io, ", ") print(io, Symbol(E.update_state!)) @@ -112,14 +112,15 @@ function _find_edge_candidates!(edge_candidates::Vector{Edge}, for target_loc in keys(edges_from_current_loc) for edge in edges_from_current_loc[target_loc] if Λ[target_loc](x) && getfield(edge, :check_constraints)(Snplus1, x, p) - if getfield(edge, :transitions)[1] == nothing + if getfield(edge, :transitions) == nothing _push_edge!(edge_candidates, edge, nbr_candidates) nbr_candidates += 1 return nbr_candidates - end - if !only_asynchronous && getfield(edge, :transitions)[1] != nothing - _push_edge!(edge_candidates, edge, nbr_candidates) - nbr_candidates += 1 + else + if !only_asynchronous + _push_edge!(edge_candidates, edge, nbr_candidates) + nbr_candidates += 1 + end end end end @@ -134,7 +135,7 @@ function _get_edge_index(edge_candidates::Vector{Edge}, nbr_candidates::Int, for i = 1:nbr_candidates edge = edge_candidates[i] # Asynchronous edge detection: we fire it - if getfield(edge, :transitions)[1] == nothing + if getfield(edge, :transitions) == nothing return (i, detected_event) end # Synchronous detection diff --git a/tests/automata/euclidean_distance_single.jl b/tests/automata/euclidean_distance_single.jl index fdebb5ae557556be601d4d99699daace9783c825..8c8260ef9b5aef428d417c025afab08238f57240 100644 --- a/tests/automata/euclidean_distance_single.jl +++ b/tests/automata/euclidean_distance_single.jl @@ -18,8 +18,9 @@ test = euclidean_distance(σ, :I, tml_obs, y_obs) == σ.state_lha_end[:d] aut2 = create_euclidean_distance_automaton_2(SIR, tml_obs, y_obs, :I) sync_SIR = SIR * aut2 σ = simulate(sync_SIR) -@show euclidean_distance(σ, :I, tml_obs, y_obs), σ.state_lha_end[:d] -test = euclidean_distance(σ, :I, tml_obs, y_obs) == σ.state_lha_end[:d] +test2 = euclidean_distance(σ, :I, tml_obs, y_obs) == σ.state_lha_end[:d] + +test_all = test && test2 -return test +return test_all