Skip to content

Commit 31f51a2

Browse files
authored
Don't remove redundancy twice for planar V-rep (#261)
1 parent 3342c44 commit 31f51a2

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/redundancy.jl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,20 @@ function removevredundancy!(p::Polyhedron; strongly=false, planar=true)
120120
vredundancy(p) == NO_REDUNDANCY && return
121121
if fulldim(p) == 2 && !strongly && planar
122122
setvrep!(p, planar_hull(vrep(p)), NO_REDUNDANCY)
123-
end
124-
solver = _solver_warn(p, true, strongly)
125-
if solver === nothing
126-
detecthlinearity!(p)
127-
detectvlinearity!(p)
128-
nonred = removevredundancy(vrep(p), hrep(p), strongly=strongly)
129123
else
130-
detectvlinearity!(p)
131-
nonred = removevredundancy(vrep(p), solver)
124+
solver = _solver_warn(p, true, strongly)
125+
if solver === nothing
126+
detecthlinearity!(p)
127+
detectvlinearity!(p)
128+
nonred = removevredundancy(vrep(p), hrep(p), strongly=strongly)
129+
else
130+
detectvlinearity!(p)
131+
nonred = removevredundancy(vrep(p), solver)
132+
end
133+
# If `strongly` then we only remove strongly redundant elements
134+
# henwe we cannot say that the redundancy is `NO_REDUNDANCY`.
135+
setvrep!(p, nonred, strongly ? LINEARITY_DETECTED : NO_REDUNDANCY)
132136
end
133-
# If `strongly` then we only remove strongly redundant elements
134-
# henwe we cannot say that the redundancy is `NO_REDUNDANCY`.
135-
setvrep!(p, nonred, strongly ? LINEARITY_DETECTED : NO_REDUNDANCY)
136137
end
137138

138139
function _redundant_indices(rep::Representation, model::MOI.ModelLike, T::Type,

0 commit comments

Comments
 (0)