Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise LazyDiscretePost #459

Merged
merged 2 commits into from
Feb 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions src/ReachSets/DiscretePost/LazyDiscretePost.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct LazyDiscretePost <: DiscretePost
check_aliases_and_add_default_value!(𝑂.dict, 𝑂copy.dict, [:overapproximation], Hyperrectangle)
check_aliases_and_add_default_value!(𝑂.dict, 𝑂copy.dict, [:lazy_R⋂I], false)
check_aliases_and_add_default_value!(𝑂.dict, 𝑂copy.dict, [:lazy_R⋂G], true)
check_aliases_and_add_default_value!(𝑂.dict, 𝑂copy.dict, [:lazy_A⌜R⋂G⌟], true)
check_aliases_and_add_default_value!(𝑂.dict, 𝑂copy.dict, [:lazy_A⌜R⋂G⌟⋂I], true)
return new(𝑂copy)
end
Expand Down Expand Up @@ -145,41 +146,35 @@ function post(𝒫::LazyDiscretePost,
sizehint!(post_jump, count_Rsets)
for reach_set in tube⋂inv[length(tube⋂inv) - count_Rsets + 1 : end]
# check intersection with guard
taken_intersection = false
if combine_constraints
R⋂G = Intersection(reach_set.X.X, invariant_guard)
taken_intersection = true
end
if !taken_intersection
else
R⋂G = Intersection(reach_set.X, guard)
end
if isempty(R⋂G)
continue
end
if !𝒫.options[:lazy_R⋂G]
R⋂G = overapproximate(R⋂G, oa)
end

# apply assignment
A⌜R⋂G⌟ = apply_assignment(𝒫, constrained_map, R⋂G)
if !𝒫.options[:lazy_R⋂G]
if !𝒫.options[:lazy_A⌜R⋂G⌟]
A⌜R⋂G⌟ = overapproximate(A⌜R⋂G⌟, oa)
end

# intersect with target invariant
A⌜R⋂G⌟⋂I = Intersection(target_invariant, A⌜R⋂G⌟)

# check if the final set is empty
if isempty(A⌜R⋂G⌟⋂I)
continue
end

# overapproximate final set once more
if !𝒫.options[:lazy_A⌜R⋂G⌟⋂I]
res = overapproximate(A⌜R⋂G⌟⋂I, oa)
else
res = A⌜R⋂G⌟⋂I
A⌜R⋂G⌟⋂I = overapproximate(A⌜R⋂G⌟⋂I, oa)
end

# store result
push!(post_jump, ReachSet{LazySet{N}, N}(res,
push!(post_jump, ReachSet{LazySet{N}, N}(A⌜R⋂G⌟⋂I,
reach_set.t_start,
reach_set.t_end))
end
Expand Down