Skip to content

Commit

Permalink
better error message for polytopes without constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Nov 29, 2019
1 parent 39c2831 commit 0a29602
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Interfaces/AbstractPolytope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,14 @@ constraint of `P`.
"""
function isuniversal(P::AbstractPolytope{N}, witness::Bool=false
)::Union{Bool, Tuple{Bool, Vector{N}}} where {N<:Real}
return witness ? isuniversal(constraints_list(P)[1], true) : false
if witness
constraints = constraints_list(P)
@assert !isempty(constraints) "polytopes without constraints are not " *
"allowed"
return isuniversal(constraints[1], true)
else
return false
end
end

# given a polytope P, apply the linear map P to each vertex of P
Expand Down

0 comments on commit 0a29602

Please sign in to comment.