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

#730 - Add constraints list of Zonotope #732

Merged
merged 1 commit into from
Oct 7, 2018
Merged
Changes from all commits
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
26 changes: 25 additions & 1 deletion src/Zonotope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export Zonotope,
linear_map,
scale,
ngens,
reduce_order
reduce_order,
constraints_list

"""
Zonotope{N<:Real} <: AbstractCentrallySymmetricPolytope{N}
Expand Down Expand Up @@ -389,3 +390,26 @@ function reduce_order(Z::Zonotope{N}, r)::Zonotope{N} where {N<:Real}
end
return Zonotope(c, Gred)
end

"""
constraints_list(P::Zonotope{N})::Vector{LinearConstraint{N}} where {N<:Real}

Return the list of constraints defining a zonotope.

### Input

- `Z` -- zonotope

### Output

The list of constraints of the polyhedron.

### Algorithm

This is a naive implementation that calculates all vertices and transforms
to the H-representation of the zonotope. The transformation to the dual
representation requires the concrete polyhedra package `Polyhedra`.
"""
function constraints_list(Z::Zonotope{N})::Vector{LinearConstraint{N}} where {N<:Real}
return constraints_list(convert(HPolytope, Z))
end