Skip to content

Commit 6883cfd

Browse files
committed
fix GLPK v1 interface
1 parent 3e54b3c commit 6883cfd

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
1010
IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
1111
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
1212
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
13+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1314
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1415
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1516
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"

src/Initialization/init_GLPK.jl

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# define constants whose name changed with different versions
2+
mf = Pkg.Operations.Context().env.manifest
3+
ver = mf[findfirst(v -> v.name == "GLPK", mf)].version
4+
if ver >= v"1"
5+
const GLPK_ON = GLPK.GLP_ON
6+
else
7+
const GLPK_ON = GLPK.ON
8+
end

src/Initialization/init_Polyhedra.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ eval(quote
2525
presolve::Bool=true)
2626
if presolve
2727
return JuMP.optimizer_with_attributes(GLPK.Optimizer,
28-
"presolve" => GLPK.ON)
28+
"presolve" => GLPK_ON)
2929
else
3030
return JuMP.optimizer_with_attributes(GLPK.Optimizer)
3131
end
@@ -36,7 +36,7 @@ eval(quote
3636
if presolve
3737
return JuMP.optimizer_with_attributes(
3838
() -> GLPK.Optimizer(method=GLPK.EXACT),
39-
"presolve" => GLPK.ON)
39+
"presolve" => GLPK_ON)
4040
else
4141
return JuMP.optimizer_with_attributes(
4242
() -> GLPK.Optimizer(method=GLPK.EXACT))

src/LazySets.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using LinearAlgebra, Reexport, Requires, SparseArrays
77
using LinearAlgebra: checksquare
88
import LinearAlgebra: norm, ×, normalize, normalize!
99
import SparseArrays: permute
10-
import Random
10+
import Pkg, Random
1111
using Random: AbstractRNG, GLOBAL_RNG, SamplerType, shuffle, randperm
1212
import InteractiveUtils: subtypes
1313
import JuMP, GLPK
@@ -31,6 +31,7 @@ activate_assertions(LazySets)
3131
# ==================
3232
# Linear programming
3333
# ==================
34+
include("Initialization/init_GLPK.jl")
3435
include("Initialization/init_JuMP.jl")
3536

3637
# =====================

0 commit comments

Comments
 (0)