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

Bump Polyhedra and JuMP #1668

Merged
merged 4 commits into from
Sep 17, 2019
Merged

Bump Polyhedra and JuMP #1668

merged 4 commits into from
Sep 17, 2019

Conversation

mforets
Copy link
Member

@mforets mforets commented Sep 2, 2019

Closes #1666.

@schillic
Copy link
Member

schillic commented Sep 2, 2019

This needs to be resolved together with #1666 because the JuMP version is exclusive at the moment.

@schillic
Copy link
Member

schillic commented Sep 3, 2019

MethodError: Cannot convert an object of type Symbol to an object of type GLPK.MethodEnum

It seems we (= you 😉) need to do some changes in the interface.

@schillic schillic changed the title Bump Polyhedra and JuMP WIP Bump Polyhedra and JuMP Sep 3, 2019
@mforets
Copy link
Member Author

mforets commented Sep 4, 2019

The problem can be traced to:

julia> convex_hull([[1//1, 3//1, 5//1], [0//1, 3//1, 5//1]])

ERROR: MethodError: Cannot `convert` an object of type Symbol to an object of type GLPK.MethodEnum
Closest candidates are:
  convert(::Type{T}, ::JuMP.GenericAffExpr{T,VarType} where VarType) where T at C:\Users\marce\.julia\packages\JuMP\iGamg\src\aff_expr.jl:298
  convert(::Type{T}, ::JuMP.GenericQuadExpr{T,VarType} where VarType) where T at C:\Users\marce\.julia\packages\JuMP\iGamg\src\quad_expr.jl:323

and then in the remove_redundant_vertices function (https://github.com/JuliaReach/LazySets.jl/blob/master/src/Sets/VPolytope.jl#L422)

julia> vQ
V-representation Polyhedra.Hull{Rational{Int64},Array{Rational{Int64},1},Int64}:
2-element iterator of Array{Rational{Int64},1}:
 Rational{Int64}[1//1, 3//1, 5//1]
 Rational{Int64}[0//1, 3//1, 5//1]

julia> solver
JuMP.OptimizerFactory(GLPK.Optimizer, (), Base.Iterators.Pairs(:method=>:Exact))

julia> Polyhedra.removevredundancy(vQ, solver)
ERROR: MethodError: Cannot `convert` an object of type Symbol to an object of type GLPK.MethodEnum
Closest candidates are:
  convert(::Type{T}, ::JuMP.GenericAffExpr{T,VarType} where VarType) where T at C:\Users\marce\.julia\packages\JuMP\iGamg\src\aff_expr.jl:298
  convert(::Type{T}, ::JuMP.GenericQuadExpr{T,VarType} where VarType) where T at C:\Users\marce\.julia\packages\JuMP\iGamg\src\quad_expr.jl:323
  convert(::Type{T}, ::T) where T at essentials.jl:154

I dont know yet for sure but it seems like this should be reported in Polyhedra.

cc: @blegat

@blegat
Copy link
Member

blegat commented Sep 5, 2019

Replace :Exact by GLPK.EXACT.

@mforets
Copy link
Member Author

mforets commented Sep 5, 2019

thanks for the feedback!

i get another error now,

julia>  convex_hull([[1//1, 3//1, 5//1], [0//1, 3//1, 5//1]])
ERROR: GLPK.GLPKError("no bf solution found (use GLPK.factorize)")
Stacktrace:
 [1] _bf_exists at C:\Users\marce\.julia\packages\GLPK\nTwL7\src\GLPK_checks.jl:271 [inlined]
 [2] macro expansion at C:\Users\marce\.julia\packages\GLPK\nTwL7\src\GLPK_checks.jl:53 [inlined]
 [3] get_bhead(::GLPK.Prob, ::Int64) at C:\Users\marce\.julia\packages\GLPK\nTwL7\src\GLPK.jl:1619
 [4] get_infeasibility_ray(::GLPK.Optimizer, ::Array{Float64,1}) at C:\Users\marce\.julia\packages\GLPK\nTwL7\src\infeasibility_certificates.jl:49
 [5] optimize!(::GLPK.Optimizer) at C:\Users\marce\.julia\packages\GLPK\nTwL7\src\MOI_wrapper.jl:1328
 [6] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{GLPK.Optimizer}) at C:\Users\marce\.julia\packages\MathOptInterface\016Ol\src\Bridges\bridge_optimizer.jl:139
 [7] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}) at C:\Users\marce\.julia\packages\MathOptInterface\016Ol\src\Utilities\cachingoptimizer.jl:178
 [8] #optimize!#78(::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::JuMP.Model, ::Nothing) at C:\Users\marce\.julia\packages\JuMP\iGamg\src\optimizer_interface.jl:141
 [9] #optimize! at .\none:0 [inlined] (repeats 2 times)
 [10] #parameter_optimizehook#2(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::JuMP.Model) at C:\Users\marce\.julia\packages\ParameterJuMP\NjgYh\src\ParameterJuMP.jl:318
 [11] parameter_optimizehook(::JuMP.Model) at C:\Users\marce\.julia\packages\ParameterJuMP\NjgYh\src\ParameterJuMP.jl:311
 [12] #optimize!#78(::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::JuMP.Model, ::Nothing) at C:\Users\marce\.julia\packages\JuMP\iGamg\src\optimizer_interface.jl:131
 [13] optimize! at C:\Users\marce\.julia\packages\JuMP\iGamg\src\optimizer_interface.jl:111 [inlined] (repeats 2 times)
 [14] is_feasible(::JuMP.Model, ::String) at C:\Users\marce\.julia\packages\Polyhedra\2GDrj\src\redundancy.jl:79
 [15] nonredundant_elements(::Polyhedra.Hull{Rational{Int64},Array{Rational{Int64},1},Int64}, ::JuMP.Model, ::Array{JuMP.GenericAffExpr{Float64,JuMP.VariableRef},1}, ::Array{ParameterJuMP.ParameterRef,1}, ::Array{Array{Rational{Int64},1},1}, ::Array{Polyhedra.Index{Rational{Int64},Array{Rational{Int64},1}},1}, ::JuMP.Containers.DenseAxisArray{JuMP.VariableRef,1,Tuple{Array{Polyhedra.Index{Rational{Int64},Array{Rational{Int64},1}},1}},Tuple{Dict{Polyhedra.Index{Rational{Int64},Array{Rational{Int64},1}},Int64}}}) at C:\Users\marce\.julia\packages\Polyhedra\2GDrj\src\redundancy.jl:140
 [16] nonredundant_points(::Polyhedra.Hull{Rational{Int64},Array{Rational{Int64},1},Int64}, ::JuMP.Model, ::Array{JuMP.GenericAffExpr{Float64,JuMP.VariableRef},1}, ::Array{ParameterJuMP.ParameterRef,1}) at C:\Users\marce\.julia\packages\Polyhedra\2GDrj\src\redundancy.jl:196
 [17] removevredundancy(::Polyhedra.Hull{Rational{Int64},Array{Rational{Int64},1},Int64}, ::JuMP.OptimizerFactory) at C:\Users\marce\.julia\packages\Polyhedra\2GDrj\src\redundancy.jl:217
 [18] #remove_redundant_vertices#133(::Nothing, ::Nothing, ::Function, ::VPolytope{Rational{Int64}}) at C:\Users\marce\.julia\dev\LazySets\src\Sets\VPolytope.jl:435
 [19] #remove_redundant_vertices at .\none:0 [inlined]
 [20] #_convex_hull_nd!#223(::Nothing, ::Nothing, ::Function, ::Array{Array{Rational{Int64},1},1}) at C:\Users\marce\.julia\dev\LazySets\src\ConcreteOperations\convex_hull.jl:374
 [21] #_convex_hull_nd! at .\array.jl:0 [inlined]
 [22] #convex_hull!#222(::Nothing, ::Nothing, ::Nothing, ::Function, ::Array{Array{Rational{Int64},1},1}) at C:\Users\marce\.julia\dev\LazySets\src\ConcreteOperations\convex_hull.jl:193
 [23] #convex_hull#221 at .\none:0 [inlined]
 [24] convex_hull(::Array{Array{Rational{Int64},1},1}) at C:\Users\marce\.julia\dev\LazySets\src\ConcreteOperations\convex_hull.jl:148
 [25] top-level scope at none:0

@schillic
Copy link
Member

i get another error now

Here is a minimal example without LazySets:

julia> using Polyhedra, JuMP, GLPK

julia> ch = convexhull([1//1, 3//1], [0//1, 3//1])
V-representation Polyhedra.PointsHull{Rational{Int64},Array{Rational{Int64},1},Int64}:
2-element iterator of Array{Rational{Int64},1}:
 Rational{Int64}[1//1, 3//1]
 Rational{Int64}[0//1, 3//1]

julia> solver = JuMP.with_optimizer(GLPK.Optimizer, method=GLPK.EXACT)
OptimizerFactory(GLPK.Optimizer, (), Base.Iterators.Pairs(:method=>EXACT))

julia> Polyhedra.removevredundancy(ch, solver)
ERROR: GLPKError("no bf solution found (use GLPK.factorize)")
[...]

@blegat: Should we report this in Polyhedra, JuMP, or GLPK?

@blegat
Copy link
Member

blegat commented Sep 15, 2019

Seems to be an issue with GLPK, could you print the JuMP model just before this line ?
https://github.com/JuliaPolyhedra/Polyhedra.jl/blob/master/src/redundancy.jl#L79

@schillic
Copy link
Member

I added a print(model) before that line and got this:

julia> Polyhedra.removevredundancy(ch, solver)
Feasibility
Subject to
 noname + noname = 1.0
 -noname = 0.0
 -3 noname - 3 noname = 0.0
 noname = 0.0
 noname  0.0
ERROR: GLPKError("no bf solution found (use GLPK.factorize)")
[...]

@schillic
Copy link
Member

With the dev version of GLPK (see jump-dev/GLPK.jl#116), tests pass locally 🎉
So all we need to do is wait for a new GLPK release.

@schillic schillic changed the title WIP Bump Polyhedra and JuMP Bump Polyhedra and JuMP Sep 17, 2019
@mforets
Copy link
Member Author

mforets commented Sep 17, 2019

I cannot approve my own PR but it looks good to me. Thanks!

@mforets mforets merged commit bf9a6f6 into master Sep 17, 2019
@mforets mforets deleted the mforets-patch-3 branch September 17, 2019 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bump CDDLib to v0.5.3
3 participants