Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing method for sethrep! (caused by removevredundancy! with ztol) #298

Closed
schillic opened this issue Apr 2, 2022 · 2 comments · Fixed by #299
Closed

Missing method for sethrep! (caused by removevredundancy! with ztol) #298

schillic opened this issue Apr 2, 2022 · 2 comments · Fixed by #299
Assignees
Labels

Comments

@schillic
Copy link
Contributor

schillic commented Apr 2, 2022

I just tried to fix the original problem behind #270 and found another problem:

(@v1.7) pkg> st Polyhedra
      Status `~/.julia/environments/v1.7/Project.toml`
  [67491407] Polyhedra v0.7.3

julia> using Polyhedra

julia> A = [1.0; -1.0;;];

julia> b = [1.0, 0.0];

julia> Q = polyhedron(hrep(A, b))
Polyhedron Interval{Float64, StaticArrays.SVector{1, Float64}, StaticArrays.Size{(1,)}}:
2-element iterator of HalfSpace{Float64, StaticArrays.SVector{1, Float64}}:
 HalfSpace([1.0], 1.0)
 HalfSpace([-1.0], 0.0):
2-element iterator of StaticArrays.SVector{1, Float64}:
 [1.0]
 [-0.0]

julia> removevredundancy!(Q; ztol=1e-7)
┌ Warning: Cannot detect exact linearity as no solver was provided and the polyhedron is not affine.
│ As fallback, we will only detect halfspaces from opposite hyperplanes but that may not detect all halfspaces.
│ Set a solver if you believe that the polyhedron may have more linearity.
│ To provide a solver to a polyhedron, first select a solver from https://jump.dev/JuMP.jl/stable/installation/#Getting-Solvers-1.
│ If you choose for instance `GLPK`, do `using GLPK; solver = GLPK.Optimizer`.
│ Then provide the solver to the library. For instance, with the default library, do `lib = DefaultLibrary{Float64}(solver)`
│ or if you use an external library, say `QHull`, do `lib = QHull.Library(solver)`.
│ Then when you create the polyhedron, say from a representation `rep`, do `polyhedron(rep, lib)`.
└ @ Polyhedra ~/.julia/packages/Polyhedra/BmL2i/src/linearity.jl:231
ERROR: MethodError: no method matching sethrep!(::Interval{Float64, StaticArrays.SVector{1, Float64}, StaticArrays.Size{(1,)}}, ::Polyhedra.Hull{Float64, StaticArrays.SVector{1, Float64}, StaticArrays.Size{(1,)}})
Closest candidates are:
  sethrep!(::Any, ::Any, ::Any) at ~/.julia/packages/Polyhedra/BmL2i/src/defaultlibrary.jl:115
  sethrep!(::Interval{T, AT}, ::HRep) where {T, AT} at ~/.julia/packages/Polyhedra/BmL2i/src/interval.jl:203
Stacktrace:
 [1] setvrep!(p::Interval{Float64, StaticArrays.SVector{1, Float64}, StaticArrays.Size{(1,)}}, v::Polyhedra.Hull{Float64, StaticArrays.SVector{1, Float64}, StaticArrays.Size{(1,)}}, red::Polyhedra.Redundancy)
   @ Polyhedra ~/.julia/packages/Polyhedra/BmL2i/src/defaultlibrary.jl:116
 [2] detectvlinearity!(p::Interval{Float64, StaticArrays.SVector{1, Float64}, StaticArrays.Size{(1,)}}, solver::Nothing; kws::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:ztol,), Tuple{Float64}}})
   @ Polyhedra ~/.julia/packages/Polyhedra/BmL2i/src/linearity.jl:56
 [3] removevredundancy!(p::Interval{Float64, StaticArrays.SVector{1, Float64}, StaticArrays.Size{(1,)}}; strongly::Bool, planar::Bool, kws::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:ztol,), Tuple{Float64}}})
   @ Polyhedra ~/.julia/packages/Polyhedra/BmL2i/src/redundancy.jl:127
@schillic
Copy link
Contributor Author

schillic commented Apr 4, 2022

Thanks for fixing! Do you mind making a new release?

@blegat
Copy link
Member

blegat commented Apr 4, 2022

Done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants