Solver for a robust model

I believe that the solver is suitable for robust models, but I cannot obtain the result of the compilation.
(template for study taken from the website: https://jumper.readthedocs.io/en/latest/jumper.htm

using JuMP, JuMPeR, GLPK

m = RobustModel(solver=GLPKSolverLP())

@variable(m, x[1:2] >= 0)
@uncertain(m, 0.3 <= u1 <= 0.5)
@uncertain(m, 0.0 <= u2 <= 2.0)
@objective(m, :Max, x[1] + x[2])
@constraint(m, u1*x[1] + 1*x[2] <= 2.0)
@constraint(m, u2*x[1] + 1*x[2] <= 6.0)

status = solveRobust(m)

println(getvalue(x[1]))  
println(getvalue(x[2]))
(robust) pkg> add JuMPeR
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Resolving package versions...
  Installed Compat ──────────── v2.2.1
  Installed ReverseDiffSparse ─ v0.8.6
  Installed JuMP ────────────── v0.18.6
  Installed JuMPeR ──────────── v0.6.0
Updating `/private/tmp/robust/Project.toml`
  [707a9f91] + JuMPeR v0.6.0
Updating `/private/tmp/robust/Manifest.toml`
  [49dc2e85] + Calculus v0.5.1
  [bbf7d656] + CommonSubexpressions v0.3.0
  [34da2185] + Compat v2.2.1
  [e66e0078] + CompilerSupportLibraries_jll v0.3.3+0
  [864edb3b] + DataStructures v0.17.20
  [163ba53b] + DiffResults v1.0.2
  [b552c78f] + DiffRules v1.0.1
  [f6369f11] + ForwardDiff v0.10.12
  [4076af6c] + JuMP v0.18.6
  [707a9f91] + JuMPeR v0.6.0
  [1914dd2f] + MacroTools v0.5.5
  [fdba3010] + MathProgBase v0.7.8
  [77ba4419] + NaNMath v0.3.4
  [efe28fd5] + OpenSpecFun_jll v0.5.3+3
  [bac558e1] + OrderedCollections v1.3.1
  [89212889] + ReverseDiffSparse v0.8.6
  [276daf66] + SpecialFunctions v0.10.3
  [90137ffa] + StaticArrays v0.12.4
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8bb1440f] + DelimitedFiles
  [8ba89e20] + Distributed
  [b77e0a4c] + InteractiveUtils
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [1a1011a3] + SharedArrays
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode

(robust) pkg> add JuMP
  Resolving package versions...
Updating `/private/tmp/robust/Project.toml`
  [4076af6c] + JuMP v0.18.6
No Changes to `/private/tmp/robust/Manifest.toml`

(robust) pkg> add GLPKMathProgInterface
  Resolving package versions...
  Installed GLPKMathProgInterface ─ v0.5.0
Updating `/private/tmp/robust/Project.toml`
  [3c7084bd] + GLPKMathProgInterface v0.5.0
Updating `/private/tmp/robust/Manifest.toml`
  [6e4b80f9] + BenchmarkTools v0.5.0
  [b99e7846] + BinaryProvider v0.5.10
  [6e34b625] + Bzip2_jll v1.0.6+4
  [523fee87] + CodecBzip2 v0.7.2
  [944b1d66] + CodecZlib v0.7.0
  [60bf3e95] + GLPK v0.13.0
  [3c7084bd] + GLPKMathProgInterface v0.5.0
  [e8aa6df9] + GLPK_jll v4.64.0+0
  [781609d7] + GMP_jll v6.1.2+5
  [cd3eb016] + HTTP v0.8.19
  [83e8ac13] + IniFile v0.5.0
  [682c06a0] + JSON v0.21.1
  [7d188eb4] + JSONSchema v0.3.2
  [b8f27783] + MathOptInterface v0.9.17
  [739be429] + MbedTLS v1.0.2
  [c8ffd9c3] + MbedTLS_jll v2.16.8+0
  [d8a4904e] + MutableArithmetics v0.2.10
  [69de0a69] + Parsers v1.0.10
  [3bb67fe8] + TranscodingStreams v0.9.5
  [a5390f91] + ZipFile v0.9.2
  [83775a58] + Zlib_jll v1.2.11+16

(robust) pkg> st
Status `/private/tmp/robust/Project.toml`
  [3c7084bd] GLPKMathProgInterface v0.5.0
  [4076af6c] JuMP v0.18.6
  [707a9f91] JuMPeR v0.6.0

julia> using JuMP, JuMPeR, GLPKMathProgInterface
[ Info: Precompiling JuMP [4076af6c-e467-56ae-b986-b466b2749572]
[ Info: Precompiling JuMPeR [707a9f91-dad3-556f-9594-9b9a3b777385]
[ Info: Precompiling GLPKMathProgInterface [3c7084bd-78ad-589a-b5bb-dbd673274bea]

julia> m = RobustModel(solver = GLPKSolverLP())
Feasibility problem with:
 * 0 linear constraints
 * 0 variables
Solver is GLPKMathProgInterface.GLPKInterfaceLP.GLPK

julia> @variable(m, x[1:2] >= 0)
2-element Array{Variable,1}:
 x[1]
 x[2]

julia> @uncertain(m, 0.3 <= u1 <= 0.5)
u1

julia> @uncertain(m, 0.0 <= u2 <= 2.0)
u2

julia> @objective(m, :Max, x[1] + x[2])
x[1] + x[2]

julia> @constraint(m, u1*x[1] + 1*x[2] <= 2.0)
ConstraintRef{Model,JuMP.GenericRangeConstraint{JuMP.GenericAffExpr{JuMP.GenericAffExpr{Float64,JuMPeR.Uncertain},Union{Variable, JuMPeR.Adaptive}}}}(Maximization problem with:
 * 0 linear constraints
 * 2 variables
Solver is GLPKMathProgInterface.GLPKInterfaceLP.GLPK, 1)

julia> @constraint(m, u2*x[1] + 1*x[2] <= 6.0)
ConstraintRef{Model,JuMP.GenericRangeConstraint{JuMP.GenericAffExpr{JuMP.GenericAffExpr{Float64,JuMPeR.Uncertain},Union{Variable, JuMPeR.Adaptive}}}}(Maximization problem with:
 * 0 linear constraints
 * 2 variables
Solver is GLPKMathProgInterface.GLPKInterfaceLP.GLPK, 2)

julia> JuMPeR.solve_robust(m)
:Optimal

julia> getvalue.(x)
2-element Array{Float64,1}:
 2.6666666666666665
 0.6666666666666667
1 Like

This is the error that appears when I try to add the GLPKMathProgInterface package in version 1.5.1-1 JuliaPro.

julia> Pkg.add ("GLPKMathProgInterface") Updating registry at C: \ Users \ raquel.santos \ .julia \ registries \ JuliaComputingRegistry`
Resolving package versions …

ERROR: Unsatisfiable requirements detected for package GLPKMathProgInterface [3c7084bd]:
GLPKMathProgInterface [3c7084bd] log:
β”œβ”€GLPKMathProgInterface [3c7084bd] has no known versions!
└─restricted to versions * by an explicit requirement - no versions left`

Do not use JuliaPro. Use the downloads from here instead: Download Julia

1 Like

Thank you for your help @odow
On this link I was able to just download Julia’s command prompt. I tried to install the interface and unfortunately I couldn’t.

If you were using Atom before through JuliaPro, you can just point it to the new executable you have downloaded by adjusting the in the Julia package settings in Atom.