Skip to content

Commit

Permalink
Don't remove redundancy twice for planar V-rep (JuliaPolyhedra#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Jun 19, 2021
1 parent 3342c44 commit 31f51a2
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/redundancy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 31f51a2

Please sign in to comment.