-
Notifications
You must be signed in to change notification settings - Fork 28
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
removevredundancy! ignores the specified solver #217
Comments
IIUC, you suggest adding a keyword argument |
That or always use |
Which solver is used in your example? It seems to be GLPK, isn't it the default solver? |
Yes, I used Lines 45 to 51 in 485f7df
Polyhedra.jl/src/defaultlibrary.jl Lines 11 to 13 in 485f7df
|
Then I don't get your comment:
In the stacktrace, we see that it uses GLPK which is the solver associated with |
It goes to line 72 which is the |
It is using Line 35 in 485f7df
|
But that one does not have |
Then that means that |
|
julia> using Polyhedra, JuMP, GLPK
julia> v1 = [[1.0, 1.0], [-1.0, 1.0], [1.0, -1.0], [-1.0, -1.0]];
julia> v2 = [[3.0, 3.0], [1.0, 3.0], [1.0, 1.0], [3.0, 1.0]];
julia> solver = Polyhedra.DefaultLibrary{Float64}(
JuMP.optimizer_with_attributes(GLPK.Optimizer, "presolve" => GLPK.ON));
julia> p1 = polyhedron(Polyhedra.vrep(v1), solver);
julia> p2 = polyhedron(Polyhedra.vrep(v2), solver);
julia> p = Polyhedra.intersect(p1, p2);
julia> Polyhedra.default_solver(p1)
MathOptInterface.OptimizerWithAttributes(GLPK.Optimizer,
Pair{MathOptInterface.AbstractOptimizerAttribute,Any}[MathOptInterface.RawParameter("presolve") => 1])
julia> Polyhedra.default_solver(p2)
MathOptInterface.OptimizerWithAttributes(GLPK.Optimizer,
Pair{MathOptInterface.AbstractOptimizerAttribute,Any}[MathOptInterface.RawParameter("presolve") => 1])
julia> Polyhedra.default_solver(p)
MathOptInterface.OptimizerWithAttributes(GLPK.Optimizer,
Pair{MathOptInterface.AbstractOptimizerAttribute,Any}[MathOptInterface.RawParameter("presolve") => 1])
julia> removevredundancy!(p);
*crash from OP* |
Maybe the solver encounters numerical errors even if the presolve is on ? The warning is just a hint that might be useful, it does not mean that the presolve is off. |
Indeed, you are right, so the original discussion is wrong. Still, this example should somehow work as it is not particularly difficult. Geometrically it is the intersection of two squares in a single vertex - clearly a corner case but doable. After replacing line 59 in Polyhedra.jl/src/redundancy.jl Lines 58 to 79 in 485f7df
by The delicate aspect here is that I can call ConclusionMy understanding is that Complete examplejulia> using Polyhedra, JuMP, GLPK
julia> v1 = [[1.0, 1.0], [-1.0, 1.0], [1.0, -1.0], [-1.0, -1.0]];
julia> v2 = [[3.0, 3.0], [1.0, 3.0], [1.0, 1.0], [3.0, 1.0]];
julia> solver = Polyhedra.DefaultLibrary{Float64}(
JuMP.optimizer_with_attributes(GLPK.Optimizer, "presolve" => GLPK.ON));
julia> p1 = polyhedron(Polyhedra.vrep(v1), solver);
julia> p2 = polyhedron(Polyhedra.vrep(v2), solver);
julia> p = Polyhedra.intersect(p1, p2)
Polyhedron DefaultPolyhedron{Float64,Polyhedra.Intersection{Float64,Array{Float64,1},Int64},Polyhedra.Hull{Float64,Array{Float64,1},Int64}}:
8-element iterator of HalfSpace{Float64,Array{Float64,1}}:
HalfSpace([-0.0, 0.3333333333333333], 0.3333333333333333)
HalfSpace([0.18181818181818182, -0.0], 0.18181818181818182)
HalfSpace([-0.0, -0.15], 0.15)
HalfSpace([-0.13953488372093026, -0.0], 0.13953488372093026)
HalfSpace([1.460819769243627e-17, 0.13157894736842105], 0.39473684210526316)
HalfSpace([-0.14251425142514254, 3.560008573561765e-17], -0.1425142514251425)
HalfSpace([0.07809788267962511, -0.0], 0.23429364803887537)
HalfSpace([-1.0367150553151396e-17, -0.0818244458905945], -0.08182444589059451)
julia> detectvlinearity!(p) # works fine
V-representation Polyhedra.Hull{Float64,Array{Float64,1},Int64}:
1-element iterator of Array{Float64,1}:
[1.0, 1.0]
julia> detecthlinearity!(p) # works fine but changes the constraints
H-representation Polyhedra.Intersection{Float64,Array{Float64,1},Int64}:
2-element iterator of HyperPlane{Float64,Array{Float64,1}}:
HyperPlane([-0.0, 0.3333333333333333], 0.3333333333333333)
HyperPlane([0.18181818181818182, -0.0], 0.18181818181818182),
4-element iterator of HalfSpace{Float64,Array{Float64,1}}:
HalfSpace([-0.0, -0.15], 0.15)
HalfSpace([-0.13953488372093026, -0.0], 0.13953488372093026)
HalfSpace([1.460819769243627e-17, 0.13157894736842105], 0.39473684210526316)
HalfSpace([0.07809788267962511, -0.0], 0.23429364803887537)
julia> detecthlinearity!(p) # second call crashes |
I have a simple polyhedron
P
(below). The functionremovevredundancy!
does not use the solver associated withP
(as can be seen in the stack trace) and then crashes. The reason is thatsolver
is initialized tonothing
and the linesolver = default_solver(p)
is only executed under some conditions. There is no other way to pass the solver to this function.Polyhedra.jl/src/redundancy.jl
Lines 58 to 79 in 485f7df
The text was updated successfully, but these errors were encountered: