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

Membership test of ExponentialMap is incorrect #484

Closed
schillic opened this issue Aug 6, 2018 · 6 comments · Fixed by #485
Closed

Membership test of ExponentialMap is incorrect #484

schillic opened this issue Aug 6, 2018 · 6 comments · Fixed by #485
Assignees
Labels
bug 🐛 Something isn't working

Comments

@schillic
Copy link
Member

schillic commented Aug 6, 2018

Example:

julia> n = 3;
julia> x = ones(n)
3-element Array{Float64,1}:
 1.0
 1.0
 1.0
julia> b = BallInf(ones(n), 0.1);

julia> sme = SparseMatrixExp(speye(n))
3×3 LazySets.SparseMatrixExp{Float64}:
 2.71828  0.0      0.0    
 0.0      2.71828  0.0    
 0.0      0.0      2.71828
julia> ex = sme * x
3-element Array{Float64,1}:
 2.71828
 2.71828
 2.71828
julia> em = sme * b;

julia> x  b
true

Now since x ∈ b, we should expect that sme * x ∈ sme * b, or in short ex ∈ em.
However:

julia> sme * x  sme * b
false
julia> ex  em
false
@schillic schillic added the bug 🐛 Something isn't working label Aug 6, 2018
@mforets
Copy link
Member

mforets commented Aug 6, 2018

True. The current exp.(A) is an element-wise exponentiation, while we really want expm there, or since we have a SparseMatrixExp, it is more appropriate to do

return (expmv(-one(N), em.spmexp.M, x), em.X) 

@schillic
Copy link
Member Author

schillic commented Aug 6, 2018

The following doctest now does not work anymore.

julia> em = ExponentialMap(SparseMatrixExp(SparseMatrixCSC([2.0 0.0; 0.0 1.0])),
                           BallInf([1., 1.], 1.));

julia> ([5.0, 1.0], em)
false

Is the expected outcome correct?

@mforets
Copy link
Member

mforets commented Aug 6, 2018

nope. one can observe by plotting both em and Singleton(x) where x=[5, 1.] that x is in em.

@schillic
Copy link
Member Author

schillic commented Aug 6, 2018

How did you plot em? I get an error.

julia> LazySets.Approximations.box_approximation(em)
ERROR: AssertionError: radius must not be negative

Sounds like yet another bug 😞

@mforets
Copy link
Member

mforets commented Aug 6, 2018

julia> using LazySets, Plots

julia> em = ExponentialMap(SparseMatrixExp(SparseMatrixCSC([2.0 0.0; 0.0 1.0])),
                                  BallInf([1., 1.], 1.));

julia> s = Singleton([5.0, 1.0])
LazySets.Singleton{Float64}([5.0, 1.0])

julia> plot(em, alpha=0.5); plot!(s, alpha=0.4)

worked for me. also

julia> LazySets.Approximations.box_approximation(em)
LazySets.Hyperrectangle{Float64}([7.38906, 2.71828], [7.38906, 2.71828])

@schillic
Copy link
Member Author

schillic commented Aug 6, 2018

What the... it is nondeterministic! LazySets.Approximations.box_approximation(em) sometimes works and sometimes does not.
I created #486.

schillic added a commit that referenced this issue Aug 6, 2018
#484 - Fix membership test of ExponentialMap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants