# Feeding solver parameters as a dictionary

**URL:** <https://discourse.julialang.org/t/feeding-solver-parameters-as-a-dictionary/46227>\
**Category:** Optimization (Mathematical)\
**Created:** [September 7, 2020, 10:22pm UTC](https://discourse.julialang.org/t/feeding-solver-parameters-as-a-dictionary/46227 "2020-09-07T22:22:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![varun7rs](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@varun7rs](https://discourse.julialang.org/u/varun7rs)\
**Post date:** [September 7, 2020, 10:22pm UTC](https://discourse.julialang.org/t/feeding-solver-parameters-as-a-dictionary/46227/1 "2020-09-07T22:22:30Z")

</div>

I’d like to set solver parameters not manually but by just passing a dictionary and unpacking the keys and arguments using the splat operator. When I tried doing this: `fRAN = Model(solver = GurobiSolver(parameters...))`

I got the following error.  
` ERROR: LoadError: MethodError: no method matching Gurobi.GurobiSolver(::Pair{Symbol,Any}, ::Pair{Symbol,Any}, ::Pair{Symbol,Any}, ::Pair{Symbol,Any}, ::Pair{Symbol,Any}, ::Pair{Symbol,Any}, ::Pair{Symbol,Any}, ::Pair{Symbol,Any}, ::Pair{Symbol,Any})`

Can these parameters be configured in an elegant manner?

Thanks

PS: I’m still using JuMP 0.18, Julia 0.6.3

---

<div class="post-metadata">

**Author:** ![anon37204545](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon37204545](https://discourse.julialang.org/u/anon37204545)\
**Post date:** [September 7, 2020, 10:30pm UTC](https://discourse.julialang.org/t/feeding-solver-parameters-as-a-dictionary/46227/2 "2020-09-07T22:30:07Z")

</div>

> [@varun7rs](#):
>
> I’d like to set solver parameters not manually but by just passing a dictionary and unpacking the keys and arguments using the splat operator.

Why not just use tuples instead? They are supposed to be holders for function arguments.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 8, 2020, 12:06am UTC](https://discourse.julialang.org/t/feeding-solver-parameters-as-a-dictionary/46227/3 "2020-09-08T00:06:13Z")

</div>

> I’m still using JuMP 0.18, Julia 0.6.3

Update to the latest version, then use

```Julia
model = Model(Gurobi.Optimizer)
for (key, val) in dict
    set_optimizer_attribute(model, key, val)
end

```
