Closed kurtulus-ercan closed 3 years ago
StochasticPrograms was unfortunately broken by the latest minor release of JuMP+MathOptInterface. Some of the issues are fixed on master but not yet all. Until I have it sorted the only option is to downgrade to prior versions of JuMP+MathOptInterface.
Thank you for your swift reply. Downgrading to MathOptInterface v0.9.14 is solved the problem.
The errors appear to be sorted out now. So the master branch should be compatible with the latest JuMP+MathOptInterface again.
Still having the issue with MOI v0.9.17
Are you on the master branch?
Yep, had to downgrade MOI to v0.9.14
Ok, I will check it out.
Works for me on v0.9.17, and seems fine on Travis as well. Can you send the output of versioninfo
and Pkg.status()
?
Sure!
julia> versioninfo()
Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_PATH = /mnt/workspace/bin/julia-1.4.2/bin
JULIA_DEPOT_PATH = /mnt/workspace/.julia
(@v1.4) pkg> status
Status `/mnt/workspace/.julia/environments/v1.4/Project.toml`
[7c4d4715] AmplNLWriter v0.6.0
[336ed68f] CSV v0.7.7
[cdb1efd8] DSPopt v0.1.1
[a93c6f00] DataFrames v0.21.7
[2e9cd046] Gurobi v0.8.1
[f67ccb44] HDF5 v0.13.6
[b6b21f68] Ipopt v0.6.3
[4138dd39] JLD v0.10.0
[033835bb] JLD2 v0.2.3
[682c06a0] JSON v0.21.1
[4076af6c] JuMP v0.21.4
[da04e1cc] MPI v0.15.1
[b8f27783] MathOptInterface v0.9.14
[76087f3c] NLopt v0.6.0
[8b8459f2] StochasticPrograms v0.4.1
[34f15cae] StructJuMP v0.2.0
Yesterday, another colleague had exactly the same problem in a Windows machine, just FYI.
Kind regards
It does not look like you are on the master branch. Did you run pgk> add StochasticPrograms#master
?
Now it works! Thanks!
Hi Martin,
I am trying to reproduce farmer example. Excact model is below:
########################################## using GLPK using StochasticPrograms
farmer_model = @stochastic_model begin @stage 1 begin @parameters begin Crops = [:wheat, :corn, :beets] Cost = Dict(:wheat=>150, :corn=>230, :beets=>260) Budget = 500 end @decision(model, x[c in Crops] >=0, integer=true) @objective(model, Min, sum(Cost[c]x[c] for c in Crops)) @constraint(model, sum(x[c] for c in Crops) <= Budget) @constraint(model, sum(x[c] for c in Crops) <= Budget) end @stage 2 begin @parameters begin Crops = [:wheat, :corn, :beets] Required = Dict(:wheat=>200, :corn=>240, :beets=>0) PurchasePrice = Dict(:wheat=>238, :corn=>210) SellPrice = Dict(:wheat=>170, :corn=>150, :beets=>36, :extra_beets=>10) end @uncertain ξ[c in Crops] @variable(model, y[p in setdiff(Crops, [:beets])] >= 0) @variable(model, w[s in Crops ∪ [:extra_beets]] >= 0) @objective(model, Min, sum(PurchasePrice[p] y[p] for p in setdiff(Crops, [:beets]))
ξ₁ = Scenario(wheat = 3.0, corn = 3.6, beets = 24.0, probability = 1/3) ξ₂ = Scenario(wheat = 2.5, corn = 3.0, beets = 20.0, probability = 1/3) ξ₃ = Scenario(wheat = 2.0, corn = 2.4, beets = 16.0, probability = 1/3)
farmer = instantiate(farmer_model, [ξ₁,ξ₂,ξ₃], optimizer = GLPK.Optimizer)
###################################
I get an error. Error message is below:
################################### LoadError: MethodError: no method matching copy(::StochasticPrograms.SingleDecisionSet{Float64}) Closest candidates are: copy(::BenchmarkTools.Parameters) at C:\Users\Ercan.julia\packages\BenchmarkTools\eCEpo\src\parameters.jl:60 copy(::SingleKnown) at C:\Users\Ercan.julia\packages\StochasticPrograms\g8Qnj\src\types\decisions\functions\decisions.jl:22 copy(::LinearAlgebra.Transpose{Bool,BitArray{2}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\bitarray.jl:226 ... ##########################
When I run the code line by line, I get following error at end of the line:
##################### farmer = instantiate(farmer_model, [ξ₁,ξ₂,ξ₃], optimizer = GLPK.Optimizer) ##########################
Error displaying Atom.EvalError{MethodError}: BoundsError: attempt to access String at index [8]
Can you please help me about this issue?
Thank you in advance. Ercan