wiz21b
November 2, 2021, 10:10am
#1
Hello,

I use Gurobi 9.1.2; Julia 1.6.2 and these packages:
Gurobi v0.9.14
JuMP v0.21.10

(I’ve seen that the C API has changed)

I try to tell Gurobi to use a specific optimizer (the PRIMAL (simplex) one):

```
LP_model = direct_model(Gurobi.Optimizer())
...
grb_model = backend(LP_model)
grb_env = GRBgetenv(grb_model)
@assert GRBsetintparam(grb_env, GRB_INT_PAR_METHOD, GRB_METHOD_PRIMAL) == 0 "Gurobi GRBsetintparam C call failed"
valueP = Ref{Cint}(1234)
@assert GRBgetintparam(grb_env, GRB_INT_PAR_METHOD, valueP) == 0 "Gurobi GRBgetintparam C call failed"
@assert valueP[] == GRB_METHOD_PRIMAL "Method was not set"
optimize!(LP_model)
```

This code doesn’t produce any error but when I do `println(solution_summary(LP_model, verbose=true))`

, I get:

```
* Work counters
Solve time (sec) : 0.00157
Simplex iterations : 0
Barrier iterations : 53
Node count : 0
```

… from which I conclude Gurobi has used a Barrier method and not the Simplex one…

Am I using the JuMP C interface correctly ?

Note I’m a beginner here, so maybe I just don’t get how Gurobi works.

Thanks

wiz21b
November 2, 2021, 10:49am
#2
It’s strange, I do this:

```
println(solution_summary(LP_model, verbose=true))
println("Simplex iterations : $(simplex_iterations(LP_model))")
println("Barrier iterations : $(barrier_iterations(LP_model))")
```

and I get this:

```
* Work counters
Solve time (sec) : 0.00164
Simplex iterations : 0
Barrier iterations : 37
Node count : 0
Simplex iterations : 37.0
Barrier iterations : 0
```

So the reported numbers seems swapped… Any idea ?

odow
November 2, 2021, 8:56pm
#3
Use `set_optimizer_attribute`

```
using JuMP, Gurobi
model = Model(Gurobi.Optimizer)
set_optimizer_attribute(model, "Method", 0)
```

The Gurobi docs explain what the values are: Method

The solution summary thing is fixed in the next release of JuMP. The numbers are just swapped in v0.21.

wiz21b
November 5, 2021, 3:54pm
#4
Thanks for answering. I didn’t see the `set_optimizer_attribute`

method. I was driven to more complex stuff by Google I understand there’s a Gurobi documentation for many languages binding, but not for Julia.

odow
November 5, 2021, 6:51pm
#5
Yes, Gurobi.jl is maintained by the community and is not an official product. Please tell Gurobi you are interested in official support for Julia.