JuliaPolyhedra / Polyhedra.jl

Polyhedral Computation Interface
Other
172 stars 27 forks source link

Invalid plot / removevrredundancy with default solver #311

Closed mtanneau closed 1 year ago

mtanneau commented 1 year ago

I am seeing invalid plots and extreme points when trying to plot a polyhedron that is defined via a set of points.

using Polyhedra
using Plots

W = [
    [0.4, 0.8],
    [0.3, 0.9],
    [0.9, 0.3],
    [0.8, 0.4],
    [0.9, 0.8],
    [0.8, 0.9],
    [0.4, 0.8],
    [0.8, 0.4],
    [0.8, 0.8],
    [0.3, 0.8],
    [0.8, 0.3],
    [0.8, 0.8],
]
P = polyhedron(vrep(W))
@show points(P)
# output:
# points(P) = [[0.4, 0.8], [0.3, 0.9], [0.9, 0.3], [0.8, 0.4], [0.9, 0.8], [0.8, 0.9], [0.4, 0.8], [0.8, 0.4], [0.8, 0.8], [0.3, 0.8], [0.8, 0.3], [0.8, 0.8]]

plt = plot(P)
for v in W
    scatter!(plt, [v[1]], [v[2]], color=:red, label=nothing)
end
@show points(P)
# output: points(P) = [[0.9, 0.3], [0.8, 0.3], [0.3, 0.9], [0.8, 0.9]]

display(plt)

produces the following plot

image

FYI, if I define P as P = polyhedron(removevredundancy(vrep(W), HiGHS.Optimizer)), then I get the expected plot.

blegat commented 1 year ago

Thanks for reporting this, I'll take a look tomorrow