JuliaPolyhedra / Polyhedra.jl

Polyhedral Computation Interface
Other
174 stars 27 forks source link

First time evaluation of polyhedron is still extremely slow #237

Closed plut closed 2 years ago

plut commented 3 years ago

Using version 0.6.10 here, issue #110 still seems to be present. The symptoms are the exact same:

# the following lines are instantaneous:
using Polyhedra
A = [1. 1; 1 -1; -1 0]
b = [1, 0, 0]
rep = hrep(A, b)
plib = default_library(2, Float64) # <- slightly modified from #110
p=polyhedron(rep, plib);
# this line takes more than 5 minutes to run:
p

In #110 it is claimed that #122 fixed this. However, the problem might have re-appeared since then. As an alternative, using GLPK does not improve this much:

using GLPK
plib = Polyhedra.DefaultLibrary{Int64}(GLPK.Optimizer)
p=polyhedron(rep, plib);
p

produces the same results.

edit I also tried using p = polyhedron(rep, CDDLib.Library()), with the same result: the first call takes several minutes.

mforets commented 3 years ago

Hi, I confirm that first time (printing) is still slow; which was reported here https://github.com/JuliaPolyhedra/Polyhedra.jl/issues/216. Idk if this was reported upstream (I'm not familiar with rr, but perhaps it's worth a try.. ? Does the problem also happen with Julia v1.6 ?)

blegat commented 3 years ago

Indeed, this came back. I agree that reporting with rr could help Julia developers fix the compiler issue. But we should first check whether this is improved with Julia v1.6.

mforets commented 3 years ago

In Julia v1.6.0-beta1 the behavior is the same so I opened an issue (https://github.com/JuliaLang/julia/issues/39349).

mforets commented 3 years ago

In the meantime, starting Julia with $ julia --compile=min is a workaround, printing is immediate with that option (idk what other implications it has).

blegat commented 2 years ago

See https://github.com/JuliaPolyhedra/Polyhedra.jl/issues/216#issuecomment-1066128472