From fa3bcd31df6e646a19e4e95c23e4b6173d6bade1 Mon Sep 17 00:00:00 2001 From: schillic Date: Fri, 26 Jul 2024 16:22:55 +0200 Subject: [PATCH 1/2] let 'remove_redundant_constraints' return empty list --- src/Interfaces/AbstractPolyhedron_functions.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Interfaces/AbstractPolyhedron_functions.jl b/src/Interfaces/AbstractPolyhedron_functions.jl index ec04e9c785..e2a99eabc1 100644 --- a/src/Interfaces/AbstractPolyhedron_functions.jl +++ b/src/Interfaces/AbstractPolyhedron_functions.jl @@ -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 @@ -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 From 5709add72b2bb6eb7d4766fed1cee465d538acd8 Mon Sep 17 00:00:00 2001 From: schillic Date: Fri, 26 Jul 2024 16:23:14 +0200 Subject: [PATCH 2/2] test for return status of 'remove_redundant_constraints' --- src/Sets/HPolyhedron/ishyperplanar.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Sets/HPolyhedron/ishyperplanar.jl b/src/Sets/HPolyhedron/ishyperplanar.jl index 4a0d4ffe0c..ea45af8825 100644 --- a/src/Sets/HPolyhedron/ishyperplanar.jl +++ b/src/Sets/HPolyhedron/ishyperplanar.jl @@ -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