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?

Thanks!

odow
2
Welcome!

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)
```

to

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

Thanks!

I recognize this from a while back: https://github.com/martinbiel/StochasticPrograms.jl/commit/6285c23c2e2566d838ef56698d54c2ce364f77f3. I believe this is sorted on master. Until I push a new release, `add StochasticPrograms#master`

should solve it temporarily

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!