# How to pass options for bonmin solver

**URL:** <https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790>\
**Category:** Optimization (Mathematical)\
**Tags:** optimization\
**Created:** [May 8, 2021, 7:05pm UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790 "2021-05-08T19:05:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![manoj.centura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manoj.centura/32/216443_2.png) [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Post date:** [May 8, 2021, 7:05pm UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790/1 "2021-05-08T19:05:48Z")

</div>

Hi,  
I am using bonmin solver via AmplNLWriter

```julia
model2 = Model(() -> AmplNLWriter.Optimizer("D:\\Julia_solver\\Bonmin-1.4.0-win32-msvc9\\bin\\bonmin"))

```

Any suggestion on how to pass time\_limit to the solver. I tried below methods but  
these are not working.

```julia
	 set_optimizer_attribute(model2, "time_limit", 100)

```

---

<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:** [May 8, 2021, 7:37pm UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790/2 "2021-05-08T19:37:26Z")

</div>

[https://github.com/jump-dev/AmplNLWriter.jl#options](https://github.com/jump-dev/AmplNLWriter.jl#options)

It’s `"bonmin.time_limit"`

---

<div class="post-metadata">

**Author:** ![manoj.centura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manoj.centura/32/216443_2.png) [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Post date:** [May 8, 2021, 7:58pm UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790/3 "2021-05-08T19:58:48Z")

</div>

Thanks for the reply.  
using julia 1.2 and tried to set time limit as

```julia
set_optimizer_attribute(model2, "bonmin.time_limit", 100)

but get the below error log

ERROR: LoadError: MathOptInterface.UnsupportedAttribute{MathOptInterface.RawParameter}: Attribute MathOptInterface.RawParameter("bonmin.time_limit") is not supported by the model.
Stacktrace:
 [1] #throw_set_error_fallback#14(::MathOptInterface.SetAttributeNotAllowed{MathOptInterface.RawParameter}, ::typeof(MathOptInterface.throw_set_error_fallback), ::AmplNLWriter.Model{Float64}, 
::MathOptInterface.RawParameter, ::Int64) at C:\Users\manojkumar.ram\.julia\packages\MathOptInterface\ZJFKw\src\attributes.jl:387
 [2] throw_set_error_fallback(::AmplNLWriter.Model{Float64}, ::MathOptInterface.RawParameter, ::Int64) at C:\Users\manojkumar.ram\.julia\packages\MathOptInterface\ZJFKw\src\attributes.jl:384  
 [3] set(::AmplNLWriter.Model{Float64}, ::MathOptInterface.RawParameter, ::Int64) at C:\Users\manojkumar.ram\.julia\packages\MathOptInterface\ZJFKw\src\attributes.jl:373
 [4] set(::MathOptInterface.Bridges.LazyBridgeOptimizer{AmplNLWriter.Model{Float64}}, ::MathOptInterface.RawParameter, ::Int64) at C:\Users\manojkumar.ram\.julia\packages\MathOptInterface\ZJFKw\src\Bridges\bridge_optimizer.jl:621
 [5] set(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, ::MathOptInterface.RawParameter, ::Int64) at C:\Users\manojkumar.ram\.julia\packages\MathOptInterface\ZJFKw\src\Utilities\cachingoptimizer.jl:665
 [6] set(::Model, ::MathOptInterface.RawParameter, ::Int64) at C:\Users\manojkumar.ram\.julia\packages\JuMP\y5vgk\src\JuMP.jl:991``
```

---

<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:** [May 8, 2021, 8:33pm UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790/4 "2021-05-08T20:33:52Z")

</div>

You need to update to the latest version.

---

<div class="post-metadata">

**Author:** ![manoj.centura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manoj.centura/32/216443_2.png) [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Post date:** [May 8, 2021, 8:41pm UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790/5 "2021-05-08T20:41:23Z")

</div>

My main code is based on 1.2 can’t change it now. The change in option file is not picked up by julia. Is there any other way to do it.

---

<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:** [May 8, 2021, 10:21pm UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790/6 "2021-05-08T22:21:22Z")

</div>

> You need to update to the latest version.

I meant the latest release of AmplNLWriter. You want version 0.7. I rewrote the latest version, so it is now much faster and better supported. There is no reason to stick with the old version.

> My main code is based on 1.2 can’t change it now

Code you write in Julia 1.2 will still work in Julia 1.6. You should also update to the latest Julia version. The latest release is much faster.

> Is there any other way to do it.

If you stick with the old version of AmplNLWriter, which I don’t recommend, you can use

```Julia
model = Model() do 
    AmplNLWriter.Optimizer("path/to/bonmin", ["bonmin.time_limit=100"])
end

```

---

<div class="post-metadata">

**Author:** ![manoj.centura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manoj.centura/32/216443_2.png) [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Post date:** [May 10, 2021, 7:49am UTC](https://discourse.julialang.org/t/how-to-pass-options-for-bonmin-solver/60790/7 "2021-05-10T07:49:33Z")

</div>

Thanks it worked.
