Commit 8bb99324 authored by Bentriou Mahmoud's avatar Bentriou Mahmoud
Browse files

All automata were readapted and are in accordance with the last description of...

All automata were readapted and are in accordance with the last description of the thesis. Tests passed
parent f79a624b
......@@ -62,49 +62,51 @@ function create_automaton_F(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1
# l1 loc
# l1 => l2
#=
@everywhere $(func_name(:cc, :l1, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
getfield(S, :time) >= $t1 &&
($x1 <= getfield(S, :values)[$(idx_var_n)] <= $x2)
@everywhere $(func_name(:us, :l1, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l2;
setindex!(getfield(S, :values), 0, $(idx_var_d)))
@everywhere $(func_name(:cc, :l1, :l2, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
=#
#=
@everywhere $(func_name(:cc, :l1, :l2, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
istrue(getfield(S, :values)[$(idx_var_isabs)]) && getfield(S, :time) <= $t2
@everywhere $(func_name(:us, :l1, :l2, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l2)
=#
@everywhere $(func_name(:cc, :l1, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
getfield(S, :time) >= $t1 &&
getfield(S, :values)[$(idx_var_d)] == 0
@everywhere $(func_name(:us, :l1, :l2, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
@everywhere $(func_name(:us, :l1, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l2)
@everywhere $(func_name(:cc, :l1, :l2, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :time) >= $t2) &&
(getfield(S, :values)[$(idx_var_n)] < $x1 || getfield(S, :values)[$(idx_var_n)] > $x2)
@everywhere $(func_name(:us, :l1, :l2, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l2;
setindex!(getfield(S, :values), min(abs(getfield(S, :values)[$(idx_var_n)] - $x1), abs(getfield(S, :values)[$(idx_var_n)] - $x2)), $(idx_var_d)))
@everywhere $(func_name(:cc, :l1, :l2, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
istrue(getfield(S, :values)[$(idx_var_isabs)]) && getfield(S, :time) <= $t2
@everywhere $(func_name(:us, :l1, :l2, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l2)
(S.loc = :l2;)
#setindex!(getfield(S, :values), min(abs(getfield(S, :values)[$(idx_var_n)] - $x1), abs(getfield(S, :values)[$(idx_var_n)] - $x2)), $(idx_var_d)))
# l1 => l3
@everywhere $(func_name(:cc, :l1, :l3, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
($x1 <= getfield(S, :values)[$(idx_var_n)] <= $x2)
(getfield(S, :time) <= $t1) &&
(getfield(S, :values)[$(idx_var_n)] < $x1 || getfield(S, :values)[$(idx_var_n)] > $x2)
@everywhere $(func_name(:us, :l1, :l3, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l3;
setindex!(getfield(S, :values), 0, $(idx_var_d)))
setindex!(getfield(S, :values), min(sqrt((getfield(S, :time) - $t1)^2 + (getfield(S, :values)[$(idx_var_n)] - $x2)^2),
sqrt((getfield(S, :time) - $t1)^2 + (getfield(S, :values)[$(idx_var_n)] - $x1)^2)), $(idx_var_d)))
@everywhere $(func_name(:cc, :l1, :l3, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :values)[$(idx_var_n)] < $x1 || getfield(S, :values)[$(idx_var_n)] > $x2) &&
(getfield(S, :time) <= $t1)
($x1 <= getfield(S, :values)[$(idx_var_n)] <= $x2)
@everywhere $(func_name(:us, :l1, :l3, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l3;
setindex!(getfield(S, :values), min(sqrt((getfield(S, :time) - $t1)^2 + (getfield(S, :values)[$(idx_var_n)] - $x2)^2),
sqrt((getfield(S, :time) - $t1)^2 + (getfield(S, :values)[$(idx_var_n)] - $x1)^2)), $(idx_var_d)))
setindex!(getfield(S, :values), 0, $(idx_var_d)))
@everywhere $(func_name(:cc, :l1, :l3, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :values)[$(idx_var_n)] < $x1 || getfield(S, :values)[$(idx_var_n)] > $x2) &&
($t1 <= getfield(S, :time) <= $t2)
(getfield(S, :time) >= $t1) &&
(getfield(S, :values)[$(idx_var_n)] < $x1 || getfield(S, :values)[$(idx_var_n)] > $x2)
@everywhere $(func_name(:us, :l1, :l3, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l3;
val_min = min(getfield(S, :values)[$(idx_var_d)],
......@@ -121,7 +123,7 @@ function create_automaton_F(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1
# l3 => l2
@everywhere $(func_name(:cc, :l3, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :time) >= $t2)
(getfield(S, :time) >= $t2 || istrue(getfield(S, :values)[$(idx_var_isabs)]))
@everywhere $(func_name(:us, :l3, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(S.loc = :l2)
end
......@@ -136,9 +138,10 @@ function create_automaton_F(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1
# 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)))
map_edges[:l1][:l2] = [edge1, edge2, edge3, edge4]
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)))
#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)))
......
......@@ -113,6 +113,7 @@ function create_automaton_G(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1
# l1 => l2
#=
@everywhere $(func_name(:cc, :l1, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
istrue(getfield(S, :values)[$(idx_var_in)]) &&
getfield(S, :time) >= $t2
......@@ -139,6 +140,7 @@ function create_automaton_G(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1
@everywhere $(func_name(:us, :l1, :l2, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2"));
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] + ($t2 - getfield(S, :time)) * min(abs($x1 - getfield(S, :values)[$(idx_var_n)]), abs($x2 - getfield(S, :values)[$(idx_var_n)])), $(idx_var_d)))
=#
# l3 => l1
@everywhere $(func_name(:cc, :l3, :l1, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) = true
......@@ -157,23 +159,23 @@ function create_automaton_G(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1
setindex!(getfield(S, :values), true, $(idx_var_in));
setindex!(getfield(S, :values), getfield(Main, $(Meta.quot(sym_isabs_func)))(p, x), $(idx_var_isabs)))
# l2 => l1
# l3 => l2
@everywhere $(func_name(:cc, :l3, :l2, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
istrue(getfield(S, :values)[$(idx_var_in)]) &&
getfield(S, :time) >= $t2
(getfield(S, :time) >= $t2 || istrue(getfield(S, :values)[$(idx_var_isabs)]))
@everywhere $(func_name(:us, :l3, :l2, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2"));
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] * ($t2 - $t1), $(idx_var_d)))
@everywhere $(func_name(:cc, :l3, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
!istrue(getfield(S, :values)[$(idx_var_in)]) &&
getfield(S, :time) >= $t2
(getfield(S, :time) >= $t2 || istrue(getfield(S, :values)[$(idx_var_isabs)]))
@everywhere $(func_name(:us, :l3, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2")))
# l4 => l2
@everywhere $(func_name(:cc, :l4, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :time) >= $t2)
(getfield(S, :time) >= $t2 || istrue(getfield(S, :values)[$(idx_var_isabs)]))
@everywhere $(func_name(:us, :l4, :l2, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2"));
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] + getfield(S, :values)[$(idx_var_tprime)] * min(abs($x1 - getfield(S, :values)[$(idx_var_n)]), abs($x2 - getfield(S, :values)[$(idx_var_n)])), $(idx_var_d));
......@@ -200,11 +202,13 @@ function create_automaton_G(m::ContinuousTimeModel, x1::Float64, x2::Float64, t1
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)))
map_edges[:l1][:l2] = [edge1, edge2, edge3, edge4]
=#
# l3 loc
# l3 => l1
......
......@@ -127,14 +127,15 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float
(setfield!(S, :loc, Symbol("l4G")))
# l1G => l2G
#=
@everywhere $(func_name(:cc, :l1G, :l2G, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
istrue(getfield(S, :values)[$(idx_var_isabs)]) &&
getfield(S, :time) <= $t1
@everywhere $(func_name(:us, :l1G, :l2G, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2G"));
setindex!(getfield(S, :values), ($t2 - $t1) * min(abs($x1 - getfield(S, :values)[$(idx_var_n)]), abs($x2 - getfield(S, :values)[$(idx_var_n)])), $(idx_var_d)))
@everywhere $(func_name(:cc, :l1G, :l2G, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
@everywhere $(func_name(:cc, :l1G, :l2G, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
istrue(getfield(S, :values)[$(idx_var_isabs)]) &&
($t1 <= getfield(S, :time) <= $t2)
@everywhere $(func_name(:us, :l1G, :l2G, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
......@@ -153,6 +154,7 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float
@everywhere $(func_name(:us, :l1G, :l2G, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2G"));
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] * ($t2 - $t1), $(idx_var_d)))
=#
# l3G loc
# l3G => l1G
......@@ -165,14 +167,14 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float
# l3G => l2G
@everywhere $(func_name(:cc, :l3G, :l2G, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
istrue(getfield(S, :values)[$(idx_var_in)]) &&
getfield(S, :time) >= $t2
(getfield(S, :time) >= $t2 || istrue(getfield(S, :values)[$(idx_var_isabs)]))
@everywhere $(func_name(:us, :l3G, :l2G, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2G"));
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] * ($t2 - $t1), $(idx_var_d)))
@everywhere $(func_name(:cc, :l3G, :l2G, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
!istrue(getfield(S, :values)[$(idx_var_in)]) &&
getfield(S, :time) >= $t2
(getfield(S, :time) >= $t2 || istrue(getfield(S, :values)[$(idx_var_isabs)]))
@everywhere $(func_name(:us, :l3G, :l2G, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2G")))
......@@ -189,11 +191,10 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float
# l4G => l2G
@everywhere $(func_name(:cc, :l4G, :l2G, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :time) >= $t2)
(getfield(S, :time) >= $t2 || istrue(getfield(S, :values)[$(idx_var_isabs)]))
@everywhere $(func_name(:us, :l4G, :l2G, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2G"));
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] + getfield(S, :values)[$(idx_var_tprime)] * min(abs($x1 - getfield(S, :values)[$(idx_var_n)]), abs($x2 - getfield(S, :values)[$(idx_var_n)])), $(idx_var_d));
setindex!(getfield(S, :values), 0.0, $(idx_var_tprime)))
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] + getfield(S, :values)[$(idx_var_tprime)] * min(abs($x1 - getfield(S, :values)[$(idx_var_n)]), abs($x2 - getfield(S, :values)[$(idx_var_n)])), $(idx_var_d));)
# Connection between the two automata: l2G => l1F
@everywhere $(func_name(:cc, :l2G, :l1F, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) = true
......@@ -207,49 +208,50 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float
# l1F => l2F
@everywhere $(func_name(:cc, :l1F, :l2F, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
getfield(S, :time) >= $t3 &&
($x3 <= getfield(S, :values)[$(idx_var_n)] <= $x4)
@everywhere $(func_name(:us, :l1F, :l2F, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2F"));
setindex!(getfield(S, :values), 0, $(idx_var_dprime)))
@everywhere $(func_name(:cc, :l1F, :l2F, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
getfield(S, :time) >= $t3 &&
getfield(S, :values)[$(idx_var_dprime)] == 0
@everywhere $(func_name(:us, :l1F, :l2F, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2F")))
@everywhere $(func_name(:us, :l1F, :l2F, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2F"));)
#setindex!(getfield(S, :values), 0, $(idx_var_dprime)))
@everywhere $(func_name(:cc, :l1F, :l2F, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :time) >= $t4) &&
(getfield(S, :values)[$(idx_var_n)] < $x3 || getfield(S, :values)[$(idx_var_n)] > $x4)
@everywhere $(func_name(:us, :l1F, :l2F, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2F"));
setindex!(getfield(S, :values), min(abs(getfield(S, :values)[$(idx_var_n)] - $x3), abs(getfield(S, :values)[$(idx_var_n)] - $x4)), $(idx_var_dprime));
#setindex!(getfield(S, :values), min(abs(getfield(S, :values)[$(idx_var_n)] - $x3), abs(getfield(S, :values)[$(idx_var_n)] - $x4)), $(idx_var_dprime));
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] + getfield(S, :values)[$(idx_var_dprime)], $(idx_var_d)))
#=
@everywhere $(func_name(:cc, :l1F, :l2F, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
istrue(getfield(S, :values)[$(idx_var_isabs)]) && getfield(S, :time) <= $t4
@everywhere $(func_name(:us, :l1F, :l2F, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2F"));
setindex!(getfield(S, :values), getfield(S, :values)[$(idx_var_d)] + getfield(S, :values)[$(idx_var_dprime)], $(idx_var_d)))
@everywhere $(func_name(:cc, :l1F, :l2F, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
getfield(S, :time) >= $t3 &&
getfield(S, :values)[$(idx_var_dprime)] == 0
@everywhere $(func_name(:us, :l1F, :l2F, 4))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2F")))
=#
# l1F => l3F
@everywhere $(func_name(:cc, :l1F, :l3F, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
($x3 <= getfield(S, :values)[$(idx_var_n)] <= $x4)
(getfield(S, :time) <= $t3) &&
(getfield(S, :values)[$(idx_var_n)] < $x3 || getfield(S, :values)[$(idx_var_n)] > $x4)
@everywhere $(func_name(:us, :l1F, :l3F, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l3F"));
setindex!(getfield(S, :values), 0, $(idx_var_dprime));)
setindex!(getfield(S, :values), min(sqrt((getfield(S, :time) - $t3)^2 + (getfield(S, :values)[$(idx_var_n)] - $x4)^2),
sqrt((getfield(S, :time) - $t3)^2 + (getfield(S, :values)[$(idx_var_n)] - $x3)^2)), $(idx_var_dprime)))
@everywhere $(func_name(:cc, :l1F, :l3F, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :values)[$(idx_var_n)] < $x3 || getfield(S, :values)[$(idx_var_n)] > $x4) &&
(getfield(S, :time) <= $t3)
($x3 <= getfield(S, :values)[$(idx_var_n)] <= $x4)
@everywhere $(func_name(:us, :l1F, :l3F, 2))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l3F"));
setindex!(getfield(S, :values), min(sqrt((getfield(S, :time) - $t3)^2 + (getfield(S, :values)[$(idx_var_n)] - $x4)^2),
sqrt((getfield(S, :time) - $t3)^2 + (getfield(S, :values)[$(idx_var_n)] - $x3)^2)), $(idx_var_dprime)))
setindex!(getfield(S, :values), 0, $(idx_var_dprime));)
@everywhere $(func_name(:cc, :l1F, :l3F, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :values)[$(idx_var_n)] < $x3 || getfield(S, :values)[$(idx_var_n)] > $x4) &&
($t3 <= getfield(S, :time) <= $t4)
(getfield(S, :time) >= $t3) &&
(getfield(S, :values)[$(idx_var_n)] < $x3 || getfield(S, :values)[$(idx_var_n)] > $x4)
@everywhere $(func_name(:us, :l1F, :l3F, 3))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l3F"));
setindex!(getfield(S, :values), min(getfield(S, :values)[$(idx_var_dprime)], min(abs(getfield(S, :values)[$(idx_var_n)] - $x3), abs(getfield(S, :values)[$(idx_var_n)] - $x4))), $(idx_var_dprime)))
......@@ -264,7 +266,7 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float
# l3F => l2F
@everywhere $(func_name(:cc, :l3F, :l2F, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(getfield(S, :time) >= $t4)
(getfield(S, :time) >= $t4 || istrue(getfield(S, :values)[$(idx_var_isabs)]))
@everywhere $(func_name(:us, :l3F, :l2F, 1))(S::StateLHA, x::Vector{Int}, p::Vector{Float64}) =
(setfield!(S, :loc, Symbol("l2F")))
end
......@@ -288,11 +290,13 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float
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)))
map_edges[:l1G][:l2G] = [edge3, edge4, edge1, edge2]
=#
# l3G loc
# l3G => l1G
......@@ -322,9 +326,10 @@ function create_automaton_G_and_F(m::ContinuousTimeModel, x1::Float64, x2::Float
# 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)))
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]
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)))
#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)))
......
......@@ -24,28 +24,31 @@ Locations={
};
Edges={
((l0,l1), #, t>=0, {n=P,test_abs=k_1*(E*S)+k_2*ES,d=9997999});
((l0,l1), #, t>=0, {n=P,test_abs=k_1*(E*S)+(k_2+k_3)*ES,d=9997999});
((l1,l2), #, t>=t1 & n>=x1 & n<=x2, {d=0});
((l1,l2), #, t>=t2 & n<=x1-1, #);
((l1,l2), #, t>=t2 & n>=x2+1, #);
((l1,l2), #, t>=t1 & d=0, #);
((l1,l2), #, t>=t2 & n<=x1-1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
((l1,l2), #, t>=t2 & n>=x2+1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
((l1,l2), #, test_abs=0 & t<=t2, #);
%((l1,l2),#, n>=x1 & n<=x2 & t>=t1 & t<=t2 ,{d=0});
%((l1,l2),#, t>=t2 & d=9997999, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
%((l1,l2),#, d=0 & t>=t1, #);
%((l1,l2),#, test_abs=0 , #);
((l1,l3), #, n>=x1 & n<=x2, {d=0});
((l1,l3), #, t<=t1 & n<=x1-1, {d=min(((t-t1)^2+(n-x2)^2)^0.5,((t-t1)^2+(n-x1)^2)^0.5)});
((l1,l3), #, t<=t1 & n>=x2+1, {d=min(((t-t1)^2+(n-x2)^2)^0.5,((t-t1)^2+(n-x1)^2)^0.5)});
((l1,l3), #, n<=x1-1 & t >= t1 & t<=t2, {d=min(d,min(((n-x1)^2)^0.5,((n-x2)^2)^0.5))});
((l1,l3), #, n>=x2+1 & t >= t1 & t<=t2, {d=min(d,min( ((n-x1)^2)^0.5, ((n-x2)^2)^0.5 ) ) });
((l1,l3), #, n>=x1 & n<=x2, {d=0});
((l1,l3), #, t>=t1 & n<=x1-1, {d=min(d,min(((n-x1)^2)^0.5,((n-x2)^2)^0.5))});
((l1,l3), #, t>=t1 & n>=x2+1, {d=min(d,min( ((n-x1)^2)^0.5, ((n-x2)^2)^0.5 ) ) });
((l3,l1), ALL, t>=0, {n=P,test_abs=k_1*(E*S)+k_2*ES});
((l3,l1), ALL, t>=0, {n=P,test_abs=k_1*(E*S)+(k_2+k_3)*ES});
((l3,l2), #, t>=t2 ,#);
((l3,l2), #, test_abs=0, #);
%((l1,l2), #, t>=t2 & n<=x1-1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
%((l1,l2), #, t>=t2 & n>=x2+1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
%((l1,l2), #, t>=t1 & n>=x1 & n<=x2, {d=0});
%((l1,l2), #, test_abs=0 & t<=t2, #);
%((l1,l2),#, n>=x1 & n<=x2 & t>=t1 & t<=t2 ,{d=0});
%((l1,l2),#, t>=t2 & d=9997999, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
%((l1,l2),#, d=0 & t>=t1, #);
%((l1,l2),#, test_abs=0 , #);
};
......@@ -30,7 +30,7 @@ Locations={
Edges={
% Init
((l0,l1), #, t>=0, {n=E,d=0,in=1,test_abs=k_1*(E*S)+k_2*ES});
((l0,l1), #, t>=0, {n=E,d=0,in=1,test_abs=k_1*(E*S)+(k_2+k_3)*ES});
((l1,l3), #, t<=t1 & n<=x1-1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5),in=0});
((l1,l3), #, t<=t1 & n>=x2+1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5),in=0});
......@@ -43,18 +43,21 @@ Edges={
((l1,l4), #, in=1 & t>=t1 & t<=t2 & n<=x1-1, #);
((l1,l4), #, in=1 & t>=t1 & t<=t2 & n>=x2+1, #);
((l1,l2), #, in=1 & t>=t2, #);
((l1,l2), #, in=0 & t>=t2, {d=d*(t2-t1)});
((l1,l2), #, test_abs=0 & t<=t1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)*(t2-t1)});
((l1,l2), #, test_abs=0 & t>=t1 & t<=t2, {d=d+(t2-t)*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
%((l1,l2), #, in=1 & t>=t2, #);
%((l1,l2), #, in=1 & t>=t2, {d=d*(t2-t1)});
%((l1,l2), #, test_abs=0 & t<=t1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)*(t2-t1)});
%((l1,l2), #, test_abs=0 & t>=t1 & t<=t2, {d=d+(t2-t)*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
((l3,l1), ALL, t>=0, {n=E,test_abs=k_1*(E*S)+k_2*ES});
((l3,l1), ALL, t>=0, {n=E,test_abs=k_1*(E*S)+(k_2+k_3)*ES});
((l3,l2), #, in=1 & t>=t2, {d=d*(t2-t1)});
((l3,l2), #, in=1 & test_abs=0, {d=d*(t2-t1)});
((l3,l2), #, in=0 & t>=t2, #);
((l3,l2), #, in=0 & test_abs=0, #);
((l4,l1), ALL, t>=0, {d=d+tprime*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5),tprime=0,n=E,in=1,test_abs=k_1*(E*S)+k_2*ES});
((l4,l1), ALL, t>=0, {d=d+tprime*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5),tprime=0,n=E,in=1,test_abs=k_1*(E*S)+(k_2+k_3)*ES});
((l4,l2), #, t>=t2, {d=d+tprime*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
((l4,l2), #, test_abs=0, {d=d+tprime*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
};
......@@ -35,7 +35,7 @@ Locations={
Edges={
% G automaton
((l0G,l1G), #, t>=0, {n=E,d=0,in=1,test_abs=k_1*(E*S)+k_2*ES});
((l0G,l1G), #, t>=0, {n=E,d=0,in=1,test_abs=k_1*(E*S)+(k_2+k_3)*ES});
((l1G,l3G), #, t<=t1 & n<=x1-1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5),in=0});
((l1G,l3G), #, t<=t1 & n>=x2+1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5),in=0});
......@@ -48,37 +48,45 @@ Edges={
((l1G,l4G), #, in=1 & t>=t1 & t<=t2 & n<=x1-1, #);
((l1G,l4G), #, in=1 & t>=t1 & t<=t2 & n>=x2+1, #);
((l1G,l2G), #, in=1 & t>=t2, #);
((l1G,l2G), #, in=0 & t>=t2, {d=d*(t2-t1)});
((l1G,l2G), #, test_abs=0 & t<=t1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)*(t2-t1)});
((l1G,l2G), #, test_abs=0 & t>=t1 & t<=t2, {d=d+(t2-t)*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
((l3G,l1G), ALL, t>=0, {n=E,test_abs=k_1*(E*S)+k_2*ES});
((l3G,l1G), ALL, t>=0, {n=E,test_abs=k_1*(E*S)+(k_2+k_3)*ES});
((l3G,l2G), #, in=1 & t>=t2, {d=d*(t2-t1)});
((l3G,l2G), #, in=1 & test_abs=0, {d=d*(t2-t1)});
((l3G,l2G), #, in=0 & t>=t2, #);
((l3G,l2G), #, in=0 & test_abs=0, #);
((l4G,l1G), ALL, t>=0, {d=d+tprime*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5),tprime=0,n=E,in=1,test_abs=k_1*(E*S)+k_2*ES});
((l4G,l1G), ALL, t>=0, {d=d+tprime*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5),tprime=0,n=E,in=1,test_abs=k_1*(E*S)+(k_2+k_3)*ES});
((l4G,l2G), #, t>=t2, {d=d+tprime*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
((l4G,l2G), #, test_abs=0, {d=d+tprime*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
% From G to F automaton
((l2G,l1F), #, t>=0, {n=P,test_abs=k_1*(E*S)+k_2*ES,dprime=9997999});
((l2G,l1F), #, t>=0, {n=P,test_abs=k_1*(E*S)+(k_2+k_3)*ES,dprime=9997999});
((l1F,l2F), #, t>=t3 & n>=x3 & n<=x4, {dprime=0});
% F automaton
((l1F,l2F), #, t>=t4 & n<=x3-1, {d=d+dprime});
((l1F,l2F), #, t>=t4 & n>=x4+1, {d=d+dprime});
((l1F,l2F), #, t>=t3 & dprime=0, #);
((l1F,l2F), #, t>=t4 & n<=x3-1, {dprime=min(((n-x3)^2)^0.5,((n-x4)^2)^0.5),d=d+dprime});
((l1F,l2F), #, t>=t4 & n>=x4+1, {dprime=min(((n-x3)^2)^0.5,((n-x4)^2)^0.5),d=d+dprime});
((l1F,l2F), #, test_abs=0 & t<=t4, {d=d+dprime});
((l1F,l3F), #, n>=x3 & n<=x4, {dprime=0});
((l1F,l3F), #, t<=t3 & n<=x3-1, {dprime=min(((t-t3)^2+(n-x4)^2)^0.5,((t-t3)^2+(n-x3)^2)^0.5)});
((l1F,l3F), #, t<=t3 & n>=x4+1, {dprime=min(((t-t3)^2+(n-x4)^2)^0.5,((t-t3)^2+(n-x3)^2)^0.5)});
((l1F,l3F), #, n<=x3-1 & t >= t3 & t<=t4, {dprime=min(dprime,min(((n-x3)^2)^0.5,((n-x4)^2)^0.5))});
((l1F,l3F), #, n>=x4+1 & t >= t3 & t<=t4, {dprime=min(dprime,min( ((n-x3)^2)^0.5, ((n-x4)^2)^0.5 ) ) });
((l1F,l3F), #, n>=x3 & n<=x4, {dprime=0});
((l1F,l3F), #, t>=t3 & n<=x3-1, {dprime=min(dprime,min(((n-x3)^2)^0.5,((n-x4)^2)^0.5))});
((l1F,l3F), #, t>=t3 & n>=x4+1, {dprime=min(dprime,min( ((n-x3)^2)^0.5, ((n-x4)^2)^0.5 ) ) });
((l3F,l1F), ALL, t>=0, {n=P,test_abs=k_1*(E*S)+(k_2+k_3)*ES});
((l3F,l2F), #, t>=t4, {dprime=d+dprime});
((l3F,l2F), #, test_abs=0, {dprime=d+dprime});
((l3F,l1F), ALL, t>=0, {n=P,test_abs=k_1*(E*S)+k_2*ES});
((l3F,l2F), #, t>=t4 ,#);
%((l1G,l2G), #, in=1 & t>=t2, #);
%((l1G,l2G), #, in=0 & t>=t2, {d=d*(t2-t1)});
%((l1G,l2G), #, test_abs=0 & t<=t1, {d=min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)*(t2-t1)});
%((l1G,l2G), #, test_abs=0 & t>=t1 & t<=t2, {d=d+(t2-t)*min(((n-x1)^2)^0.5,((n-x2)^2)^0.5)});
%((l1F,l2F), #, t>=t4 & n<=x3-1, {dprime=min(((n-x3)^2)^0.5,((n-x4)^2)^0.5),d=d+dprime});
%((l1F,l2F), #, t>=t4 & n>=x4+1, {dprime=min(((n-x3)^2)^0.5,((n-x4)^2)^0.5),d=d+dprime});
%((l1F,l2F), #, t>=t3 & n>=x3 & n<=x4, {dprime=0});
%((l1F,l2F), #, test_abs=0 & t<=t4, {d=d+dprime});
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment