Gurobi with StochasticPrograms.jl

Hi there,

I’m trying to use Gurobi solver to optimize the farmer problem proposed in StochasticPrograms.jl and I get the following error message:

ERROR: MethodError: no method matching all_decisions(::DeterministicEquivalent{2,1,Tuple{Array{Scenario{JuMP.Containers.DenseAxisArray{Float64,1,Tuple{Array{Symbol,1}},Tuple{JuMP.Containers._AxisLookup{Dict{Symbol,Int64}}}}},1}}})

When I try to solve it with GLPK it works fine.

Anyone knows what’s happpening or if it’s possible to use Gurobi with StochasticPrograms?



Take a read of Please read: make it easier to help you. It’s easier to help if you provide a minimal working example.

Are you sure changing the solver to Gurobi is the problem? That error doesn’t look like it has anything to do with GLPK or Gurobi?

Thanks for the fast response,

I’m using exactly the same code that’s provided in the examples of StochasticPrograms.jl

When I change the line

farmer = instantiate(farmer_model, [ξ₁,ξ₂,ξ₃], optimizer = GLPK.Optimizer) 

farmer = instantiate(farmer_model, [ξ₁,ξ₂,ξ₃], optimizer = Gurobi.Optimizer)

(and add using Gurobi on the top of the code)

then it shows the error message that I posted above.

That’s why I’m guessing that changing the solver is the problem, maybe I’m wrong


@martinbiel any ideas?

I recognize this from a while back: I believe this is sorted on master. Until I push a new release, add StochasticPrograms#master should solve it temporarily :slight_smile:

1 Like

Thanks @martinbiel,

I’m sorry but I’m new to Julia, how do I add StochasticPrograms#master to solve the problem?

Nevermind, I figured out how to do it!

Thank you very much!

No problem. Good luck! :slight_smile:


it worked by the way!