Skip to content

Commit

Permalink
Merge pull request #3623 from JuliaReach/schillic/rrc
Browse files Browse the repository at this point in the history
Let `remove_redundant_constraints` return an empty list if infeasible
  • Loading branch information
schillic authored Nov 19, 2024
2 parents 3f4164d + 5709add commit feb9db4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Interfaces/AbstractPolyhedron_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ Remove the redundant constraints of a given list of linear constraints.
linear program
### Output
The list of constraints with the redundant ones removed, or an empty set if the
The list of constraints with the redundant ones removed, or an empty list if the
constraints are infeasible.
### Notes
Expand All @@ -253,8 +253,7 @@ function remove_redundant_constraints(constraints::AbstractVector{S};
if remove_redundant_constraints!(constraints_copy; backend=backend)
return constraints_copy
else # the constraints are infeasible
N = eltype(first(constraints))
return EmptySet{N}(dim(constraints[1]))
return Vector{eltype(constraints)}(undef, 0)
end
end

Expand Down
4 changes: 4 additions & 0 deletions src/Sets/HPolyhedron/ishyperplanar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ function ishyperplanar(P::HPolyhedron)
if m > 2
# try to remove redundant constraints
clist = remove_redundant_constraints(clist)
if isempty(clist)
# constraints are contradictory
return false
end
m = length(clist)
end
if m != 2
Expand Down

0 comments on commit feb9db4

Please sign in to comment.