JuliaPolyhedra / Polyhedra.jl

Polyhedral Computation Interface
Other
174 stars 27 forks source link

polyhedron from intersection of hyperplanes #136

Open blegat opened 6 years ago

blegat commented 6 years ago
using Polyhedra
h = HyperPlane([1, 0], 1) ∩ HyperPlane([-1, 0], 1)
p = polyhedron(h);

throws

MethodError: no method matching Polyhedra.Intersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}(::Int64, ::Polyhedra.SingleRepIterator{Rational{BigInt},HyperPlane{Rational{BigInt},Array{Rational{BigInt},1}},HyperPlanesIntersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}})
Closest candidates are:
  Polyhedra.Intersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}(::Union{Int64, Size}, ::Union{AbstractArray{#s18,1}, AbstractRepIterator{#s17,#s18} where #s17, AllRepIterator{#s181,#s18,LinElemT,LRT,RT} where RT<:AbstractRepIterator{#s181,#s18} where LRT<:AbstractRepIterator{#s181,LinElemT} where LinElemT where #s181} where #s18<:(HyperPlane{T,AT} where AT<:AbstractArray{T,1}), !Matched::Union{AbstractArray{#s18,1}, AbstractRepIterator{#s17,#s18} where #s17, AllRepIterator{#s181,#s18,LinElemT,LRT,RT} where RT<:AbstractRepIterator{#s181,#s18} where LRT<:AbstractRepIterator{#s181,LinElemT} where LinElemT where #s181} where #s18<:(HalfSpace{T,AT} where AT<:AbstractArray{T,1})) where {T, AT, D} at /home/blegat/.julia/dev/Polyhedra/src/vecrep.jl:62

Stacktrace:
 [1] constructpolyhedron(::Type{Polyhedra.Intersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}}, ::Int64, ::Tuple{HyperPlanesIntersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}}, ::Polyhedra.SingleRepIterator{Rational{BigInt},HyperPlane{Rational{BigInt},Array{Rational{BigInt},1}},HyperPlanesIntersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}}) at /home/blegat/.julia/dev/Polyhedra/src/default.jl:121
 [2] hconvert(::Type{Polyhedra.Intersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}}, ::HyperPlanesIntersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}) at /home/blegat/.julia/dev/Polyhedra/src/iterators.jl:360
 [3] convert(::Type{Polyhedra.Intersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}}, ::HyperPlanesIntersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}) at /home/blegat/.julia/dev/Polyhedra/src/representation.jl:60
 [4] DefaultPolyhedron{Rational{BigInt},Polyhedra.Intersection{Rational{BigInt},Array{Rational{BigInt},1},Int64},Polyhedra.Hull{Rational{BigInt},Array{Rational{BigInt},1},Int64}}(::HyperPlanesIntersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}, ::Nothing) at /home/blegat/.julia/dev/Polyhedra/src/defaultlibrary.jl:33
 [5] DefaultPolyhedron{Rational{BigInt},HRepT,VRepT} where VRepT<:VRepresentation{Rational{BigInt}} where HRepT<:HRepresentation{Rational{BigInt}}(::HyperPlanesIntersection{Rational{BigInt},Array{Rational{BigInt},1},Int64}, ::Nothing) at /home/blegat/.julia/dev/Polyhedra/src/defaultlibrary.jl:61
 [6] DefaultPolyhedron{Rational{BigInt},HRepT,VRepT} where VRepT<:VRepresentation{Rational{BigInt}} where HRepT<:HRepresentation{Rational{BigInt}}(::HyperPlanesIntersection{Int64,Array{Int64,1},Int64}, ::Nothing) at /home/blegat/.julia/dev/Polyhedra/src/defaultlibrary.jl:57
 [7] polyhedron(::HyperPlanesIntersection{Int64,Array{Int64,1},Int64}, ::DefaultLibrary{Int64}) at /home/blegat/.julia/dev/Polyhedra/src/defaultlibrary.jl:70
 [8] polyhedron(::HyperPlanesIntersection{Int64,Array{Int64,1},Int64}) at /home/blegat/.julia/dev/Polyhedra/src/polyhedron.jl:11
 [9] top-level scope at In[6]:3
arbenede commented 5 years ago

Try

p = polyhedron(h, CDDLib.Library())

blegat commented 5 years ago

Indeed, it works with CDD, I am leaving the issue opened as it should be fixed with DefaultLibrary.