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

#2019 - Special case concrete Minkowski sum for intervals #2026

Merged
merged 4 commits into from
Feb 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions src/ConcreteOperations/minkowski_sum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,7 @@ function minkowski_sum(Z1::AbstractZonotope{N}, Z2::AbstractZonotope{N};
Gnew = hcat(genmat(Z1), genmat(Z2))
return Zonotope(cnew, Gnew, remove_zero_generators=remove_zero_generators)
end

function minkowski_sum(x::Interval, y::Interval)
return Interval(x.dat + y.dat)
end
mforets marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions test/unit_Interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ for N in Ns
v = vertices_list(m)
@test N[1.5] in v && N[-2] in v

# the concrete Minkowski sum of intervals returns an interval
sum_x_y = minkowski_sum(x, y)
@test sum_x_y isa Interval
@test min(sum_x_y) == N[-2] && max(sum_x_y) == N[1.5]
mforets marked this conversation as resolved.
Show resolved Hide resolved
mforets marked this conversation as resolved.
Show resolved Hide resolved

# subtraction
d = x - y
@test dim(d) == 1
Expand Down