How to pass options for bonmin solver

Hi,
I am using bonmin solver via AmplNLWriter

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.

	 set_optimizer_attribute(model2, "time_limit", 100)

It’s "bonmin.time_limit"

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

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

You need to update to the latest version.

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.

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

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

Thanks it worked.

1 Like