-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
discussion 🗣️Requires human inputRequires human inputrefactoring 🔧Internal code changes, typically no impact on APIInternal code changes, typically no impact on APIsimplification 👶Simplifies codeSimplifies code
Description
I suggest to let overapproximate
only dispatch on the second argument (the target type). In each method we can call helper methods that then dispatch on the first argument. This unifies the interface and avoids many disambiguation methods.
function overapproximate(X::LazySet, ::Type{<:Interval})
return overapproximate_interval(X)
end
function overapproximate(X::LazySet{N}, ::Type{<:HPolygon}) where {N<:Real}
return overapproximate_hpolygon(X, N(1e-3))
end
function overapproximate(X::LazySet{N}, ::Type{<:HPolygon}, ε::Real) where {N<:Real}
return overapproximate_hpolygon(X, ε)
end
...
function overapproximate_interval(X::LazySet)
... # default implementation with two support-function queries
end
function overapproximate_interval(X::S)
... # specific implementation for set type S
end
...
function overapproximate_hpolygon(X::LazySet{N}, ε::N) where {N<:Real}
... # epsilon-close approximation
end
...
Originally posted by @schillic in #1353 (comment)
Metadata
Metadata
Assignees
Labels
discussion 🗣️Requires human inputRequires human inputrefactoring 🔧Internal code changes, typically no impact on APIInternal code changes, typically no impact on APIsimplification 👶Simplifies codeSimplifies code