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

#720 - add upper bounds #721

Merged
merged 14 commits into from Oct 6, 2018
Merged

#720 - add upper bounds #721

merged 14 commits into from Oct 6, 2018

Conversation

mforets
Copy link
Member

@mforets mforets commented Oct 6, 2018

Closes #720.

@schillic
Copy link
Member

schillic commented Oct 6, 2018

This is not what you wrote in #720.

cap::Intersection{N, <:LazySet, S};
kwargs...) where {N<:AbstractFloat, S<:AbstractPolytope{N}}

Return an upper bound ofd the intersection between a compact set and a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ofd


- `d` -- direction
- `cap` -- intersection of a compact set and a polytope
- `kwargs` -- additional arguents that are passed to the support function algorithm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arguents

@mforets
Copy link
Member Author

mforets commented Oct 6, 2018

This is not what you wrote in #720.

Hmm what do you think about adding it as:

function ρ_upper_bound(d::AbstractVector{N}, cap::Intersection{N}) where {N<:AbstractFloat}
    return min(ρ_upper_bound(d, cap.X), ρ_upper_bound(d, cap.Y))
end

@schillic
Copy link
Member

schillic commented Oct 6, 2018

Why AbstractFloat and not Real? This holds for the whole PR.

@mforets
Copy link
Member Author

mforets commented Oct 6, 2018

i don't know, let's change it to real.

the problem is that i get (here X is a HPolygon):

julia> ρ_upper_bound(rand(2), X  X)
ERROR: MethodError: LazySets.Approximations.ρ_upper_bound(::Array{Float64,1}, ::LazySets.Intersection{Float64,LazySets.HPolygon{Float64},LazySets.HPolygon{Float64}}) is ambiguous. Candid
ates:
  ρ_upper_bound(d::AbstractArray{N,1}, cap::LazySets.Intersection{N,S1,S2} where S2<:LazySets.LazySet{N} where S1<:LazySets.LazySet{N}) where N<:AbstractFloat in LazySets.Approximations
at /Users/forets/.julia/v0.6/LazySets/src/Approximations/upper_bounds.jl:73
  ρ_upper_bound(d::AbstractArray{N,1}, cap::LazySets.Intersection{N,#s105,S} where #s105<:LazySets.LazySet) where {N<:AbstractFloat, S<:LazySets.AbstractPolytope{N<:AbstractFloat}} in La

zySets.Approximations at /Users/forets/.julia/v0.6/LazySets/src/Approximations/upper_bounds.jl:67
Possible fix, define
  ρ_upper_bound(::AbstractArray{N<:AbstractFloat,1}, ::LazySets.Intersection{N<:AbstractFloat,#s105,S<:LazySets.AbstractPolytope{N<:AbstractFloat}} where #s105<:LazySets.LazySet{N<:Abstr
actFloat})

@mforets
Copy link
Member Author

mforets commented Oct 6, 2018

it is fixed defining

function ρ_upper_bound(d::AbstractVector{N},
                       cap::Intersection{N, <:LazySet, S}) where {N<:Real, S<:AbstractPolytope{N}}
    return min(ρ_upper_bound(d, cap.X), ρ_upper_bound(d, cap.Y))
end

@schillic
Copy link
Member

schillic commented Oct 6, 2018

You have to add ρ_upper_bound(d::AbstractVector{N}, cap::Intersection{N, AbstractPolytope{N}, AbstractPolytope{N}}; kwargs...) where {N<:AbstractFloat}
And actually you should also add the symmetric version where the first element of the Intersection is the AbstractPolytope.

@mforets mforets merged commit f36475c into master Oct 6, 2018
@schillic schillic deleted the mforets/720 branch October 6, 2018 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants