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

Let remove_redundant_constraints return an empty list if infeasible #3623

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
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
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
Loading