From 31f51a2b6dfd7cd30a5388df096ee245868c8c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sat, 19 Jun 2021 11:12:23 -0400 Subject: [PATCH] Don't remove redundancy twice for planar V-rep (#261) --- src/redundancy.jl | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/redundancy.jl b/src/redundancy.jl index c3c67cbe..7e6843f2 100644 --- a/src/redundancy.jl +++ b/src/redundancy.jl @@ -120,19 +120,20 @@ function removevredundancy!(p::Polyhedron; strongly=false, planar=true) vredundancy(p) == NO_REDUNDANCY && return if fulldim(p) == 2 && !strongly && planar setvrep!(p, planar_hull(vrep(p)), NO_REDUNDANCY) - end - solver = _solver_warn(p, true, strongly) - if solver === nothing - detecthlinearity!(p) - detectvlinearity!(p) - nonred = removevredundancy(vrep(p), hrep(p), strongly=strongly) else - detectvlinearity!(p) - nonred = removevredundancy(vrep(p), solver) + solver = _solver_warn(p, true, strongly) + if solver === nothing + detecthlinearity!(p) + detectvlinearity!(p) + nonred = removevredundancy(vrep(p), hrep(p), strongly=strongly) + else + detectvlinearity!(p) + nonred = removevredundancy(vrep(p), solver) + end + # If `strongly` then we only remove strongly redundant elements + # henwe we cannot say that the redundancy is `NO_REDUNDANCY`. + setvrep!(p, nonred, strongly ? LINEARITY_DETECTED : NO_REDUNDANCY) end - # If `strongly` then we only remove strongly redundant elements - # henwe we cannot say that the redundancy is `NO_REDUNDANCY`. - setvrep!(p, nonred, strongly ? LINEARITY_DETECTED : NO_REDUNDANCY) end function _redundant_indices(rep::Representation, model::MOI.ModelLike, T::Type,