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

#264 - Merge Properties module into ReachSets #265

Merged
merged 1 commit into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
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
63 changes: 0 additions & 63 deletions src/Properties/Properties.jl

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ OUTPUT:
The first time index where the property is violated, and 0 if the property is satisfied.
=#

# helper functions
@inline proj(bi::UnitRange{Int}, n::Int) =
sparse(1:length(bi), bi, ones(length(bi)), length(bi), n)
@inline proj(bi::Int, n::Int) = sparse([1], [bi], ones(1), 1, n)
@inline row(ϕpowerk::AbstractMatrix, bi::UnitRange{Int}) = ϕpowerk[bi, :]
@inline row(ϕpowerk::AbstractMatrix, bi::Int) = ϕpowerk[[bi], :]
@inline row(ϕpowerk::SparseMatrixExp, bi::UnitRange{Int}) = get_rows(ϕpowerk, bi)
@inline row(ϕpowerk::SparseMatrixExp, bi::Int) = Matrix(get_row(ϕpowerk, bi))
@inline block(ϕpowerk_πbi::AbstractMatrix, bj::UnitRange{Int}) = ϕpowerk_πbi[:, bj]
@inline block(ϕpowerk_πbi::AbstractMatrix, bj::Int) = ϕpowerk_πbi[:, [bj]]

# sparse
function check_blocks(ϕ::SparseMatrixCSC{NUM, Int},
Xhat0::Vector{<:LazySet{NUM}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Interface to property checking algorithms for an LTI system.
### Notes

A dictionary with available algorithms is available via
`Properties.available_algorithms`.
`available_algorithms_check`.
"""
function check_property(S::IVP{<:AbstractDiscreteSystem},
options::Options
Expand Down Expand Up @@ -164,7 +164,7 @@ function check_property(S::IVP{<:AbstractDiscreteSystem},
# call the adequate function with the given arguments list
info("- Computing successors")
tic()
answer = available_algorithms[algorithm_backend]["func"](args...)
answer = available_algorithms_check[algorithm_backend]["func"](args...)
tocc()

# return the result
Expand Down
File renamed without changes.
47 changes: 47 additions & 0 deletions src/ReachSets/ReachSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,53 @@ include("inout_map_reach.jl")

export inout_map_reach

# ==============================
# Property struct and evaluation
# ==============================
include("Properties/Property.jl")
export Property,
inout_map_property

include("Properties/LinearConstraintProperty.jl")
export LinearConstraintProperty,
Clause

include("Properties/IntersectionProperty.jl")
export IntersectionProperty

include("Properties/SubsetProperty.jl")
export SubsetProperty

# ==========================
# Property checking results
# ==========================
include("Properties/CheckSolution.jl")

export CheckSolution

# =============================
# Property checking algorithms
# =============================

# dictionary of registered algorithms
available_algorithms_check = Dict{String, Dict{String, Any}}()

# "explicit" backends
include("Properties/check_blocks.jl")
push!(available_algorithms_check, "explicit_blocks"=>Dict("func"=>check_blocks,
"is_explicit"=>true))

include("Properties/check_property.jl")

export available_algorithms_check,
check_property

# ====================================================
# Algorithms to find a threshold for property checking
# ====================================================
include("Properties/tune.jl")
export tune_δ

# =====================
# Reachability results
# =====================
Expand Down
4 changes: 1 addition & 3 deletions src/Reachability.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ include("logging.jl")
include("Utils/Utils.jl")
include("options.jl")
include("ReachSets/ReachSets.jl")
include("Properties/Properties.jl")
include("Transformations/Transformations.jl")

@reexport using Reachability.Utils

using Reachability.ReachSets,
Reachability.Properties,
Reachability.Transformations

export Properties, LinearConstraintProperty, Clause,
export LinearConstraintProperty, Clause,
IntersectionProperty,
SubsetProperty,
Transformations
Expand Down
2 changes: 1 addition & 1 deletion test/Properties/unit_tune.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ algorithm(N, δ) = solve(S, :mode => "check", :partition=>[1:2, 3:4],
:T => time_horizon,
:property=>LinearConstraintProperty([24., 0., 1, 0], 375.)).satisfied

Properties.tune_δ(algorithm, time_horizon, precision, initial_δ)
Reachability.tune_δ(algorithm, time_horizon, precision, initial_δ)