-
Notifications
You must be signed in to change notification settings - Fork 16
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
sampling #614
Comments
Flowpipes live in LazySets.sample(fp::ReachabilityAnalysis.ReachSolution, m) = vcat([sample(set(R), m) for R in array(flowpipe(fp))]...) Example: using ReachabilityAnalysis, Polyhedra, Plots
# sample model (here: Motor)
using SparseArrays
function motor_homog()
I = [1, 2, 2, 3, 3, 3, 3, 4, 5, 6, 6, 7, 7, 7, 7, 8]
J = [2, 3, 2, 1, 2, 3, 4, 1, 6, 7, 6, 5, 6, 7, 8, 5]
V = [1, 8487.2, -1.0865, -2592.1, -21.119, -698.91, -141399.0, 1.0, 1.0,
8487.2, -1.0865, -2592.1, -21.119, -698.91, -141399.0, 1.0]
A = sparse(I, J, V)
X0 = Hyperrectangle(low=[0.002, 0.0, 0.0, 0.0, 0.001, 0.0, 0.0, 0.0],
high=[0.0025, 0.0, 0.0, 0.0, 0.0015, 0.0, 0.0, 0.0])
return @ivp(x' = Ax, x(0) ∈ X0)
end
P = motor_homog();
# compute the flowpipe
F = solve(P, T=0.02, δ = 1e-3);
# sample 30 elements from each reach set
julia> V = sample(F, 30);
# plot the reach sets and the samples (here I plot dimensions 1 and 2)
julia> plot(F, vars=(1, 2))
julia> plot!([Singleton(p[1:2]) for p in V]) |
@schillic, thank you, this helped. I did not understand all the details of the example. This is what I got: function sample_flowpipe(fp, m)
return [LazySets.sample(set(R), m) for R in fp]
end
sample_flowpipe(𝒫ℛ, 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How does the sampling work for a LazySet. I used Projections and intersections to process the sets. Is there a method for flowpipes
The text was updated successfully, but these errors were encountered: